Repository navigation
fix(secret-alerts): finding spans name the secret's file and line - #1184
Conversation
SSA001, SSA003 and SSA004 put the secret type in `file`, so a verdict span (`span.file`) pointed at a file that does not exist (raised on #1024, left to the owner, decided: use the real location). - fetch_alerts reads each file-scoped alert's `locations_url` once (one page of up to 100 locations, API host only, since the token goes with it) and records the first location with a path. - The finding's `file` and `line` come from that location, so the verdict span is `{file, start_line, end_line}` of the secret. - A secret found outside the repository's files (issue, pull-request comment), a failed lookup or a missing URL gives the repository-level file "." and `detail.location` records the reason; a lookup failure is never fatal and never reported as a file. - SSA002, the repo summary, uses "." too; `owner/repo` moves to `detail.repo`. - `scan/2` now fetches once for all four rules (it fetched four times), logging a failure and returning no findings as before. The secret type stays in `detail.secret_type`. The bash/jq sweep reads only `status` and `total`, so it is unaffected. Tests: 8 new cases in test/secret_scanning_alerts_test.exs (location choice, no-file error, per_page request, off-host refusal, failure recording, which alerts are looked up, finding fields, verdict span). The file passes, 33 tests, 0 failures, run under ExUnit against Jason 1.4.5 built from source (Hex is unreachable from this session, so not via `mix test`; Elixir 1.14 locally, CI uses 1.19). Ignoring the location, or dropping the API-host guard, makes tests fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P4yFkxW5Heb8p2YW7ZYs9F
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 28 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6320d704b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…leak Four findings from the Codex review of #1184, each verified and pinned by a test that fails without its fix. - A located secret's path could be vendored or generated (`node_modules/`, `dist/`, `deps/`, `test/`), and the uniform suppression pass then dropped the whole critical finding. Secret- scanning alerts are GitHub findings, not local pattern noise: only a `.hypatia-ignore` entry that names `secret_scanning_alerts` suppresses one now; universal excludes, default exemptions and any-rule entries do not. - The main scan path's normalizer copied `file` but not `line`, so `hypatia scan` still emitted line 0. The normalizer is now `CLI.normalize_secret_alert/1` and keeps the located line. - A `wiki_commit` location has a path, but in `<repo>.wiki.git`. Only a `commit` location becomes a file span; others stay repository-level. - Each rule looks up locations only for the alerts it reports: SSA001 open, SSA003 stale open, SSA004 suspiciously resolved, SSA002 none. scan/2 and sweep/2 look up the union once. Tests: 4 new cases in test/secret_scanning_alerts_test.exs; the file passes, 37 tests, 0 failures, run under ExUnit against Jason built from source (Hex is unreachable from this session; Hypatia.CLI's normalizer was run from its own source text in a stub module). Each fix reverted makes one test fail. Formatting checked (Elixir 1.14 locally; CI checks on 1.19). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P4yFkxW5Heb8p2YW7ZYs9F
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: efdffaefa5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Three findings from Codex's second review of #1184, each verified and pinned by a test that fails without its fix. - GitHub writes a location's path with a leading slash (`/example/secrets.txt`). It was copied as an absolute path, which SARIF could not relativise. It is now repository-relative, like every other rule's `file`. - Only the first page of locations was read, so a commit location behind more than 100 wiki or comment locations was missed and the finding dropped to repository level. The `next` link is now followed, on the API host only, up to 10 pages. - The scan path's normalizer dropped `detail`, losing the alert number, URL and the reason a finding has no file. It now keeps `detail`. Tests: 4 new cases in test/secret_scanning_alerts_test.exs; the file passes, 41 tests, 0 failures, under ExUnit against Jason built from source (Hex is unreachable from this session; the normalizer was run from its own source text in a stub module). Reverting each fix makes tests fail. Formatting checked (Elixir 1.14 locally; CI on 1.19). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P4yFkxW5Heb8p2YW7ZYs9F
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
## Change `HYPATIA_SHA` in `.github/workflows/hypatia-scan.yml` moves from `7c10e5d` to `6d8ab66`, hypatia's `main` head on 2026-11-16. The new scanner includes: - secret-scanning findings that name the secret's file and line, and are never hidden by path exclusions (hyperpolymath/hypatia#1184); - the RSR 3.2.2 verdict from the capability reader (hyperpolymath/hypatia#1188); - the parsed workflow model for WH013 (hyperpolymath/hypatia#1192); - the actions-lock proof ledger (hyperpolymath/hypatia#1187). The workflow's interface to the scanner is unchanged at that commit: `hypatia-cli.sh` is still there, and the build is still `mix escript.build`. ## Findings at the new pin From [run 43967735672](https://github.com/hyperpolymath/echo-types/actions/runs/43967735672) on `29278de`: - **Build.** The cache missed, so the scanner was built fresh from `6d8ab66` ("Generated escript hypatia"). - **Hypatia.** Both the JSON and SARIF scans report `0 findings >= medium (critical=0, high=0, medium=0, warn=0, low=0, info=0)`, and the counts step reports critical 0, high 0, total 0. The gating row is 🟢 clean. - **Alert-backed rules.** These read 0 observations. The job token can read code-scanning and Dependabot alerts but not secret-scanning alerts, which need an App or PAT. That limit is unchanged by this PR. The 🔴 rows in the rendered grid come from **advisory** fleet reporters at the pinned `gitbot-fleet` revision, not from Hypatia, and this PR does not change them: - **rhodibot (RSR):** 11 high. Most expect `.a2ml` descriptiles (`ANCHOR.a2ml`, `STATE.a2ml`, `0-AI-MANIFEST.a2ml`, `.machine_readable/descriptiles/` and others). A2ML is retired estate-wide, so these rules are stale. They are not answered by creating `.a2ml` files here; rhodibot's criteria need updating to deeds in gitbot-fleet. - **finishingbot:** 2 high and 174 medium, mostly docs that name files which no longer exist (`All.agda`, `Smoke.agda`, `EchoVsQuotient.agda`, …). This is a docs clean-up for its own PR. - **glambot:** 1 medium and 136 minor (line length, heading levels). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01P4yFkxW5Heb8p2YW7ZYs9F Co-authored-by: Claude <noreply@anthropic.com>



Follow-up to #1024. Its review thread on
span.filewas left to the owner, who chose to use the real location.Problem
SSA001, SSA003 and SSA004 set a finding's
fileto the secret type (for examplegithub_personal_access_token). The verdict span (span.file) therefore named a file that does not exist.Change
locations_url:scan/2andsweep/2look up the union once.nextlink, on the API host only (the token goes with each request), up to 10 pages of 100.commitlocation is used. Awiki_commitpath belongs to<repo>.wiki.git, not this repository.fileandlinecome from that location. GitHub's leading slash is stripped, so the path is repository-relative. The verdict span becomes{file, start_line, end_line}of the secret.file: ".").detail.locationrecords the reason. A lookup failure is never fatal and is never reported as a file.node_modules/,dist/,deps/,test/). Only a.hypatia-ignoreentry that namessecret_scanning_alertscan suppress these findings. Universal excludes, default exemptions and any-rule entries cannot, because they would hide a leaked credential.hypatia scanbuilds these findings inHypatia.CLI.normalize_secret_alert/1, which keepslineanddetail.fileis now".", andowner/repomoves todetail.repo.scan/2.scan/2used to fetch the alerts four times, once per rule. It now fetches them once; a failed fetch is still logged and gives no findings, as before.The secret type stays in
detail.secret_type. The bash/jq secret-scanning sweep reads onlystatusandtotal, so it is unaffected.API cost: one extra request per located alert, more only when its first commit location is past page one. Alerts resolved as
revoked,used_in_tests,pattern_deletedorpattern_editedare never looked up.Evidence
test/secret_scanning_alerts_test.exspasses: 41 tests, 0 failures, 16 of them new.mix test: Hex is unreachable from the authoring session.f803ee1ran the full suite:mix test --include integration, 3562 tests, 0 failures. CI on the current head is the authoritative run.Generated by Claude Code