Skip to content

Health Software Common Practices

HSCP-T-003 · open test

Actively exploited vulnerability: handling times against reporting deadlines

Serves HSCP-G-120 · Recipe: HSCP-R-012

Code under the licence Apache 2.0 · Python 3.10 or later, standard library only, no network access

What the test checks

The evidence item is the register of actively exploited vulnerabilities affecting the product, one per line (JSON Lines), with the reports sent:

Field Required Meaning
id, composant yes the vulnerability and the affected component
connue_le yes date and time when it became known to be actively exploited
source no where the information comes from: public catalogue of exploited vulnerabilities, vendor, own finding
qualification yes, within 24 h a-signaler (to be reported) or non-concernee (not concerned)
motif for non-concernee why reporting does not apply
alerte_le for a-signaler early warning sent
notification_le for a-signaler notification sent
mesure_corrective_le when it exists date a corrective or mitigating measure is available
rapport_final_le after the corrective measure final report sent

Default deadlines: early warning 24 h and notification 72 h after connue_le, final report 14 days after the corrective measure. These are the deadlines of Regulation (EU) 2024/2847, Art. 14(2); --delais changes them. A vulnerability known before the obligation starts (--applicable-le, 11/09/2026 by default) is listed with no deadline required.

The test refuses a report sent late, an expired deadline with no report, a report dated before its starting point, a qualification missing more than 24 h after connue_le, and non-concernee without a reason. A deadline still running gives a note with its limit.

Running the test

python3 verifier.py exploitees.jsonl --date 2026-11-22T12:00:00Z

Without --date, the test uses the present instant. --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

Free scanners (Trivy, Grype) matched against a public catalogue of exploited vulnerabilities give the lines to create and their connue_le. Report dates come from the acknowledgement of each report.

Examples

  • exemples/valide/: one vulnerability reported on time up to the final report, one ruled out with its reason, one known the day before whose early warning has been sent and whose notification is still running. Accepted.
  • exemples/refuse/: an early warning sent after 24 h and a final report never sent, a vulnerability without qualification for five days. Refused.

What the test does not say

  • It does not legally qualify a vulnerability, nor say whether the product is subject to the obligation: the qualification remains a written decision, which the test reads.
  • It does not say whether the vulnerability is actually exploited, nor whether all exploited ones are in the register.
  • It sends nothing.

Code

