feat(registry-quality): scope-Achse — 2 out_of_scope + derived_obligation (User Option 2)

User-Entscheidung 2026-07-01 zum Scope-Audit: Adressat der Norm != Handlungspflicht des
Herstellers. Neue `scope`-Attribut-Achse (Enum, KEINE neue Objektklasse -> Freeze v1.0
unberuehrt): in_scope (default) / out_of_scope / derived_obligation.

- sanctions + market_surveillance_safeguard -> out_of_scope (reine Staats-/Durchsetzungs-
  bestimmungen; Praezedenz CSIRT/ENISA im CRA-Vuln-Cut). Aus join_keys gefiltert.
- notified_body_requirements -> derived_obligation (Norm adressiert primaer die notifizierte
  Stelle, erzeugt aber mittelbare Herstellerpflichten: NB einbeziehen + Unterlagen +
  Konformitaetsbewertung) + scope_split_candidate (spaetere Aufspaltung Normadressat <->
  abgeleitete Herstellerpflicht). BLEIBT im Set (Prinzip: Wissen nicht zu frueh verwerfen).
- export_join_keys.py filtert scope==out_of_scope + fuehrt scope je Eintrag -> join_keys
  126->124 (MaschVO 31->29; 123 in_scope + 1 derived_obligation).
- scope_audit.py jetzt 3-Wege-klassifikations-bewusst (0 unklassifizierte Reste) +
  apply_scope_classification.py (deterministisch). Fuer jeden kuenftigen Cut mitlaufen.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-07-01 13:22:38 +02:00
