Skip to content

fix: filter PR reviews and inline review comments to trigger time#1385

Open
EffortlessSteven wants to merge 1 commit into
anthropics:mainfrom
EffortlessSteven:claude/filter-reviews-trigger-time
Open

fix: filter PR reviews and inline review comments to trigger time#1385
EffortlessSteven wants to merge 1 commit into
anthropics:mainfrom
EffortlessSteven:claude/filter-reviews-trigger-time

Conversation

@EffortlessSteven

Copy link
Copy Markdown

What this does

A PR review or inline review comment submitted or edited after an authorized @claude trigger reaches Claude's prompt verbatim, bypassing the trigger-time (TOCTOU) filter that issue/PR comments (#512) and the body (#710) already get. fetchGitHubData filtered reviewData by actor only; the review trigger-time filter existed but was wired only to image downloads, never to the data the prompt is built from.

Fix: reviews and inline review comments are now trigger-time filtered like comments and the body, so nothing added or edited at/after the trigger reaches the prompt. No-trigger-time events (issues/pull_request) are unchanged.

Verification

Red on main, green after.

Check Result
post-trigger + edited-after reviews unpatched all 3, patched 1 (pre-trigger)
inline review comments unpatched keeps created/edited-after, patched only pre-trigger
time + actor compose pre-trigger human kept; bot and post-trigger dropped
no trigger time all reviews returned, unchanged
tsc, prettier, bun test clean / 701 passed

Review map

  • src/github/data/fetcher.ts: trigger-time filter reviewData.nodes (filterReviewsToTriggerTime) and each review's comments (filterCommentsToTriggerTime) alongside the actor filter; image lists derive from the filtered nodes.
  • test/data-fetcher.test.ts: assert post-trigger/edited-after reviews and comments are dropped (previously asserted the unfiltered count); add a time + actor composition test.

Issue/PR comments (anthropics#512) and the issue/PR body (anthropics#710) are filtered to the
trigger timestamp so content created or edited after an authorized trigger
cannot be injected into Claude's prompt (TOCTOU protection). Reviews and
inline review comments were not: fetchGitHubData returned reviewData filtered
by actor only, and formatReviewComments renders it into the prompt, so a
review submitted or edited after the trigger reached Claude verbatim.

filterReviewsToTriggerTime already existed (added alongside the comment filter
in anthropics#512) but was only wired to the image-download list, never to the returned
reviewData.

Filter reviewData.nodes through filterReviewsToTriggerTime and each review's
inline comments through filterCommentsToTriggerTime, alongside the existing
actor filter, then build the review image-processing lists from those
already-filtered nodes (removing a now-redundant second filter pass).
Strengthen the two integration tests to assert post-trigger and edited-after
reviews/comments are dropped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant