# -*- coding: utf-8 -*- import json, collections, os BASE=os.path.dirname(__file__) d=json.load(open(os.path.join(BASE,"mapping.json"),encoding="utf-8")) POLTITLE={"L00":"Informationssicherheitsleitlinie","R01":"ISMS-Organisation und Rollen","R02":"Asset- und Klassifizierung","R03":"Risikomanagement und Audit","R04":"Incident, Notfall und Kontinuitaet","R05":"Personalsicherheit und Awareness","R06":"Mobiles Arbeiten und mobile Geraete","R07":"Physische Sicherheit","R08":"Identitaets- und Zugriffsmanagement","R09":"Kryptografie und Uebertragung","R10":"Betriebssicherheit","R11":"Sichere Beschaffung und Entwicklung","R12":"Cloud-, KI- und externe IT-Dienste","R13":"Lieferanten- und Dienstleistersteuerung","R14":"Compliance und Datenschutz"} by=collections.OrderedDict() for a in d["anforderungen"]: by.setdefault(a["control"],[]).append(a) L=[] L.append("# ISA-Mapping-Matrix - VDA ISA 2027 (Information Security)\n") L.append("Zentrale Zuordnung: **ISA-Control -> Richtlinie -> einzelne Anforderungen (MUSS/SOLL)**. Ersetzt den frueheren Abschnitt 'Bezug zu VDA ISA' in den einzelnen Richtlinien. Das Tool verlinkt von jeder Anforderung (Hidden-Anker, siehe `mapping.json`) auf diese Matrix und auf das Nachweisregister ({{LINK:NACHWEISREGISTER}}).\n") L.append("| ISA | Richtlinie | MUSS | SOLL | Anforderungs-IDs |") L.append("|-----|-----------|------|------|------------------|") for ctrl,items in by.items(): pol=items[0]["policy"] m=sum(1 for x in items if x["type"]=="MUSS"); s=len(items)-m ids=", ".join(x["id"].split("-",1)[1] for x in items) L.append(f"| {ctrl} | {{{{LINK:{pol}}}}} {POLTITLE.get(pol,pol)} | {m} | {s} | {ids} |") cnt=collections.Counter(a["type"] for a in d["anforderungen"]) L.append(f"\n**Summe:** {len(d['anforderungen'])} Anforderungen (MUSS {cnt['MUSS']}, SOLL {cnt['SOLL']}) ueber {len(by)} Controls und {len(set(a['policy'] for a in d['anforderungen']))} Dokumente.\n") L.append("> Hinweis zu 3.1.2: In der ISA 2027 als 'Superseded by 1.6.3, 5.2.8 und 5.2.9' entfallen - abgedeckt ueber {{LINK:R04}} und {{LINK:R10}}.\n") L.append("## Detailzuordnung je Anforderung\n") L.append("| ID | Typ | Richtlinie | Anforderung (Kurz) | Bedingung |") L.append("|----|-----|-----------|--------------------|-----------|") for a in d["anforderungen"]: req=a["requirement"].replace("|","/") req=(req[:80]+"...") if len(req)>80 else req L.append(f"| {a['id']} | {a['type']} | {a['policy']} | {req} | {a['condition'] or '-'} |") open(os.path.join(BASE,"ISA-Mapping-Matrix.md"),"w",encoding="utf-8").write("\n".join(L)) print("Matrix ok, Controls:",len(by),"Anforderungen:",len(d["anforderungen"]))