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>
318 lines
18 KiB
Go
318 lines
18 KiB
Go
package iace
|
|
|
|
import "time"
|
|
|
|
// builtinHazardsConfigIntegration returns hazard library entries for
|
|
// configuration errors, logging/audit failures, and integration errors.
|
|
func builtinHazardsConfigIntegration() []HazardLibraryEntry {
|
|
now := time.Now()
|
|
|
|
return []HazardLibraryEntry{
|
|
// ====================================================================
|
|
// Category: configuration_error (8 entries)
|
|
// ====================================================================
|
|
{
|
|
ID: hazardUUID("configuration_error", 1),
|
|
Category: "configuration_error",
|
|
Name: "Falscher Safety-Parameter bei Inbetriebnahme",
|
|
Description: "Beim Einrichten werden sicherheitsrelevante Parameter (z.B. Maximalgeschwindigkeit, Abschaltgrenzen) falsch konfiguriert und nicht verifiziert.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "firmware", "controller"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "ISO 13849", "IEC 62061"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Parameterpruefung nach Inbetriebnahme", "4-Augen-Prinzip", "Parameterprotokoll in technischer Akte"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("configuration_error", 2),
|
|
Category: "configuration_error",
|
|
Name: "Factory Reset loescht Sicherheitskonfiguration",
|
|
Description: "Ein Factory Reset setzt alle Parameter auf Werkseinstellungen zurueck, einschliesslich sicherheitsrelevanter Konfigurationen, ohne Warnung.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"firmware", "software"},
|
|
RegulationReferences: []string{"IEC 62304", "CRA", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Separate Safety-Partition", "Bestaetigung vor Reset", "Safety-Config vor Reset sichern"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("configuration_error", 3),
|
|
Category: "configuration_error",
|
|
Name: "Fehlerhafte Parameter-Migration bei Update",
|
|
Description: "Beim Software-Update werden vorhandene Konfigurationsparameter nicht korrekt in das neue Format migriert, was zu falschen Systemeinstellungen fuehrt.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"software", "firmware"},
|
|
RegulationReferences: []string{"IEC 62304", "CRA"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Migrations-Skript-Tests", "Konfig-Backup vor Update", "Post-Update-Verifikation"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("configuration_error", 4),
|
|
Category: "configuration_error",
|
|
Name: "Konflikthafte redundante Einstellungen",
|
|
Description: "Widersprüchliche Parameter in verschiedenen Konfigurationsdateien oder -ebenen fuehren zu unvorhersehbarem Systemverhalten.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "firmware"},
|
|
RegulationReferences: []string{"IEC 62304", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Konfig-Validierung beim Start", "Einzelne Quelle fuer Safety-Params", "Konsistenzpruefung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("configuration_error", 5),
|
|
Category: "configuration_error",
|
|
Name: "Hard-coded Credentials in Konfiguration",
|
|
Description: "Passwörter oder Schluessel sind fest im Code oder in Konfigurationsdateien hinterlegt und koennen nicht geaendert werden.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"software", "firmware"},
|
|
RegulationReferences: []string{"CRA", "IEC 62443"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Secrets-Management", "Kein Hard-Coding", "Credential-Scan im CI"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("configuration_error", 6),
|
|
Category: "configuration_error",
|
|
Name: "Debug-Modus in Produktionsumgebung aktiv",
|
|
Description: "Debug-Schnittstellen oder erhoehte Logging-Level sind in der Produktionsumgebung aktiv und ermoeglichen Angreifern Zugang zu sensiblen Systeminfos.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"software", "firmware"},
|
|
RegulationReferences: []string{"CRA", "IEC 62443"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Build-Konfiguration pruefe Debug-Flag", "Produktions-Checkliste", "Debug-Port-Deaktivierung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("configuration_error", 7),
|
|
Category: "configuration_error",
|
|
Name: "Out-of-Bounds-Eingabe ohne Validierung",
|
|
Description: "Nutzereingaben oder Schnittstellendaten werden ohne Bereichspruefung in sicherheitsrelevante Parameter uebernommen.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "hmi"},
|
|
RegulationReferences: []string{"IEC 62304", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Eingabevalidierung", "Bereichsgrenzen definieren", "Sanity-Check"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("configuration_error", 8),
|
|
Category: "configuration_error",
|
|
Name: "Konfigurationsdatei nicht schreibgeschuetzt",
|
|
Description: "Sicherheitsrelevante Konfigurationsdateien koennen von unautorisierten Nutzern oder Prozessen veraendert werden.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "firmware"},
|
|
RegulationReferences: []string{"IEC 62443", "CRA"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Dateisystem-Berechtigungen", "Code-Signing fuer Konfig", "Integritaetspruefung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
|
|
// ====================================================================
|
|
// Category: logging_audit_failure (5 entries)
|
|
// ====================================================================
|
|
{
|
|
ID: hazardUUID("logging_audit_failure", 1),
|
|
Category: "logging_audit_failure",
|
|
Name: "Safety-Events nicht protokolliert",
|
|
Description: "Sicherheitsrelevante Ereignisse (Alarme, Not-Halt-Betaetigungen, Fehlerzustaende) werden nicht in ein Protokoll geschrieben.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "controller"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "IEC 62443", "CRA"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Pflicht-Logging Safety-Events", "Unveraenderliches Audit-Log", "Log-Integritaetspruefung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("logging_audit_failure", 2),
|
|
Category: "logging_audit_failure",
|
|
Name: "Log-Manipulation moeglich",
|
|
Description: "Authentifizierte Benutzer oder Angreifer koennen Protokolleintraege aendern oder loeschen und so Beweise fuer Sicherheitsvorfaelle vernichten.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"software"},
|
|
RegulationReferences: []string{"CRA", "IEC 62443"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Write-Once-Speicher", "Kryptografische Signaturen", "Externes Log-Management"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("logging_audit_failure", 3),
|
|
Category: "logging_audit_failure",
|
|
Name: "Log-Overflow ueberschreibt alte Eintraege",
|
|
Description: "Wenn der Log-Speicher voll ist, werden aeltere Eintraege ohne Warnung ueberschrieben, was eine lueckenlose Rueckverfolgung verhindert.",
|
|
DefaultSeverity: 3,
|
|
DefaultProbability: 4,
|
|
ApplicableComponentTypes: []string{"software", "controller"},
|
|
RegulationReferences: []string{"CRA", "IEC 62443"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Log-Kapazitaetsalarm", "Externes Log-System", "Zirkulaerpuffer mit Warnschwelle"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("logging_audit_failure", 4),
|
|
Category: "logging_audit_failure",
|
|
Name: "Fehlende Zeitstempel in Protokolleintraegen",
|
|
Description: "Log-Eintraege enthalten keine oder ungenaue Zeitstempel, was die zeitliche Rekonstruktion von Ereignissen bei der Fehlersuche verhindert.",
|
|
DefaultSeverity: 3,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "controller"},
|
|
RegulationReferences: []string{"CRA", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"NTP-Synchronisation", "RTC im Geraet", "ISO-8601-Zeitstempel"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("logging_audit_failure", 5),
|
|
Category: "logging_audit_failure",
|
|
Name: "Audit-Trail loeschbar durch Bediener",
|
|
Description: "Der Audit-Trail kann von einem normalen Bediener geloescht werden, was die Nachvollziehbarkeit von Sicherheitsereignissen untergaebt.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"software"},
|
|
RegulationReferences: []string{"CRA", "IEC 62443", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"RBAC: Nur Admin darf loeschen", "Log-Export vor Loeschung", "Unanderbare Log-Speicherung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
|
|
// ====================================================================
|
|
// Category: integration_error (8 entries)
|
|
// ====================================================================
|
|
{
|
|
ID: hazardUUID("integration_error", 1),
|
|
Category: "integration_error",
|
|
Name: "Datentyp-Mismatch an Schnittstelle",
|
|
Description: "Zwei Systeme tauschen Daten ueber eine Schnittstelle aus, die inkompatible Datentypen verwendet, was zu Interpretationsfehlern fuehrt.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "network"},
|
|
RegulationReferences: []string{"IEC 62304", "IEC 62443"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Schnittstellendefinition (IDL/Protobuf)", "Integrationstests", "Datentypvalidierung"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("integration_error", 2),
|
|
Category: "integration_error",
|
|
Name: "Endianness-Fehler bei Datenuebertragung",
|
|
Description: "Big-Endian- und Little-Endian-Systeme kommunizieren ohne Byte-Order-Konvertierung, was zu falsch interpretierten numerischen Werten fuehrt.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "network"},
|
|
RegulationReferences: []string{"IEC 62304", "IEC 62443"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Explizite Byte-Order-Definiton", "Integrationstests", "Schnittstellenspezifikation"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("integration_error", 3),
|
|
Category: "integration_error",
|
|
Name: "Protokoll-Versions-Konflikt",
|
|
Description: "Sender und Empfaenger verwenden unterschiedliche Protokollversionen, die nicht rueckwaertskompatibel sind, was zu Paketablehnung oder Fehlinterpretation fuehrt.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "network", "firmware"},
|
|
RegulationReferences: []string{"IEC 62443", "CRA"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Versions-Aushandlung beim Verbindungsaufbau", "Backward-Compatibilitaet", "Kompatibilitaets-Matrix"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("integration_error", 4),
|
|
Category: "integration_error",
|
|
Name: "Timeout nicht behandelt bei Kommunikation",
|
|
Description: "Eine Kommunikationsverbindung bricht ab oder antwortet nicht, der Sender erkennt dies nicht und wartet unendlich lang.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "network"},
|
|
RegulationReferences: []string{"IEC 62443", "Maschinenverordnung 2023/1230"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Timeout-Konfiguration", "Watchdog-Timer", "Fail-Safe bei Verbindungsverlust"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("integration_error", 5),
|
|
Category: "integration_error",
|
|
Name: "Buffer Overflow an Schnittstelle",
|
|
Description: "Eine Schnittstelle akzeptiert Eingaben, die groesser als der zugewiesene Puffer sind, was zu Speicher-Ueberschreibung und Kontrollfluss-Manipulation fuehrt.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"software", "firmware", "network"},
|
|
RegulationReferences: []string{"CRA", "IEC 62443", "IEC 62304"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Laengenvalidierung", "Sichere Puffer-Funktionen", "Statische Analyse (z.B. MISRA)"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("integration_error", 6),
|
|
Category: "integration_error",
|
|
Name: "Fehlender Heartbeat bei Safety-Verbindung",
|
|
Description: "Eine Safety-Kommunikationsverbindung sendet keinen periodischen Heartbeat, so dass ein stiller Ausfall (z.B. unterbrochenes Kabel) nicht erkannt wird.",
|
|
DefaultSeverity: 5,
|
|
DefaultProbability: 2,
|
|
ApplicableComponentTypes: []string{"network", "software"},
|
|
RegulationReferences: []string{"IEC 61784-3", "ISO 13849", "IEC 62061"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Heartbeat-Protokoll", "Verbindungsueberwachung", "Safe-State bei Heartbeat-Ausfall"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("integration_error", 7),
|
|
Category: "integration_error",
|
|
Name: "Falscher Skalierungsfaktor bei Sensordaten",
|
|
Description: "Sensordaten werden mit einem falschen Faktor skaliert, was zu signifikant fehlerhaften Messwerten und moeglichen Fehlentscheidungen fuehrt.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"sensor", "software"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "IEC 62304"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Kalibrierungspruefung", "Plausibilitaetstest", "Schnittstellendokumentation"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
{
|
|
ID: hazardUUID("integration_error", 8),
|
|
Category: "integration_error",
|
|
Name: "Einheitenfehler (mm vs. inch)",
|
|
Description: "Unterschiedliche Masseinheiten zwischen Systemen fuehren zu fehlerhaften Bewegungsbefehlen oder Werkzeugpositionierungen.",
|
|
DefaultSeverity: 4,
|
|
DefaultProbability: 3,
|
|
ApplicableComponentTypes: []string{"software", "hmi"},
|
|
RegulationReferences: []string{"Maschinenverordnung 2023/1230", "IEC 62304"},
|
|
SuggestedMitigations: mustMarshalJSON([]string{"Explizite Einheitendefinition", "Einheitenkonvertierung in der Schnittstelle", "Integrationstests"}),
|
|
IsBuiltin: true,
|
|
TenantID: nil,
|
|
CreatedAt: now,
|
|
},
|
|
}
|
|
}
|