Repository navigation
Redact credentials in GitHub review findings - #1312
Conversation
Architecture-Review: unchanged; publication and recovery still use the same GitHub payload and original finding identities. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on ffdcdbf34d3e1937ac6baec071b26ed5bb283078, 50.3s: approve (0 critical, 0 important, 4 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Findings without a file location:
- suggestion: Read-back of reviews published before this change can no longer match if their findings contained credential-shaped text — Recovery (cli.py:941-944) regenerates
review_payloadsfor every format, including legacy layouts, and requires the body to match exactly. Findings are now always redacted, even inlegacy_displayformats. A review published before this change whose finding prose containedsk-…orghp_…therefore no longer matches its own read-back. This fails closed and affects few reviews, so it isn't blocking. If that history matters, render legacy formats without redaction, or document the mismatch.
Native Claude output is retained in the restricted local review receipt.
|
|
||
| def _comment_body(f: Finding, head_sha: str, prefix: str = "") -> str: | ||
| text = f"{prefix}**{f.severity}: {f.title}**\n\n{f.body}".rstrip() | ||
| text = prefix + _CREDENTIAL_TOKEN_RE.sub("[REDACTED]", f"**{f.severity}: {f.title}**\n\n{f.body}").rstrip() |
There was a problem hiding this comment.
suggestion: Finding prose uses a narrower credential recogniser than the shared _redact_tokens
The task says to apply the shared credential recognition to finding prose. _comment_body and _review_body only apply _CREDENTIAL_TOKEN_RE. They don't use the rest of _redact_tokens (github.py:199): exact matches for the live GH_TOKEN/GITHUB_TOKEN/app token, Authorization: ... values and Bearer <value>. So a finding that quotes Authorization: Bearer eyJ..., or a token whose format isn't gh*_, github_pat_ or sk-, is still published as written. The URL-query and token= rules in _redact_tokens would damage normal explanatory text like token: str, so I wouldn't use the whole function. Smallest fix: add one _redact_prose(text) helper that applies the exact-secret replacements, the Bearer/Authorization rules and _CREDENTIAL_TOKEN_RE. Call it from both places and from _redact_tokens, so the two recognisers can't drift apart.
| if unplaced: | ||
| lines.append("\nFindings without a file location:\n") | ||
| lines += [f"- **{f.severity}**: {f.title} — {f.body}".rstrip(" —") for f in unplaced] | ||
| lines += [_CREDENTIAL_TOKEN_RE.sub("[REDACTED]", f"- **{f.severity}**: {f.title} — {f.body}".rstrip(" —")) for f in unplaced] |
There was a problem hiding this comment.
suggestion: The same inline redaction call is duplicated at two publication sites
_CREDENTIAL_TOKEN_RE.sub("[REDACTED]", ...) is written out at line 718 (inline comment) and line 770 (unplaced findings). If someone later adds a third place that renders finding prose, or changes the marker, these will drift. Line 770 is also now a long nested expression. Move it into a small named helper (for example _public_text(s)) and call it from both sites. This also gives later rendering paths, such as the cannot anchor '{f.title}' message at line 890, an obvious function to reuse.
| _GITHUB_TOKEN_RE = re.compile( | ||
| r"\b(?:github_pat_[A-Za-z0-9_]+|gh[pousr]_[A-Za-z0-9_]{10,})\b" | ||
| _CREDENTIAL_TOKEN_RE = re.compile( | ||
| r"\b(?:github_pat_[A-Za-z0-9_]+\b|gh[pousr]_[A-Za-z0-9_]{10,}\b|sk-[A-Za-z0-9_-]{8,})" |
There was a problem hiding this comment.
suggestion: The broader sk- pattern can redact ordinary hyphenated words in both prose and API error diagnostics
\bsk-[A-Za-z0-9_-]{8,} matches any standalone word that starts with sk- and has 8 or more following characters, including hyphens. Ordinary text like sk-learn-compatible or a branch name like sk-refactor-loader becomes [REDACTED]. This works against the acceptance item that explanatory text must survive. The regex is shared with _redact_tokens, so the same applies to GhError diagnostics. If false positives matter, require a longer body or a known prefix, for example sk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}. The tests use short fake values, so they would need longer ones.
|
@Mergifyio queue |
❌ Left the queue ·
|
|
No description provided. |
|
@Mergifyio queue |
❌ Left the queue ·
|
|
No description provided. |
|
@Mergifyio queue |
🛑 Queue command cancelledQueue requested — the merge queue status continues in this comment ↓. |
|
No description provided. |
There was a problem hiding this comment.
loopzero delta review by codex on 2652547af15b326f504935b9f9af982e29e7cff7, 6.6s: approve (0 critical, 0 important, 0 suggestion)
Same-family fallback: independent reviewers failed: claude: not authenticated. Cross-family review is preferred.
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model gpt-6.2-astra (effort medium); CLI-reported model gpt-6.2-astra (effort medium); configured model gpt-6.2-astra (effort medium)
Raw reviewer output
Native Codex transcript retained in the restricted local review receipt; public evidence is publisher-derived, not backend attestation. Exact raw SHA256: 58145cd10e30f0a9633a495091bc58495bc5714a9d44a2f97d51c8b24f971b91
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Redact credentials in GitHub review findings
Context and goal
Closes #1256
Acceptance
review --repost.Notes
Treat model-written finding prose as potentially sensitive. Apply shared credential recognition to prose rendering while the saved result and finding IDs continue to use original fields. The existing payload generator serves both publication and recovery.
The lost-response test reproduces fake token exposure on the base and passes with redaction. The focused GitHub tests and full recovery test file pass. Security review traced the GitHub payload, preserved finding IDs and checked exact read-back. The architecture guide still describes those boundaries.
The exact source head passed the local gate and both required hosted checks. Mergify candidate #1364 stopped at 13,507 test lines against the 13,500-line cap. The approved head is parked on that cap.
Base
Base: fa78ebb
Validation
Recorded for
2652547af15buv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0Review
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.