Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#351 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript
領域
api, backend

調査の方向性

api/recent-activityエンドポイントから始めて、ユーザー検索と結果の上限が現在どのように適用されているかを確認してください。結果を制限する前にユーザーのフィルタリングが行われていることを確認してください。完了の基準は、上限によって一致する結果が除外されることなく、エンドポイントが一致する最近のアクティビティを返すことです。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
JavaScript
スター
57
フォーク
18
平均マージ
21時間 30分
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mitre-attack/attack-workbench-rest-api のほかの issue

mitre-attack/attack-workbench-rest-api の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。