Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

GET /recent-activity applies filters after limiting and truncates pagination with incorrect totals

Đang mở
#351 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu từ endpoint api/recent-activity và kiểm tra cách tìm kiếm người dùng và giới hạn kết quả hiện được áp dụng. Xác nhận rằng việc lọc người dùng diễn ra trước khi giới hạn kết quả; hoàn tất có nghĩa là endpoint trả về hoạt động gần đây khớp mà không loại trừ các kết quả khớp do giới hạn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Replacement title and description for REST API issue #351. Verified on REST API 4.24.0, commit 69b37fe769e6abe7675d413451a8361aecc36bea.

Reproduction and impact

Create three techniques with distinct modified timestamps in an instance containing older relationship activity. Confirm the techniques occupy the first three entries:

GET /api/recent-activity?limit=3&offset=0&includePagination=true

Request the same endpoint with limit=1 at offsets 0, 1 and 2. In the verified reproduction, offset zero returned the newest technique; offset one skipped two newer techniques and returned an older relationship; offset two was empty. All reported total=2.

The three-entry baseline stayed unchanged before and after the probes. Changing only limit from 1 to 2, 3 and 10 changed reported total to 2, 4, 6 and 20. Direct HTTP requests reproduce the defect without an updater filter.

Root cause and expected fix

The repository applies $sort, $limit, then $match separately to objects and relationships. This can discard matching updater activity. The service paginates the merged, truncated candidates again and uses their length as total.

Apply updater and revoked/deprecated selection before limiting; count the complete matching population independently; globally order results and select the requested page. For bounded requests, fetch enough filtered candidates from each collection for offset + limit, then merge and slice. Preserve unlimited limit=0 behavior. Moving filtering before the current early limit alone leaves pagination broken.

Regression tests should cover mixed objects/relationships, successive pages, totals invariant across limits/offsets, older matching updater records behind newer nonmatches, revoked/deprecated selection, and timestamp ties. Compare (id, modified) identities using stable fixtures. Pages should traverse every matching record in order, and totals should remain correct beyond the end.

Ngôn ngữ chính
JavaScript
Star
56
Fork
18
Merge trung bình
21 giờ 14 phút
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của mitre-attack/attack-workbench-rest-api

Tất cả issue của mitre-attack/attack-workbench-rest-api

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.