Download the test (zip archive: program, examples, README, licence) (12 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-003 : délai de traitement d'une vulnérabilité activement exploitée, face aux délais de signalement.

    python3 verifier.py <exploitees.jsonl> [--date AAAA-MM-JJTHH:MM:SSZ] [--delais 24,72,14] [--applicable-le AAAA-MM-JJ] [--json]

Une ligne JSON par vulnérabilité activement exploitée qui touche le produit :
  id                    identifiant de la vulnérabilité
  composant             composant du produit concerné
  connue_le             date et heure où le fabricant a su qu'elle était activement exploitée (ISO 8601)
  source                d'où vient l'information d'exploitation (catalogue public, éditeur, constat), facultatif
  qualification         a-signaler | non-concernee
  motif                 obligatoire si non-concernee
  alerte_le             date et heure de l'alerte précoce envoyée
  notification_le       date et heure de la notification envoyée
  mesure_corrective_le  date à laquelle une mesure corrective ou d'atténuation est disponible
  rapport_final_le      date du rapport final envoyé

Délais par défaut (--delais) : alerte précoce 24 h et notification 72 h après connue_le, rapport final 14 jours après
la mesure corrective ; ce sont ceux du règlement (UE) 2024/2847, art. 14 § 2. Une vulnérabilité connue avant
--applicable-le (défaut : 2026-09-11, début de l'obligation de signalement de ce règlement) est relevée sans délai exigé.

Refus : ligne illisible, champ obligatoire absent, date illisible ou future, envoi daté avant connue_le, envoi hors
délai, délai échu sans envoi à --date, qualification absente plus de 24 h après connue_le, non-concernee sans motif.
Il ne qualifie pas juridiquement une vulnérabilité, ne dit pas si elle est réellement exploitée et n'envoie rien : il
vérifie que le registre des envois tient les délais.

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-003"
QUALIFICATIONS = ("a-signaler", "non-concernee")


def instant(texte):
    s = str(texte or "").strip()
    if not s:
        return None
    try:
        d = dt.datetime.fromisoformat(s.replace("Z", "+00:00") if "T" in s else s + "T00:00:00+00:00")
    except ValueError:
        return None
    return d if d.tzinfo else d.replace(tzinfo=dt.timezone.utc)


def court(d):
    return d.astimezone(dt.timezone.utc).strftime("%Y-%m-%d %H:%M UTC")


def verifier(chemin, maintenant, delais, applicable):
    h_alerte, h_notif, j_final = delais
    refus, notes, n = [], [], 0
    try:
        lignes = open(chemin, encoding="utf-8").read().splitlines()
    except OSError as e:
        return {"refus": [f"fichier illisible : {e.strerror}"], "notes": []}

    def envoi(ici, d, champ, depart, delai, nom):
        """Un envoi exigé : daté, après le départ, dans le délai ; ou pas encore échu."""
        limite = depart + delai
        quand = instant(d.get(champ))
        if d.get(champ) and not quand:
            refus.append(f"{ici} : {champ} illisible « {d.get(champ)} »")
        elif quand:
            if quand < depart:
                refus.append(f"{ici} : {nom} : envoi daté du {court(quand)}, avant son point de départ ({court(depart)})")
            elif quand > limite:
                refus.append(f"{ici} : {nom} : envoi du {court(quand)}, après la limite du {court(limite)}")
            elif quand > maintenant:
                refus.append(f"{ici} : {nom} : envoi daté dans le futur ({court(quand)})")
        elif maintenant > limite:
            refus.append(f"{ici} : {nom} : aucun envoi, délai échu le {court(limite)}")
        else:
            notes.append(f"{ici} : {nom} : à envoyer avant le {court(limite)}")

    for num, texte in enumerate(lignes, 1):
        if not texte.strip():
            continue
        n += 1
        try:
            d = json.loads(texte)
        except ValueError as e:
            refus.append(f"ligne {num} : JSON illisible ({e})")
            continue
        if not isinstance(d, dict):
            refus.append(f"ligne {num} : pas un objet JSON")
            continue
        ici = f"ligne {num} ({d.get('id') or '?'} sur {d.get('composant') or '?'})"
        for champ in ("id", "composant", "connue_le"):
            if not str(d.get(champ) or "").strip():
                refus.append(f"{ici} : champ « {champ} » absent ou vide")
        connue = instant(d.get("connue_le"))
        if d.get("connue_le") and not connue:
            refus.append(f"{ici} : connue_le illisible « {d.get('connue_le')} »")
            continue
        if not connue:
            continue
        if connue > maintenant:
            refus.append(f"{ici} : connue_le dans le futur ({court(connue)})")
            continue
        q = d.get("qualification")
        if q and q not in QUALIFICATIONS:
            refus.append(f"{ici} : qualification « {q} » hors vocabulaire ({', '.join(QUALIFICATIONS)})")
            continue
        if connue.date() < applicable:
            notes.append(f"{ici} : connue le {connue.date()}, avant le début de l'obligation ({applicable}) : aucun délai exigé")
            continue
        if not q:
            if maintenant - connue > dt.timedelta(hours=h_alerte):
                refus.append(f"{ici} : aucune qualification consignée, {round((maintenant - connue).total_seconds() / 3600)} h après connue_le")
            else:
                notes.append(f"{ici} : à qualifier avant le {court(connue + dt.timedelta(hours=h_alerte))}")
            continue
        if q == "non-concernee":
            if len(str(d.get("motif") or "").strip()) < 10:
                refus.append(f"{ici} : non-concernee sans motif")
            continue
        envoi(ici, d, "alerte_le", connue, dt.timedelta(hours=h_alerte), "alerte précoce")
        envoi(ici, d, "notification_le", connue, dt.timedelta(hours=h_notif), "notification")
        mesure = instant(d.get("mesure_corrective_le"))
        if d.get("mesure_corrective_le") and not mesure:
            refus.append(f"{ici} : mesure_corrective_le illisible « {d.get('mesure_corrective_le')} »")
        elif mesure:
            envoi(ici, d, "rapport_final_le", mesure, dt.timedelta(days=j_final), "rapport final")
        elif d.get("rapport_final_le"):
            refus.append(f"{ici} : rapport final daté sans date de mesure corrective")
        else:
            notes.append(f"{ici} : mesure corrective pas encore disponible, rapport final non exigible")
    if not n:
        notes.insert(0, "aucune vulnérabilité activement exploitée déclarée")
    else:
        notes.insert(0, f"{n} vulnérabilité(s) activement exploitée(s), délais {h_alerte} h, {h_notif} h et {j_final} j")
    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 vulnérabilité activement exploitée par ligne")
    analyseur.add_argument("--date", help="instant de la vérification (défaut : maintenant), ISO 8601")
    analyseur.add_argument("--delais", default="24,72,14", help="alerte (h), notification (h), rapport final (j) ; défaut 24,72,14")
    analyseur.add_argument("--applicable-le", default="2026-09-11", help="début de l'obligation, AAAA-MM-JJ (défaut 2026-09-11)")
    analyseur.add_argument("--json", action="store_true", help="sortie JSON")
    a = analyseur.parse_args(argv)
    maintenant = instant(a.date) if a.date else dt.datetime.now(dt.timezone.utc)
    if not maintenant:
        analyseur.error(f"--date illisible : {a.date}")
    try:
        delais = tuple(int(x) for x in a.delais.split(","))
        assert len(delais) == 3 and all(x > 0 for x in delais)
        applicable = dt.date.fromisoformat(a.applicable_le)
    except (ValueError, AssertionError):
        analyseur.error("--delais attend trois entiers positifs (24,72,14) et --applicable-le une date AAAA-MM-JJ")
    r = verifier(a.registre, maintenant, delais, applicable)
    r.update(test=ID, piece=a.registre, date=maintenant.isoformat(), accepte=not r["refus"])
    if a.json:
        print(json.dumps(r, ensure_ascii=False, indent=1))
    else:
        print(f"{ID} délais de signalement des vulnérabilités exploitées : {a.registre} (au {court(maintenant)})")
        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())

Files of the test