Skip to content

fix(security): resolve three deferred Hypatia findings (CodeQL/scorecard/setup.sh)#34

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/wizardly-archimedes-9pnqed
Jun 20, 2026
Merged

fix(security): resolve three deferred Hypatia findings (CodeQL/scorecard/setup.sh)#34
hyperpolymath merged 1 commit into
mainfrom
claude/wizardly-archimedes-9pnqed

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Why

Resolves three deferred Hypatia findings in wokelangiser.

Changes

1. CodeQL — scan Rust source (.github/workflows/codeql.yml)

The "nominal-only SAST" finding's literal remediation (language: actions) was already in place, so that finding was stale. The real gap: only workflow YAML was scanned, never the repo's Rust source (the primary implementation). Added language: rust (build-mode: none, buildless) to the matrix so CodeQL now analyses the actual code too. (Zig/Idris2 aren't CodeQL-supported, so they're out of scope.)

2. Scorecard — de-publish the enforcer (.github/workflows/scorecard-enforcer.yml)

The scorecard job held a privileged publish step (id-token: write, security-events: write) right next to a custom run: score-gate — the scorecard_publish_with_run_step pattern. Since scorecard.yml (the reusable workflow) already publishes results, the enforcer's publish was redundant. Now:

  • publish_results: false
  • removed the upload-sarif step
  • job reduced to contents: read
  • the score gate still runs on the locally-generated results.sarif

No new actions added (no new dependency-pinning surface).

3. setup.sh — verified just install (CWE-494)

Replaced both curl -fsSL https://just.systems/install.sh | bash calls with a install_just_pinned() helper:

  • pins just 1.53.0
  • maps platform/arch → release target triple
  • downloads the tarball over HTTPS, verifies SHA256 (per-target, taken from the release SHA256SUMS), then extracts + installs
  • fails closed on checksum mismatch or unsupported arch
  • usage comment now documents download → review → run instead of pipe-to-shell

Verification

  • sh -n setup.sh passes; both workflows parse as valid YAML.
  • Functionally tested the installer's core path: downloaded just-1.53.0-x86_64-unknown-linux-musl.tar.gz, confirmed the pinned SHA256 matches, confirmed a wrong hash is rejected (fail-closed), extracted just, and ran it (just 1.53.0).
  • CI on this PR will exercise both CodeQL matrix jobs (actions, rust) and the de-published scorecard job.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5


Generated by Claude Code

…ard/setup)

- codeql.yml: add `language: rust` to the CodeQL matrix so the Rust
  source (the primary implementation) gets real SAST, not just the
  GitHub Actions workflows. The `actions` entry already satisfied the
  stale "lacks actions" finding; this makes SAST non-nominal.

- scorecard-enforcer.yml: de-publish the enforcer. scorecard.yml (the
  reusable workflow) already publishes results, so the enforcer's
  publish was redundant and placed a privileged publish step (id-token
  / security-events) next to a custom run: score-gate. Set
  publish_results: false, drop the upload-sarif step, and reduce the
  job to contents: read. The score gate still runs on the locally
  generated results.sarif. Resolves scorecard_publish_with_run_step.

- setup.sh: replace the two `curl … | bash` just installers (CWE-494)
  with install_just_pinned(): pin just 1.53.0, map platform/arch to the
  release target, download the tarball over HTTPS, verify SHA256, then
  extract+install — failing closed on mismatch. Usage comment now
  documents download-review-run instead of pipe-to-shell.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 6 issues detected

Severity Count
🔴 Critical 1
🟠 High 3
🟡 Medium 2

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Download-and-execute pattern (curl|wget pipe to shell) -- verify integrity before execution (2 occurrences, CWE-494)",
    "type": "shell_download_then_run",
    "file": "/home/runner/work/wokelangiser/wokelangiser/setup.sh",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "high"
  },
  {
    "line": 24,
    "reason": "Secret found: Generic API key",
    "type": "secret_detected",
    "file": "/home/runner/work/wokelangiser/wokelangiser/.envrc",
    "action": "revoke_rotate_and_purge",
    "rule_module": "security_errors",
    "severity": "critical"
  },
  {
    "reason": "1 workflow(s) with tag-pinned (not SHA-pinned) actions in wokelangiser",
    "type": "DependencyPinning",
    "file": "/home/runner/work/wokelangiser/wokelangiser",
    "action": "auto_fix",
    "rule_module": "scorecard",
    "severity": "medium",
    "remediation": "Pin GitHub Actions and Docker base images by SHA hash.",
    "scorecard_check": "Pinned-Dependencies"
  },
  {
    "reason": "Repository has 12 non-main remote branch(es). Policy: single main branch only.",
    "type": "GS007",
    "file": ".",
    "action": "delete_remote_branches",
    "rule_module": "git_state",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/workflow_audit/scorecard_publish_with_run_step -- Hypatia workflow_audit: scorecard_publish_with_run_step -- 20 day(s) old [STALE]",
    "type": "CSA001",
    "file": "scorecard-enforcer.yml",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  },
  {
    "reason": "Code-scanning alert hypatia/workflow_audit/scorecard_publish_with_run_step (high) at scorecard-enforcer.yml is 20 days old (threshold: 7 days) -- overdue for remediation",
    "type": "CSA003",
    "file": "scorecard-enforcer.yml",
    "action": "escalate",
    "rule_module": "code_scanning_alerts",
    "severity": "high"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@hyperpolymath hyperpolymath marked this pull request as ready for review June 20, 2026 14:02
@hyperpolymath hyperpolymath merged commit f2c3f50 into main Jun 20, 2026
21 checks passed
hyperpolymath pushed a commit that referenced this pull request Jun 20, 2026
…, curl|sh doc)

