@aegis-scan/skills 0.2.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/ATTRIBUTION.md +171 -4
  2. package/CHANGELOG.md +112 -1
  3. package/README.md +27 -0
  4. package/dist/skills-loader.d.ts +43 -0
  5. package/dist/skills-loader.d.ts.map +1 -1
  6. package/dist/skills-loader.js +102 -0
  7. package/dist/skills-loader.js.map +1 -1
  8. package/package.json +1 -1
  9. package/skills/compliance/_INDEX.md +49 -0
  10. package/skills/compliance/aegis-native/brutaler-anwalt/CHANGELOG.md +202 -0
  11. package/skills/compliance/aegis-native/brutaler-anwalt/LICENSE +43 -0
  12. package/skills/compliance/aegis-native/brutaler-anwalt/README.md +236 -0
  13. package/skills/compliance/aegis-native/brutaler-anwalt/SKILL.md +437 -6
  14. package/skills/compliance/aegis-native/brutaler-anwalt/references/aegis-integration.md +3 -4
  15. package/skills/compliance/aegis-native/brutaler-anwalt/references/audit-patterns.md +842 -5
  16. package/skills/compliance/aegis-native/brutaler-anwalt/references/bgh-urteile.md +226 -10
  17. package/skills/compliance/aegis-native/brutaler-anwalt/references/branchenrecht.md +365 -1
  18. package/skills/compliance/aegis-native/brutaler-anwalt/references/checklisten.md +33 -0
  19. package/skills/compliance/aegis-native/brutaler-anwalt/references/dsgvo.md +26 -0
  20. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BDSG/paragraphs.md +62 -0
  21. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BFSG/paragraphs.md +85 -0
  22. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/BGB/paragraphs.md +112 -0
  23. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/DDG/paragraphs.md +71 -0
  24. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/DSGVO/articles.md +182 -0
  25. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/AI-Act-2024-1689/articles.md +108 -0
  26. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/EU-Verordnungen/DSA-2022-2065/articles.md +131 -0
  27. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/HGB-AO/paragraphs.md +61 -0
  28. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/INDEX.md +93 -0
  29. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/TDDDG/paragraphs.md +67 -0
  30. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/UWG/paragraphs.md +117 -0
  31. package/skills/compliance/aegis-native/brutaler-anwalt/references/gesetze/VSBG/paragraphs.md +57 -0
  32. package/skills/compliance/aegis-native/brutaler-anwalt/references/it-recht.md +22 -0
  33. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/INDEX.md +122 -0
  34. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/ai/mistral-eu.md +123 -0
  35. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/ai/openai-dpa.md +120 -0
  36. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/auth/nextauth-tom.md +120 -0
  37. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/auth/supabase-auth-tom.md +104 -0
  38. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/nextjs/proxy-csp-pattern.md +93 -0
  39. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/payment/stripe-pci-tom.md +121 -0
  40. package/skills/compliance/aegis-native/brutaler-anwalt/references/stack-patterns/tracking/plausible-pattern.md +107 -0
  41. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/AffiliateDisclaimer.tsx.example +54 -0
  42. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/COMPLIANCE-AUDIT-TRAIL-template.md +95 -0
  43. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/DSE-Section-UGC.md.example +77 -0
  44. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/DSFA-template.md +76 -0
  45. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/LostFoundReportForm-consent.tsx.example +126 -0
  46. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/README.md +33 -0
  47. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/UmamiScript.tsx.example +64 -0
  48. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/VVT-template.md +60 -0
  49. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/data-retention-cron.ts.example +52 -0
  50. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/data-retention-workflow.yml.example +47 -0
  51. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/proxy-strict-dynamic.ts.example +80 -0
  52. package/skills/compliance/aegis-native/brutaler-anwalt/references/templates/security.txt.example +26 -0
  53. package/skills/compliance/aegis-native/brutaler-anwalt/scripts/health-check.sh +120 -0
  54. package/skills/defensive/aegis-native/rls-defense/SKILL.md +110 -0
  55. package/skills/defensive/aegis-native/tenant-isolation-defense/SKILL.md +26 -0
  56. package/skills/foundation/_INDEX.md +73 -0
  57. package/skills/foundation/aegis-native/aegis-audit/SKILL.md +194 -0
  58. package/skills/foundation/aegis-native/aegis-audit/references/layer-1-headers.md +138 -0
  59. package/skills/foundation/aegis-native/aegis-audit/references/layer-2-html.md +153 -0
  60. package/skills/foundation/aegis-native/aegis-audit/references/layer-3-impressum.md +159 -0
  61. package/skills/foundation/aegis-native/aegis-audit/references/layer-4-dse.md +178 -0
  62. package/skills/foundation/aegis-native/aegis-audit/references/layer-5-cookie.md +180 -0
  63. package/skills/foundation/aegis-native/aegis-audit/references/layer-6-branche.md +204 -0
  64. package/skills/foundation/aegis-native/aegis-audit/references/layer-7-code-cross-check.md +212 -0
  65. package/skills/foundation/aegis-native/aegis-audit/references/layer-8-schadens-diagnose.md +232 -0
  66. package/skills/foundation/aegis-native/aegis-customer-build/SKILL.md +232 -0
  67. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-1-recon.md +147 -0
  68. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-2-architecture.md +164 -0
  69. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-3-component-build.md +231 -0
  70. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-4-content.md +196 -0
  71. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-5-integration.md +273 -0
  72. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-6-mid-audit.md +200 -0
  73. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-7-final-verify.md +258 -0
  74. package/skills/foundation/aegis-native/aegis-handover-writer/SKILL.md +128 -0
  75. package/skills/foundation/aegis-native/aegis-module-builder/SKILL.md +255 -0
  76. package/skills/foundation/aegis-native/aegis-orchestrator/SKILL.md +229 -0
  77. package/skills/foundation/aegis-native/aegis-quality-gates/SKILL.md +182 -0
  78. package/skills/foundation/aegis-native/aegis-skill-creator/SKILL.md +223 -0
  79. package/skills/foundation/aegis-native/aegis-skill-creator/references/hard-constraint-template.md +213 -0
  80. package/skills/foundation/aegis-native/aegis-skill-creator/references/skillforge-methodology.md +220 -0
  81. package/skills/foundation/aegis-native/dsgvo-compliance/SKILL.md +185 -0
  82. package/skills/foundation/aegis-native/dsgvo-compliance/references/art-13-15-templates.md +309 -0
  83. package/skills/foundation/aegis-native/dsgvo-compliance/references/datenpanne-runbook.md +291 -0
  84. package/skills/offensive/matty-fork/cicd-redteam/SKILL.md +531 -0
  85. package/skills/offensive/matty-fork/cloud-security/SKILL.md +106 -0
  86. package/skills/offensive/matty-fork/container-escape/SKILL.md +174 -0
  87. package/skills/offensive/matty-fork/mobile-pentester/SKILL.md +357 -0
  88. package/skills/offensive/matty-fork/subdomain-takeover/SKILL.md +154 -0
  89. package/skills/osint/elementalsouls-fork/offensive-osint/README.md +92 -0
  90. package/skills/osint/elementalsouls-fork/offensive-osint/SKILL.md +4177 -0
  91. package/skills/osint/elementalsouls-fork/osint-methodology/README.md +66 -0
  92. package/skills/osint/elementalsouls-fork/osint-methodology/SKILL.md +1695 -0
  93. package/sbom.cdx.json +0 -1
