Skip to content

fix(ci): rampart-gate.js severity precedence — metadata.rampart must win over raw semgrep severity - #25

Merged
acamarata merged 2 commits into
mainfrom
fix/rampart-gate-severity-precedence
Jul 5, 2026
Merged

acamarata merged 2 commits into
mainfrom
fix/rampart-gate-severity-precedence

Conversation

@acamarata

Copy link
Copy Markdown
Contributor

Bug

.github/scripts/rampart-gate.js has a severity-precedence bug in the semgrep tool branch. Custom rules under rules/rampart/*.yml are all authored with severity: ERROR (so semgrep itself never filters them out) and carry the real business severity separately in metadata.rampart. The old logic let raw semgrep severity win before metadata.rampart was checked:

if (rampartMeta === 'CRITICAL' || rawSev === 'ERROR') sev = 'CRITICAL';

Since every custom rule has rawSev === 'ERROR', this force-promoted every custom-rule finding to CRITICAL regardless of its documented severity. CRITICAL always blocks the Rampart PR Gate, even in warn mode.

Fix

metadata.rampart now wins outright; raw semgrep severity is only a fallback when metadata.rampart is absent (built-in semgrep rules, no rampart metadata).

Evidence — real CI artifact

Downloaded semgrep-report.json from Rampart PR Gate run 28587296865 (2026-07-02), which actually failed CI. It contains 10 real findings of rules.rampart.no-localstorage-token (severity: ERROR, metadata.rampart: "HIGH").

Ran the exact CI invocation (node .github/scripts/rampart-gate.js semgrep-report.json --tool semgrep) before and after the fix:

critical high medium low exit
Before (buggy) 14 80 1 0 1 (blocked)
After (fixed) 4 90 1 0 1 (still blocks — 4 genuine CRITICAL findings remain, correctly)

The 10 no-localstorage-token findings move from critical to high, exactly matching their documented metadata.rampart: "HIGH".

Same bug + fix as ummeco/praycalc#58.

…win over raw semgrep severity

Custom rampart/ rules are authored with severity: ERROR so semgrep never
filters them out, and carry the real business severity in metadata.rampart
instead. That metadata must win over the raw semgrep severity — otherwise
every custom rule (all severity: ERROR by convention) gets promoted to
CRITICAL regardless of its own documented rampart severity.

Confirmed real impact via Rampart PR Gate run 28587296865 (2026-07-02,
which actually failed): 10 rules.rampart.no-localstorage-token findings
(metadata.rampart: HIGH) were force-promoted to CRITICAL. Before fix:
critical=14 high=80. After fix: critical=4 high=90 (4 genuine CRITICAL
findings still correctly block).

Same bug + fix as ummeco/praycalc#58.
@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
islamwiki Ready Ready Preview, Comment Jul 5, 2026 10:07pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ummat-islamwiki Ignored Ignored Preview Jul 5, 2026 10:07pm

Request Review

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

🟢 Rampart Security Gate — CLEAN

Tool CRITICAL HIGH MEDIUM LOW
(no findings)

Totals: 0 critical · 0 high · 0 medium · 0 low

Mode: RAMPART_ENFORCE=warn

…ule)

lhci autorun was crashing with "ReferenceError: module is not defined in ES
module scope" because web/package.json sets type:"module", so Node parsed the
CommonJS module.exports config as ESM. This job is already continue-on-error
(ticket TB9-17/P2-E5, CI services not yet wired) so it wasn't blocking, but
the config itself was genuinely broken and worth fixing while touching CI.
@acamarata
acamarata merged commit 9456429 into main Jul 5, 2026
2 of 4 checks passed
@acamarata
acamarata deleted the fix/rampart-gate-severity-precedence branch July 5, 2026 22:06
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