parent e54d07f2d9
commit 6523286af6
6 changed files with 539 additions and 372 deletions
+38 -32
View File
@@ -1,24 +1,24 @@
"""Scope-Audit: Adressaten-Prüfung der Obligation-Registry (Review-Stage-Werkzeug).
Prinzip (etabliert im CRA-Vuln-Cut, CSIRT/ENISA out_of_scope): die Registry modelliert
**Hersteller-Pflichten**. Bestimmungen, die an BEHÖRDEN / notifizierte Stellen / Mitgliedstaaten
adressiert sind (Marktüberwachung, Sanktionen, Anforderungen an Konformitätsbewertungsstellen),
sind Enforcement-/Institutions-Recht → out_of_scope-KANDIDATEN.
Prinzip (User 2026-07-01): **Adressat der Norm ⊥ Handlungspflicht des Herstellers.** Die Registry
modelliert Hersteller-Pflichten. `scope`-Achse (Attribut-Enum, KEINE neue Objektklasse — freeze-safe):
- in_scope : Norm adressiert direkt den Hersteller (default).
- out_of_scope : reines Staats-/Durchsetzungs-/Institutions-Recht (Adressat != Hersteller,
KEINE mittelbare Herstellerpflicht) — z.B. Sanktionen, Marktüberwachung.
Präzedenz CSIRT/ENISA (CRA-Vuln-Cut). Aus join_keys gefiltert.
- derived_obligation : Norm adressiert primär eine andere Rolle, erzeugt aber MITTELBAR eine
Hersteller-Handlungspflicht — bleibt im Set (Wissen nicht verwerfen),
ggf. `scope_split_candidate` (Aufspaltung Normadressat ↔ abgeleitete Pflicht).
WICHTIG (False-Positive-Abgrenzung): eine Hersteller-Pflicht, Etwas AN eine Behörde zu MELDEN
(z.B. `exploited_vuln_reporting_authorities`, applicability=products_with_digital_elements) ist
IN-SCOPE — Adressat der Pflicht = Hersteller, Behörde = nur Empfänger. Der Audit key't daher auf
`applicability` (Adressat), NICHT auf Behörden-Nennung im Namen.
Deterministisch, kein LLM. Reklassifizierung = Owner-/User-Entscheidung (dieser Audit FLAGGT nur).
Für jeden künftigen Regulierungs-Cut mitlaufen lassen.
False-Positive-Guard: Melde-AN-Behörde-Pflichten (applicability=domain:products…) sind IN-SCOPE
(Adressat = Hersteller, Behörde nur Empfänger) — der Audit key't auf `applicability`, nicht auf
Behörden-Nennung im Namen. Deterministisch, kein LLM. Audit FLAGGT; Reklassifizierung = User/Owner.
"""
from __future__ import annotations
import glob
import json
# applicability-Präfixe, die einen NICHT-Hersteller-Adressaten bezeichnen
NON_MANUFACTURER_DOMAINS = {
"domain:authority",
"domain:notified_body",
@@ -29,39 +29,45 @@ NON_MANUFACTURER_DOMAINS = {
def main() -> None:
findings = []
classified = [] # bereits per scope entschieden
unclassified = [] # nicht-Hersteller-Adressat OHNE scope -> Review-Kandidat
total = 0
for f in sorted(glob.glob("obligations/cra*.json")):
d = json.load(open(f, encoding="utf-8"))
for o in d.get("obligations", []):
total += 1
appl = (o.get("applicability") or "").strip()
if appl in NON_MANUFACTURER_DOMAINS:
findings.append({
"file": f.split("/")[-1],
"id": o.get("id") or o.get("obligation_id"),
"name": o.get("name"),
"tier": o.get("tier"),
"applicability": appl,
"subdomain": o.get("subdomain"),
"member_count": o.get("member_count"),
"reason": "Adressat ist Behörde/notifizierte Stelle/Mitgliedstaat, nicht Hersteller",
"precedent": "CRA-Vuln-Cut: CSIRT/ENISA out_of_scope (Adressat != Hersteller)",
"recommendation": "out_of_scope ODER eigene Kategorie 'institutional/enforcement'",
})
scope = o.get("scope")
rec = {
"file": f.split("/")[-1], "id": o.get("id") or o.get("obligation_id"),
"name": o.get("name"), "tier": o.get("tier"), "applicability": appl,
"scope": scope, "scope_reason": o.get("scope_reason"),
}
if scope in ("out_of_scope", "derived_obligation"):
if o.get("scope_split_candidate"):
rec["scope_split_note"] = o.get("scope_split_note")
classified.append(rec)
elif appl in NON_MANUFACTURER_DOMAINS:
rec["reason"] = "Adressat Behörde/notifizierte Stelle/Mitgliedstaat, nicht klassifiziert"
rec["recommendation"] = "out_of_scope (reine Durchsetzung) ODER derived_obligation (mittelbare Herstellerpflicht)"
unclassified.append(rec)
out = {
"audit": "obligation scope audit (Adressat: Hersteller vs Behörde/notified_body)",
"principle": "Registry modelliert Hersteller-Pflichten; Enforcement/Institutions-Recht = out_of_scope-Kandidat",
"principle": "Adressat der Norm != Handlungspflicht des Herstellers; scope-Achse in_scope/out_of_scope/derived_obligation",
"false_positive_guard": "Melde-AN-Behörde-Pflichten (applicability=domain:products…) bleiben IN-SCOPE",
"obligations_scanned": total,
"out_of_scope_candidates": findings,
"decision_owner": "User/Registry-Owner — Audit FLAGGT nur, reklassifiziert nicht",
"classified": classified,
"unclassified_candidates": unclassified,
"decision_owner": "User/Registry-Owner — Audit FLAGGT nur; für jeden künftigen Cut mitlaufen lassen",
}
json.dump(out, open("obligations/scope_audit_findings.json", "w", encoding="utf-8"),
ensure_ascii=False, indent=1)
print(f"gescannt {total} Obligations | out_of_scope-Kandidaten: {len(findings)}")
for fnd in findings:
print(f" [{fnd['file']}] {fnd['id']:32} tier={fnd['tier']} appl={fnd['applicability']}")
print(f"gescannt {total} | klassifiziert {len(classified)} | unklassifizierte Kandidaten {len(unclassified)}")
for r in classified:
extra = " [SPLIT-KANDIDAT]" if r.get("scope_split_note") else ""
print(f" [{r['scope']}] {r['id']} appl={r['applicability']}{extra}")
for r in unclassified:
print(f" [UNKLASSIFIZIERT] {r['id']} appl={r['applicability']}")
if __name__ == "__main__":