Repository navigation
feat(ci): scope_redact.py learns GitHub tokens and --redact-env for the reviewer lanes - #21795
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 612677d Description read[DESCRIPTION-READ] efb3efb8434cea6f9d44eaf56cce87166bdb5c672b0bd6575e3edf3d24663fbb That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS
What this change shipsInventory (6 items) — 6 justifiedIntent: let the ten reviewer lanes drop their copied perl scrub for the base-owned
[FIRST-PRINCIPLES-REVIEWED] 612677d Description read[DESCRIPTION-READ] 2e6de0ccee003a487993541426e7284a0f7c7f1eeff9d50667830208948a2a87 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Security Scope Review -- 🟡 CONCERNSWhich legitimate operations does Verdict basis: the reviewer's own judgement; no confirmed regression. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: CONCERNS TIGHTENING: The outbound scrub ADJUDICATED: 11 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: I wrote candidates for posix, windows and any.
The diff's only new platform assumption is UNADJUDICATED: The guard is Call path: Legitimate inputs I would have submitted for a verdict (prose, since they are rows that would be withheld, not shell refusals):
[SCOPE-REVIEWED] 612677d |
47e0d16 to
b0743a7
Compare
|
…he reviewer lanes
b0743a7 to
612677d
Compare
|
|
|
Review-ready at 612677d: PR Readiness passed, every check green (the Windows shard 1 flake #20565 passed on its single rerun), and every Design and First Principles item has a disposition. Waiting only on a maintainer approval. The follow-up PR that moves the ten lanes and closes #10037 opens once this merges. |
chenmingwei23
left a comment
There was a problem hiding this comment.
Approving per maintainer bulk readiness pass (readiness: passed, no failing lanes).
Problem / Motivation
Goal: Give
scripts/scope_redact.pythe two rules the reviewer lanes' copied perl scrub has and it lacks, so those lanes can move onto it in a follow-up PR without losing any redaction.Ten reviewer workflows scrub their output with a copied
perl -i -peone-liner (#10037). The issue asks them to call the base-ownedscripts/scope_redact.pyinstead. Two copies do things the script cannot do yet:first-principles-review.ymlandfork-first-principles-review.ymlalso redact GitHub token shapes (ghp_...,github_pat_...) to[REDACTED-GH-TOKEN].fork-gpt-review.ymlandfork-opus-review.ymlalso replace the exact inherited AWS credential values with[REDACTED-CREDENTIAL], because a bare secret access key has no shape any rule can see.Why it matters
The lanes must stage the redactor from the BASE commit, so a lane cannot call a flag the base copy does not have yet. If the migration and these rules landed in one PR, every migrated lane would refuse on that PR. This PR puts the rules on main first; the migration PR then runs on a base that has them.
Not a goal
--drop-changed-fields.What changed (motivation → approach → change)
gh[pousr]_,github_pat_)[REDACTED-GH-TOKEN]--redact-env NAME(repeatable): the exact value of env varNAME[REDACTED-CREDENTIAL]--redact-envtakes the variable's name, so the value never appears on a command line. Unset values and values under 16 characters are skipped, like the perl copy's length guard. Exact values are replaced before any shape rule runs. The perl copy did it the other way round, so a 12-digit run inside a session token (between/and+) became[REDACTED-ACCT]first and the rest of the token no longer matched.--redact-envis refused with--drop-changed-fields, because a corpus field is measured verbatim.Two small fixes ride along, because the new rules make them reachable more often. The assignment rule leaves a whole marker alone, so
aws_secret_access_key=<value>ends as=[REDACTED-CREDENTIAL]instead of=[REDACTED]]. A JSON key that carries a credential is still refused, but the error no longer prints the key, since stderr reaches a public job log.The GitHub token rule also reaches the two Security Scope Review lanes, which already run this script. That only redacts more: a token in prose is redacted, and one in a classified corpus field is refused (exit 11) instead of being measured.
Backwards compatibility
Compatible: every existing rule, marker and exit code is unchanged; the new flag is opt-in, and the new token rule only rewrites text that was being published raw.
Removes nothing: no rule, flag, marker or output field is removed.
Tests
test/test_scope_redact.py:--redact-envredacts a bare value in text mode and inside a JSON string, matches before a shape rule can split the value, skips unset and short values, and is refused with--drop-changed-fields.[REDACTED-CREDENTIAL]is pinned as an exact spelling.[redacted-...,[REDACTEDabc) is still redacted.Determinism: all 56 tests in
test_scope_redact.pypassed 5 repeated runs and one shuffled-order run (shufof the node ids,-o addopts=""). They use onlytmp_path,capsysandmonkeypatch.Scoped runs:
test_scope_redact.py,test_scope_redact_classified_pin.py,test_ai_review_workflows_scope_isolation.py,test_ai_review_workflows_verdict_publication.py,test_ai_review_workflows_scope_verdict.py: all pass.Manual verification
N/A — unit coverage sufficient: the change is a pure text transform and its CLI, both exercised directly.
Related Issues
Part of #10037
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)