A finding reported with severity "High" is stored as-is, so it is missing from severity counts and min_severity channels drop it

Aperta
#650 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@chaitanya0305 ci sta già lavorando.

Dal 28/11/2026.

  • #651 di @chaitanya0305 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, postgresql
Ambito
backend, security

Direzione di ricerca

Start in db/finding_traffic.go at RecordFindingTx (lines near 417, 438 and 454), where in.Severity is written unchanged to the node payload, the findings row and the notification snapshot, and check how agent/tools.go fills it. Also look at db.ValidSeverity and the SeverityRank/AtLeast comparison used by notify.Match. Done means severity is normalized to lowercase and trimmed before storage, and the regression test shows a high finding reaching a min_severity=high channel. A linked pull request (#651) already exists, so this is claimed work.

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

Descrizione

bug P2

report_finding passes the model's severity text straight to the database. The tool schema says critical|high|medium|low, but nothing normalizes or checks the value on this path. A finding reported as "High", "Critical" or " high " is stored with that exact text.

Everything that reads the severity compares exact lowercase values:

  • Notification channels: notify.Match calls AtLeast(s.Severity, f.MinSeverity), and SeverityRank("High") is 0. A channel with min_severity: "high" (or any threshold) never receives the finding. No error and no "skipped" row; it is just not delivered.
  • Severity counters: COUNT(*) FILTER (WHERE severity='high') in db/findings.go:445, db/task_outcome.go:79, db/exploration.go:1646 and the archive aggregates. The finding is in the total but in no severity bucket.

The HTTP path is strict (PATCH /api/findings/{id} rejects anything db.ValidSeverity does not accept), and scan_ingest.go lowercases nuclei severities. Only the agent path keeps the raw text.

Reproduce

Against a test database (ARTEX_PG_DSN set), in package db:

ch := newTestChannel(t, d, notify.KindDingTalk, NotifyModeRealtime, `{"min_severity":"high"}`)
tk, _ := d.CreateTask("severity case", "goal", nil, 0, 0)
f, _ := d.Exploration(tk.ExplorationID).RecordFinding(ctx, RecordFindingInput{
	TaskID: tk.ID, Worker: "test", VulnClass: "SQL injection", Severity: " High ", Summary: "s",
})
d.FanOutPendingEvents(ctx, 1000)
// SELECT severity FROM findings WHERE id=f.FindingID          -> " High "
// deliveries for (ch.ID, f.FindingID)                          -> 0

Output on main (b8cd251), from the regression test in the fix (the second line with the first check skipped):

stored severity = " High ", want "high"
a high finding must reach the min_severity=high channel, got 0 deliveries

Expected: the finding is stored as high, counted as high, and delivered to the channel.

Cause

db/finding_traffic.go:417, :438 and :454 (RecordFindingTx) write in.Severity unchanged into the node payload, the findings row and the notification snapshot. agent/tools.go:1782 fills it from the tool input as given.

Version: main at b8cd251.

A tested fix is ready on branch chaitanya0305:fix/finding-severity-case.

Lingua principale
Go
Stelle
18.7k
Fork
7k
Merge medio
10h 41m
PR unite (30g)
342

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 BaaRai/ARTEX

Tutte le issue di BaaRai/ARTEX

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.