Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

security: ZAP severity gate reads alert.url, so every URL-scoped exception in .zap/rules.tsv is inert

Aperta Adatta ai principianti
#761 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
Mezza giornata
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
ci-cd, security

Direzione di ricerca

Parti da scripts/check-zap-severity.mjs e dal punto in cui legge alert.url; aggiungi un helper di risoluzione URL che preferisca alert.instances[].uri con alert.url come fallback, e verifica dove viene stampato il testo (no url). Poi aggiungi un test unitario che fissi la forma dell'alert di ZAP 0.15.0 (array instances, nessun url di primo livello) e un test che dimostri che una riga con scope URL in .zap/rules.tsv corrisponde solo all'URL previsto — assicurati che sia il fixture rules.tsv, non quello reale del repository, a essere testato. Fatto significa che tutti i criteri di accettazione sono spuntati e che i test esistenti passano ancora.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

github_actions security

Summary

scripts/check-zap-severity.mjs reads the affected URL from alert.url, but the ZAP
baseline action (zaproxy/action-baseline) does not set a top-level url on alerts.
Observed URLs live in alert.instances[].uri, with the alert acting as a group.

The practical effect: every URL-scoped exception in .zap/rules.tsv silently fails to
match, and the scope column is inert.
A row intended to waive one bundle path either
does not apply at all, or — depending on the branch taken — applies rule-wide. A narrow,
reviewed waiver quietly becomes something other than what was written.

Proof

Running this repo's own script against a real-shape ZAP report, alonga corrected version,
with an identical rules.tsv:

report:   {"pluginid":"10003","riskcode":"3","instances":[{"uri":".../main-ABC123.js"}]}
rules:    10003  IGNORE  /main-  <issue>  <owner>  2027-01-01  reason

this script (alert.url):        "- [10003] Vulnerable JS Library: High (Medium) (no url)"   EXIT 1
corrected (instances[].uri):    "no unexcepted medium- or high-risk alerts"                 EXIT 0

The (no url) in the failure output is the tell — it is printed on every real finding.

Fleet status

repo state
GSA/sam-design-system already correct — reads instances[].uri with a documented url fallback
GSA/ngx-uswds-icons not affected — rule-id-only gate, no URL scoping
GSA/sam-styles no script
GSA/ngx-uswds affected
GSA/sam-ui-elements affected

Suggested fix

Port the resolution helper from GSA/sam-design-system's copy of this script, which
already handles both shapes. Equivalent shape:

function urlsOf(alert) {
  const fromInstances = Array.isArray(alert.instances)
    ? alert.instances.map((i) => String(i?.uri ?? '')).filter((u) => u.length > 0)
    : [];
  return alert.url === undefined || alert.url === null
    ? fromInstances
    : [...fromInstances, String(alert.url)];
}

Acceptance criteria

  • Scope matching reads alert.instances[].uri, retaining alert.url only as a fallback
  • Failure output prints real URLs instead of (no url)
  • A unit test pins the actual ZAP 0.15.0 alert shape (instances array, no top-level url)
  • A test proves a URL-scoped exception matches the intended URL and does not match a different one
  • Existing .zap/rules.tsv rows are re-reviewed — scopes were never enforced, so each may be broader than intended

Note on test harnesses

When writing the test, make sure the fixture rules.tsv is actually the file under test.
A first attempt at this test elsewhere passed for the wrong reason because the harness fell
through to the repository's real .zap/rules.tsv.

Reference

Fixed in GSA/sam-layouts via PR #93 (issue #80), with 5 tests pinning the real shape.

Lingua principale
TypeScript
Stelle
8
Fork
34
Merge medio
2g 14h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GSA/sam-ui-elements

Tutte le issue di GSA/sam-ui-elements

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.