feat(cra,agent): readiness copy refinement + Track B (CompanyProfile prefill)

Readiness check: legally tighter + sales-sharper copy per review — names both
regulations cleanly (CRA + Machinery Reg 2023/1230 in plain language), frames CRA
Art. 13 as "more than a yearly pentest: assess/document/handle cyber risk across
the lifecycle" (not over-claiming a "continuously documented risk assessment"),
adds the "we turn regulation into code" positioning, and reorders the 8 questions
in CRA order (machine -> connectivity -> software -> updates -> remote -> app ->
personal data -> critical env).

Track B: the Compliance Agent Pre-Scan wizard now detects the shared
CompanyProfile and offers "Aus Profil übernehmen" — tolerant mapping (legal_form,
industry, employee_count) across the differing module vocabularies, user-
triggered (never silent), so company context isn't re-asked.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-14 22:27:44 +02:00
parent 00f304fed9
commit ef4cf1cb62
2 changed files with 83 additions and 16 deletions
@@ -110,6 +110,34 @@ export function isContextComplete(ctx: ScanContext): boolean {
) )
} }
// Track B — consolidation: prefill from the shared CompanyProfile instead of
// re-asking. Vocabularies differ across modules, so map tolerantly (only fields
// that map cleanly; the rest the user fills). User-triggered, never silent.
const DEV_TENANT = '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e'
const _VALID_LEGAL = new Set(['ag', 'gmbh', 'gmbh_co_kg', 'kg', 'ohg', 'ug', 'ek', 'verein', 'stiftung', 'behoerde'])
const _INDUSTRY_ALIAS: Record<string, string> = {
maschinenbau: 'manufacturing', industrie: 'manufacturing', manufacturing: 'manufacturing',
automotive: 'automotive', oem: 'automotive', saas: 'saas', software: 'saas',
ecommerce: 'ecommerce', handel: 'ecommerce', banking: 'banking', finance: 'banking',
insurance: 'insurance', versicherung: 'insurance', healthcare: 'healthcare', gesundheit: 'healthcare',
bildung: 'education', education: 'education', medien: 'media', media: 'media',
verwaltung: 'public', public: 'public',
}
const _SIZE_TO_EMP: Record<string, string> = {
micro: 'lt10', small: '20_49', medium: '50_249', large: '250_499', enterprise: '1000_plus',
}
function mapProfileToScanContext(p: any): Partial<ScanContext> {
const out: Partial<ScanContext> = {}
const lf = String(p.legal_form || '').toLowerCase().replace(/[^a-z_]/g, '')
if (_VALID_LEGAL.has(lf)) out.legal_form = lf
const ind = String(Array.isArray(p.industry) ? p.industry[0] : (p.industry || '')).toLowerCase().trim()
if (_INDUSTRY_ALIAS[ind]) out.industry = _INDUSTRY_ALIAS[ind]
const size = String(p.company_size || '').toLowerCase()
if (_SIZE_TO_EMP[size]) out.employee_count = _SIZE_TO_EMP[size]
return out
}
export function PreScanWizard({ export function PreScanWizard({
value, value,
onChange, onChange,
@@ -117,6 +145,14 @@ export function PreScanWizard({
value: ScanContext value: ScanContext
onChange: (ctx: ScanContext) => void onChange: (ctx: ScanContext) => void
}) { }) {
const [profile, setProfile] = useState<any>(null)
useEffect(() => {
fetch(`/api/sdk/v1/company-profile?tenant_id=${DEV_TENANT}`)
.then((r) => (r.ok ? r.json() : null))
.then((p) => { if (p && p.company_name) setProfile(p) })
.catch(() => {})
}, [])
const update = <K extends keyof ScanContext>(key: K, val: ScanContext[K]) => { const update = <K extends keyof ScanContext>(key: K, val: ScanContext[K]) => {
onChange({ ...value, [key]: val }) onChange({ ...value, [key]: val })
} }
@@ -149,6 +185,24 @@ export function PreScanWizard({
Einschätzung statt pauschaler Verstoss-Listen. Einschätzung statt pauschaler Verstoss-Listen.
</p> </p>
{profile && (
<div style={{ background: '#ecfdf5', border: '1px solid #a7f3d0', borderRadius: 8,
padding: '8px 12px', marginBottom: 12, fontSize: 11, color: '#065f46' }}>
<strong>Unternehmensprofil erkannt:</strong> {profile.company_name}
{profile.industry ? ` · ${Array.isArray(profile.industry) ? profile.industry.join(', ') : profile.industry}` : ''}
{profile.legal_form ? ` · ${profile.legal_form}` : ''}
{profile.company_size ? ` · ${profile.company_size}` : ''}
{' '} diese Angaben müssen Sie nicht erneut eingeben.
<button
onClick={() => onChange({ ...value, ...mapProfileToScanContext(profile) })}
style={{ marginLeft: 8, padding: '2px 10px', borderRadius: 6, border: '1px solid #059669',
background: '#059669', color: '#fff', cursor: 'pointer', fontSize: 11 }}
>
Aus Profil übernehmen
</button>
</div>
)}
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 10 }}> <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 10 }}>
<Field label="1. Branche*"> <Field label="1. Branche*">
<select value={value.industry} onChange={e => update('industry', e.target.value)} style={inputStyle}> <select value={value.industry} onChange={e => update('industry', e.target.value)} style={inputStyle}>
@@ -54,29 +54,42 @@ export function ReadinessCheck({ onCreateProject }: { onCreateProject?: () => vo
} }
const QUESTIONS: { k: string; label: string }[] = [ const QUESTIONS: { k: string; label: string }[] = [
{ k: 'is_machinery', label: 'Ist es eine Maschine/Anlage (CE nach Maschinenrecht)?' }, { k: 'is_machinery', label: 'Ist das Produkt eine Maschine oder Anlage?' },
{ k: 'connected_to_internet', label: 'Hängt das Produkt am Internet (oder soll es)?' }, { k: 'connected_to_internet', label: 'Ist das Produkt mit Netzwerken oder dem Internet verbunden?' },
{ k: 'user_parameter_app', label: 'Gibt es eine App, mit der Nutzer Parameter einstellen?' }, { k: 'has_firmware', label: 'Enthält das Produkt Software oder Firmware?' },
{ k: 'remote_maintenance', label: 'Bietet ihr Fernwartung an?' }, { k: 'has_software_updates', label: 'Werden Software- oder Firmware-Updates bereitgestellt?' },
{ k: 'has_software_updates', label: 'Hat es Software-/Firmware-Updates?' }, { k: 'remote_maintenance', label: 'Gibt es Fernwartungszugänge?' },
{ k: 'has_firmware', label: 'Enthält es Firmware (Embedded/IoT)?' }, { k: 'user_parameter_app', label: 'Gibt es eine App oder Weboberfläche für Nutzer?' },
{ k: 'processes_personal_data', label: 'Verarbeitet es personenbezogene Daten?' }, { k: 'processes_personal_data', label: 'Werden personenbezogene Daten verarbeitet?' },
{ k: 'is_critical_infra_supplier', label: 'Wird es in kritischer Infrastruktur eingesetzt?' }, { k: 'is_critical_infra_supplier', label: 'Wird das Produkt in kritischen Umgebungen oder Infrastrukturen eingesetzt?' },
] ]
return ( return (
<div className="rounded-xl border border-purple-200 dark:border-purple-800 bg-purple-50/50 dark:bg-purple-900/20 p-5 mb-6"> <div className="rounded-xl border border-purple-200 dark:border-purple-800 bg-purple-50/50 dark:bg-purple-900/20 p-5 mb-6">
<h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100">CRA-Readiness-Check</h2> <h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100">CRA-Readiness-Check</h2>
<p className="text-sm text-gray-600 dark:text-gray-300 mt-1"> <p className="text-sm text-gray-600 dark:text-gray-300 mt-1">
Vernetzte Maschinen/Anlagen treffen ab 2027 gleich <span className="font-medium">zwei Verordnungen</span>: der Vernetzte Produkte und Maschinen treffen ab 2027 gleich zwei neue regulatorische Anforderungen:
{' '}<span className="font-medium">Cyber Resilience Act</span> (Hersteller-Pflichten ab 11.12.2027) und die
{' '}<span className="font-medium">neue Maschinen-VO 2023/1230</span> (ab 20.01.2027 Cybersecurity mit
Safety-Bezug). Ein paar Fragen sofort eine auf Ihren Scope zugeschnittene Übersicht (Code, Prozesse, Dokumentation).
</p> </p>
<p className="text-xs text-gray-500 mt-1 mb-4"> <ul className="text-sm text-gray-600 dark:text-gray-300 mt-1 ml-1 space-y-0.5">
Der CRA will kein jährliches Pentest-Häkchen, sondern eine <span className="font-medium">fortlaufend dokumentierte <li> <span className="font-medium">Cyber Resilience Act (CRA)</span> Herstellerpflichten ab 11.12.2027</li>
Cyber-Risikobeurteilung</span> über den Lebenszyklus (Art. 13 + Anhang I/VII). <span className="italic">Wir analysieren <li> <span className="font-medium">Maschinenverordnung (EU) 2023/1230</span> Anwendung ab 20.01.2027</li>
und setzen es mit Ihnen um, als laufendes System (versionierte Snapshots), nicht als Einmal-Check.</span> </ul>
<p className="text-sm text-gray-600 dark:text-gray-300 mt-2">
Während der CRA die Cybersecurity vernetzter Produkte über ihren gesamten Lebenszyklus regelt, verlangt die
neue Maschinenverordnung Schutzmaßnahmen gegen <span className="font-medium">digitale Manipulationen, soweit diese
Auswirkungen auf die Sicherheit von Personen</span> haben können.
</p>
<p className="text-xs text-gray-500 mt-2">
Mit wenigen Fragen erhalten Sie eine erste Einschätzung, welche Anforderungen für Ihr Produkt relevant werden
und welche Maßnahmen in den Bereichen Entwicklung, Dokumentation, Risikobeurteilung, Updates und Prozesse erforderlich sind.
</p>
<p className="text-xs text-gray-600 dark:text-gray-300 mt-2">
Der CRA verlangt mehr als einen jährlichen Penetrationstest: Hersteller müssen Cyber-Risiken über den gesamten
Produktlebenszyklus bewerten, dokumentieren und behandeln von der Entwicklung bis zur Bereitstellung von Sicherheitsupdates.
</p>
<p className="text-xs text-purple-700 dark:text-purple-300 font-medium mt-2 mb-4">
Wir prüfen nicht nur die CRA-Konformität wir übersetzen regulatorische Anforderungen direkt in Risiken,
Maßnahmen, Tickets, Evidenzen und technische Umsetzungsaufgaben. (We turn regulation into code.)
</p> </p>
<textarea <textarea