@@ -0,0 +1,204 @@
1
+ # Layer 6 Reference — Branche-Specific (Industry Compliance)
2
+
3
+ Layer 6 applies industry-specific pflichtangaben + werbevorschriften per the target's branch. Industries handled: BORA (Anwalt), HWG (Heilwesen), LMIV (Lebensmittel), MPDG (Medizinprodukte), GlüStV (Glücksspiel), FernUSG (Fernunterricht), HWO/HwO (Handwerk), GewO (Gewerbeordnung). **Time:** ~5-10 min per target after industry-detection.
4
+
5
+ ---
6
+
7
+ ## Industry Detection
8
+
9
+ Industry is detected from:
10
+
11
+ 1. The briefing's `industry` field (if customer-build invocation)
12
+ 2. The target's NAICS / WZ-Code (if available)
13
+ 3. Heuristic from page-content (keyword-density)
14
+
15
+ Detection-fallback (heuristic):
16
+
17
+ ```bash
18
+ # Anwaltskanzlei
19
+ grep -iqE '(Rechtsanwalt|Kanzlei|Fachanwalt|BORA|RVG)' /tmp/audit-html-static.html && industry="anwalt"
20
+
21
+ # Heilwesen (Arzt, Psychotherapie, Heilpraktiker)
22
+ grep -iqE '(Arzt|Ärztin|Praxis|Heilpraktiker|Psychotherapie|Diagnose|Therapie)' /tmp/audit-html-static.html && industry="heilwesen"
23
+
24
+ # Lebensmittel (Online-Shop)
25
+ grep -iqE '(Lebensmittel|Bio-|Allergene|Nährwert|LMIV)' /tmp/audit-html-static.html && industry="lebensmittel"
26
+
27
+ # Medizinprodukte
28
+ grep -iqE '(MPDG|CE-Kennzeichen|Medizinprodukt|UDI|EUDAMED)' /tmp/audit-html-static.html && industry="medizinprodukte"
29
+
30
+ # Steuerberater
31
+ grep -iqE '(Steuerberater|StBerG|StBVV|Steuerkanzlei)' /tmp/audit-html-static.html && industry="steuerberater"
32
+
33
+ # Architekt
34
+ grep -iqE '(Architekt|Architektenkammer|HOAI)' /tmp/audit-html-static.html && industry="architekt"
35
+
36
+ # Handwerk
37
+ grep -iqE '(HwO|Handwerk|Meisterprüfung|Innung)' /tmp/audit-html-static.html && industry="handwerk"
38
+
39
+ # Default
40
+ [ -z "$industry" ] && industry="generic"
41
+ ```
42
+
43
+ If detection ambiguous — ask operator. Don't apply Branchen-checks based on weak signal.
44
+
45
+ ---
46
+
47
+ ## BORA — Anwaltskanzlei
48
+
49
+ | # | Pflichtangabe | Severity if missing |
50
+ |---|---|---|
51
+ | 1 | Berufsbezeichnung "Rechtsanwalt"/"Rechtsanwältin" + verleihender Staat | KRITISCH |
52
+ | 2 | Zuständige Rechtsanwaltskammer | KRITISCH |
53
+ | 3 | Berufshaftpflichtversicherung (Versicherer + räumlicher Geltungsbereich) | KRITISCH |
54
+ | 4 | Berufsrechtliche Regelungen + zugängliche Quelle (BORA, BRAK, RVG) | HOCH |
55
+ | 5 | Fachanwaltsbezeichnungen (when used) — verleihender Staat | HOCH |
56
+ | 6 | Hinweis Streitbeilegung (RVG, ZAR) | MITTEL |
57
+
58
+ **Werbevorschriften (BORA + UWG):**
59
+
60
+ - Keine reißerische Werbung (BORA § 6)
61
+ - Keine vergleichende Werbung mit Mitbewerbern (BORA + UWG)
62
+ - Erfolgshonorar-Hinweis (BORA + RVG-Reform 2021) — only when applicable
63
+
64
+ ```bash
65
+ # Detection patterns
66
+ grep -iE '(garantiere(n)?\s+(Erfolg|Sieg)|100%\s+Erfolg|absolute\s+Sicherheit)' /tmp/audit-html-static.html | head -3
67
+ # If matches → L6-BORA-ERFOLGSREKLAME: KRITISCH
68
+ ```
69
+
70
+ ---
71
+
72
+ ## HWG — Heilwesen (Arzt, Psychotherapie, Heilpraktiker)
73
+
74
+ | # | Pflichtangabe | Severity |
75
+ |---|---|---|
76
+ | 1 | Berufsbezeichnung "Arzt"/"Ärztin"/"Heilpraktiker" + verleihender Staat | KRITISCH |
77
+ | 2 | Zuständige Aufsichtsbehörde (Landesärztekammer / Gesundheitsamt) | KRITISCH |
78
+ | 3 | Berufshaftpflicht | KRITISCH |
79
+ | 4 | Approbationsstaat | HOCH |
80
+ | 5 | Schwerpunkte / Zusatzbezeichnungen (when used) | HOCH |
81
+ | 6 | Berufsordnung-Verweis | MITTEL |
82
+
83
+ **HWG-Werbevorschriften (Heilmittelwerbegesetz):**
84
+
85
+ - Kein Werbung mit "neu", "garantiert wirksam", "vollständig heilbar"
86
+ - Keine Patientenfotos / -berichte ohne Einwilligung + Datenschutz-Hinweis
87
+ - Keine vergleichende Werbung gegenüber anderen Methoden
88
+ - Hinweis "Zu Risiken und Nebenwirkungen..." bei Medikamenten
89
+
90
+ ```bash
91
+ # Common HWG-Verstöße
92
+ grep -iE '(garantierte\s+Heilung|100%\s+wirksam|vollständig\s+heilbar|nebenwirkungs\s*frei)' /tmp/audit-html-static.html
93
+ ```
94
+
95
+ ---
96
+
97
+ ## LMIV — Lebensmittel-Online-Shop
98
+
99
+ | Pflicht | Severity if missing |
100
+ |---|---|
101
+ | Bezeichnung des Lebensmittels (specific, not just brand) | KRITISCH |
102
+ | Zutatenliste (in absteigender Mengenreihenfolge) | KRITISCH |
103
+ | Allergene (Hervorhebung) | KRITISCH |
104
+ | Nettomenge / Gewicht | HOCH |
105
+ | Mindestens-Haltbar-Datum / Verbrauchsdatum | HOCH |
106
+ | Hersteller / Inverkehrbringer + Anschrift | KRITISCH |
107
+ | Ursprungsland (when applicable) | HOCH |
108
+ | Nährwertdeklaration (per 100g/100ml) | KRITISCH |
109
+ | Anweisungen zur sachgerechten Aufbewahrung | MITTEL |
110
+
111
+ ---
112
+
113
+ ## MPDG — Medizinprodukte
114
+
115
+ | Pflicht | Severity |
116
+ |---|---|
117
+ | CE-Kennzeichnung (mit Notified-Body-Nummer für Klasse Is/IIa+) | KRITISCH |
118
+ | UDI-DI / UDI-PI (per EU-Verordnung 2017/745) | HOCH |
119
+ | EUDAMED-Eintrag (when produced/imported in EU) | HOCH |
120
+ | Hersteller + Adresse | KRITISCH |
121
+ | Klassifikation (Klasse I/IIa/IIb/III) | HOCH |
122
+ | Bevollmächtigter EU (when ext.-EU manufacturer) | KRITISCH |
123
+ | Gebrauchsanweisung (PDF-Link or paper) | KRITISCH |
124
+
125
+ ---
126
+
127
+ ## StBerG — Steuerberater
128
+
129
+ | Pflicht | Severity |
130
+ |---|---|
131
+ | Berufsbezeichnung "Steuerberater"/"Steuerbevollmächtigter" + verleihender Staat | KRITISCH |
132
+ | Zuständige Steuerberaterkammer | KRITISCH |
133
+ | StBVV-Hinweis (Vergütung) | HOCH |
134
+ | Berufshaftpflicht | KRITISCH |
135
+ | Eintragung Berufsregister | HOCH |
136
+
137
+ ---
138
+
139
+ ## HOAI — Architekt
140
+
141
+ | Pflicht | Severity |
142
+ |---|---|
143
+ | Berufsbezeichnung "Architekt"/"Architektin" + verleihender Staat | KRITISCH |
144
+ | Architektenkammer (Bundesland) | KRITISCH |
145
+ | Eintragsnummer | HOCH |
146
+ | HOAI-Hinweis (Vergütung) | MITTEL |
147
+ | Berufshaftpflicht | KRITISCH |
148
+
149
+ ---
150
+
151
+ ## HwO — Handwerk
152
+
153
+ | Pflicht | Severity |
154
+ |---|---|
155
+ | Handwerksrolle + Eintragsnummer (when zulassungspflichtiges Handwerk) | KRITISCH |
156
+ | Meisterprüfung-Nachweis (when rolle-pflichtig) | HOCH |
157
+ | Zuständige Handwerkskammer | HOCH |
158
+ | Innung-Mitgliedschaft (when applicable) | LOW |
159
+
160
+ ---
161
+
162
+ ## GlüStV — Glücksspiel
163
+
164
+ For online-Glücksspiel: Stricter regime + license-display per GlüStV-2021. Out-of-scope unless target is licensed gambling.
165
+
166
+ ---
167
+
168
+ ## FernUSG — Fernunterricht
169
+
170
+ If site sells distance-learning (online-courses with Lehrpersonen + Prüfung):
171
+
172
+ - Zulassung-Nummer FernUSG (ZFU)
173
+ - Vertragsbedingungen klar getrennt von Marketing
174
+ - Widerrufsbelehrung verlängert (FernUSG)
175
+
176
+ ---
177
+
178
+ ## Findings Format
179
+
180
+ ```yaml
181
+ - id: L6-BORA-NO-VERSICHERER
182
+ layer: 6
183
+ industry: anwalt
184
+ severity: KRITISCH
185
+ evidence:
186
+ detected_industry: anwalt
187
+ detection_signal: "Fachanwalt (line 23), BORA (line 47)"
188
+ impressum_url: <url>
189
+ versicherer_present: false
190
+ recommendation: "Add Berufshaftpflichtversicherung (Versicherer + räumlicher Geltungsbereich) per BORA § 7 + DDG § 5 Abs. 1 Nr. 8"
191
+ citation: "BORA § 7, DDG § 5 Abs. 1 Nr. 8, BRAO § 51"
192
+ abmahn_risk: "€2000-7000 (Kammern + Konkurrenz-Anwalt-Abmahnung)"
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Anti-Patterns specific to Layer 6
198
+
199
+ - ❌ Applying BORA-checks to a marketing-website that mentions "Rechtsanwalt" as a stock-image alt-text — verify the site is actually offering legal services.
200
+ - ❌ Reporting LMIV-violations on a non-online-shop site (e.g., a restaurant blog without ordering) — LMIV applies to commercial offer of food, not editorial.
201
+ - ❌ Reporting HWG on a private-blog about wellness — HWG applies to advertising of medicinal products / treatments by professionals.
202
+ - ❌ Skipping Layer 6 for "generic" industry — even generic businesses have GewO basics (Gewerbeschein, GewSt-Nummer when applicable).
203
+ - ❌ Inferring industry from a single keyword — require multiple signals (e.g., 2+ industry-specific terms before classification).
204
+ - ❌ Hard-coding industry-list — the catalog should grow with operator-feedback; new industries added per `references/layer-6-branche-<industry>.md` extension.
@@ -0,0 +1,212 @@
1
+ # Layer 7 Reference — Code-Cross-Check
2
+
3
+ Layer 7 runs ONLY when aegis-audit has access to the source-code (local repo / customer-build artifact). Catches: hardcoded secrets, unsafe-eval / unsafe-inline patterns, missing CSP-headers in middleware, env-vars-leak in public builds, bug-bounty-known-bad-patterns. **Time:** ~5-15 min per target.
4
+
5
+ ---
6
+
7
+ ## Activation Conditions
8
+
9
+ Layer 7 runs when:
10
+
11
+ - Target is a local repo (`--target=./` or `--target=customers/<slug>/`)
12
+ - Target is a built artifact with source-maps (`<target>/.next/server/chunks/`)
13
+ - Operator passes `--enable-layer-7`
14
+
15
+ Layer 7 does NOT run on a deployed-only URL — there's no source to inspect.
16
+
17
+ ---
18
+
19
+ ## Hardcoded Secrets Detection
20
+
21
+ ```bash
22
+ # Common secret-patterns
23
+ TARGETS="src/ app/ pages/ lib/ scripts/ next.config.js next.config.ts middleware.ts"
24
+
25
+ # API keys
26
+ grep -rEn '(api[_-]?key|secret[_-]?key|password|access[_-]?token)\s*[=:]\s*["\x27][^"\x27]{20,}' $TARGETS --include="*.{ts,tsx,js,jsx,json,env*}" 2>/dev/null
27
+
28
+ # AWS-style
29
+ grep -rEn 'AKIA[0-9A-Z]{16}' $TARGETS 2>/dev/null
30
+
31
+ # JWT-like tokens
32
+ grep -rEn 'eyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*' $TARGETS 2>/dev/null
33
+
34
+ # Private keys
35
+ grep -rEn -- '-----BEGIN (RSA |EC |DSA )?PRIVATE KEY-----' $TARGETS 2>/dev/null
36
+ ```
37
+
38
+ | Match | Severity |
39
+ |---|---|
40
+ | API-key / token in source | KRITISCH |
41
+ | Database connection string | KRITISCH |
42
+ | JWT-secret in source | KRITISCH |
43
+ | Private key in source | KRITISCH |
44
+ | `.env` file committed | KRITISCH |
45
+ | `.env.local` file committed | HOCH |
46
+ | Hardcoded test-credential (e.g., test-stripe-key) | LOW (intentional) |
47
+
48
+ ---
49
+
50
+ ## Public-Build Env-Vars-Leak
51
+
52
+ Next.js: only `NEXT_PUBLIC_*` env-vars are exposed to client-bundles. Anything else exposed = leak.
53
+
54
+ ```bash
55
+ # Find env-vars used on client
56
+ grep -rEn 'process\.env\.[A-Z_]+' src/components/ src/app/*/page.tsx src/lib/client/ 2>/dev/null
57
+
58
+ # For each, verify it's prefixed NEXT_PUBLIC_
59
+ # If not — leak
60
+ ```
61
+
62
+ | Pattern | Severity |
63
+ |---|---|
64
+ | `process.env.SECRET_KEY` in 'use client' component | KRITISCH |
65
+ | `process.env.STRIPE_SECRET` in client-component | KRITISCH |
66
+ | `NEXT_PUBLIC_*` used in server-only context | LOW (just bad style) |
67
+
68
+ ---
69
+
70
+ ## CSP Cross-Check
71
+
72
+ Layer 1 reports the actual served CSP. Layer 7 reads `next.config.js` / `middleware.ts` to verify CSP-source.
73
+
74
+ ```bash
75
+ # Find CSP-source
76
+ grep -rEn 'Content-Security-Policy' next.config.* middleware.* src/middleware.* 2>/dev/null
77
+
78
+ # Verify against served (Layer 1 finding)
79
+ diff <(grep -oE "Content-Security-Policy.*" /tmp/audit-headers-get.txt) \
80
+ <(grep -oE "Content-Security-Policy.*" middleware.ts | head -1)
81
+ ```
82
+
83
+ | Drift | Severity |
84
+ |---|---|
85
+ | CSP in middleware but not in served headers | HOCH (proxy stripping it) |
86
+ | CSP in next.config but not in served | MITTEL (build-config not active) |
87
+ | CSP differs between source + served | HOCH (drift / proxy-rewrite) |
88
+
89
+ ---
90
+
91
+ ## Unsafe Patterns
92
+
93
+ ```bash
94
+ # eval / Function-constructor
95
+ grep -rEn '\beval\(|new Function\(' src/ 2>/dev/null
96
+
97
+ # Set innerHTML / dangerouslySetInnerHTML without sanitization
98
+ grep -rEn 'dangerouslySetInnerHTML' src/ | xargs -I{} grep -L 'sanitize\|DOMPurify' {} 2>/dev/null
99
+
100
+ # document.write
101
+ grep -rEn 'document\.write\(' src/ 2>/dev/null
102
+
103
+ # raw HTML construction
104
+ grep -rEn 'innerHTML\s*=' src/ 2>/dev/null
105
+ ```
106
+
107
+ | Pattern | Severity |
108
+ |---|---|
109
+ | `eval()` in production code | HOCH (CSP-cross-check: needs `unsafe-eval`) |
110
+ | `dangerouslySetInnerHTML` without DOMPurify-or-equivalent | HOCH |
111
+ | `document.write` | MITTEL |
112
+ | `innerHTML =` with untrusted input | KRITISCH |
113
+ | `target="_blank"` without `rel="noopener noreferrer"` | MITTEL (window-opener attack) |
114
+
115
+ ---
116
+
117
+ ## API-Route Wrapper Coverage
118
+
119
+ Verify every API-route uses `secureApiRoute`:
120
+
121
+ ```bash
122
+ # Find all api routes
123
+ find app/api -name "route.ts" -o -name "route.tsx" 2>/dev/null
124
+
125
+ # For each, verify wrapper used
126
+ for f in $(find app/api -name "route.ts" 2>/dev/null); do
127
+ if ! grep -q "secureApiRoute\|requireRole\|withAuth" "$f"; then
128
+ echo "L7-API-ROUTE-NO-WRAPPER: $f (HOCH)"
129
+ fi
130
+ done
131
+ ```
132
+
133
+ Routes without wrapper bypass: rate-limit + Origin-check + body-validation. KRITISCH for state-mutating routes (POST/PUT/DELETE).
134
+
135
+ ---
136
+
137
+ ## Form Honeypot + DSGVO-Consent Coverage
138
+
139
+ ```bash
140
+ # Find form components
141
+ grep -rln '<form' src/components/forms/ src/components/ 2>/dev/null
142
+
143
+ # Verify honeypot present
144
+ for f in $(grep -rln '<form' src/components/ 2>/dev/null); do
145
+ if ! grep -qE '_honey|honeypot|hidden\s+input' "$f"; then
146
+ echo "L7-FORM-NO-HONEYPOT: $f (MITTEL)"
147
+ fi
148
+ if ! grep -qE 'consent\|dsgvo\|datenschutz' "$f"; then
149
+ echo "L7-FORM-NO-CONSENT: $f (HOCH)"
150
+ fi
151
+ done
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Dependency Vulnerability Scan
157
+
158
+ ```bash
159
+ # pnpm audit (or npm audit)
160
+ pnpm audit --json > /tmp/audit-deps.json 2>/dev/null
161
+
162
+ # Parse high/critical
163
+ high_count=$(jq -r '.metadata.vulnerabilities.high // 0' /tmp/audit-deps.json)
164
+ crit_count=$(jq -r '.metadata.vulnerabilities.critical // 0' /tmp/audit-deps.json)
165
+
166
+ [ $crit_count -gt 0 ] && echo "L7-DEPS-CRITICAL: $crit_count (KRITISCH)"
167
+ [ $high_count -gt 0 ] && echo "L7-DEPS-HIGH: $high_count (HOCH)"
168
+ ```
169
+
170
+ ---
171
+
172
+ ## License-Cross-Check (compliance-relevant)
173
+
174
+ ```bash
175
+ # Find dependencies with non-permissive licenses (GPL, AGPL)
176
+ npx license-checker --json 2>/dev/null | jq -r 'to_entries[] | select(.value.licenses | tostring | test("GPL|AGPL")) | "\(.key): \(.value.licenses)"'
177
+ ```
178
+
179
+ | Issue | Severity |
180
+ |---|---|
181
+ | AGPL dep in proprietary build | KRITISCH (license-incompatible) |
182
+ | GPL dep in proprietary build | HOCH |
183
+ | Unknown license | MITTEL |
184
+
185
+ ---
186
+
187
+ ## Findings Format
188
+
189
+ ```yaml
190
+ - id: L7-API-ROUTE-NO-WRAPPER
191
+ layer: 7
192
+ severity: HOCH
193
+ evidence:
194
+ file: app/api/contact/route.ts
195
+ line_range: [1, 30]
196
+ detected_pattern: "export const POST = async (req) => { ... }"
197
+ expected_pattern: "export const POST = secureApiRoute({...})"
198
+ recommendation: "Wrap POST handler in secureApiRoute (rate-limit + Origin-check + Zod-validation)"
199
+ citation: "BSI TR-03116-4 §4.5; OWASP API Top-10 #4 (Lack of Resources & Rate Limiting)"
200
+ abmahn_risk: "Indirect — facilitates DoS / spam / credential-stuffing; €0 direct, escalates incident-cost when exploited"
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Anti-Patterns specific to Layer 7
206
+
207
+ - ❌ Running Layer 7 on a deployed-only URL — needs source-code.
208
+ - ❌ Reporting "secret in source" for a `.env.example` template file — verify it's a real env-file.
209
+ - ❌ Marking `dangerouslySetInnerHTML` as KRITISCH without checking for sanitization — DOMPurify or equivalent makes it acceptable.
210
+ - ❌ Skipping `pnpm audit` because "deps look fine" — CVE-database changes daily.
211
+ - ❌ Reporting "GPL dep" when project is also GPL — license-conflict only when target's license differs.
212
+ - ❌ Inferring CSP-drift without serving the build first — middleware might be overridden by reverse-proxy in production.
@@ -0,0 +1,232 @@
1
+ # Layer 8 Reference — Schadens-Diagnose (SYNTHESIZER + €-Range)
2
+
3
+ Layer 8 is the consolidator. Reads Layer 1-7 findings, produces the 4-section report, computes €-range estimates via the industry × visibility × competitor formula. **Time:** ~5-10 min after Layer 7 completes.
4
+
5
+ ---
6
+
7
+ ## 4-Section Report Structure
8
+
9
+ ```markdown
10
+ # Audit Report — <project_slug | target>
11
+
12
+ **Date:** YYYY-MM-DD
13
+ **Mode:** mid | full
14
+ **Target:** <url | repo-path>
15
+
16
+ ---
17
+
18
+ ## 1. Schadens-Diagnose
19
+
20
+ (Top-level summary, ≤ 200 words. €-range estimate. Status DONE | INCOMPLETE.)
21
+
22
+ ---
23
+
24
+ ## 2. Findings-Tabelle
25
+
26
+ (Detailed per-finding. Severity + layer + ID + evidence + recommendation + citation. Ordered KRITISCH → HOCH → MITTEL → LOW.)
27
+
28
+ ---
29
+
30
+ ## 3. Anwalts-Anhang
31
+
32
+ (Legal citations + court-decisions referenced. Per finding, the source-of-law that justifies the severity-classification.)
33
+
34
+ ---
35
+
36
+ ## 4. Abmahn-Simulation
37
+
38
+ (Probability-weighted cost model. Industry × Visibility × Competitor-Pressure → € range over 12 months.)
39
+
40
+ ---
41
+
42
+ **Disclaimer:** Estimates are advisory; not legal advice. Verify with a Fachanwalt für IT-Recht / Wettbewerbsrecht / Gewerblichen Rechtsschutz before relying on them.
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Section 1: Schadens-Diagnose
48
+
49
+ ```markdown
50
+ ## 1. Schadens-Diagnose
51
+
52
+ **Status:** DONE | INCOMPLETE
53
+ **AEGIS-Score (when scan-mode):** N/1000 / Grade <S|A|B|C|D|F> / Bracket <FORTRESS|HARDENED|...>
54
+ **Findings-Total:** K KRITISCH / H HOCH / M MITTEL / L LOW
55
+ **€-Range (12 months):** €<low> - €<high>
56
+ **Top-3-Risks:**
57
+ 1. <ID>: <one-sentence-summary>. Risk: €<low>-<high>.
58
+ 2. <ID>: ...
59
+ 3. <ID>: ...
60
+
61
+ **Composite-Findings (cross-correlation pass):**
62
+ - <ID-A> + <ID-B> + <ID-C> → composite KRITISCH (€<low>-<high>)
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Section 2: Findings-Tabelle
68
+
69
+ ```markdown
70
+ ## 2. Findings-Tabelle
71
+
72
+ | Severity | Layer | ID | Title | €-Range | Citation |
73
+ |---|---|---|---|---|---|
74
+ | KRITISCH | 4 | L4-DSE-DRITTLAND-MISSING | DSE fehlt Drittlandtransfer-Section | €2000-15000 | DSGVO Art. 13/46; EuGH C-311/18 |
75
+ | KRITISCH | 5 | L5-PRE-CONSENT-TRACKER | _ga + _fbp set before banner-acceptance | €500-5000 | TTDSG §25; BGH I ZR 7/16 |
76
+ | HOCH | 1 | L1-CSP-UNSAFE-INLINE | CSP allows unsafe-inline on script-src | €0 (no direct abmahn) | OWASP CSP-3 |
77
+ | HOCH | 3 | L3-IMPRESSUM-VAT-MISSING | Impressum fehlt USt-IdNr | €500-2000 | DDG §5 Abs. 1 Nr. 6 |
78
+ | ... | ... | ... | ... | ... | ... |
79
+
80
+ (Then per finding, expand with Evidence + Recommendation block.)
81
+
82
+ ### KRITISCH 1: L4-DSE-DRITTLAND-MISSING
83
+
84
+ **Severity:** KRITISCH
85
+ **Layer:** 4
86
+ **Found at:** /datenschutz (line 47)
87
+ **Evidence:**
88
+ - 3rd-parties detected: fonts.googleapis.com, www.google-analytics.com, connect.facebook.net
89
+ - DSE-mentions-Drittland: false
90
+ - DSE-mentions-SCC: false
91
+
92
+ **Recommendation:**
93
+ Add Drittlandtransfer-section listing US-3rd-parties (Google Fonts, Google Analytics, Facebook Pixel), reference SCC + TIA per Schrems-II EuGH C-311/18, Art. 46 DSGVO Schutzgarantien.
94
+
95
+ **Citation:** DSGVO Art. 13 Abs. 1 lit. f; Art. 46; EuGH C-311/18 (Schrems-II); LG München I 3 O 17493/20 (Google Fonts).
96
+
97
+ **€-Range:** €2000-15000 over 12 months (industry × visibility-dependent).
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Section 3: Anwalts-Anhang
103
+
104
+ ```markdown
105
+ ## 3. Anwalts-Anhang
106
+
107
+ ### DSGVO (Verordnung (EU) 2016/679)
108
+
109
+ - **Art. 13** — Informationspflicht bei Erhebung beim Betroffenen (referenced by L4-DSE-*)
110
+ - **Art. 46** — Übermittlung vorbehaltlich geeigneter Garantien (referenced by L4-DSE-DRITTLAND-MISSING)
111
+ - **Art. 7 Abs. 1** — Einwilligung nachweisen (referenced by L5-PRE-CONSENT-*)
112
+ - **Art. 28** — Auftragsverarbeitung (referenced by L4-DSE-AVV-MISSING)
113
+
114
+ ### TTDSG / TDDDG
115
+
116
+ - **§ 25 Abs. 1** — Einwilligung erforderlich für Speicherung von Informationen / Zugriff darauf (Cookies, fingerprinting)
117
+
118
+ ### DDG (vormals TMG)
119
+
120
+ - **§ 5 Abs. 1** — Allgemeine Informationspflichten (Impressum)
121
+ - **§ 5 Abs. 1 Nr. 6** — USt-IdNr. (when § 27a UStG applies)
122
+
123
+ ### Court Decisions
124
+
125
+ - **EuGH 2020-07-16 C-311/18 (Schrems-II)** — Privacy-Shield invalid; SCC + TIA required for US-Drittlandtransfer
126
+ - **BGH 2020-05-28 I ZR 7/16** — Cookie-Banner: einseitige Klick-Lösung unzulässig
127
+ - **LG München I 2022-01-20 3 O 17493/20** — Google Fonts via Google CDN = Drittlandtransfer ohne Rechtsgrundlage; €100 Schadensersatz pro Betroffenem
128
+ - **EuGH 2008-10-16 C-298/07** — § 5 TMG (= jetzt DDG §5) ist auch B2B-Pflicht
129
+ - **OLG Düsseldorf 2019-03-26 I-20 U 75/18** — DSE als wettbewerbsrechtlich relevante Pflicht (UWG-Abmahnung möglich)
130
+
131
+ ### Industry-specific (Layer 6)
132
+
133
+ (Listed per industry detected — BORA / HWG / LMIV / etc.)
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Section 4: Abmahn-Simulation
139
+
140
+ ```markdown
141
+ ## 4. Abmahn-Simulation
142
+
143
+ ### Methodology
144
+
145
+ For each KRITISCH/HOCH finding, the €-range is computed as:
146
+
147
+ ```
148
+ €-range = Base × Industry-Multiplier × Visibility-Multiplier × Competitor-Pressure
149
+ ```
150
+
151
+ | Variable | Range |
152
+ |---|---|
153
+ | Base (per finding-class) | €100-2000 |
154
+ | Industry-Multiplier | 0.5 (private blog) - 2.5 (regulated industry: Anwalt, Arzt, Steuerberater) |
155
+ | Visibility-Multiplier | 0.3 (Alexa > 1M) - 2.0 (Top-10000) |
156
+ | Competitor-Pressure | 0.5 (uncommon abmahn-target) - 2.0 (active abmahn-anwalt watching industry) |
157
+
158
+ ### Example Calculation: L4-DSE-DRITTLAND-MISSING
159
+
160
+ - Base: €1500 (DSGVO Drittlandtransfer cluster)
161
+ - Industry: 1.0 (generic web-business)
162
+ - Visibility: 1.5 (Top-100k DACH-traffic)
163
+ - Competitor: 1.5 (Google Fonts = active abmahn-anwalt-Linie)
164
+ - **Total: €1500 × 1.0 × 1.5 × 1.5 = €3375 mid-estimate**
165
+ - Range: €2000-€5000 (varying competitor + industry factors)
166
+
167
+ ### Composite-Findings (cross-correlation)
168
+
169
+ Composite findings (≥ 2 KRITISCH from related layers) get aggregated:
170
+
171
+ - DSE incomplete + Pre-consent tracker + Impressum incomplete = **abmahn-cluster** (likely Konkurrenz-Anwalt or Verbraucherschutzverband target).
172
+ - Aggregated: €5000-€15000 over 12 months.
173
+
174
+ ### Probability-Weighted Estimate
175
+
176
+ | Scenario | Probability | Cost |
177
+ |---|---|---|
178
+ | No abmahnung | 60% | €0 |
179
+ | 1 individual abmahnung (Verbraucher) | 25% | €1500-3500 |
180
+ | 1 Konkurrenz-Abmahnung | 12% | €5000-10000 |
181
+ | Multi-finding abmahn-cluster | 3% | €10000-25000 |
182
+
183
+ **Expected value:** 0.6 × 0 + 0.25 × 2500 + 0.12 × 7500 + 0.03 × 17500 = **~€2050 over 12 months**.
184
+
185
+ (Recompute per project. The probabilities shift with industry, visibility, competitor-pressure.)
186
+
187
+ ---
188
+
189
+ **Disclaimer:** This is a probabilistic risk-model, not legal advice. Actual abmahnungen depend on case-specific factors (timing, abmahn-anwalt activity, court-Linie). For anything ≥ €5000 estimated risk, consult a Fachanwalt für IT-Recht.
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Computation Algorithm
195
+
196
+ ```ts
197
+ // Pseudo-code for €-range computation
198
+ function computeEuroRange(finding, context) {
199
+ const base = SEVERITY_BASE[finding.severity]; // KRITISCH: 1000-3000, HOCH: 200-1000, MITTEL: 50-200, LOW: 0-50
200
+ const industry = INDUSTRY_MULTIPLIER[context.industry] ?? 1.0;
201
+ const visibility = visibilityMultiplier(context.alexa_rank ?? 1_000_000);
202
+ const competitor = competitorPressure(context.industry, finding.id);
203
+ const low = base.low * industry * visibility * competitor;
204
+ const high = base.high * industry * visibility * competitor;
205
+ return { low, high };
206
+ }
207
+
208
+ function aggregateComposites(findings) {
209
+ // Find clusters of related KRITISCH findings (cross-correlation pass already classified them)
210
+ const clusters = groupByCluster(findings);
211
+ return clusters.map(cluster => ({
212
+ ids: cluster.map(f => f.id),
213
+ severity: 'COMPOSITE-KRITISCH',
214
+ range: cluster.reduce((acc, f) => ({
215
+ low: acc.low + f.range.low * 0.7, // 30% discount for composite (single abmahn-letter for multiple findings)
216
+ high: acc.high + f.range.high * 0.85,
217
+ }), { low: 0, high: 0 }),
218
+ }));
219
+ }
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Anti-Patterns specific to Layer 8
225
+
226
+ - ❌ Reporting €-range without disclaimer — always note "advisory; not legal advice".
227
+ - ❌ Hardcoding base-amounts — use a configurable table per `aegis.config.json` `audit.severity_base[]`.
228
+ - ❌ Skipping composite-findings cross-correlation — single findings are often €0; clusters are where the abmahn-risk lives.
229
+ - ❌ Using Alexa-rank only for visibility — also factor: industry-specific visibility (Top-10 in Anwalt-Verzeichnis = high visibility even at Alexa > 1M).
230
+ - ❌ Ignoring competitor-pressure for non-DACH — Layer 8 is calibrated for DACH abmahn-Linien; for US/UK markets, recalibrate.
231
+ - ❌ Promising precise €-amount — always range. "€3375 exact" gives false confidence; "€2000-5000" reflects uncertainty.
232
+ - ❌ Skipping disclaimer in stdout-summary — every output includes the advisory-not-legal-advice note.