Skip to content

fix(rules): eliminate four code-scanning false-positives (closes #524) - #527

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/code-scanning-false-positives-524
Jun 22, 2026
Merged

fix(rules): eliminate four code-scanning false-positives (closes #524)#527
hyperpolymath merged 1 commit into
mainfrom
fix/code-scanning-false-positives-524

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Fixes the four code-scanning rule false-positives documented in #524, verified end-to-end: built the escript, scanned rsr-template-repo main, and drove its open Hypatia code-scanning alerts from 48 → 0 (a clean 0-result analysis was uploaded under the hypatia category, auto-closing the stale alerts). Every one was a rule bug — the repo already satisfied the intent.

Fixes

  1. cicd_rules.has_file? — recognise community-health files (SECURITY.md, …) in .github/ and docs/, not just root (GitHub treats all three as canonical). Killed the missing_requirement FP.
  2. root_hygiene.scan_required_missing — remove SECURITY.md from the root-only required list; it's owned location-aware by cicd_rules. Removes a double-report + .github/-location FP.
  3. scorecard_ingestor.check_sast — aggregate across all CodeQL-mentioning workflows instead of Enum.find-ing the first (e.g. workflow-linter.yml mentions "codeql" in a comment but has no matrix, masking codeql.yml's language: actions). Killed the spurious "nominal-only SAST".
  4. workflow_audit WF017 — accept the valid env+output cross-step secret gate (if: steps.<id>.outputs.<name> + a step writing $GITHUB_OUTPUT). The secrets context isn't available in step-level if:, so the previously-required if: secrets.X != '' form is itself unusable.

Not changed (already resolved on main)

The .hypatia-ignore-not-wired-into-scan structural gap from #524 is already fixed on main (ScannerSuppression is applied in the scan path). The SD013 / DependencyPinning / shell_download_then_run / scorecard_wrapper FPs from the original report no longer reproduce on current main.

Closes #524.

Verified by building the escript and scanning rsr-template-repo (48 open
alerts -> 0; the repo genuinely satisfied every intent — these were rule
bugs, not repo defects).

- cicd_rules `has_file?`: recognise community-health files (SECURITY.md, …)
  in `.github/` and `docs/`, not just repo root — GitHub treats all three as
  canonical. Was a false-positive when SECURITY.md lives under `.github/`.
- root_hygiene `scan_required_missing`: drop SECURITY.md from the root-only
  required list. It is owned (location-aware) by cicd_rules; listing it here
  too caused a double-report and a `.github/`-location false-positive.
- scorecard_ingestor `check_sast`: aggregate across ALL workflows that mention
  CodeQL, not just the first. `Enum.find` could return workflow-linter.yml
  (mentions "codeql" in a comment, no language matrix) and miss codeql.yml's
  `language: actions`, yielding a spurious "nominal-only SAST".
- workflow_audit WF017: accept the valid env+output cross-step secret gate
  (`if: steps.<id>.outputs.<name>` + a step emitting $GITHUB_OUTPUT). The
  `secrets` context is unavailable in step-level `if:`, so the previously
  required `if: secrets.X != ''` form is itself unusable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@hyperpolymath
hyperpolymath merged commit 904e7aa into main Jun 22, 2026
25 of 33 checks passed
@hyperpolymath
hyperpolymath deleted the fix/code-scanning-false-positives-524 branch June 22, 2026 22:58
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 42 issues detected

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 42
View findings
[
  {
    "reason": "Repository has 5 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/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 20 day(s) old",
    "type": "CSA001",
    "file": "src/ui/gossamer/README.adoc",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 20 day(s) old",
    "type": "CSA001",
    "file": "scripts/ci-tools/Cargo.toml",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 20 day(s) old",
    "type": "CSA001",
    "file": "scripts/bench-tools/Cargo.toml",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 20 day(s) old",
    "type": "CSA001",
    "file": "ffi/zig/README.adoc",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 20 day(s) old",
    "type": "CSA001",
    "file": "docs/reports/audit/audit-2026-04-15-post.md",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 20 day(s) old",
    "type": "CSA001",
    "file": "docs/integration/github-registry.adoc",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 20 day(s) old",
    "type": "CSA001",
    "file": "docs/integration/github-registry.adoc",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 20 day(s) old",
    "type": "CSA001",
    "file": "docs/integration/a2ml-k9.md",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  },
  {
    "reason": "Code scanning (Hypatia): hypatia/structural_drift/SD022 -- Hypatia structural_drift: SD022 -- 20 day(s) old",
    "type": "CSA001",
    "file": "docs/architecture/system-integration.md",
    "action": "review",
    "rule_module": "code_scanning_alerts",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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.

rules: false-positives + .hypatia-ignore not wired into scan (found driving rsr-template to zero)

1 participant