All oversized iace files now comply with the 500-line hard cap: - hazard_library_ai_sw.go split into ai_sw (false_classification..communication) and ai_fw (unauthorized_access..update_failure) - hazard_library_software_hmi.go split into software_hmi (software_fault+hmi) and config_integration (configuration_error+logging+integration) - hazard_library_machine_safety.go split to keep mechanical/electrical/thermal/emc, safety_functions extracted into hazard_library_safety_functions.go - store_hazards.go split: hazard library queries moved to store_hazard_library.go - store_projects.go split: component and classification ops to store_components.go - store_mitigations.go split: evidence/verification/ref-data to store_evidence.go - hazard_library.go GetBuiltinHazardLibrary() updated to call all sub-functions - All iace tests pass (go test ./internal/iace/...) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
303 lines
16 KiB
Go
303 lines
16 KiB
Go
package iace
|
|
|
|
import "time"
|
|
|
|
// builtinHazardsAIFW returns hazard library entries for AI/firmware categories:
|
|
// unauthorized_access, firmware_corruption, safety_boundary_violation,
|
|
// mode_confusion, unintended_bias, update_failure.
|
|
func builtinHazardsAIFW() []HazardLibraryEntry {
|
|
now := time.Now()
|
|
|
|
return []HazardLibraryEntry{
|
|
// ====================================================================
|
|
// Category: unauthorized_access (4 entries)
|
|
// ====================================================================
|
|
{
|
|
ID: hazardUUID("unauthorized_access", 1),
|
|
Category: "unauthorized_access",
|
|
Name: "Unautorisierter Remote-Zugriff",
|
|
Description: "Ein Angreifer erlangt ueber das Netzwerk Zugriff auf die Maschinensteuerung und kann sicherheitsrelevante Parameter aendern.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"network", "software"},
|
|
RegulationReferences: []string{"IEC 62443", "CRA", "EU AI Act Art. 15"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"VPN", "MFA", "Netzwerksegmentierung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("unauthorized_access", 2),
|
|
Category: "unauthorized_access",
|
|
Name: "Konfigurations-Manipulation",
|
|
Description: "Sicherheitsrelevante Konfigurationsparameter werden unautorisiert geaendert, z.B. Grenzwerte, Schwellwerte oder Betriebsmodi.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"software", "firmware"},
|
|
RegulationReferences: []string{"IEC 62443", "CRA", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Zugriffskontrolle", "Audit-Log"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("unauthorized_access", 3),
|
|
Category: "unauthorized_access",
|
|
Name: "Privilege Escalation",
|
|
Description: "Ein Benutzer oder Prozess erlangt hoehere Berechtigungen als vorgesehen und kann sicherheitskritische Aktionen ausfuehren.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 1,
|
|
ApplicableComponentTypes: []string{"software"},
|
|
RegulationReferences: []string{"IEC 62443", "CRA"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"RBAC", "Least Privilege"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("unauthorized_access", 4),
|
|
Category: "unauthorized_access",
|
|
Name: "Supply-Chain-Angriff auf Komponente",
|
|
Description: "Eine kompromittierte Softwarekomponente oder Firmware wird ueber die Lieferkette eingeschleust und enthaelt Schadcode oder Backdoors.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 1,
|
|
ApplicableComponentTypes: []string{"software", "firmware"},
|
|
RegulationReferences: []string{"CRA", "IEC 62443", "EU AI Act Art. 15"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"SBOM", "Signaturpruefung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
|
|
// ====================================================================
|
|
// Category: firmware_corruption (3 entries)
|
|
// ====================================================================
|
|
{
|
|
ID: hazardUUID("firmware_corruption", 1),
|
|
Category: "firmware_corruption",
|
|
Name: "Update-Abbruch mit inkonsistentem Zustand",
|
|
Description: "Ein Firmware-Update wird unterbrochen (z.B. Stromausfall), wodurch das System in einem inkonsistenten und potenziell unsicheren Zustand verbleibt.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"firmware"},
|
|
RegulationReferences: []string{"CRA", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"A/B-Partitioning", "Rollback"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("firmware_corruption", 2),
|
|
Category: "firmware_corruption",
|
|
Name: "Rollback-Fehler auf alte Version",
|
|
Description: "Ein Rollback auf eine aeltere Firmware-Version schlaegt fehl oder fuehrt zu Inkompatibilitaeten mit der aktuellen Hardware-/Softwarekonfiguration.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"firmware"},
|
|
RegulationReferences: []string{"CRA", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Versionsmanagement", "Kompatibilitaetspruefung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("firmware_corruption", 3),
|
|
Category: "firmware_corruption",
|
|
Name: "Boot-Chain-Angriff",
|
|
Description: "Die Bootsequenz wird manipuliert, um unsignierte oder kompromittierte Firmware auszufuehren, was die gesamte Sicherheitsarchitektur untergaebt.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 1,
|
|
ApplicableComponentTypes: []string{"firmware"},
|
|
RegulationReferences: []string{"CRA", "IEC 62443"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Secure Boot", "TPM"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
|
|
// ====================================================================
|
|
// Category: safety_boundary_violation (4 entries)
|
|
// ====================================================================
|
|
{
|
|
ID: hazardUUID("safety_boundary_violation", 1),
|
|
Category: "safety_boundary_violation",
|
|
Name: "Kraft-/Drehmoment-Ueberschreitung",
|
|
Description: "Aktorische Systeme ueberschreiten die zulaessigen Kraft- oder Drehmomentwerte, was zu Verletzungen oder Maschinenschaeden fuehren kann.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"controller", "actuator"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "ISO 13849", "IEC 62061"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Hardware-Limiter", "SIL-Ueberwachung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("safety_boundary_violation", 2),
|
|
Category: "safety_boundary_violation",
|
|
Name: "Geschwindigkeitsueberschreitung Roboter",
|
|
Description: "Ein Industrieroboter ueberschreitet die zulaessige Geschwindigkeit, insbesondere bei Mensch-Roboter-Kollaboration.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"controller", "software"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "ISO 13849", "ISO 10218"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Safe Speed Monitoring", "Lichtgitter"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("safety_boundary_violation", 3),
|
|
Category: "safety_boundary_violation",
|
|
Name: "Versagen des Safe-State",
|
|
Description: "Das System kann im Fehlerfall keinen sicheren Zustand einnehmen, da die Sicherheitssteuerung selbst versagt.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 1,
|
|
ApplicableComponentTypes: []string{"controller", "software", "firmware"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "ISO 13849", "IEC 62061"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Redundante Sicherheitssteuerung", "Diverse Programmierung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("safety_boundary_violation", 4),
|
|
Category: "safety_boundary_violation",
|
|
Name: "Arbeitsraum-Verletzung",
|
|
Description: "Ein Roboter oder Aktor verlaesst seinen definierten Arbeitsraum und dringt in den Schutzbereich von Personen ein.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"controller", "sensor"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "ISO 13849", "ISO 10218"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Sichere Achsueberwachung", "Schutzzaun-Sensorik"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
|
|
// ====================================================================
|
|
// Category: mode_confusion (3 entries)
|
|
// ====================================================================
|
|
{
|
|
ID: hazardUUID("mode_confusion", 1),
|
|
Category: "mode_confusion",
|
|
Name: "Falsche Betriebsart aktiv",
|
|
Description: "Das System befindet sich in einer unbeabsichtigten Betriebsart (z.B. Automatik statt Einrichtbetrieb), was zu unerwarteten Maschinenbewegungen fuehrt.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"hmi", "software"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "ISO 13849"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Betriebsart-Anzeige", "Schluesselschalter"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("mode_confusion", 2),
|
|
Category: "mode_confusion",
|
|
Name: "Wartung/Normal-Verwechslung",
|
|
Description: "Das System wird im Normalbetrieb gewartet oder der Wartungsmodus wird nicht korrekt verlassen, was zu gefaehrlichen Situationen fuehrt.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"hmi", "software"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "ISO 13849"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Zugangskontrolle", "Sicherheitsverriegelung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("mode_confusion", 3),
|
|
Category: "mode_confusion",
|
|
Name: "Automatik-Eingriff waehrend Handbetrieb",
|
|
Description: "Das System wechselt waehrend des Handbetriebs unerwartet in den Automatikbetrieb, wodurch eine Person im Gefahrenbereich verletzt werden kann.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"software", "controller"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "ISO 13849"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Exklusive Betriebsarten", "Zustimmtaster"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
|
|
// ====================================================================
|
|
// Category: unintended_bias (2 entries)
|
|
// ====================================================================
|
|
{
|
|
ID: hazardUUID("unintended_bias", 1),
|
|
Category: "unintended_bias",
|
|
Name: "Diskriminierende KI-Entscheidung",
|
|
Description: "Das KI-Modell trifft systematisch diskriminierende Entscheidungen, z.B. bei der Qualitaetsbewertung bestimmter Produktchargen oder Lieferanten.",
|
|
DefaultSeverity: 3,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"ai_model"},
|
|
RegulationReferences: []string{"EU AI Act Art. 10", "EU AI Act Art. 71"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Bias-Testing", "Fairness-Metriken"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("unintended_bias", 2),
|
|
Category: "unintended_bias",
|
|
Name: "Verzerrte Trainingsdaten",
|
|
Description: "Die Trainingsdaten sind nicht repraesentativ und enthalten systematische Verzerrungen, die zu unfairen oder fehlerhaften Modellergebnissen fuehren.",
|
|
DefaultSeverity: 3,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"ai_model"},
|
|
RegulationReferences: []string{"EU AI Act Art. 10", "EU AI Act Art. 71"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Datensatz-Audit", "Ausgewogenes Sampling"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
|
|
// ====================================================================
|
|
// Category: update_failure (3 entries)
|
|
// ====================================================================
|
|
{
|
|
ID: hazardUUID("update_failure", 1),
|
|
Category: "update_failure",
|
|
Name: "Unvollstaendiges OTA-Update",
|
|
Description: "Ein Over-the-Air-Update wird nur teilweise uebertragen oder angewendet, wodurch das System in einem inkonsistenten Zustand verbleibt.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"firmware", "software"},
|
|
RegulationReferences: []string{"CRA", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Atomare Updates", "Integritaetspruefung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("update_failure", 2),
|
|
Category: "update_failure",
|
|
Name: "Versionskonflikt nach Update",
|
|
Description: "Nach einem Update sind Software- und Firmware-Versionen inkompatibel, was zu Fehlfunktionen oder Ausfaellen fuehrt.",
|
|
DefaultSeverity: 3,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "firmware"},
|
|
RegulationReferences: []string{"CRA", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Kompatibilitaetsmatrix", "Staging-Tests"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("update_failure", 3),
|
|
Category: "update_failure",
|
|
Name: "Unkontrollierter Auto-Update",
|
|
Description: "Ein automatisches Update wird ohne Genehmigung oder ausserhalb eines Wartungsfensters eingespielt und stoert den laufenden Betrieb.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"software"},
|
|
RegulationReferences: []string{"CRA", "Maschinenverordnung 2023/1230", "IEC 62443"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Update-Genehmigung", "Wartungsfenster"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
}
|
|
}
|