-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: the Hypatia gate could never fire — the defects that made it unconditionally vacuous #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ jobs: | |
| id: install | ||
| run: | | ||
| # Try to fetch the latest release binary from the org | ||
| PA_URL="https://github.com/${REPO_OWNER}/panic-attack/releases/latest/download/panic-attack-linux-x86_64" | ||
| PA_URL="https://github.com/hyperpolymath/panic-attack/releases/latest/download/panic-attack-linux-x86_64" | ||
| mkdir -p "$HOME/.local/bin" | ||
| if curl -fsSL --head "$PA_URL" >/dev/null 2>&1; then | ||
| curl -fsSL -o "$HOME/.local/bin/panic-attack" "$PA_URL" | ||
|
|
@@ -151,7 +151,7 @@ jobs: | |
| id: build | ||
| continue-on-error: true | ||
| run: | | ||
| git clone "https://github.com/${REPO_OWNER}/hypatia.git" "$HOME/hypatia" 2>/dev/null || true | ||
| git clone "https://github.com/hyperpolymath/hypatia.git" "$HOME/hypatia" 2>/dev/null || true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
printf '%s\n' '--- changed ranges ---'
git diff --unified=30 -- .github/workflows/static-analysis-gate.yml
printf '%s\n' '--- workflow context ---'
sed -n '120,235p' .github/workflows/static-analysis-gate.ymlRepository: hyperpolymath/vcl-ut Length of output: 5381 🏁 Script executed: #!/bin/bash
printf '%s\n' '--- workflow start and first job ---'
sed -n '1,125p' .github/workflows/static-analysis-gate.yml
printf '%s\n' '--- workflow tail ---'
sed -n '220,340p' .github/workflows/static-analysis-gate.yml
printf '%s\n' '--- fallback and upload references ---'
rg -n -C 3 'hypatia-findings|upload-artifact|\\[\\]|ready|critical' .github/workflows/static-analysis-gate.ymlRepository: hyperpolymath/vcl-ut Length of output: 19638 Fail the gate when Hypatia is unavailable If Hypatia is mandatory, 🤖 Prompt for AI Agents |
||
| if [ -f "$HOME/hypatia/mix.exs" ]; then | ||
| cd "$HOME/hypatia" | ||
| if [ ! -f hypatia ] && [ ! -f hypatia-v2 ]; then | ||
|
|
@@ -169,12 +169,28 @@ jobs: | |
| if: steps.build.outputs.ready == 'true' | ||
| run: | | ||
| set +e | ||
| HYPATIA_FORMAT=json "$HOME/hypatia/hypatia-cli.sh" scan . > hypatia-findings.json 2>&1 | ||
| HYPATIA_FORMAT=json "$HOME/hypatia/hypatia-cli.sh" scan . --exit-zero > hypatia-findings.json | ||
| HYP_EXIT=$? | ||
| set -e | ||
|
|
||
| if [ ! -s hypatia-findings.json ] || ! jq empty hypatia-findings.json 2>/dev/null; then | ||
| echo "[]" > hypatia-findings.json | ||
| # --exit-zero is Hypatia's own documented CI recipe (lib/hypatia/cli.ex), | ||
| # for exactly this case: "use in CI when a downstream step gates on | ||
| # severity counts". Findings go to stdout, the one-line summary to | ||
| # stderr, and the process exits 0 unless the SCANNER itself failed. | ||
| # | ||
| # Do NOT redirect stderr into the payload with `2>&1`: that folds the | ||
| # summary line into the JSON, so every parse fails, the old `[]` | ||
| # fallback substituted a clean result, CRITICAL was always 0, and the | ||
| # gate below could never fire on any input. Keep stderr on the log. | ||
| if [ "$HYP_EXIT" -ne 0 ]; then | ||
| echo "::error::Hypatia scanner execution failed with exit ${HYP_EXIT}" | ||
| exit "$HYP_EXIT" | ||
| fi | ||
| # `jq empty` is NOT sufficient -- it succeeds on any valid JSON, | ||
| # including a bare string, object or null. Assert the array. | ||
| if [ ! -s hypatia-findings.json ] || ! jq -e 'type == "array"' hypatia-findings.json >/dev/null; then | ||
| echo "::error::Hypatia did not produce a valid JSON findings array" | ||
| exit 1 | ||
| fi | ||
|
|
||
| TOTAL=$(jq '. | length' hypatia-findings.json 2>/dev/null || echo 0) | ||
|
|
@@ -192,13 +208,19 @@ jobs: | |
| - name: Emit check annotations | ||
| if: steps.build.outputs.ready == 'true' | ||
| run: | | ||
| jq -r '.[] | select(.file != null) | | ||
| # Findings carry no `.message` (keys: action,file,line,reason,rule_module, | ||
| # severity,type), so every annotation read "null". `.file` is an absolute | ||
| # runner path, which GitHub cannot anchor to the diff, so it is made | ||
| # workspace-relative here. | ||
| jq -r --arg ws "$GITHUB_WORKSPACE" '.[] | select(.file != null) | | ||
| (.file | ltrimstr($ws + "/")) as $f | | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- workflow lines 200-225 ---'
sed -n '200,225p' .github/workflows/static-analysis-gate.yml
printf '%s\n' '--- workspace/path variables and jq filter ---'
rg -n -C 3 '\$ws|GITHUB_WORKSPACE|ltrimstr|\.file|Hypatia|hypatia' .github/workflows/static-analysis-gate.yml
printf '%s\n' '--- referenced Hypatia source ---'
curl -fsSL https://raw.githubusercontent.com/hyperpolymath/hypatia/main/lib/hypatia/cli.ex | rg -n -C 5 'expand|absolute|Path|file|reason'Repository: hyperpolymath/vcl-ut Length of output: 36817 🏁 Script executed: #!/bin/bash
set -eu
sed -n '160,202p' /tmp/coderabbit-shell-logs/shell-output-QmV60z 2>/dev/null || true
printf '%s\n' '--- Hypatia run_scan implementation ---'
curl -fsSL https://raw.githubusercontent.com/hyperpolymath/hypatia/main/lib/hypatia/cli.ex | sed -n '160,202p'Repository: hyperpolymath/vcl-ut Length of output: 3145 Handle the workspace-root path before prefix removal. When 🤖 Prompt for AI AgentsSource: MCP tools |
||
| (.reason // .message // .type // "finding") as $m | | ||
| if .severity == "critical" then | ||
| "::error file=\(.file),line=\(.line // 1)::[hypatia] \(.message)" | ||
| "::error file=\($f),line=\(.line // 1)::[hypatia] \($m)" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
sed -n '205,225p' .github/workflows/static-analysis-gate.yml
printf '\n-- nearby command construction --\n'
sed -n '168,222p' .github/workflows/static-analysis-gate.ymlRepository: hyperpolymath/vcl-ut Length of output: 4274 🌐 Web query:
💡 Result: To prevent GitHub Actions from misinterpreting special characters in workflow commands, you must escape specific characters using percent-encoding [1][2][3]. When sending commands to the runner via stdout—such as the Citations:
Escape annotation values before writing workflow commands. The 🤖 Prompt for AI AgentsSource: MCP tools |
||
| elif .severity == "high" then | ||
| "::error file=\(.file),line=\(.line // 1)::[hypatia] \(.message)" | ||
| "::error file=\($f),line=\(.line // 1)::[hypatia] \($m)" | ||
| else | ||
| "::warning file=\(.file),line=\(.line // 1)::[hypatia] \(.message)" | ||
| "::warning file=\($f),line=\(.line // 1)::[hypatia] \($m)" | ||
| end | ||
| ' hypatia-findings.json || true | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🔵 Trivial | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
Repository: hyperpolymath/vcl-ut
Length of output: 2326
Pin both scanner sources to immutable revisions.
The
releases/latestURL at line 37 and the default branch cloned at line 154 can change the code executed by this workflow without a workflow change. Pin each source to a reviewed release or commit, and verify the binary or source checksum before execution.🤖 Prompt for AI Agents