Feature #70
closedTag scan tickets by severity (vuln-{severity} token + severity custom field) — extends #24
0%
conversation:scan-severity-tagging
Description
**Lié à :** #24 (hook scan→ticket, livré) · **Surface :** Client-Dashboard `api/` (domain + infrastructure)
Enrichir les tickets créés par le hook scan→ticket (#46/#47) avec la **sévérité tagguée**, filtrable :
1. **Token greppable dans la description** (pattern `bf-disagree`) : `SecurityFinding.ticket_description` ajoute un token `vuln-critical` | `vuln-high` | `vuln-medium` | `vuln-low` (selon `severity`), pour que la liste du dashboard affiche une puce de sévérité + filtre.
2. **Champ custom Redmine `severity` (id 13, liste critical/high/medium/low)** : l'adaptateur `RedmineScanTicketAdapter.create_ticket` pose ce champ = `finding.severity.value.lower()` à la création.
3. **Activer `security_key` (id 12)** : `infrastructure/config.py` → `redmine_security_key_field_id` défaut **12** ; ajouter `redmine_severity_field_id` défaut **13**. L'adaptateur pose les deux champs custom à la création.
## Critères d'acceptation
- Token `vuln-{severity}` dans la description (greppable, multi-tenant).
- À la création : champ custom `severity` (13) = sévérité, `security_key` (12) = clé de dédup.
- Config : `redmine_security_key_field_id=12`, `redmine_severity_field_id=13` par défaut.
- TDD respx (token + les 2 champs custom dans le payload). Gate vert : pytest ×2, ruff, mypy.
RA Updated by Redmine Admin about 2 months ago
- Status changed from Submitted to Spec
- spec_ref updated (diff)
RA Updated by Redmine Admin about 2 months ago
- Status changed from Spec to In development
RA Updated by Redmine Admin about 2 months ago
- Status changed from In development to QA
- branch set to feat/70-scan-severity-tagging
- pr_url set to https://github.com/omdev-tech/PipeLiner-Client/pull/34
PR ouverte vers `dev` : https://github.com/omdev-tech/PipeLiner-Client/pull/34
Implémentation (Client-Dashboard `api/`, étend le hook scan→ticket #24/#46/#47) :
- **Domaine** : `SecurityFinding.ticket_description` ajoute un token greppable `vuln-{severity}` (en minuscules, entre backticks, sur sa propre ligne — modèle `bf-disagree`) → puce de sévérité + filtre côté dashboard.
- **Config** : `redmine_security_key_field_id` défaut **12**, nouveau `redmine_severity_field_id` défaut **13** (lus via `REDMINE_SECURITY_KEY_FIELD_ID` / `REDMINE_SEVERITY_FIELD_ID`).
- **Adaptateur** : `create_ticket` pose les deux champs custom — `{12: dedup_key, 13: severity.value.lower()}`. Le fallback clé-dans-le-corps n'est conservé que si l'id du champ security_key vaut 0.
TDD : tests respx vérifiant le token `vuln-{severity}`, champ 12 = clé de dédup, champ 13 = sévérité en minuscules — pour un finding Trivy CRITICAL et un Semgrep HIGH.
Gate vert (api/.venv) : pytest **463 passed, 2 skipped** (×2 sur pgvector éphémère + `alembic upgrade head`, idempotent) · ruff OK · mypy OK.
Statut : In development → QA.
RA Updated by Redmine Admin about 2 months ago
- Status changed from QA to Shipped
Shipped en prod (master #67). Hook scan→ticket taggue désormais la sévérité : token greppable `vuln-{severity}` dans la description + champ custom `severity` (13) + `security_key` (12, chemin dédup exact activé). Smoke live prouvé sur **omdev-website** : POST Trivy HIGH (lodash CVE-2021-23337) → /scan-results (200, created:1) → ticket Redmine #74 (projet 4) avec subject `[Sécurité]…`, severity=high, security_key=lodash@4.17.20_CVE-2021-23337, token vuln-high. Champs Redmine security_key(12)+severity(13) créés via bootstrap.rb. SCAN_WEBHOOK_SECRET posé (env-prod). Plugin issue_tags écarté (incompatible Redmine 6.1.2 — le champ custom severity est l'équivalent natif filtrable).