HSCP-T-002 · open test
Register of vulnerability decisions: every line dated, justified, with a due date
What the test checks
The evidence item is the register of decisions taken on the product's vulnerabilities, one decision per line (JSON Lines). Every line carries:
| Field | Required | Meaning |
|---|---|---|
id |
yes | vulnerability identifier (CVE, GHSA or vendor identifier) |
composant |
yes | product component concerned |
date |
yes | date of the decision |
statut |
yes | corrige (fixed), non-expose (not exposed), accepte (accepted) or attente-amont (waiting for upstream) |
motif |
yes | the reason for the decision, in one sentence |
echeance |
for accepte and non-expose |
review date |
prochaine_verification |
for attente-amont |
date of the next check for an upstream fix |
lien |
for corrige |
evidence of the fix: version, commit, report |
par |
no | who decides |
The test refuses an unreadable line, a missing required field, an unreadable or future date, a status outside the vocabulary, a reason shorter than ten characters, a missing due date or one earlier than the decision, a fix without a link, and two decisions on the same day for the same vulnerability on the same component.
It also refuses a past due date, but only on the latest decision for a vulnerability: an expired acceptance must be reviewed, and the review is written as a new line.
Running the test
python3 verifier.py decisions.jsonl --date 2026-11-22
Without --date, the test uses the current day. --json gives the answer in JSON. Exit code: 0 evidence accepted, 1 evidence refused, 2 incorrect call. Python 3.10 or later, no dependency, no network access.
Producing the evidence
The register is written by hand or by the team's tracking tool. Free vulnerability scanners (Trivy, Grype, OSV-Scanner) give the list of vulnerabilities to decide on; a VEX file (CycloneDX or OpenVEX) can carry the decisions, to be converted into one line per decision.
Examples
exemples/valide/: four decisions, one per status. Accepted on 22/11/2026.exemples/refuse/: a fix without a link, an expired acceptance, an acceptance with neither due date nor real reason, an unknown status. Refused.
What the test does not say
- It does not say whether the decision is the right one, nor whether the vulnerability is actually fixed or not exploitable.
- It does not say whether every vulnerability of the product has a decision: that requires matching the register against a scan result.
Code
Download the test (zip archive: program, examples, README, licence) (11 KB) · verifier.py
The code and its messages are not translated (French).
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright 2026 les contributeurs des Gestes communs du logiciel de santé
"""HSCP-T-002 : registre des décisions sur les vulnérabilités, chaque ligne datée, motivée, avec échéance.
python3 verifier.py <decisions.jsonl> [--date AAAA-MM-JJ] [--json]
Une ligne JSON par décision :
id identifiant de la vulnérabilité (CVE-…, GHSA-…, ou identifiant de l'éditeur)
composant composant du produit concerné
date date de la décision (AAAA-MM-JJ ou ISO 8601)
statut corrige | non-expose | accepte | attente-amont
motif pourquoi cette décision (texte)
echeance date de réexamen ; obligatoire pour accepte et non-expose
prochaine_verification date de la prochaine vérification ; obligatoire pour attente-amont (vaut échéance)
lien preuve de la correction (commit, version, rapport) ; obligatoire pour corrige
par qui décide (facultatif)
Refus : ligne illisible, champ obligatoire absent, date illisible ou postérieure à --date, statut hors vocabulaire,
motif vide, échéance absente, échéance antérieure à la décision, échéance de la dernière décision d'une vulnérabilité
dépassée à --date (une acceptation échue doit être réexaminée ; une décision remplacée par une plus récente ne compte
plus), deux décisions pour la même vulnérabilité et le même composant à la même date.
Il ne dit pas si la décision est la bonne, ni si la vulnérabilité est réellement corrigée : il vérifie la forme du
registre.
Codes de retour : 0 pièce acceptée, 1 pièce refusée, 2 appel incorrect.
Bibliothèque standard seulement, aucun accès réseau.
"""
import argparse
import datetime as dt
import json
import sys
ID = "HSCP-T-002"
STATUTS = ("corrige", "non-expose", "accepte", "attente-amont")
ECHEANCE = {"accepte": "echeance", "non-expose": "echeance", "attente-amont": "prochaine_verification"}
MOTIF_MIN = 10 # caractères : « n/a » ou « ok » ne sont pas des motifs
def jour(texte):
s = str(texte or "").strip()
try:
return dt.date.fromisoformat(s[:10])
except ValueError:
return None
def verifier(chemin, aujourd_hui):
refus, notes, vus, derniere, n = [], [], {}, {}, 0
comptes = dict.fromkeys(STATUTS, 0)
try:
lignes = open(chemin, encoding="utf-8").read().splitlines()
except OSError as e:
return {"refus": [f"fichier illisible : {e.strerror}"], "notes": []}
for num, texte in enumerate(lignes, 1):
if not texte.strip():
continue
n += 1
ici = f"ligne {num}"
try:
d = json.loads(texte)
except ValueError as e:
refus.append(f"{ici} : JSON illisible ({e})")
continue
if not isinstance(d, dict):
refus.append(f"{ici} : pas un objet JSON")
continue
for champ in ("id", "composant", "date", "statut", "motif"):
if not str(d.get(champ) or "").strip():
refus.append(f"{ici} : champ « {champ} » absent ou vide")
ici = f"ligne {num} ({d.get('id') or '?'} sur {d.get('composant') or '?'})"
quand = jour(d.get("date"))
if d.get("date") and not quand:
refus.append(f"{ici} : date illisible « {d.get('date')} »")
elif quand and quand > aujourd_hui:
refus.append(f"{ici} : décision datée du {quand}, postérieure au {aujourd_hui}")
st = d.get("statut")
if st and st not in STATUTS:
refus.append(f"{ici} : statut « {st} » hors vocabulaire ({', '.join(STATUTS)})")
elif st:
comptes[st] += 1
motif = str(d.get("motif") or "").strip()
if motif and len(motif) < MOTIF_MIN:
refus.append(f"{ici} : motif trop court pour être une raison (« {motif} »)")
champ = ECHEANCE.get(st)
if champ:
ech = jour(d.get(champ))
if not d.get(champ):
refus.append(f"{ici} : statut {st} sans « {champ} »")
elif not ech:
refus.append(f"{ici} : {champ} illisible « {d.get(champ)} »")
else:
if quand and ech < quand:
refus.append(f"{ici} : {champ} ({ech}) antérieure à la décision ({quand})")
k = (d.get("id"), d.get("composant"))
if quand and (k not in derniere or quand >= derniere[k][0]):
derniere[k] = (quand, ici, champ, ech)
if st and st not in ECHEANCE and quand: # une décision sans échéance remplace la précédente
k = (d.get("id"), d.get("composant"))
if k not in derniere or quand >= derniere[k][0]:
derniere[k] = (quand, ici, None, None)
if st == "corrige" and not str(d.get("lien") or "").strip():
refus.append(f"{ici} : correction sans « lien » vers sa preuve (commit, version, rapport)")
cle = (d.get("id"), d.get("composant"), str(quand))
if quand and cle in vus:
refus.append(f"{ici} : deuxième décision du même jour pour la même vulnérabilité (ligne {vus[cle]})")
vus.setdefault(cle, num)
for quand, ici, champ, ech in sorted(derniere.values(), key=lambda x: int(x[1].split()[1])):
if champ and ech < aujourd_hui: # seule la dernière décision d'une vulnérabilité compte pour l'échéance
refus.append(f"{ici} : {champ} dépassée ({ech}) : la décision est à réexaminer")
if not n:
refus.append("registre vide")
notes.append(f"{n} décision(s) : " + ", ".join(f"{k} {v}" for k, v in comptes.items()))
return {"refus": refus, "notes": notes}
def main(argv=None):
analyseur = argparse.ArgumentParser(description=__doc__.split("\n")[0], formatter_class=argparse.RawDescriptionHelpFormatter)
analyseur.add_argument("registre", help="fichier JSON Lines, une décision par ligne")
analyseur.add_argument("--date", help="date de la vérification (défaut : aujourd'hui), AAAA-MM-JJ")
analyseur.add_argument("--json", action="store_true", help="sortie JSON")
a = analyseur.parse_args(argv)
aujourd_hui = jour(a.date) if a.date else dt.date.today()
if not aujourd_hui:
analyseur.error(f"--date illisible : {a.date}")
r = verifier(a.registre, aujourd_hui)
r.update(test=ID, piece=a.registre, date=str(aujourd_hui), accepte=not r["refus"])
if a.json:
print(json.dumps(r, ensure_ascii=False, indent=1))
else:
print(f"{ID} registre des décisions sur les vulnérabilités : {a.registre} (au {aujourd_hui})")
for x in r["refus"]:
print(f" REFUS {x}")
for x in r["notes"]:
print(f" NOTE {x}")
print("Résultat : " + ("pièce acceptée" if r["accepte"] else f"pièce refusée ({len(r['refus'])} refus)"))
return 0 if r["accepte"] else 1
if __name__ == "__main__":
sys.exit(main())