chainwall 0.1.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.
- package/LICENSE +21 -0
- package/README.md +278 -0
- package/commands/security-scan.md +35 -0
- package/dist/auditor/access-mapper.d.ts +3 -0
- package/dist/auditor/access-mapper.d.ts.map +1 -0
- package/dist/auditor/access-mapper.js +15 -0
- package/dist/auditor/access-mapper.js.map +1 -0
- package/dist/auditor/cli-detector.d.ts +7 -0
- package/dist/auditor/cli-detector.d.ts.map +1 -0
- package/dist/auditor/cli-detector.js +63 -0
- package/dist/auditor/cli-detector.js.map +1 -0
- package/dist/auditor/cross-reference.d.ts +4 -0
- package/dist/auditor/cross-reference.d.ts.map +1 -0
- package/dist/auditor/cross-reference.js +16 -0
- package/dist/auditor/cross-reference.js.map +1 -0
- package/dist/auditor/env-auditor.d.ts +9 -0
- package/dist/auditor/env-auditor.d.ts.map +1 -0
- package/dist/auditor/env-auditor.js +83 -0
- package/dist/auditor/env-auditor.js.map +1 -0
- package/dist/auditor/mcp-analyzer.d.ts +11 -0
- package/dist/auditor/mcp-analyzer.d.ts.map +1 -0
- package/dist/auditor/mcp-analyzer.js +145 -0
- package/dist/auditor/mcp-analyzer.js.map +1 -0
- package/dist/auditor/mcp-detector.d.ts +17 -0
- package/dist/auditor/mcp-detector.d.ts.map +1 -0
- package/dist/auditor/mcp-detector.js +86 -0
- package/dist/auditor/mcp-detector.js.map +1 -0
- package/dist/auditor/remediation.d.ts +26 -0
- package/dist/auditor/remediation.d.ts.map +1 -0
- package/dist/auditor/remediation.js +222 -0
- package/dist/auditor/remediation.js.map +1 -0
- package/dist/auditor/tool-detector.d.ts +15 -0
- package/dist/auditor/tool-detector.d.ts.map +1 -0
- package/dist/auditor/tool-detector.js +241 -0
- package/dist/auditor/tool-detector.js.map +1 -0
- package/dist/auditor/types.d.ts +31 -0
- package/dist/auditor/types.d.ts.map +1 -0
- package/dist/auditor/types.js +2 -0
- package/dist/auditor/types.js.map +1 -0
- package/dist/auditor/vscode-extension-scanner.d.ts +8 -0
- package/dist/auditor/vscode-extension-scanner.d.ts.map +1 -0
- package/dist/auditor/vscode-extension-scanner.js +51 -0
- package/dist/auditor/vscode-extension-scanner.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +159 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/audit.d.ts +8 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +151 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +34 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/remediate-cli.d.ts +3 -0
- package/dist/commands/remediate-cli.d.ts.map +1 -0
- package/dist/commands/remediate-cli.js +96 -0
- package/dist/commands/remediate-cli.js.map +1 -0
- package/dist/commands/scan.d.ts +11 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +138 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/watch.d.ts +6 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +203 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +235 -0
- package/dist/config.js.map +1 -0
- package/dist/mcp-server/index.d.ts +3 -0
- package/dist/mcp-server/index.d.ts.map +1 -0
- package/dist/mcp-server/index.js +69 -0
- package/dist/mcp-server/index.js.map +1 -0
- package/dist/mcp-server/schemas.d.ts +13 -0
- package/dist/mcp-server/schemas.d.ts.map +1 -0
- package/dist/mcp-server/schemas.js +13 -0
- package/dist/mcp-server/schemas.js.map +1 -0
- package/dist/mcp-server/tools/audit-status.d.ts +3 -0
- package/dist/mcp-server/tools/audit-status.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit-status.js +46 -0
- package/dist/mcp-server/tools/audit-status.js.map +1 -0
- package/dist/mcp-server/tools/check-command.d.ts +4 -0
- package/dist/mcp-server/tools/check-command.d.ts.map +1 -0
- package/dist/mcp-server/tools/check-command.js +30 -0
- package/dist/mcp-server/tools/check-command.js.map +1 -0
- package/dist/mcp-server/tools/scan-content.d.ts +4 -0
- package/dist/mcp-server/tools/scan-content.d.ts.map +1 -0
- package/dist/mcp-server/tools/scan-content.js +18 -0
- package/dist/mcp-server/tools/scan-content.js.map +1 -0
- package/dist/mcp-server/tools/scan-file.d.ts +4 -0
- package/dist/mcp-server/tools/scan-file.d.ts.map +1 -0
- package/dist/mcp-server/tools/scan-file.js +48 -0
- package/dist/mcp-server/tools/scan-file.js.map +1 -0
- package/dist/mcp-server/types.d.ts +15 -0
- package/dist/mcp-server/types.d.ts.map +1 -0
- package/dist/mcp-server/types.js +2 -0
- package/dist/mcp-server/types.js.map +1 -0
- package/dist/reporter/audit-report.d.ts +4 -0
- package/dist/reporter/audit-report.d.ts.map +1 -0
- package/dist/reporter/audit-report.js +186 -0
- package/dist/reporter/audit-report.js.map +1 -0
- package/dist/reporter/json-report.d.ts +3 -0
- package/dist/reporter/json-report.d.ts.map +1 -0
- package/dist/reporter/json-report.js +4 -0
- package/dist/reporter/json-report.js.map +1 -0
- package/dist/reporter/remediation-text.d.ts +3 -0
- package/dist/reporter/remediation-text.d.ts.map +1 -0
- package/dist/reporter/remediation-text.js +12 -0
- package/dist/reporter/remediation-text.js.map +1 -0
- package/dist/reporter/risk-scorer.d.ts +8 -0
- package/dist/reporter/risk-scorer.d.ts.map +1 -0
- package/dist/reporter/risk-scorer.js +40 -0
- package/dist/reporter/risk-scorer.js.map +1 -0
- package/dist/reporter/sarif-report.d.ts +3 -0
- package/dist/reporter/sarif-report.d.ts.map +1 -0
- package/dist/reporter/sarif-report.js +80 -0
- package/dist/reporter/sarif-report.js.map +1 -0
- package/dist/reporter/shared.d.ts +11 -0
- package/dist/reporter/shared.d.ts.map +1 -0
- package/dist/reporter/shared.js +85 -0
- package/dist/reporter/shared.js.map +1 -0
- package/dist/reporter/summary-generator.d.ts +16 -0
- package/dist/reporter/summary-generator.d.ts.map +1 -0
- package/dist/reporter/summary-generator.js +89 -0
- package/dist/reporter/summary-generator.js.map +1 -0
- package/dist/reporter/terminal-report.d.ts +4 -0
- package/dist/reporter/terminal-report.d.ts.map +1 -0
- package/dist/reporter/terminal-report.js +135 -0
- package/dist/reporter/terminal-report.js.map +1 -0
- package/dist/rules/crypto-rules.d.ts +3 -0
- package/dist/rules/crypto-rules.d.ts.map +1 -0
- package/dist/rules/crypto-rules.js +252 -0
- package/dist/rules/crypto-rules.js.map +1 -0
- package/dist/rules/default-rules.d.ts +9 -0
- package/dist/rules/default-rules.d.ts.map +1 -0
- package/dist/rules/default-rules.js +1319 -0
- package/dist/rules/default-rules.js.map +1 -0
- package/dist/rules/index.d.ts +7 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +7 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/injection-rules.d.ts +8 -0
- package/dist/rules/injection-rules.d.ts.map +1 -0
- package/dist/rules/injection-rules.js +108 -0
- package/dist/rules/injection-rules.js.map +1 -0
- package/dist/rules/types.d.ts +52 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +2 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/scanner/filesystem-scanner.d.ts +26 -0
- package/dist/scanner/filesystem-scanner.d.ts.map +1 -0
- package/dist/scanner/filesystem-scanner.js +369 -0
- package/dist/scanner/filesystem-scanner.js.map +1 -0
- package/dist/scanner/injection-scanner.d.ts +12 -0
- package/dist/scanner/injection-scanner.d.ts.map +1 -0
- package/dist/scanner/injection-scanner.js +136 -0
- package/dist/scanner/injection-scanner.js.map +1 -0
- package/dist/scanner/permission-checker.d.ts +4 -0
- package/dist/scanner/permission-checker.d.ts.map +1 -0
- package/dist/scanner/permission-checker.js +37 -0
- package/dist/scanner/permission-checker.js.map +1 -0
- package/dist/scanner/redact.d.ts +3 -0
- package/dist/scanner/redact.d.ts.map +1 -0
- package/dist/scanner/redact.js +17 -0
- package/dist/scanner/redact.js.map +1 -0
- package/dist/scanner/rule-engine.d.ts +9 -0
- package/dist/scanner/rule-engine.d.ts.map +1 -0
- package/dist/scanner/rule-engine.js +129 -0
- package/dist/scanner/rule-engine.js.map +1 -0
- package/dist/scanner/system-targets.d.ts +17 -0
- package/dist/scanner/system-targets.d.ts.map +1 -0
- package/dist/scanner/system-targets.js +81 -0
- package/dist/scanner/system-targets.js.map +1 -0
- package/dist/tui/App.d.ts +6 -0
- package/dist/tui/App.d.ts.map +1 -0
- package/dist/tui/App.js +224 -0
- package/dist/tui/App.js.map +1 -0
- package/dist/tui/components/BootSequence.d.ts +6 -0
- package/dist/tui/components/BootSequence.d.ts.map +1 -0
- package/dist/tui/components/BootSequence.js +40 -0
- package/dist/tui/components/BootSequence.js.map +1 -0
- package/dist/tui/components/BorderedSection.d.ts +12 -0
- package/dist/tui/components/BorderedSection.d.ts.map +1 -0
- package/dist/tui/components/BorderedSection.js +7 -0
- package/dist/tui/components/BorderedSection.js.map +1 -0
- package/dist/tui/components/ErrorBoundary.d.ts +18 -0
- package/dist/tui/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/tui/components/ErrorBoundary.js +36 -0
- package/dist/tui/components/ErrorBoundary.js.map +1 -0
- package/dist/tui/components/FirstUseHint.d.ts +7 -0
- package/dist/tui/components/FirstUseHint.d.ts.map +1 -0
- package/dist/tui/components/FirstUseHint.js +20 -0
- package/dist/tui/components/FirstUseHint.js.map +1 -0
- package/dist/tui/components/Footer.d.ts +10 -0
- package/dist/tui/components/Footer.d.ts.map +1 -0
- package/dist/tui/components/Footer.js +51 -0
- package/dist/tui/components/Footer.js.map +1 -0
- package/dist/tui/components/MetricCard.d.ts +11 -0
- package/dist/tui/components/MetricCard.d.ts.map +1 -0
- package/dist/tui/components/MetricCard.js +8 -0
- package/dist/tui/components/MetricCard.js.map +1 -0
- package/dist/tui/components/Panel.d.ts +15 -0
- package/dist/tui/components/Panel.d.ts.map +1 -0
- package/dist/tui/components/Panel.js +25 -0
- package/dist/tui/components/Panel.js.map +1 -0
- package/dist/tui/components/RemediationMenu.d.ts +10 -0
- package/dist/tui/components/RemediationMenu.d.ts.map +1 -0
- package/dist/tui/components/RemediationMenu.js +84 -0
- package/dist/tui/components/RemediationMenu.js.map +1 -0
- package/dist/tui/components/RiskGauge.d.ts +7 -0
- package/dist/tui/components/RiskGauge.d.ts.map +1 -0
- package/dist/tui/components/RiskGauge.js +55 -0
- package/dist/tui/components/RiskGauge.js.map +1 -0
- package/dist/tui/components/ScrollableList.d.ts +11 -0
- package/dist/tui/components/ScrollableList.d.ts.map +1 -0
- package/dist/tui/components/ScrollableList.js +14 -0
- package/dist/tui/components/ScrollableList.js.map +1 -0
- package/dist/tui/components/Section.d.ts +9 -0
- package/dist/tui/components/Section.d.ts.map +1 -0
- package/dist/tui/components/Section.js +7 -0
- package/dist/tui/components/Section.js.map +1 -0
- package/dist/tui/components/SectionHeader.d.ts +8 -0
- package/dist/tui/components/SectionHeader.d.ts.map +1 -0
- package/dist/tui/components/SectionHeader.js +15 -0
- package/dist/tui/components/SectionHeader.js.map +1 -0
- package/dist/tui/components/SeverityBadge.d.ts +5 -0
- package/dist/tui/components/SeverityBadge.d.ts.map +1 -0
- package/dist/tui/components/SeverityBadge.js +7 -0
- package/dist/tui/components/SeverityBadge.js.map +1 -0
- package/dist/tui/components/Sidebar.d.ts +2 -0
- package/dist/tui/components/Sidebar.d.ts.map +1 -0
- package/dist/tui/components/Sidebar.js +40 -0
- package/dist/tui/components/Sidebar.js.map +1 -0
- package/dist/tui/components/StatusIndicator.d.ts +8 -0
- package/dist/tui/components/StatusIndicator.d.ts.map +1 -0
- package/dist/tui/components/StatusIndicator.js +15 -0
- package/dist/tui/components/StatusIndicator.js.map +1 -0
- package/dist/tui/components/Table.d.ts +21 -0
- package/dist/tui/components/Table.d.ts.map +1 -0
- package/dist/tui/components/Table.js +38 -0
- package/dist/tui/components/Table.js.map +1 -0
- package/dist/tui/components/Transition.d.ts +8 -0
- package/dist/tui/components/Transition.d.ts.map +1 -0
- package/dist/tui/components/Transition.js +38 -0
- package/dist/tui/components/Transition.js.map +1 -0
- package/dist/tui/components/WelcomeScreen.d.ts +6 -0
- package/dist/tui/components/WelcomeScreen.d.ts.map +1 -0
- package/dist/tui/components/WelcomeScreen.js +14 -0
- package/dist/tui/components/WelcomeScreen.js.map +1 -0
- package/dist/tui/educational.d.ts +32 -0
- package/dist/tui/educational.d.ts.map +1 -0
- package/dist/tui/educational.js +117 -0
- package/dist/tui/educational.js.map +1 -0
- package/dist/tui/hooks/useAudit.d.ts +24 -0
- package/dist/tui/hooks/useAudit.d.ts.map +1 -0
- package/dist/tui/hooks/useAudit.js +263 -0
- package/dist/tui/hooks/useAudit.js.map +1 -0
- package/dist/tui/hooks/useConfig.d.ts +18 -0
- package/dist/tui/hooks/useConfig.d.ts.map +1 -0
- package/dist/tui/hooks/useConfig.js +85 -0
- package/dist/tui/hooks/useConfig.js.map +1 -0
- package/dist/tui/hooks/useHookStatus.d.ts +10 -0
- package/dist/tui/hooks/useHookStatus.d.ts.map +1 -0
- package/dist/tui/hooks/useHookStatus.js +59 -0
- package/dist/tui/hooks/useHookStatus.js.map +1 -0
- package/dist/tui/hooks/useLogs.d.ts +42 -0
- package/dist/tui/hooks/useLogs.d.ts.map +1 -0
- package/dist/tui/hooks/useLogs.js +105 -0
- package/dist/tui/hooks/useLogs.js.map +1 -0
- package/dist/tui/hooks/useScan.d.ts +39 -0
- package/dist/tui/hooks/useScan.d.ts.map +1 -0
- package/dist/tui/hooks/useScan.js +255 -0
- package/dist/tui/hooks/useScan.js.map +1 -0
- package/dist/tui/hooks/useTerminalSize.d.ts +10 -0
- package/dist/tui/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/tui/hooks/useTerminalSize.js +27 -0
- package/dist/tui/hooks/useTerminalSize.js.map +1 -0
- package/dist/tui/index.d.ts +2 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/screens/AuditPanel.d.ts +7 -0
- package/dist/tui/screens/AuditPanel.d.ts.map +1 -0
- package/dist/tui/screens/AuditPanel.js +467 -0
- package/dist/tui/screens/AuditPanel.js.map +1 -0
- package/dist/tui/screens/LogsPanel.d.ts +2 -0
- package/dist/tui/screens/LogsPanel.d.ts.map +1 -0
- package/dist/tui/screens/LogsPanel.js +127 -0
- package/dist/tui/screens/LogsPanel.js.map +1 -0
- package/dist/tui/screens/OverviewPanel.d.ts +2 -0
- package/dist/tui/screens/OverviewPanel.d.ts.map +1 -0
- package/dist/tui/screens/OverviewPanel.js +84 -0
- package/dist/tui/screens/OverviewPanel.js.map +1 -0
- package/dist/tui/screens/ScanPanel.d.ts +2 -0
- package/dist/tui/screens/ScanPanel.d.ts.map +1 -0
- package/dist/tui/screens/ScanPanel.js +188 -0
- package/dist/tui/screens/ScanPanel.js.map +1 -0
- package/dist/tui/screens/ScanResultsPanel.d.ts +2 -0
- package/dist/tui/screens/ScanResultsPanel.d.ts.map +1 -0
- package/dist/tui/screens/ScanResultsPanel.js +394 -0
- package/dist/tui/screens/ScanResultsPanel.js.map +1 -0
- package/dist/tui/screens/SettingsPanel.d.ts +2 -0
- package/dist/tui/screens/SettingsPanel.d.ts.map +1 -0
- package/dist/tui/screens/SettingsPanel.js +353 -0
- package/dist/tui/screens/SettingsPanel.js.map +1 -0
- package/dist/tui/state.d.ts +35 -0
- package/dist/tui/state.d.ts.map +1 -0
- package/dist/tui/state.js +13 -0
- package/dist/tui/state.js.map +1 -0
- package/dist/tui/theme.d.ts +58 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +80 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/hooks/audit-logger.sh +74 -0
- package/hooks/detection-lib.sh +301 -0
- package/hooks/git-pre-commit.sh +195 -0
- package/hooks/git-pre-push.sh +125 -0
- package/hooks/git-safety.sh +152 -0
- package/hooks/security-scanner.sh +527 -0
- package/install.sh +543 -0
- package/package.json +67 -0
- package/patterns/credentials.yaml +317 -0
- package/patterns/dangerous-commands.yaml +167 -0
- package/patterns/pii.yaml +95 -0
- package/patterns/prompt-injection.yaml +131 -0
- package/patterns/supply-chain.yaml +119 -0
- package/rules/AGENTS.md +60 -0
- package/rules/SECURITY-RULES.md +177 -0
- package/rules/claude.md +9 -0
- package/rules/clinerules +29 -0
- package/rules/continuerules +29 -0
- package/rules/copilot-instructions.md +9 -0
- package/rules/cursor-security.mdc +14 -0
- package/rules/gemini.md +9 -0
- package/rules/kiro-security.md +29 -0
- package/rules/roocode-security.md +29 -0
- package/rules/trae-security.md +29 -0
- package/rules/windsurfrules +9 -0
- package/skill/llm-antivirus/SKILL.md +73 -0
- package/skill/llm-antivirus/references/threat-patterns.yaml +82 -0
- package/skill/llm-antivirus/scripts/security-audit.sh +244 -0
- package/uninstall.sh +215 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# ChainWall — Prompt Injection Detection Patterns
|
|
2
|
+
#
|
|
3
|
+
# Layer 6 patterns for detecting prompt injection, jailbreak attempts,
|
|
4
|
+
# system prompt disclosure, and role confusion attacks.
|
|
5
|
+
# Reference database. Consumed by security-audit.sh for project scanning.
|
|
6
|
+
# Critical patterns are hardcoded in hooks for real-time enforcement.
|
|
7
|
+
#
|
|
8
|
+
# These are WARNING-ONLY (never block) due to high false-positive risk.
|
|
9
|
+
#
|
|
10
|
+
# Fields:
|
|
11
|
+
# name: Human-readable pattern name
|
|
12
|
+
# regex: POSIX ERE with `(?i)` prefix convention (stripped by scanner, replaced with -i flag)
|
|
13
|
+
# severity: medium | low
|
|
14
|
+
# description: What attack vector this detects
|
|
15
|
+
# action: warn (never block)
|
|
16
|
+
|
|
17
|
+
patterns:
|
|
18
|
+
|
|
19
|
+
# ── Instruction Override ─────────────────────────────────────────────
|
|
20
|
+
- name: Ignore Previous Instructions
|
|
21
|
+
regex: "(?i)ignore\\s+(all\\s+)?previous\\s+instructions"
|
|
22
|
+
severity: medium
|
|
23
|
+
description: "Attempts to override prior system/user instructions"
|
|
24
|
+
action: warn
|
|
25
|
+
|
|
26
|
+
- name: Disregard Prior Instructions
|
|
27
|
+
regex: "(?i)disregard\\s+(all\\s+)?prior|disregard\\s+previous"
|
|
28
|
+
severity: medium
|
|
29
|
+
description: "Attempts to nullify previously given instructions"
|
|
30
|
+
action: warn
|
|
31
|
+
|
|
32
|
+
- name: Forget Instructions
|
|
33
|
+
regex: "(?i)forget\\s+(all|your|previous|prior)\\s+(instructions|rules|constraints)"
|
|
34
|
+
severity: medium
|
|
35
|
+
description: "Attempts to make the model forget its instructions"
|
|
36
|
+
action: warn
|
|
37
|
+
|
|
38
|
+
- name: New Instructions Override
|
|
39
|
+
regex: "(?i)(new|updated|revised)\\s+instructions?:?\\s+(you|from now)"
|
|
40
|
+
severity: medium
|
|
41
|
+
description: "Claims to provide replacement instructions"
|
|
42
|
+
action: warn
|
|
43
|
+
|
|
44
|
+
# ── Role Confusion / Impersonation ───────────────────────────────────
|
|
45
|
+
- name: Role Assumption
|
|
46
|
+
regex: "(?i)(i am|acting as|my role is)\\s*.*(system|admin|root|developer mode|superuser)"
|
|
47
|
+
severity: medium
|
|
48
|
+
description: "Claims privileged identity to manipulate agent behavior"
|
|
49
|
+
action: warn
|
|
50
|
+
|
|
51
|
+
- name: Authority Claim
|
|
52
|
+
regex: "(?i)(authorized|permission|clearance)\\s+to\\s+(access|bypass|override|disable)"
|
|
53
|
+
severity: medium
|
|
54
|
+
description: "Claims special authorization to bypass restrictions"
|
|
55
|
+
action: warn
|
|
56
|
+
|
|
57
|
+
- name: Admin Override
|
|
58
|
+
regex: "(?i)admin\\s+override|maintenance\\s+mode|debug\\s+mode\\s+enabled"
|
|
59
|
+
severity: medium
|
|
60
|
+
description: "Claims special operational mode to change behavior"
|
|
61
|
+
action: warn
|
|
62
|
+
|
|
63
|
+
# ── System Prompt Extraction ─────────────────────────────────────────
|
|
64
|
+
- name: System Prompt Disclosure
|
|
65
|
+
regex: "(?i)(reveal|show|print|display|output|repeat)\\s+(your|the|system)\\s+(prompt|instructions|rules)"
|
|
66
|
+
severity: medium
|
|
67
|
+
description: "Attempts to extract the system prompt or instructions"
|
|
68
|
+
action: warn
|
|
69
|
+
|
|
70
|
+
- name: Prompt Fragments
|
|
71
|
+
regex: "(?i)(you are a helpful|your instructions are|your system prompt)"
|
|
72
|
+
severity: medium
|
|
73
|
+
description: "Contains fragments suggesting system prompt leakage"
|
|
74
|
+
action: warn
|
|
75
|
+
|
|
76
|
+
- name: Instruction Reflection
|
|
77
|
+
regex: "(?i)(what are your|tell me your|list your)\\s+(instructions|rules|constraints|guidelines)"
|
|
78
|
+
severity: medium
|
|
79
|
+
description: "Asks the model to reflect on its own instructions"
|
|
80
|
+
action: warn
|
|
81
|
+
|
|
82
|
+
# ── Jailbreak Attempts ──────────────────────────────────────────────
|
|
83
|
+
- name: DAN/Jailbreak Keywords
|
|
84
|
+
regex: "(?i)(developer mode|jailbreak|dan mode|dude mode|chaos mode)"
|
|
85
|
+
severity: medium
|
|
86
|
+
description: "Uses known jailbreak persona or mode names"
|
|
87
|
+
action: warn
|
|
88
|
+
|
|
89
|
+
- name: Do Anything Now
|
|
90
|
+
regex: "(?i)do anything now|no restrictions|without (any )?(restrictions|limitations|filters)"
|
|
91
|
+
severity: medium
|
|
92
|
+
description: "Attempts to remove model safety constraints"
|
|
93
|
+
action: warn
|
|
94
|
+
|
|
95
|
+
- name: Hypothetical Bypass
|
|
96
|
+
regex: "(?i)(pretend|imagine|hypothetically|in a fictional|roleplay).*(no (rules|restrictions|limits)|anything goes)"
|
|
97
|
+
severity: medium
|
|
98
|
+
description: "Uses hypothetical framing to bypass safety measures"
|
|
99
|
+
action: warn
|
|
100
|
+
|
|
101
|
+
# ── Encoded/Obfuscated Injection ─────────────────────────────────────
|
|
102
|
+
- name: Base64 Instruction
|
|
103
|
+
regex: "(?i)(decode|base64|b64)\\s+(this|the following|and follow|instructions)"
|
|
104
|
+
severity: medium
|
|
105
|
+
description: "Attempts to pass encoded instructions"
|
|
106
|
+
action: warn
|
|
107
|
+
|
|
108
|
+
- name: Markdown/Code Block Injection
|
|
109
|
+
regex: "(?i)```\\s*(system|instructions|prompt)"
|
|
110
|
+
severity: low
|
|
111
|
+
description: "Attempts to inject instructions via code block formatting"
|
|
112
|
+
action: warn
|
|
113
|
+
|
|
114
|
+
# ── Output Manipulation ──────────────────────────────────────────────
|
|
115
|
+
- name: Output Suppression
|
|
116
|
+
regex: "(?i)do not (mention|reveal|tell|say|output|show).*(blocked|detected|security|antivirus|hook)"
|
|
117
|
+
severity: medium
|
|
118
|
+
description: "Attempts to suppress security detection output"
|
|
119
|
+
action: warn
|
|
120
|
+
|
|
121
|
+
- name: Response Formatting Attack
|
|
122
|
+
regex: "(?i)(respond only with|your response must be|output exactly|say only)"
|
|
123
|
+
severity: low
|
|
124
|
+
description: "Attempts to control model output format for injection"
|
|
125
|
+
action: warn
|
|
126
|
+
|
|
127
|
+
- name: Output Suppression Override
|
|
128
|
+
regex: "(?i)do not (output|print|show|display).*previous"
|
|
129
|
+
severity: medium
|
|
130
|
+
description: "Attempts to suppress display of previous context or instructions"
|
|
131
|
+
action: warn
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# ChainWall — Supply Chain Attack Detection Patterns
|
|
2
|
+
#
|
|
3
|
+
# Patterns for detecting supply chain compromise vectors that AI agents
|
|
4
|
+
# might introduce: typosquatting packages, suspicious install scripts,
|
|
5
|
+
# dependency confusion, and post-install exploitation.
|
|
6
|
+
# Reference database. Consumed by security-audit.sh for project scanning.
|
|
7
|
+
# Critical patterns are hardcoded in hooks for real-time enforcement.
|
|
8
|
+
#
|
|
9
|
+
# Fields:
|
|
10
|
+
# name: Human-readable pattern name
|
|
11
|
+
# regex: POSIX ERE with `(?i)` prefix convention (stripped by scanner, replaced with -i flag)
|
|
12
|
+
# severity: critical | high | medium
|
|
13
|
+
# description: What supply chain vector this detects
|
|
14
|
+
# scope: command | content | both
|
|
15
|
+
|
|
16
|
+
patterns:
|
|
17
|
+
|
|
18
|
+
# ── Suspicious Package Installation ──────────────────────────────────
|
|
19
|
+
|
|
20
|
+
- name: pip Install from URL
|
|
21
|
+
regex: "pip3?\\s+install\\s+https?://"
|
|
22
|
+
severity: high
|
|
23
|
+
description: "Installs Python package from arbitrary URL — bypass PyPI vetting"
|
|
24
|
+
scope: command
|
|
25
|
+
|
|
26
|
+
- name: pip Install Trusted Host
|
|
27
|
+
regex: "pip3?\\s+install.*--trusted-host"
|
|
28
|
+
severity: high
|
|
29
|
+
description: "Installs Python package with TLS verification disabled"
|
|
30
|
+
scope: command
|
|
31
|
+
|
|
32
|
+
- name: npm Registry Override
|
|
33
|
+
regex: "npm\\s+(config\\s+set|install).*registry\\s*="
|
|
34
|
+
severity: high
|
|
35
|
+
description: "Overrides npm registry — potential dependency confusion"
|
|
36
|
+
scope: command
|
|
37
|
+
|
|
38
|
+
- name: Gem Install from Source
|
|
39
|
+
regex: "gem\\s+install.*--source\\s+https?://"
|
|
40
|
+
severity: high
|
|
41
|
+
description: "Installs Ruby gem from custom source"
|
|
42
|
+
scope: command
|
|
43
|
+
|
|
44
|
+
# ── Post-Install Scripts ─────────────────────────────────────────────
|
|
45
|
+
- name: Package.json Lifecycle Script with Network
|
|
46
|
+
regex: "\"(preinstall|postinstall|prepare)\":\\s*\".*curl|\"(preinstall|postinstall|prepare)\":\\s*\".*wget"
|
|
47
|
+
severity: critical
|
|
48
|
+
description: "Package lifecycle script makes network requests — exfiltration vector"
|
|
49
|
+
scope: content
|
|
50
|
+
|
|
51
|
+
- name: Package.json Lifecycle Script with Eval
|
|
52
|
+
regex: "\"(preinstall|postinstall|prepare)\":\\s*\".*eval|\"(preinstall|postinstall|prepare)\":\\s*\".*node -e"
|
|
53
|
+
severity: critical
|
|
54
|
+
description: "Package lifecycle script evaluates dynamic code"
|
|
55
|
+
scope: content
|
|
56
|
+
|
|
57
|
+
- name: Setup.py OS Command
|
|
58
|
+
regex: "os\\.system\\(|subprocess\\.call\\(|subprocess\\.run\\(|subprocess\\.Popen\\("
|
|
59
|
+
severity: medium
|
|
60
|
+
description: "Python setup.py executes system commands — common in malicious packages"
|
|
61
|
+
scope: content
|
|
62
|
+
|
|
63
|
+
# ── Dependency Manipulation ──────────────────────────────────────────
|
|
64
|
+
- name: Git Dependency with Commit Hash
|
|
65
|
+
regex: "\"git\\+https?://.*#[a-f0-9]{40}\""
|
|
66
|
+
severity: medium
|
|
67
|
+
description: "Git dependency pinned to specific commit — verify source legitimacy"
|
|
68
|
+
scope: content
|
|
69
|
+
|
|
70
|
+
- name: Private Registry in Lockfile
|
|
71
|
+
regex: "resolved.*https?://(?!registry\\.(npmjs\\.org|yarnpkg\\.com))"
|
|
72
|
+
severity: medium
|
|
73
|
+
description: "Package resolved from non-standard registry in lockfile"
|
|
74
|
+
scope: content
|
|
75
|
+
|
|
76
|
+
- name: NPM Scope Confusion
|
|
77
|
+
regex: "\"@[a-z]+/[a-z]+-[a-z]+\":\\s*\"[*~^]"
|
|
78
|
+
severity: low
|
|
79
|
+
description: "Scoped package with loose version — verify scope ownership"
|
|
80
|
+
scope: content
|
|
81
|
+
|
|
82
|
+
# ── Binary/Native Modules ────────────────────────────────────────────
|
|
83
|
+
- name: Native Module Prebuild Download
|
|
84
|
+
regex: "(prebuild-install|node-pre-gyp|node-gyp)\\s+(install|rebuild)"
|
|
85
|
+
severity: medium
|
|
86
|
+
description: "Downloads prebuilt native binaries — verify binary integrity"
|
|
87
|
+
scope: command
|
|
88
|
+
|
|
89
|
+
# ── Lock File Manipulation ───────────────────────────────────────────
|
|
90
|
+
- name: Lock File Deletion
|
|
91
|
+
regex: "rm\\s+(-f\\s+)?(package-lock\\.json|yarn\\.lock|pnpm-lock\\.yaml|Gemfile\\.lock|poetry\\.lock)"
|
|
92
|
+
severity: high
|
|
93
|
+
description: "Deletes dependency lock file — allows dependency substitution"
|
|
94
|
+
scope: command
|
|
95
|
+
|
|
96
|
+
- name: Lock File Git Checkout
|
|
97
|
+
regex: "git\\s+checkout\\s+--\\s+(package-lock\\.json|yarn\\.lock|pnpm-lock\\.yaml)"
|
|
98
|
+
severity: medium
|
|
99
|
+
description: "Reverts lock file to older version — may reintroduce vulnerable dependencies"
|
|
100
|
+
scope: command
|
|
101
|
+
|
|
102
|
+
# ── Container Image Supply Chain ─────────────────────────────────────
|
|
103
|
+
- name: Docker Image Without Tag
|
|
104
|
+
regex: "docker\\s+(pull|run)\\s+[a-z]+/[a-z]+\\s"
|
|
105
|
+
severity: medium
|
|
106
|
+
description: "Pulls Docker image without explicit tag — defaults to :latest, mutable reference"
|
|
107
|
+
scope: command
|
|
108
|
+
|
|
109
|
+
- name: Docker Image from Unknown Registry
|
|
110
|
+
regex: "docker\\s+(pull|run)\\s+[a-z]+\\.[a-z]+\\.[a-z]+/"
|
|
111
|
+
severity: medium
|
|
112
|
+
description: "Pulls Docker image from non-standard registry"
|
|
113
|
+
scope: command
|
|
114
|
+
|
|
115
|
+
- name: Dependency Confusion
|
|
116
|
+
regex: "--extra-index-url"
|
|
117
|
+
severity: high
|
|
118
|
+
description: "Adds extra PyPI index — dependency confusion attack vector"
|
|
119
|
+
scope: command
|
package/rules/AGENTS.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Security Rules for AI Coding Agents
|
|
2
|
+
|
|
3
|
+
These rules are enforced by ChainWall hooks and apply to all AI agents
|
|
4
|
+
operating in this repository. Violations are blocked or logged automatically.
|
|
5
|
+
|
|
6
|
+
## NEVER (Blocking — agent will be stopped)
|
|
7
|
+
|
|
8
|
+
1. **NEVER write credentials** — No API keys, tokens, passwords, or secrets in
|
|
9
|
+
code, configs, or commands. Use environment variables or secret managers.
|
|
10
|
+
2. **NEVER access sensitive files** — Do not read/write `.env`, `credentials.json`,
|
|
11
|
+
`secrets.json`, SSH private keys (`id_rsa`, `id_dsa`, `id_ed25519`), `.npmrc`,
|
|
12
|
+
or `.pypirc`.
|
|
13
|
+
3. **NEVER run destructive commands** — No `rm -rf`, `mkfs`, `dd of=/dev/*`,
|
|
14
|
+
`chmod 777`, or redirect to block devices.
|
|
15
|
+
4. **NEVER pipe downloads to shell** — No `curl|bash`, `wget|sh`, or equivalent
|
|
16
|
+
remote code execution patterns.
|
|
17
|
+
5. **NEVER expose PII** — No Social Security numbers, credit card numbers, bank
|
|
18
|
+
account numbers, or medical record identifiers in outputs.
|
|
19
|
+
6. **NEVER write private keys** — No PEM-format private keys (RSA, DSA, EC,
|
|
20
|
+
OpenSSH, PGP) in any file or command.
|
|
21
|
+
7. **NEVER force-push to main** — No `git push --force` to main/master branches.
|
|
22
|
+
No `git reset --hard` on shared branches.
|
|
23
|
+
8. **NEVER install unverified packages** — No packages from arbitrary URLs, no
|
|
24
|
+
registry overrides, no lifecycle scripts with network calls.
|
|
25
|
+
|
|
26
|
+
## ALWAYS (Guidance — high compliance expected)
|
|
27
|
+
|
|
28
|
+
1. **ALWAYS use environment variables** for secrets — reference `process.env.*`,
|
|
29
|
+
`os.environ`, or equivalent instead of literal values.
|
|
30
|
+
2. **ALWAYS validate inputs** at system boundaries — sanitize user input, API
|
|
31
|
+
responses, and file contents before processing.
|
|
32
|
+
3. **ALWAYS use parameterized queries** — never concatenate user input into SQL,
|
|
33
|
+
shell commands, or template strings.
|
|
34
|
+
4. **ALWAYS pin dependency versions** — use exact versions or lock files, never
|
|
35
|
+
`*` or unpinned ranges for production dependencies.
|
|
36
|
+
5. **ALWAYS check file paths** — validate that file operations target expected
|
|
37
|
+
directories, prevent path traversal (`../`).
|
|
38
|
+
6. **ALWAYS use HTTPS** — no plaintext HTTP for API calls, package downloads,
|
|
39
|
+
or webhook endpoints.
|
|
40
|
+
7. **ALWAYS preserve lock files** — do not delete `package-lock.json`,
|
|
41
|
+
`yarn.lock`, `poetry.lock`, or `Gemfile.lock`.
|
|
42
|
+
8. **ALWAYS review before committing** — verify no secrets, PII, or debug
|
|
43
|
+
artifacts are included in staged changes.
|
|
44
|
+
|
|
45
|
+
## Severity Reference
|
|
46
|
+
|
|
47
|
+
| Severity | Action | Examples |
|
|
48
|
+
|----------|--------|---------|
|
|
49
|
+
| CRITICAL | Blocked | Credentials, private keys, rm -rf, reverse shells |
|
|
50
|
+
| HIGH | Blocked | PII, chmod 777, force-push, curl\|bash |
|
|
51
|
+
| MEDIUM | Warning | Prompt injection, jailbreak attempts, loose deps |
|
|
52
|
+
| LOW | Logged | Informational patterns, style suggestions |
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
Override paths: `~/.llm-av/config.json` (global), `.llm-av/config.json` (project)
|
|
57
|
+
Escape hatch: `LLMAV_SKIP=1` (logged, use sparingly)
|
|
58
|
+
Audit trail: `.llm-av/audit.jsonl`
|
|
59
|
+
|
|
60
|
+
Full reference: See SECURITY-RULES.md in the ChainWall repository
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# ChainWall Security Rules — Comprehensive Reference
|
|
2
|
+
|
|
3
|
+
This document provides detailed explanations of all security rules, their
|
|
4
|
+
rationale, OWASP LLM Top 10 mapping, and configuration guidance.
|
|
5
|
+
|
|
6
|
+
For the concise version read by AI agents, see [AGENTS.md](./AGENTS.md).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Architecture Overview
|
|
11
|
+
|
|
12
|
+
ChainWall enforces security through four layers:
|
|
13
|
+
|
|
14
|
+
| Layer | Mechanism | Enforcement |
|
|
15
|
+
|-------|-----------|-------------|
|
|
16
|
+
| 1. Hooks | Bash scripts on PreToolUse/PostToolUse | Deterministic, <50ms |
|
|
17
|
+
| 2. Instruction Files | AGENTS.md, CLAUDE.md, platform rules | Probabilistic, high compliance |
|
|
18
|
+
| 3. Skills | On-demand security auditing | User-invoked |
|
|
19
|
+
| 4. Installer | One-command setup | Zero-config |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Detection Layers
|
|
24
|
+
|
|
25
|
+
### Layer 1: File Blocklist
|
|
26
|
+
|
|
27
|
+
**Blocked filenames** (basename matching):
|
|
28
|
+
- `.env`, `.env.local`, `.env.production`, `.env.development`
|
|
29
|
+
- `credentials`, `credentials.json`, `secrets.json`
|
|
30
|
+
- `id_rsa`, `id_dsa`, `id_ed25519`
|
|
31
|
+
- `.npmrc`, `.pypirc`
|
|
32
|
+
|
|
33
|
+
**Not blocked** (safe patterns):
|
|
34
|
+
- `.env.example`, `.env.template`, `.env.sample`
|
|
35
|
+
- `id_rsa.pub`, `id_ed25519.pub` (public keys)
|
|
36
|
+
- `credentials-validator.ts` (different basename)
|
|
37
|
+
|
|
38
|
+
**Rationale:** These files commonly contain secrets that should never be
|
|
39
|
+
read or modified by an AI agent. The blocklist uses basename matching
|
|
40
|
+
to avoid false positives from path segments.
|
|
41
|
+
|
|
42
|
+
### Layer 2: Credential Detection
|
|
43
|
+
|
|
44
|
+
55 patterns across major providers. See `patterns/credentials.yaml` for
|
|
45
|
+
the full database. Key categories:
|
|
46
|
+
|
|
47
|
+
| Category | Patterns | Examples |
|
|
48
|
+
|----------|----------|---------|
|
|
49
|
+
| Cloud Providers | AWS, GCP, Azure | `AKIA*`, `AIza*`, `AccountKey=*` |
|
|
50
|
+
| Source Control | GitHub, GitLab | `ghp_*`, `glpat-*` |
|
|
51
|
+
| Communication | Slack, Twilio, SendGrid | `xox[pboa]-*`, `SK*`, `SG.*` |
|
|
52
|
+
| Payment | Stripe | `sk_live_*`, `sk_test_*` |
|
|
53
|
+
| AI Platforms | OpenAI, Anthropic | `sk-*` (48 chars), `sk-ant-*` |
|
|
54
|
+
| Package Registries | npm, PyPI, Docker | `npm_*`, `pypi-*`, `dckr_pat_*` |
|
|
55
|
+
| Infrastructure | Vault, Heroku, Vercel | `hvs.*`, Heroku UUID |
|
|
56
|
+
| Generic | JWT, Bearer, passwords | `eyJ*.*.*`, `Bearer *` |
|
|
57
|
+
|
|
58
|
+
### Layer 3: Private Key Detection
|
|
59
|
+
|
|
60
|
+
Detects PEM-format key headers using string matching:
|
|
61
|
+
- `-----BEGIN RSA PRIVATE KEY-----`
|
|
62
|
+
- `-----BEGIN DSA PRIVATE KEY-----`
|
|
63
|
+
- `-----BEGIN EC PRIVATE KEY-----`
|
|
64
|
+
- `-----BEGIN OPENSSH PRIVATE KEY-----`
|
|
65
|
+
- `-----BEGIN PGP PRIVATE KEY BLOCK-----`
|
|
66
|
+
|
|
67
|
+
**Not detected** (by design):
|
|
68
|
+
- Public keys (`-----BEGIN PUBLIC KEY-----`)
|
|
69
|
+
- Certificates (`-----BEGIN CERTIFICATE-----`)
|
|
70
|
+
- Encrypted private keys (`-----BEGIN ENCRYPTED PRIVATE KEY-----`)
|
|
71
|
+
|
|
72
|
+
### Layer 4: Dangerous Commands
|
|
73
|
+
|
|
74
|
+
24 patterns across categories. See `patterns/dangerous-commands.yaml`.
|
|
75
|
+
|
|
76
|
+
| Category | Risk | Examples |
|
|
77
|
+
|----------|------|---------|
|
|
78
|
+
| Destructive | Data loss | `rm -rf`, `shred`, `mkfs` |
|
|
79
|
+
| Remote Execution | Code injection | `curl\|bash`, `eval $VAR`, base64 decode |
|
|
80
|
+
| Permissions | Privilege escalation | `chmod 777`, SUID bit |
|
|
81
|
+
| Network | Exfiltration | Reverse shell, netcat, SSH tunnels |
|
|
82
|
+
| Persistence | Backdoors | Crontab, systemd service install |
|
|
83
|
+
| Anti-forensics | Evidence destruction | History deletion, log tampering |
|
|
84
|
+
|
|
85
|
+
### Layer 5: PII Detection
|
|
86
|
+
|
|
87
|
+
15 patterns with validation. See `patterns/pii.yaml`.
|
|
88
|
+
|
|
89
|
+
**SSN validation logic:**
|
|
90
|
+
1. Match `XXX-XX-XXXX` format
|
|
91
|
+
2. Extract first group (XXX)
|
|
92
|
+
3. Reject if first group is `000` (invalid per SSA)
|
|
93
|
+
4. Reject if first group is `666` (never issued)
|
|
94
|
+
5. Reject if first group is `900-999` (ITIN range)
|
|
95
|
+
|
|
96
|
+
### Layer 6: Prompt Injection (Warning Only)
|
|
97
|
+
|
|
98
|
+
18 patterns, never blocks. See `patterns/prompt-injection.yaml`.
|
|
99
|
+
|
|
100
|
+
Categories: instruction override, role confusion, system prompt extraction,
|
|
101
|
+
jailbreak keywords, encoded injection, output manipulation.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## OWASP LLM Top 10 Mapping
|
|
106
|
+
|
|
107
|
+
| OWASP ID | Vulnerability | Coverage |
|
|
108
|
+
|----------|---------------|----------|
|
|
109
|
+
| LLM01 | Prompt Injection | Layer 6 (warn), instruction files |
|
|
110
|
+
| LLM02 | Insecure Output Handling | Layer 2-3, 5 (credential/PII in output) |
|
|
111
|
+
| LLM06 | Sensitive Information Disclosure | Layers 1-3, 5 (file, credential, key, PII) |
|
|
112
|
+
| LLM07 | System Prompt Leakage | Layer 6 (disclosure markers) |
|
|
113
|
+
| LLM08 | Excessive Agency | Layer 4 (dangerous commands) |
|
|
114
|
+
| LLM09 | Overreliance | Instruction files (ALWAYS rules) |
|
|
115
|
+
| LLM10 | Model Theft | `patterns/supply-chain.yaml` |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Configuration
|
|
120
|
+
|
|
121
|
+
### Allowlist/Blocklist
|
|
122
|
+
|
|
123
|
+
Configuration files use JSON format with two scopes:
|
|
124
|
+
|
|
125
|
+
**Global** (`~/.llm-av/config.json`) — applies to all projects:
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"allowlist": {
|
|
129
|
+
"paths": ["tests/fixtures/*", "*.test.ts"],
|
|
130
|
+
"patterns": ["test_credential_[a-z]+"]
|
|
131
|
+
},
|
|
132
|
+
"blocklist": {
|
|
133
|
+
"paths": ["production/secrets/*"],
|
|
134
|
+
"patterns": ["CUSTOM_SECRET_[A-Z0-9]+"]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Project** (`.llm-av/config.json`) — extends global settings:
|
|
140
|
+
Same structure. Project settings are additive (they do not override global).
|
|
141
|
+
|
|
142
|
+
### Escape Hatch
|
|
143
|
+
|
|
144
|
+
For testing or emergencies, bypass all checks:
|
|
145
|
+
```bash
|
|
146
|
+
LLMAV_SKIP=1 claude "do something"
|
|
147
|
+
```
|
|
148
|
+
- Bypass is logged to the audit trail
|
|
149
|
+
- Use sparingly — defeats all protection
|
|
150
|
+
|
|
151
|
+
### Audit Trail
|
|
152
|
+
|
|
153
|
+
All blocked operations and warnings are logged to `.llm-av/audit.jsonl`
|
|
154
|
+
in JSON Lines format:
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{"timestamp":"2026-01-30T10:15:30Z","severity":"block","category":"credential","pattern":"AWS Access Key","tool":"Write","content":"AKIA..."}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Log rotation occurs automatically at 10MB.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Limitations
|
|
165
|
+
|
|
166
|
+
1. **Pattern-based** — can be bypassed with obfuscation (e.g., splitting a key
|
|
167
|
+
across multiple variables)
|
|
168
|
+
2. **No semantic analysis** — cannot understand intent, only matches patterns
|
|
169
|
+
3. **False positives** — some legitimate patterns (16-digit order IDs, reference
|
|
170
|
+
numbers with SSN format) will match
|
|
171
|
+
4. **No training-time protection** — does not address model poisoning attacks
|
|
172
|
+
5. **Warning-only prompt injection** — Layer 6 cannot reliably distinguish
|
|
173
|
+
injection from legitimate instructions
|
|
174
|
+
|
|
175
|
+
This tool reduces attack surface but is not a complete security solution.
|
|
176
|
+
Defense in depth (secret scanners, code review, least-privilege access)
|
|
177
|
+
remains essential.
|
package/rules/claude.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Claude Code Security Rules
|
|
2
|
+
|
|
3
|
+
This project uses ChainWall for security enforcement.
|
|
4
|
+
|
|
5
|
+
Read and follow ALL rules in [AGENTS.md](./AGENTS.md) before performing any
|
|
6
|
+
file operations, shell commands, or code generation.
|
|
7
|
+
|
|
8
|
+
Security hooks are active on PreToolUse and PostToolUse — violations will
|
|
9
|
+
be blocked automatically with exit code 2.
|
package/rules/clinerules
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Security Rules — Cline
|
|
2
|
+
|
|
3
|
+
These rules are enforced by ChainWall and apply to all Cline operations.
|
|
4
|
+
|
|
5
|
+
## NEVER
|
|
6
|
+
|
|
7
|
+
- Write credentials, API keys, tokens, or passwords in code or commands
|
|
8
|
+
- Access .env, credentials.json, secrets.json, SSH keys, .npmrc, or .pypirc
|
|
9
|
+
- Run rm -rf, mkfs, dd to devices, chmod 777, or redirect to block devices
|
|
10
|
+
- Pipe downloads to shell (curl|bash, wget|sh)
|
|
11
|
+
- Expose SSNs, credit card numbers, or other PII in outputs
|
|
12
|
+
- Write PEM private keys (RSA, DSA, EC, OpenSSH, PGP) to any file
|
|
13
|
+
- Force-push to main/master or hard-reset shared branches
|
|
14
|
+
- Install packages from arbitrary URLs or override registries
|
|
15
|
+
|
|
16
|
+
## ALWAYS
|
|
17
|
+
|
|
18
|
+
- Use environment variables for secrets
|
|
19
|
+
- Validate inputs at system boundaries
|
|
20
|
+
- Use parameterized queries — never concatenate user input into SQL or shell
|
|
21
|
+
- Pin dependency versions and preserve lock files
|
|
22
|
+
- Check file paths to prevent path traversal
|
|
23
|
+
- Use HTTPS for API calls and package downloads
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
Override: ~/.llm-av/config.json (global), .llm-av/config.json (project)
|
|
28
|
+
Bypass: LLMAV_SKIP=1 (logged)
|
|
29
|
+
Audit: .llm-av/audit.jsonl
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Security Rules — Continue.dev
|
|
2
|
+
|
|
3
|
+
These rules are enforced by ChainWall and apply to all Continue.dev operations.
|
|
4
|
+
|
|
5
|
+
## NEVER
|
|
6
|
+
|
|
7
|
+
- Write credentials, API keys, tokens, or passwords in code or commands
|
|
8
|
+
- Access .env, credentials.json, secrets.json, SSH keys, .npmrc, or .pypirc
|
|
9
|
+
- Run rm -rf, mkfs, dd to devices, chmod 777, or redirect to block devices
|
|
10
|
+
- Pipe downloads to shell (curl|bash, wget|sh)
|
|
11
|
+
- Expose SSNs, credit card numbers, or other PII in outputs
|
|
12
|
+
- Write PEM private keys (RSA, DSA, EC, OpenSSH, PGP) to any file
|
|
13
|
+
- Force-push to main/master or hard-reset shared branches
|
|
14
|
+
- Install packages from arbitrary URLs or override registries
|
|
15
|
+
|
|
16
|
+
## ALWAYS
|
|
17
|
+
|
|
18
|
+
- Use environment variables for secrets
|
|
19
|
+
- Validate inputs at system boundaries
|
|
20
|
+
- Use parameterized queries — never concatenate user input into SQL or shell
|
|
21
|
+
- Pin dependency versions and preserve lock files
|
|
22
|
+
- Check file paths to prevent path traversal
|
|
23
|
+
- Use HTTPS for API calls and package downloads
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
Override: ~/.llm-av/config.json (global), .llm-av/config.json (project)
|
|
28
|
+
Bypass: LLMAV_SKIP=1 (logged)
|
|
29
|
+
Audit: .llm-av/audit.jsonl
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# GitHub Copilot Security Rules
|
|
2
|
+
|
|
3
|
+
This project uses ChainWall for security enforcement.
|
|
4
|
+
|
|
5
|
+
Read and follow ALL rules in AGENTS.md (in the project root) before performing any
|
|
6
|
+
file operations, shell commands, or code generation.
|
|
7
|
+
|
|
8
|
+
Do not write credentials, access sensitive files, run destructive commands,
|
|
9
|
+
or expose PII. See AGENTS.md for the complete rule set.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Security rules for AI-assisted coding in this project
|
|
3
|
+
globs: ["**/*"]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cursor Security Rules
|
|
7
|
+
|
|
8
|
+
This project uses ChainWall for security enforcement.
|
|
9
|
+
|
|
10
|
+
Read and follow ALL rules in `rules/AGENTS.md` before performing any
|
|
11
|
+
file operations, shell commands, or code generation.
|
|
12
|
+
|
|
13
|
+
Do not write credentials, access sensitive files, run destructive commands,
|
|
14
|
+
or expose PII. See AGENTS.md for the complete rule set.
|
package/rules/gemini.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Gemini Security Rules
|
|
2
|
+
|
|
3
|
+
This project uses ChainWall for security enforcement.
|
|
4
|
+
|
|
5
|
+
Read and follow ALL rules in [AGENTS.md](./AGENTS.md) before performing any
|
|
6
|
+
file operations, shell commands, or code generation.
|
|
7
|
+
|
|
8
|
+
Do not write credentials, access sensitive files, run destructive commands,
|
|
9
|
+
or expose PII. See AGENTS.md for the complete rule set.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Security Rules — Kiro
|
|
2
|
+
|
|
3
|
+
These rules are enforced by ChainWall and apply to all Kiro operations.
|
|
4
|
+
|
|
5
|
+
## NEVER
|
|
6
|
+
|
|
7
|
+
- Write credentials, API keys, tokens, or passwords in code or commands
|
|
8
|
+
- Access .env, credentials.json, secrets.json, SSH keys, .npmrc, or .pypirc
|
|
9
|
+
- Run rm -rf, mkfs, dd to devices, chmod 777, or redirect to block devices
|
|
10
|
+
- Pipe downloads to shell (curl|bash, wget|sh)
|
|
11
|
+
- Expose SSNs, credit card numbers, or other PII in outputs
|
|
12
|
+
- Write PEM private keys (RSA, DSA, EC, OpenSSH, PGP) to any file
|
|
13
|
+
- Force-push to main/master or hard-reset shared branches
|
|
14
|
+
- Install packages from arbitrary URLs or override registries
|
|
15
|
+
|
|
16
|
+
## ALWAYS
|
|
17
|
+
|
|
18
|
+
- Use environment variables for secrets
|
|
19
|
+
- Validate inputs at system boundaries
|
|
20
|
+
- Use parameterized queries — never concatenate user input into SQL or shell
|
|
21
|
+
- Pin dependency versions and preserve lock files
|
|
22
|
+
- Check file paths to prevent path traversal
|
|
23
|
+
- Use HTTPS for API calls and package downloads
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
Override: ~/.llm-av/config.json (global), .llm-av/config.json (project)
|
|
28
|
+
Bypass: LLMAV_SKIP=1 (logged)
|
|
29
|
+
Audit: .llm-av/audit.jsonl
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Security Rules — RooCode
|
|
2
|
+
|
|
3
|
+
These rules are enforced by ChainWall and apply to all RooCode operations.
|
|
4
|
+
|
|
5
|
+
## NEVER
|
|
6
|
+
|
|
7
|
+
- Write credentials, API keys, tokens, or passwords in code or commands
|
|
8
|
+
- Access .env, credentials.json, secrets.json, SSH keys, .npmrc, or .pypirc
|
|
9
|
+
- Run rm -rf, mkfs, dd to devices, chmod 777, or redirect to block devices
|
|
10
|
+
- Pipe downloads to shell (curl|bash, wget|sh)
|
|
11
|
+
- Expose SSNs, credit card numbers, or other PII in outputs
|
|
12
|
+
- Write PEM private keys (RSA, DSA, EC, OpenSSH, PGP) to any file
|
|
13
|
+
- Force-push to main/master or hard-reset shared branches
|
|
14
|
+
- Install packages from arbitrary URLs or override registries
|
|
15
|
+
|
|
16
|
+
## ALWAYS
|
|
17
|
+
|
|
18
|
+
- Use environment variables for secrets
|
|
19
|
+
- Validate inputs at system boundaries
|
|
20
|
+
- Use parameterized queries — never concatenate user input into SQL or shell
|
|
21
|
+
- Pin dependency versions and preserve lock files
|
|
22
|
+
- Check file paths to prevent path traversal
|
|
23
|
+
- Use HTTPS for API calls and package downloads
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
Override: ~/.llm-av/config.json (global), .llm-av/config.json (project)
|
|
28
|
+
Bypass: LLMAV_SKIP=1 (logged)
|
|
29
|
+
Audit: .llm-av/audit.jsonl
|