clawsec 0.0.1
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/README.md +560 -0
- package/dist/bin/clawsec.d.ts +7 -0
- package/dist/bin/clawsec.d.ts.map +1 -0
- package/dist/bin/clawsec.js +12 -0
- package/dist/bin/clawsec.js.map +1 -0
- package/dist/src/actions/block.d.ts +22 -0
- package/dist/src/actions/block.d.ts.map +1 -0
- package/dist/src/actions/block.js +83 -0
- package/dist/src/actions/block.js.map +1 -0
- package/dist/src/actions/confirm.d.ts +35 -0
- package/dist/src/actions/confirm.d.ts.map +1 -0
- package/dist/src/actions/confirm.js +156 -0
- package/dist/src/actions/confirm.js.map +1 -0
- package/dist/src/actions/executor.d.ts +64 -0
- package/dist/src/actions/executor.d.ts.map +1 -0
- package/dist/src/actions/executor.js +114 -0
- package/dist/src/actions/executor.js.map +1 -0
- package/dist/src/actions/index.d.ts +13 -0
- package/dist/src/actions/index.d.ts.map +1 -0
- package/dist/src/actions/index.js +15 -0
- package/dist/src/actions/index.js.map +1 -0
- package/dist/src/actions/log.d.ts +19 -0
- package/dist/src/actions/log.d.ts.map +1 -0
- package/dist/src/actions/log.js +63 -0
- package/dist/src/actions/log.js.map +1 -0
- package/dist/src/actions/types.d.ts +85 -0
- package/dist/src/actions/types.d.ts.map +1 -0
- package/dist/src/actions/types.js +78 -0
- package/dist/src/actions/types.js.map +1 -0
- package/dist/src/actions/warn.d.ts +22 -0
- package/dist/src/actions/warn.d.ts.map +1 -0
- package/dist/src/actions/warn.js +84 -0
- package/dist/src/actions/warn.js.map +1 -0
- package/dist/src/approval/agent-confirm.d.ts +104 -0
- package/dist/src/approval/agent-confirm.d.ts.map +1 -0
- package/dist/src/approval/agent-confirm.js +173 -0
- package/dist/src/approval/agent-confirm.js.map +1 -0
- package/dist/src/approval/index.d.ts +14 -0
- package/dist/src/approval/index.d.ts.map +1 -0
- package/dist/src/approval/index.js +9 -0
- package/dist/src/approval/index.js.map +1 -0
- package/dist/src/approval/native.d.ts +56 -0
- package/dist/src/approval/native.d.ts.map +1 -0
- package/dist/src/approval/native.js +196 -0
- package/dist/src/approval/native.js.map +1 -0
- package/dist/src/approval/store.d.ts +88 -0
- package/dist/src/approval/store.d.ts.map +1 -0
- package/dist/src/approval/store.js +192 -0
- package/dist/src/approval/store.js.map +1 -0
- package/dist/src/approval/types.d.ts +119 -0
- package/dist/src/approval/types.d.ts.map +1 -0
- package/dist/src/approval/types.js +6 -0
- package/dist/src/approval/types.js.map +1 -0
- package/dist/src/approval/webhook.d.ts +170 -0
- package/dist/src/approval/webhook.d.ts.map +1 -0
- package/dist/src/approval/webhook.js +362 -0
- package/dist/src/approval/webhook.js.map +1 -0
- package/dist/src/cli/commands/audit.d.ts +43 -0
- package/dist/src/cli/commands/audit.d.ts.map +1 -0
- package/dist/src/cli/commands/audit.js +115 -0
- package/dist/src/cli/commands/audit.js.map +1 -0
- package/dist/src/cli/commands/feedback.d.ts +27 -0
- package/dist/src/cli/commands/feedback.d.ts.map +1 -0
- package/dist/src/cli/commands/feedback.js +228 -0
- package/dist/src/cli/commands/feedback.js.map +1 -0
- package/dist/src/cli/commands/index.d.ts +11 -0
- package/dist/src/cli/commands/index.d.ts.map +1 -0
- package/dist/src/cli/commands/index.js +13 -0
- package/dist/src/cli/commands/index.js.map +1 -0
- package/dist/src/cli/commands/status.d.ts +20 -0
- package/dist/src/cli/commands/status.d.ts.map +1 -0
- package/dist/src/cli/commands/status.js +122 -0
- package/dist/src/cli/commands/status.js.map +1 -0
- package/dist/src/cli/commands/test.d.ts +23 -0
- package/dist/src/cli/commands/test.d.ts.map +1 -0
- package/dist/src/cli/commands/test.js +134 -0
- package/dist/src/cli/commands/test.js.map +1 -0
- package/dist/src/cli/commands/types.d.ts +81 -0
- package/dist/src/cli/commands/types.d.ts.map +1 -0
- package/dist/src/cli/commands/types.js +6 -0
- package/dist/src/cli/commands/types.js.map +1 -0
- package/dist/src/cli/index.d.ts +17 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +267 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/config/defaults.d.ts +20 -0
- package/dist/src/config/defaults.d.ts.map +1 -0
- package/dist/src/config/defaults.js +123 -0
- package/dist/src/config/defaults.js.map +1 -0
- package/dist/src/config/index.d.ts +8 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +41 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/config/loader.d.ts +99 -0
- package/dist/src/config/loader.d.ts.map +1 -0
- package/dist/src/config/loader.js +242 -0
- package/dist/src/config/loader.js.map +1 -0
- package/dist/src/config/schema.d.ts +627 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +585 -0
- package/dist/src/config/schema.js.map +1 -0
- package/dist/src/detectors/destructive/cloud-detector.d.ts +51 -0
- package/dist/src/detectors/destructive/cloud-detector.d.ts.map +1 -0
- package/dist/src/detectors/destructive/cloud-detector.js +556 -0
- package/dist/src/detectors/destructive/cloud-detector.js.map +1 -0
- package/dist/src/detectors/destructive/code-detector.d.ts +59 -0
- package/dist/src/detectors/destructive/code-detector.d.ts.map +1 -0
- package/dist/src/detectors/destructive/code-detector.js +558 -0
- package/dist/src/detectors/destructive/code-detector.js.map +1 -0
- package/dist/src/detectors/destructive/index.d.ts +54 -0
- package/dist/src/detectors/destructive/index.d.ts.map +1 -0
- package/dist/src/detectors/destructive/index.js +168 -0
- package/dist/src/detectors/destructive/index.js.map +1 -0
- package/dist/src/detectors/destructive/shell-detector.d.ts +43 -0
- package/dist/src/detectors/destructive/shell-detector.d.ts.map +1 -0
- package/dist/src/detectors/destructive/shell-detector.js +302 -0
- package/dist/src/detectors/destructive/shell-detector.js.map +1 -0
- package/dist/src/detectors/destructive/types.d.ts +143 -0
- package/dist/src/detectors/destructive/types.d.ts.map +1 -0
- package/dist/src/detectors/destructive/types.js +6 -0
- package/dist/src/detectors/destructive/types.js.map +1 -0
- package/dist/src/detectors/exfiltration/cloud-detector.d.ts +51 -0
- package/dist/src/detectors/exfiltration/cloud-detector.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/cloud-detector.js +427 -0
- package/dist/src/detectors/exfiltration/cloud-detector.js.map +1 -0
- package/dist/src/detectors/exfiltration/http-detector.d.ts +47 -0
- package/dist/src/detectors/exfiltration/http-detector.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/http-detector.js +429 -0
- package/dist/src/detectors/exfiltration/http-detector.js.map +1 -0
- package/dist/src/detectors/exfiltration/index.d.ts +44 -0
- package/dist/src/detectors/exfiltration/index.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/index.js +118 -0
- package/dist/src/detectors/exfiltration/index.js.map +1 -0
- package/dist/src/detectors/exfiltration/network-detector.d.ts +55 -0
- package/dist/src/detectors/exfiltration/network-detector.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/network-detector.js +504 -0
- package/dist/src/detectors/exfiltration/network-detector.js.map +1 -0
- package/dist/src/detectors/exfiltration/types.d.ts +139 -0
- package/dist/src/detectors/exfiltration/types.d.ts.map +1 -0
- package/dist/src/detectors/exfiltration/types.js +6 -0
- package/dist/src/detectors/exfiltration/types.js.map +1 -0
- package/dist/src/detectors/purchase/domain-detector.d.ts +44 -0
- package/dist/src/detectors/purchase/domain-detector.d.ts.map +1 -0
- package/dist/src/detectors/purchase/domain-detector.js +296 -0
- package/dist/src/detectors/purchase/domain-detector.js.map +1 -0
- package/dist/src/detectors/purchase/form-detector.d.ts +27 -0
- package/dist/src/detectors/purchase/form-detector.d.ts.map +1 -0
- package/dist/src/detectors/purchase/form-detector.js +344 -0
- package/dist/src/detectors/purchase/form-detector.js.map +1 -0
- package/dist/src/detectors/purchase/index.d.ts +65 -0
- package/dist/src/detectors/purchase/index.d.ts.map +1 -0
- package/dist/src/detectors/purchase/index.js +216 -0
- package/dist/src/detectors/purchase/index.js.map +1 -0
- package/dist/src/detectors/purchase/spend-tracker.d.ts +132 -0
- package/dist/src/detectors/purchase/spend-tracker.d.ts.map +1 -0
- package/dist/src/detectors/purchase/spend-tracker.js +313 -0
- package/dist/src/detectors/purchase/spend-tracker.js.map +1 -0
- package/dist/src/detectors/purchase/types.d.ts +139 -0
- package/dist/src/detectors/purchase/types.d.ts.map +1 -0
- package/dist/src/detectors/purchase/types.js +6 -0
- package/dist/src/detectors/purchase/types.js.map +1 -0
- package/dist/src/detectors/purchase/url-detector.d.ts +31 -0
- package/dist/src/detectors/purchase/url-detector.d.ts.map +1 -0
- package/dist/src/detectors/purchase/url-detector.js +292 -0
- package/dist/src/detectors/purchase/url-detector.js.map +1 -0
- package/dist/src/detectors/secrets/api-key-detector.d.ts +30 -0
- package/dist/src/detectors/secrets/api-key-detector.d.ts.map +1 -0
- package/dist/src/detectors/secrets/api-key-detector.js +297 -0
- package/dist/src/detectors/secrets/api-key-detector.js.map +1 -0
- package/dist/src/detectors/secrets/index.d.ts +43 -0
- package/dist/src/detectors/secrets/index.d.ts.map +1 -0
- package/dist/src/detectors/secrets/index.js +261 -0
- package/dist/src/detectors/secrets/index.js.map +1 -0
- package/dist/src/detectors/secrets/pii-detector.d.ts +54 -0
- package/dist/src/detectors/secrets/pii-detector.d.ts.map +1 -0
- package/dist/src/detectors/secrets/pii-detector.js +286 -0
- package/dist/src/detectors/secrets/pii-detector.js.map +1 -0
- package/dist/src/detectors/secrets/token-detector.d.ts +51 -0
- package/dist/src/detectors/secrets/token-detector.d.ts.map +1 -0
- package/dist/src/detectors/secrets/token-detector.js +233 -0
- package/dist/src/detectors/secrets/token-detector.js.map +1 -0
- package/dist/src/detectors/secrets/types.d.ts +157 -0
- package/dist/src/detectors/secrets/types.d.ts.map +1 -0
- package/dist/src/detectors/secrets/types.js +6 -0
- package/dist/src/detectors/secrets/types.js.map +1 -0
- package/dist/src/detectors/website/category-detector.d.ts +22 -0
- package/dist/src/detectors/website/category-detector.d.ts.map +1 -0
- package/dist/src/detectors/website/category-detector.js +162 -0
- package/dist/src/detectors/website/category-detector.js.map +1 -0
- package/dist/src/detectors/website/index.d.ts +53 -0
- package/dist/src/detectors/website/index.d.ts.map +1 -0
- package/dist/src/detectors/website/index.js +232 -0
- package/dist/src/detectors/website/index.js.map +1 -0
- package/dist/src/detectors/website/pattern-matcher.d.ts +33 -0
- package/dist/src/detectors/website/pattern-matcher.d.ts.map +1 -0
- package/dist/src/detectors/website/pattern-matcher.js +121 -0
- package/dist/src/detectors/website/pattern-matcher.js.map +1 -0
- package/dist/src/detectors/website/types.d.ts +105 -0
- package/dist/src/detectors/website/types.d.ts.map +1 -0
- package/dist/src/detectors/website/types.js +6 -0
- package/dist/src/detectors/website/types.js.map +1 -0
- package/dist/src/engine/analyzer.d.ts +87 -0
- package/dist/src/engine/analyzer.d.ts.map +1 -0
- package/dist/src/engine/analyzer.js +427 -0
- package/dist/src/engine/analyzer.js.map +1 -0
- package/dist/src/engine/cache.d.ts +80 -0
- package/dist/src/engine/cache.d.ts.map +1 -0
- package/dist/src/engine/cache.js +167 -0
- package/dist/src/engine/cache.js.map +1 -0
- package/dist/src/engine/index.d.ts +11 -0
- package/dist/src/engine/index.d.ts.map +1 -0
- package/dist/src/engine/index.js +11 -0
- package/dist/src/engine/index.js.map +1 -0
- package/dist/src/engine/llm-client.d.ts +210 -0
- package/dist/src/engine/llm-client.d.ts.map +1 -0
- package/dist/src/engine/llm-client.js +506 -0
- package/dist/src/engine/llm-client.js.map +1 -0
- package/dist/src/engine/types.d.ts +163 -0
- package/dist/src/engine/types.d.ts.map +1 -0
- package/dist/src/engine/types.js +21 -0
- package/dist/src/engine/types.js.map +1 -0
- package/dist/src/feedback/index.d.ts +9 -0
- package/dist/src/feedback/index.d.ts.map +1 -0
- package/dist/src/feedback/index.js +8 -0
- package/dist/src/feedback/index.js.map +1 -0
- package/dist/src/feedback/learner.d.ts +222 -0
- package/dist/src/feedback/learner.d.ts.map +1 -0
- package/dist/src/feedback/learner.js +401 -0
- package/dist/src/feedback/learner.js.map +1 -0
- package/dist/src/feedback/store.d.ts +113 -0
- package/dist/src/feedback/store.d.ts.map +1 -0
- package/dist/src/feedback/store.js +228 -0
- package/dist/src/feedback/store.js.map +1 -0
- package/dist/src/feedback/types.d.ts +126 -0
- package/dist/src/feedback/types.d.ts.map +1 -0
- package/dist/src/feedback/types.js +6 -0
- package/dist/src/feedback/types.js.map +1 -0
- package/dist/src/hooks/before-agent-start/handler.d.ts +37 -0
- package/dist/src/hooks/before-agent-start/handler.d.ts.map +1 -0
- package/dist/src/hooks/before-agent-start/handler.js +109 -0
- package/dist/src/hooks/before-agent-start/handler.js.map +1 -0
- package/dist/src/hooks/before-agent-start/index.d.ts +8 -0
- package/dist/src/hooks/before-agent-start/index.d.ts.map +1 -0
- package/dist/src/hooks/before-agent-start/index.js +7 -0
- package/dist/src/hooks/before-agent-start/index.js.map +1 -0
- package/dist/src/hooks/before-agent-start/prompts.d.ts +48 -0
- package/dist/src/hooks/before-agent-start/prompts.d.ts.map +1 -0
- package/dist/src/hooks/before-agent-start/prompts.js +103 -0
- package/dist/src/hooks/before-agent-start/prompts.js.map +1 -0
- package/dist/src/hooks/before-tool-call/handler.d.ts +42 -0
- package/dist/src/hooks/before-tool-call/handler.d.ts.map +1 -0
- package/dist/src/hooks/before-tool-call/handler.js +226 -0
- package/dist/src/hooks/before-tool-call/handler.js.map +1 -0
- package/dist/src/hooks/before-tool-call/index.d.ts +7 -0
- package/dist/src/hooks/before-tool-call/index.d.ts.map +1 -0
- package/dist/src/hooks/before-tool-call/index.js +6 -0
- package/dist/src/hooks/before-tool-call/index.js.map +1 -0
- package/dist/src/hooks/tool-result-persist/filter.d.ts +72 -0
- package/dist/src/hooks/tool-result-persist/filter.d.ts.map +1 -0
- package/dist/src/hooks/tool-result-persist/filter.js +305 -0
- package/dist/src/hooks/tool-result-persist/filter.js.map +1 -0
- package/dist/src/hooks/tool-result-persist/handler.d.ts +49 -0
- package/dist/src/hooks/tool-result-persist/handler.d.ts.map +1 -0
- package/dist/src/hooks/tool-result-persist/handler.js +217 -0
- package/dist/src/hooks/tool-result-persist/handler.js.map +1 -0
- package/dist/src/hooks/tool-result-persist/index.d.ts +11 -0
- package/dist/src/hooks/tool-result-persist/index.d.ts.map +1 -0
- package/dist/src/hooks/tool-result-persist/index.js +11 -0
- package/dist/src/hooks/tool-result-persist/index.js.map +1 -0
- package/dist/src/index.d.ts +256 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +222 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/notifications/discord.d.ts +10 -0
- package/dist/src/notifications/discord.d.ts.map +1 -0
- package/dist/src/notifications/discord.js +218 -0
- package/dist/src/notifications/discord.js.map +1 -0
- package/dist/src/notifications/index.d.ts +37 -0
- package/dist/src/notifications/index.d.ts.map +1 -0
- package/dist/src/notifications/index.js +68 -0
- package/dist/src/notifications/index.js.map +1 -0
- package/dist/src/notifications/slack.d.ts +10 -0
- package/dist/src/notifications/slack.d.ts.map +1 -0
- package/dist/src/notifications/slack.js +218 -0
- package/dist/src/notifications/slack.js.map +1 -0
- package/dist/src/notifications/telegram.d.ts +10 -0
- package/dist/src/notifications/telegram.d.ts.map +1 -0
- package/dist/src/notifications/telegram.js +242 -0
- package/dist/src/notifications/telegram.js.map +1 -0
- package/dist/src/notifications/types.d.ts +119 -0
- package/dist/src/notifications/types.d.ts.map +1 -0
- package/dist/src/notifications/types.js +6 -0
- package/dist/src/notifications/types.js.map +1 -0
- package/dist/src/proxy/index.d.ts +8 -0
- package/dist/src/proxy/index.d.ts.map +1 -0
- package/dist/src/proxy/index.js +9 -0
- package/dist/src/proxy/index.js.map +1 -0
- package/dist/src/proxy/middleware.d.ts +55 -0
- package/dist/src/proxy/middleware.d.ts.map +1 -0
- package/dist/src/proxy/middleware.js +215 -0
- package/dist/src/proxy/middleware.js.map +1 -0
- package/dist/src/proxy/server.d.ts +57 -0
- package/dist/src/proxy/server.d.ts.map +1 -0
- package/dist/src/proxy/server.js +298 -0
- package/dist/src/proxy/server.js.map +1 -0
- package/dist/src/proxy/types.d.ts +136 -0
- package/dist/src/proxy/types.d.ts.map +1 -0
- package/dist/src/proxy/types.js +6 -0
- package/dist/src/proxy/types.js.map +1 -0
- package/dist/src/sanitization/index.d.ts +10 -0
- package/dist/src/sanitization/index.d.ts.map +1 -0
- package/dist/src/sanitization/index.js +9 -0
- package/dist/src/sanitization/index.js.map +1 -0
- package/dist/src/sanitization/patterns.d.ts +51 -0
- package/dist/src/sanitization/patterns.d.ts.map +1 -0
- package/dist/src/sanitization/patterns.js +266 -0
- package/dist/src/sanitization/patterns.js.map +1 -0
- package/dist/src/sanitization/scanner.d.ts +29 -0
- package/dist/src/sanitization/scanner.d.ts.map +1 -0
- package/dist/src/sanitization/scanner.js +328 -0
- package/dist/src/sanitization/scanner.js.map +1 -0
- package/dist/src/sanitization/types.d.ts +57 -0
- package/dist/src/sanitization/types.d.ts.map +1 -0
- package/dist/src/sanitization/types.js +5 -0
- package/dist/src/sanitization/types.js.map +1 -0
- package/openclaw.plugin.json +114 -0
- package/package.json +63 -0
- package/rules/builtin/README.md +139 -0
- package/rules/builtin/ai-services.yaml +70 -0
- package/rules/builtin/api-keys.yaml +64 -0
- package/rules/builtin/authentication.yaml +56 -0
- package/rules/builtin/aws-security.yaml +57 -0
- package/rules/builtin/azure-security.yaml +58 -0
- package/rules/builtin/cicd-security.yaml +64 -0
- package/rules/builtin/cloud-storage.yaml +64 -0
- package/rules/builtin/container-registry.yaml +55 -0
- package/rules/builtin/crypto-wallets.yaml +71 -0
- package/rules/builtin/database-nosql.yaml +58 -0
- package/rules/builtin/database-sql.yaml +62 -0
- package/rules/builtin/development-env.yaml +67 -0
- package/rules/builtin/docker.yaml +57 -0
- package/rules/builtin/filesystem.yaml +71 -0
- package/rules/builtin/financial-pci.yaml +61 -0
- package/rules/builtin/gcp-security.yaml +57 -0
- package/rules/builtin/git-operations.yaml +68 -0
- package/rules/builtin/healthcare-hipaa.yaml +64 -0
- package/rules/builtin/kubernetes.yaml +60 -0
- package/rules/builtin/messaging-services.yaml +53 -0
- package/rules/builtin/minimal.yaml +47 -0
- package/rules/builtin/mobile-development.yaml +61 -0
- package/rules/builtin/monitoring.yaml +63 -0
- package/rules/builtin/network-security.yaml +57 -0
- package/rules/builtin/package-managers.yaml +74 -0
- package/rules/builtin/payment-processing.yaml +66 -0
- package/rules/builtin/pii-protection.yaml +48 -0
- package/rules/builtin/production-strict.yaml +55 -0
- package/rules/builtin/secrets-management.yaml +63 -0
- package/rules/builtin/serverless.yaml +74 -0
- package/rules/builtin/ssh-security.yaml +66 -0
- package/rules/builtin/terraform.yaml +51 -0
- package/rules/builtin/web-security.yaml +62 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main scanner implementation for prompt injection detection
|
|
3
|
+
*/
|
|
4
|
+
import { getEnabledPatterns, PATTERNS_BY_CATEGORY } from './patterns.js';
|
|
5
|
+
/**
|
|
6
|
+
* Default scanner configuration
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_SCANNER_CONFIG = {
|
|
9
|
+
enabled: true,
|
|
10
|
+
categories: {
|
|
11
|
+
instructionOverride: true,
|
|
12
|
+
systemLeak: true,
|
|
13
|
+
jailbreak: true,
|
|
14
|
+
encodedPayload: true,
|
|
15
|
+
},
|
|
16
|
+
minConfidence: 0.5,
|
|
17
|
+
redactMatches: false,
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Redaction placeholder
|
|
21
|
+
*/
|
|
22
|
+
const REDACTED = '[REDACTED]';
|
|
23
|
+
/**
|
|
24
|
+
* Maximum recursion depth for encoded payload scanning
|
|
25
|
+
*/
|
|
26
|
+
const MAX_DECODE_DEPTH = 3;
|
|
27
|
+
/**
|
|
28
|
+
* Decode base64 string safely
|
|
29
|
+
* @param str - Base64 string to decode
|
|
30
|
+
* @returns Decoded string or null if invalid
|
|
31
|
+
*/
|
|
32
|
+
function decodeBase64(str) {
|
|
33
|
+
try {
|
|
34
|
+
// Normalize padding
|
|
35
|
+
let normalized = str;
|
|
36
|
+
while (normalized.length % 4 !== 0) {
|
|
37
|
+
normalized += '=';
|
|
38
|
+
}
|
|
39
|
+
const decoded = atob(normalized);
|
|
40
|
+
// Only return if it's printable text
|
|
41
|
+
if (/^[\x20-\x7E\s]+$/.test(decoded)) {
|
|
42
|
+
return decoded;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Decode hex escape sequences
|
|
52
|
+
* @param str - String containing hex escapes
|
|
53
|
+
* @returns Decoded string or null if invalid
|
|
54
|
+
*/
|
|
55
|
+
function decodeHexEscapes(str) {
|
|
56
|
+
try {
|
|
57
|
+
const decoded = str.replace(/\\x([0-9a-fA-F]{2})/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)));
|
|
58
|
+
if (/^[\x20-\x7E\s]+$/.test(decoded)) {
|
|
59
|
+
return decoded;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Decode unicode escape sequences
|
|
69
|
+
* @param str - String containing unicode escapes
|
|
70
|
+
* @returns Decoded string or null if invalid
|
|
71
|
+
*/
|
|
72
|
+
function decodeUnicodeEscapes(str) {
|
|
73
|
+
try {
|
|
74
|
+
const decoded = str.replace(/\\u([0-9a-fA-F]{4})/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)));
|
|
75
|
+
if (/^[\x20-\x7E\s]+$/.test(decoded)) {
|
|
76
|
+
return decoded;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Decode URL encoded sequences
|
|
86
|
+
* @param str - URL encoded string
|
|
87
|
+
* @returns Decoded string or null if invalid
|
|
88
|
+
*/
|
|
89
|
+
function decodeUrlEncoding(str) {
|
|
90
|
+
try {
|
|
91
|
+
const decoded = decodeURIComponent(str);
|
|
92
|
+
if (/^[\x20-\x7E\s]+$/.test(decoded)) {
|
|
93
|
+
return decoded;
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Extract and decode base64 content from a string
|
|
103
|
+
* @param content - Content to search for base64
|
|
104
|
+
* @returns Array of decoded base64 strings
|
|
105
|
+
*/
|
|
106
|
+
function extractBase64Content(content) {
|
|
107
|
+
const results = [];
|
|
108
|
+
// Match base64 strings (at least 20 chars)
|
|
109
|
+
const base64Pattern = /[A-Za-z0-9+/]{20,}={0,2}/g;
|
|
110
|
+
let match;
|
|
111
|
+
while ((match = base64Pattern.exec(content)) !== null) {
|
|
112
|
+
const decoded = decodeBase64(match[0]);
|
|
113
|
+
if (decoded) {
|
|
114
|
+
results.push(decoded);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return results;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Scan content for injection patterns
|
|
121
|
+
* @param content - Content to scan
|
|
122
|
+
* @param config - Scanner configuration
|
|
123
|
+
* @returns Scan result
|
|
124
|
+
*/
|
|
125
|
+
export function scan(content, config) {
|
|
126
|
+
const mergedConfig = {
|
|
127
|
+
...DEFAULT_SCANNER_CONFIG,
|
|
128
|
+
...config,
|
|
129
|
+
categories: {
|
|
130
|
+
...DEFAULT_SCANNER_CONFIG.categories,
|
|
131
|
+
...config?.categories,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
// Return early if disabled
|
|
135
|
+
if (!mergedConfig.enabled) {
|
|
136
|
+
return {
|
|
137
|
+
hasInjection: false,
|
|
138
|
+
matches: [],
|
|
139
|
+
highestConfidence: 0,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const matches = [];
|
|
143
|
+
// Get enabled patterns
|
|
144
|
+
const enabledPatterns = getEnabledPatterns(mergedConfig.categories);
|
|
145
|
+
// Scan main content
|
|
146
|
+
for (const [category, patternDef] of enabledPatterns) {
|
|
147
|
+
const regex = new RegExp(patternDef.pattern.source, 'gi');
|
|
148
|
+
let match;
|
|
149
|
+
while ((match = regex.exec(content)) !== null) {
|
|
150
|
+
if (patternDef.confidence >= mergedConfig.minConfidence) {
|
|
151
|
+
matches.push({
|
|
152
|
+
category,
|
|
153
|
+
pattern: patternDef.pattern.source,
|
|
154
|
+
match: match[0],
|
|
155
|
+
position: {
|
|
156
|
+
start: match.index,
|
|
157
|
+
end: match.index + match[0].length,
|
|
158
|
+
},
|
|
159
|
+
confidence: patternDef.confidence,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// Recursively scan decoded content if encoded payload detection is enabled
|
|
165
|
+
if (mergedConfig.categories.encodedPayload) {
|
|
166
|
+
scanEncodedContent(content, matches, mergedConfig, 0);
|
|
167
|
+
}
|
|
168
|
+
// Sort matches by position
|
|
169
|
+
matches.sort((a, b) => a.position.start - b.position.start);
|
|
170
|
+
// Remove duplicates (same position)
|
|
171
|
+
const uniqueMatches = matches.filter((match, index, arr) => index === 0 ||
|
|
172
|
+
match.position.start !== arr[index - 1].position.start ||
|
|
173
|
+
match.position.end !== arr[index - 1].position.end);
|
|
174
|
+
const highestConfidence = uniqueMatches.length > 0
|
|
175
|
+
? Math.max(...uniqueMatches.map((m) => m.confidence))
|
|
176
|
+
: 0;
|
|
177
|
+
const result = {
|
|
178
|
+
hasInjection: uniqueMatches.length > 0,
|
|
179
|
+
matches: uniqueMatches,
|
|
180
|
+
highestConfidence,
|
|
181
|
+
};
|
|
182
|
+
// Add sanitized output if redaction is enabled
|
|
183
|
+
if (mergedConfig.redactMatches && uniqueMatches.length > 0) {
|
|
184
|
+
result.sanitizedOutput = sanitize(content, uniqueMatches);
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Scan encoded content recursively
|
|
190
|
+
* @param content - Content to scan
|
|
191
|
+
* @param matches - Accumulated matches
|
|
192
|
+
* @param config - Scanner configuration
|
|
193
|
+
* @param depth - Current recursion depth
|
|
194
|
+
*/
|
|
195
|
+
function scanEncodedContent(content, matches, config, depth) {
|
|
196
|
+
if (depth >= MAX_DECODE_DEPTH)
|
|
197
|
+
return;
|
|
198
|
+
// Extract and decode base64 content
|
|
199
|
+
const base64Contents = extractBase64Content(content);
|
|
200
|
+
for (const decoded of base64Contents) {
|
|
201
|
+
// Scan decoded content for all patterns (not just encoded)
|
|
202
|
+
const allPatterns = [
|
|
203
|
+
...PATTERNS_BY_CATEGORY['instruction-override'],
|
|
204
|
+
...PATTERNS_BY_CATEGORY['system-leak'],
|
|
205
|
+
...PATTERNS_BY_CATEGORY.jailbreak,
|
|
206
|
+
];
|
|
207
|
+
for (const patternDef of allPatterns) {
|
|
208
|
+
const regex = new RegExp(patternDef.pattern.source, 'gi');
|
|
209
|
+
let match;
|
|
210
|
+
while ((match = regex.exec(decoded)) !== null) {
|
|
211
|
+
// Boost confidence for nested encoded content
|
|
212
|
+
const boostedConfidence = Math.min(patternDef.confidence + 0.1 * (depth + 1), 1.0);
|
|
213
|
+
if (boostedConfidence >= config.minConfidence) {
|
|
214
|
+
matches.push({
|
|
215
|
+
category: 'encoded-payload',
|
|
216
|
+
pattern: `encoded(${patternDef.pattern.source})`,
|
|
217
|
+
match: `[decoded] ${match[0]}`,
|
|
218
|
+
position: { start: -1, end: -1 }, // Position unknown for decoded content
|
|
219
|
+
confidence: boostedConfidence,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Recurse for nested encodings
|
|
225
|
+
scanEncodedContent(decoded, matches, config, depth + 1);
|
|
226
|
+
}
|
|
227
|
+
// Try decoding hex escapes
|
|
228
|
+
const hexPattern = /\\x[0-9a-fA-F]{2}(?:\\x[0-9a-fA-F]{2})+/g;
|
|
229
|
+
let hexMatch;
|
|
230
|
+
while ((hexMatch = hexPattern.exec(content)) !== null) {
|
|
231
|
+
const decoded = decodeHexEscapes(hexMatch[0]);
|
|
232
|
+
if (decoded) {
|
|
233
|
+
scanDecodedForInjections(decoded, matches, config, depth);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// Try decoding unicode escapes
|
|
237
|
+
const unicodePattern = /\\u[0-9a-fA-F]{4}(?:\\u[0-9a-fA-F]{4})+/g;
|
|
238
|
+
let unicodeMatch;
|
|
239
|
+
while ((unicodeMatch = unicodePattern.exec(content)) !== null) {
|
|
240
|
+
const decoded = decodeUnicodeEscapes(unicodeMatch[0]);
|
|
241
|
+
if (decoded) {
|
|
242
|
+
scanDecodedForInjections(decoded, matches, config, depth);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Try URL decoding
|
|
246
|
+
const urlPattern = /%[0-9a-fA-F]{2}(?:%[0-9a-fA-F]{2})+/g;
|
|
247
|
+
let urlMatch;
|
|
248
|
+
while ((urlMatch = urlPattern.exec(content)) !== null) {
|
|
249
|
+
const decoded = decodeUrlEncoding(urlMatch[0]);
|
|
250
|
+
if (decoded) {
|
|
251
|
+
scanDecodedForInjections(decoded, matches, config, depth);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Scan decoded content for injection patterns
|
|
257
|
+
* @param decoded - Decoded content
|
|
258
|
+
* @param matches - Accumulated matches
|
|
259
|
+
* @param config - Scanner configuration
|
|
260
|
+
* @param depth - Current recursion depth
|
|
261
|
+
*/
|
|
262
|
+
function scanDecodedForInjections(decoded, matches, config, depth) {
|
|
263
|
+
const allPatterns = [
|
|
264
|
+
...PATTERNS_BY_CATEGORY['instruction-override'],
|
|
265
|
+
...PATTERNS_BY_CATEGORY['system-leak'],
|
|
266
|
+
...PATTERNS_BY_CATEGORY.jailbreak,
|
|
267
|
+
];
|
|
268
|
+
for (const patternDef of allPatterns) {
|
|
269
|
+
const regex = new RegExp(patternDef.pattern.source, 'gi');
|
|
270
|
+
let match;
|
|
271
|
+
while ((match = regex.exec(decoded)) !== null) {
|
|
272
|
+
const boostedConfidence = Math.min(patternDef.confidence + 0.1 * (depth + 1), 1.0);
|
|
273
|
+
if (boostedConfidence >= config.minConfidence) {
|
|
274
|
+
matches.push({
|
|
275
|
+
category: 'encoded-payload',
|
|
276
|
+
pattern: `encoded(${patternDef.pattern.source})`,
|
|
277
|
+
match: `[decoded] ${match[0]}`,
|
|
278
|
+
position: { start: -1, end: -1 },
|
|
279
|
+
confidence: boostedConfidence,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
// Recurse if depth allows
|
|
285
|
+
if (depth < MAX_DECODE_DEPTH) {
|
|
286
|
+
scanEncodedContent(decoded, matches, config, depth + 1);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Sanitize content by redacting matched injections
|
|
291
|
+
* @param content - Original content
|
|
292
|
+
* @param matches - Detected injection matches
|
|
293
|
+
* @returns Sanitized content with redactions
|
|
294
|
+
*/
|
|
295
|
+
export function sanitize(content, matches) {
|
|
296
|
+
if (matches.length === 0)
|
|
297
|
+
return content;
|
|
298
|
+
// Filter to matches with valid positions
|
|
299
|
+
const validMatches = matches.filter((m) => m.position.start >= 0 && m.position.end > m.position.start);
|
|
300
|
+
if (validMatches.length === 0)
|
|
301
|
+
return content;
|
|
302
|
+
// Sort by position descending to replace from end to start
|
|
303
|
+
const sortedMatches = [...validMatches].sort((a, b) => b.position.start - a.position.start);
|
|
304
|
+
let result = content;
|
|
305
|
+
for (const match of sortedMatches) {
|
|
306
|
+
const before = result.slice(0, match.position.start);
|
|
307
|
+
const after = result.slice(match.position.end);
|
|
308
|
+
result = before + REDACTED + after;
|
|
309
|
+
}
|
|
310
|
+
return result;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Create a scanner instance with preset configuration
|
|
314
|
+
* @param config - Scanner configuration
|
|
315
|
+
* @returns Scanner function
|
|
316
|
+
*/
|
|
317
|
+
export function createScanner(config) {
|
|
318
|
+
const mergedConfig = {
|
|
319
|
+
...DEFAULT_SCANNER_CONFIG,
|
|
320
|
+
...config,
|
|
321
|
+
categories: {
|
|
322
|
+
...DEFAULT_SCANNER_CONFIG.categories,
|
|
323
|
+
...config?.categories,
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
return (content) => scan(content, mergedConfig);
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../src/sanitization/scanner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEzE;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,OAAO,EAAE,IAAI;IACb,UAAU,EAAE;QACV,mBAAmB,EAAE,IAAI;QACzB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,IAAI;KACrB;IACD,aAAa,EAAE,GAAG;IAClB,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,QAAQ,GAAG,YAAY,CAAC;AAE9B;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B;;;;GAIG;AACH,SAAS,YAAY,CAAC,GAAW;IAC/B,IAAI,CAAC;QACH,oBAAoB;QACpB,IAAI,UAAU,GAAG,GAAG,CAAC;QACrB,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,UAAU,IAAI,GAAG,CAAC;QACpB,CAAC;QACD,MA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Y,CAAC,CAAC,IAAI,CAC1C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAC9C,CAAC;IAEF,IAAI,MAAM,GAAG,OAAO,CAAC;IACrB,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,MAA+B;IAE/B,MAAM,YAAY,GAAkB;QAClC,GAAG,sBAAsB;QACzB,GAAG,MAAM;QACT,UAAU,EAAE;YACV,GAAG,sBAAsB,CAAC,UAAU;YACpC,GAAG,MAAM,EAAE,UAAU;SACtB;KACF,CAAC;IAEF,OAAO,CAAC,OAAe,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for prompt injection scanner
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Categories of prompt injection attacks
|
|
6
|
+
*/
|
|
7
|
+
export type InjectionCategory = 'instruction-override' | 'system-leak' | 'jailbreak' | 'encoded-payload';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a matched injection pattern
|
|
10
|
+
*/
|
|
11
|
+
export interface InjectionMatch {
|
|
12
|
+
/** Category of the detected injection */
|
|
13
|
+
category: InjectionCategory;
|
|
14
|
+
/** The pattern that matched */
|
|
15
|
+
pattern: string;
|
|
16
|
+
/** The actual matched content */
|
|
17
|
+
match: string;
|
|
18
|
+
/** Position of the match in the content */
|
|
19
|
+
position: {
|
|
20
|
+
start: number;
|
|
21
|
+
end: number;
|
|
22
|
+
};
|
|
23
|
+
/** Confidence score (0.0 - 1.0) */
|
|
24
|
+
confidence: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Result of scanning content for prompt injections
|
|
28
|
+
*/
|
|
29
|
+
export interface ScanResult {
|
|
30
|
+
/** Whether any injection was detected */
|
|
31
|
+
hasInjection: boolean;
|
|
32
|
+
/** All detected injection matches */
|
|
33
|
+
matches: InjectionMatch[];
|
|
34
|
+
/** Highest confidence score among all matches */
|
|
35
|
+
highestConfidence: number;
|
|
36
|
+
/** Content with matches redacted (if redaction enabled) */
|
|
37
|
+
sanitizedOutput?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Configuration for the scanner
|
|
41
|
+
*/
|
|
42
|
+
export interface ScannerConfig {
|
|
43
|
+
/** Whether scanning is enabled */
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
/** Which categories to scan for */
|
|
46
|
+
categories: {
|
|
47
|
+
instructionOverride: boolean;
|
|
48
|
+
systemLeak: boolean;
|
|
49
|
+
jailbreak: boolean;
|
|
50
|
+
encodedPayload: boolean;
|
|
51
|
+
};
|
|
52
|
+
/** Minimum confidence threshold to report a match */
|
|
53
|
+
minConfidence: number;
|
|
54
|
+
/** Whether to redact matches in sanitizedOutput */
|
|
55
|
+
redactMatches: boolean;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/sanitization/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,sBAAsB,GACtB,aAAa,GACb,WAAW,GACX,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,YAAY,EAAE,OAAO,CAAC;IACtB,qCAAqC;IACrC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,iDAAiD;IACjD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,mCAAmC;IACnC,UAAU,EAAE;QACV,mBAAmB,EAAE,OAAO,CAAC;QAC7B,UAAU,EAAE,OAAO,CAAC;QACpB,SAAS,EAAE,OAAO,CAAC;QACnB,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,aAAa,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/sanitization/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://openclaw.ai/schemas/plugin.json",
|
|
3
|
+
"id": "clawsec",
|
|
4
|
+
"name": "Clawsec Security Plugin",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"kind": "security",
|
|
7
|
+
"description": "Comprehensive security plugin for OpenClaw.ai that prevents AI agents from taking dangerous actions. Provides purchase protection, website control, destructive command prevention, and sensitive data filtering.",
|
|
8
|
+
"author": "Clawsec Team",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/clawsec/clawsec"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"security",
|
|
16
|
+
"ai-safety",
|
|
17
|
+
"protection",
|
|
18
|
+
"purchase-protection",
|
|
19
|
+
"destructive-commands",
|
|
20
|
+
"data-filtering"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"openclaw": ">=1.0.0",
|
|
24
|
+
"node": ">=18.0.0"
|
|
25
|
+
},
|
|
26
|
+
"main": "dist/src/index.js",
|
|
27
|
+
"types": "dist/src/index.d.ts",
|
|
28
|
+
"configSchema": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"configPath": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"default": "./clawsec.yaml",
|
|
34
|
+
"description": "Path to the Clawsec YAML configuration file"
|
|
35
|
+
},
|
|
36
|
+
"enabled": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"default": true,
|
|
39
|
+
"description": "Whether the security plugin is enabled"
|
|
40
|
+
},
|
|
41
|
+
"logLevel": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": ["debug", "info", "warn", "error"],
|
|
44
|
+
"default": "info",
|
|
45
|
+
"description": "Logging verbosity level"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"additionalProperties": false
|
|
49
|
+
},
|
|
50
|
+
"uiHints": {
|
|
51
|
+
"configPath": {
|
|
52
|
+
"label": "Configuration File",
|
|
53
|
+
"helpText": "Path to clawsec.yaml configuration file"
|
|
54
|
+
},
|
|
55
|
+
"enabled": {
|
|
56
|
+
"label": "Enable Plugin",
|
|
57
|
+
"helpText": "Toggle the security plugin on or off"
|
|
58
|
+
},
|
|
59
|
+
"logLevel": {
|
|
60
|
+
"label": "Log Level",
|
|
61
|
+
"helpText": "Set logging verbosity (debug, info, warn, error)"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"hooks": {
|
|
65
|
+
"before-tool-call": {
|
|
66
|
+
"id": "clawsec-before-tool-call",
|
|
67
|
+
"description": "Intercepts tool calls to detect and block dangerous actions before execution",
|
|
68
|
+
"priority": 100,
|
|
69
|
+
"handler": "dist/index.js:beforeToolCallHandler"
|
|
70
|
+
},
|
|
71
|
+
"before-agent-start": {
|
|
72
|
+
"id": "clawsec-before-agent-start",
|
|
73
|
+
"description": "Injects security context and reminders into the agent's system prompt",
|
|
74
|
+
"priority": 50,
|
|
75
|
+
"handler": "dist/index.js:beforeAgentStartHandler"
|
|
76
|
+
},
|
|
77
|
+
"tool-result-persist": {
|
|
78
|
+
"id": "clawsec-tool-result-persist",
|
|
79
|
+
"description": "Filters sensitive data from tool outputs before persisting to conversation history",
|
|
80
|
+
"priority": 100,
|
|
81
|
+
"handler": "dist/index.js:toolResultPersistHandler"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"configuration": {
|
|
85
|
+
"externalConfigFile": {
|
|
86
|
+
"format": "yaml",
|
|
87
|
+
"filename": "clawsec.yaml",
|
|
88
|
+
"schemaRef": "./schemas/clawsec-config.schema.json"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"capabilities": {
|
|
92
|
+
"requiresApprovalAPI": true,
|
|
93
|
+
"requiresLogging": true,
|
|
94
|
+
"requiresConversationAccess": false,
|
|
95
|
+
"requiresNetworkAccess": false
|
|
96
|
+
},
|
|
97
|
+
"categories": [
|
|
98
|
+
"security",
|
|
99
|
+
"safety",
|
|
100
|
+
"compliance"
|
|
101
|
+
],
|
|
102
|
+
"permissions": [
|
|
103
|
+
"hook:before-tool-call",
|
|
104
|
+
"hook:before-agent-start",
|
|
105
|
+
"hook:tool-result-persist",
|
|
106
|
+
"api:approval",
|
|
107
|
+
"api:logging"
|
|
108
|
+
],
|
|
109
|
+
"documentation": {
|
|
110
|
+
"readme": "README.md",
|
|
111
|
+
"changelog": "CHANGELOG.md",
|
|
112
|
+
"configuration": "docs/configuration.md"
|
|
113
|
+
}
|
|
114
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "clawsec",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Security plugin for OpenClaw.ai - prevents AI agents from taking dangerous actions",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"dev": "tsc --watch",
|
|
11
|
+
"test": "vitest run",
|
|
12
|
+
"test:watch": "vitest",
|
|
13
|
+
"test:coverage": "vitest run --coverage",
|
|
14
|
+
"lint": "eslint src --ext .ts",
|
|
15
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
16
|
+
"clean": "rm -rf dist",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/clawdsec/clawsec.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/clawdsec/clawsec#readme",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/clawdsec/clawsec/issues"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"openclaw",
|
|
29
|
+
"security",
|
|
30
|
+
"ai-safety",
|
|
31
|
+
"plugin"
|
|
32
|
+
],
|
|
33
|
+
"author": "Clawsec Team",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"openclaw": {
|
|
36
|
+
"extensions": ["./dist/src/index.js"]
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18.0.0"
|
|
40
|
+
},
|
|
41
|
+
"bin": {
|
|
42
|
+
"clawsec": "./dist/bin/clawsec.js"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"rules",
|
|
47
|
+
"openclaw.plugin.json"
|
|
48
|
+
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"yaml": "^2.8.2",
|
|
51
|
+
"zod": "^4.3.6"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@eslint/js": "^9.39.2",
|
|
55
|
+
"@types/node": "^25.2.0",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
57
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
58
|
+
"eslint": "^9.39.2",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"typescript-eslint": "^8.54.0",
|
|
61
|
+
"vitest": "^4.0.18"
|
|
62
|
+
}
|
|
63
|
+
}
|