Follow-up to #34. No runtime behaviour changes — these only remove patterns
that trip naive scanners:

- .envrc: move the commented `# export API_KEY="..."` / DATABASE_URL examples
  (flagged as a "Generic API key" — a false positive: commented "..."
  placeholders) into a new .envrc.example template. .envrc keeps a pointer
  comment; real secrets still go in a gitignored .env via dotenv_if_exists.
- setup.sh: drop the `curl … | sh` convenience one-liner from the usage
  comment and reword the helper header ("avoids curl|sh" -> "no
  pipe-to-shell") so no curl-pipe-to-shell substring remains anywhere.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5
hyperpolymath added a commit that referenced this pull request Jun 20, 2026
…p.sh doc) (#35)

* chore(security): clear Hypatia false-positives (.envrc secret example, curl|sh doc)

Follow-up to #34. No runtime behaviour changes — these only remove patterns
that trip naive scanners:

- .envrc: move the commented `# export API_KEY="..."` / DATABASE_URL examples
  (flagged as a "Generic API key" — a false positive: commented "..."
  placeholders) into a new .envrc.example template. .envrc keeps a pointer
  comment; real secrets still go in a gitignored .env via dotenv_if_exists.
- setup.sh: drop the `curl … | sh` convenience one-liner from the usage
  comment and reword the helper header ("avoids curl|sh" -> "no
  pipe-to-shell") so no curl-pipe-to-shell substring remains anywhere.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5

* fix: avoid API_KEY token in .envrc.example so Hypatia stops flagging it

The relocated `# export API_KEY="..."` example tripped Hypatia's secret_detected
rule on .envrc.example (same false positive, new file). Describe the optional
vars in prose (no NAME="value" assignment, no API_KEY token) so no tracked file
contains a secret-looking pattern.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5

---------

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Jun 21, 2026
* chore(security): clear Hypatia false-positives (.envrc secret example, curl|sh doc)

Follow-up to #34. No runtime behaviour changes — these only remove patterns
that trip naive scanners:

- .envrc: move the commented `# export API_KEY="..."` / DATABASE_URL examples
  (flagged as a "Generic API key" — a false positive: commented "..."
  placeholders) into a new .envrc.example template. .envrc keeps a pointer
  comment; real secrets still go in a gitignored .env via dotenv_if_exists.
- setup.sh: drop the `curl … | sh` convenience one-liner from the usage
  comment and reword the helper header ("avoids curl|sh" -> "no
  pipe-to-shell") so no curl-pipe-to-shell substring remains anywhere.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5

* fix: avoid API_KEY token in .envrc.example so Hypatia stops flagging it

The relocated `# export API_KEY="..."` example tripped Hypatia's secret_detected
rule on .envrc.example (same false positive, new file). Describe the optional
vars in prose (no NAME="value" assignment, no API_KEY token) so no tracked file
contains a secret-looking pattern.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5

* Add branch-cleanup workflow for server-side stale-branch deletion

GS007 cleanup needs stale claude/* branches deleted, but the dev git
proxy blocks `git push --delete`. This manual-dispatch workflow deletes
caller-specified branches server-side via gh/GITHUB_TOKEN, with a
dry-run default and a hard-coded keep-list guard. Reusable for future
cleanups.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5

---------

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Jun 21, 2026
…esh 6a2 state (#37)

- SPDX: PMPL-1.0-or-later -> MPL-2.0 in governance.yml, hypatia-scan.yml,
  scorecard.yml (matches repo policy + the no-pmpl contractile rule).
- Fill unfilled {{...}} template placeholders with real values:
  anchors/ANCHOR.a2ml, flake.nix (+enable Rust/Idris2/Zig dev shell),
  guix.scm, .guix-channel.
- Refresh .machine_readable/6a2: STATE (date, PRs #34/#35/#36, blockers),
  PLAYBOOK (document branch-cleanup workflow + proxy-blocks-deletes),
  NEUROSYM (record upstream standards@5a93d9d Hypatia pin breakage).
- QUICKSTART-DEV.adoc: fill placeholders and correct non-existent recipe
  names (setup-dev/panic-scan/llm-context -> real recipes).


Claude-Session: https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5

Co-authored-by: Claude <noreply@anthropic.com>
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.

3 participants