fix: filter PR reviews and inline review comments to trigger time#1385
Open
EffortlessSteven wants to merge 1 commit into
Open
fix: filter PR reviews and inline review comments to trigger time#1385EffortlessSteven wants to merge 1 commit into
EffortlessSteven wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
A PR review or inline review comment submitted or edited after an authorized
@claudetrigger reaches Claude's prompt verbatim, bypassing the trigger-time (TOCTOU) filter that issue/PR comments (#512) and the body (#710) already get.fetchGitHubDatafilteredreviewDataby 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.tsc,prettier,bun testReview map
src/github/data/fetcher.ts: trigger-time filterreviewData.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.