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,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Before Agent Start Hook
|
|
3
|
+
* Re-exports for the before-agent-start hook
|
|
4
|
+
*/
|
|
5
|
+
export type { BeforeAgentStartHandlerOptions } from './handler.js';
|
|
6
|
+
export { createBeforeAgentStartHandler, createDefaultBeforeAgentStartHandler, } from './handler.js';
|
|
7
|
+
export { SECURITY_CONTEXT_HEADER, BASE_SECURITY_INTRO, CATEGORY_REMINDERS, BLOCKED_ACTION_INSTRUCTIONS, SECURITY_CONTEXT_FOOTER, getAgentConfirmInstructions, getEnabledCategoryReminders, buildSecurityContextPrompt, } from './prompts.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/before-agent-start/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EACL,6BAA6B,EAC7B,oCAAoC,GACrC,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Before Agent Start Hook
|
|
3
|
+
* Re-exports for the before-agent-start hook
|
|
4
|
+
*/
|
|
5
|
+
export { createBeforeAgentStartHandler, createDefaultBeforeAgentStartHandler, } from './handler.js';
|
|
6
|
+
export { SECURITY_CONTEXT_HEADER, BASE_SECURITY_INTRO, CATEGORY_REMINDERS, BLOCKED_ACTION_INSTRUCTIONS, SECURITY_CONTEXT_FOOTER, getAgentConfirmInstructions, getEnabledCategoryReminders, buildSecurityContextPrompt, } from './prompts.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/before-agent-start/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACL,6BAA6B,EAC7B,oCAAoC,GACrC,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Before Agent Start Hook - Prompt Templates
|
|
3
|
+
*
|
|
4
|
+
* Templates for security context injection into agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
import type { ClawsecConfig } from '../../config/schema.js';
|
|
7
|
+
/**
|
|
8
|
+
* Security context header
|
|
9
|
+
*/
|
|
10
|
+
export declare const SECURITY_CONTEXT_HEADER = "[CLAWSEC SECURITY CONTEXT]";
|
|
11
|
+
/**
|
|
12
|
+
* Base security introduction
|
|
13
|
+
*/
|
|
14
|
+
export declare const BASE_SECURITY_INTRO = "This session has security protections enabled:";
|
|
15
|
+
/**
|
|
16
|
+
* Category-specific security reminders
|
|
17
|
+
*/
|
|
18
|
+
export declare const CATEGORY_REMINDERS: {
|
|
19
|
+
readonly purchase: "- Purchase Protection: Transactions require approval";
|
|
20
|
+
readonly destructive: "- Destructive Commands: Commands like rm -rf, DROP TABLE are monitored";
|
|
21
|
+
readonly secrets: "- Secrets Detection: API keys and credentials in outputs are filtered";
|
|
22
|
+
readonly website: "- Website Control: Some domains may be restricted";
|
|
23
|
+
readonly exfiltration: "- Data Exfiltration: Outbound data transfers are monitored";
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Instructions for when actions are blocked
|
|
27
|
+
*/
|
|
28
|
+
export declare const BLOCKED_ACTION_INSTRUCTIONS = "If an action is blocked:\n1. You'll receive a message explaining why\n2. For confirmable actions, retry with _clawsec_confirm=\"<approval-id>\"\n3. Some actions cannot be approved and are permanently blocked";
|
|
29
|
+
/**
|
|
30
|
+
* Custom agent-confirm instructions with parameter name
|
|
31
|
+
*/
|
|
32
|
+
export declare function getAgentConfirmInstructions(parameterName: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Footer for the security context
|
|
35
|
+
*/
|
|
36
|
+
export declare const SECURITY_CONTEXT_FOOTER = "Work safely within these protections.";
|
|
37
|
+
/**
|
|
38
|
+
* Get enabled category reminders based on config
|
|
39
|
+
*/
|
|
40
|
+
export declare function getEnabledCategoryReminders(config: ClawsecConfig): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Build the full security context prompt
|
|
43
|
+
*
|
|
44
|
+
* @param config - Clawsec configuration
|
|
45
|
+
* @returns The complete security context prompt or undefined if no protections enabled
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildSecurityContextPrompt(config: ClawsecConfig): string | undefined;
|
|
48
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../src/hooks/before-agent-start/prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,mBAAmB,mDAAmD,CAAC;AAEpF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,2BAA2B,oNAGuB,CAAC;AAEhE;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAKzE;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,0CAA0C,CAAC;AAE/E;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAqB3E;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAmCpF"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Before Agent Start Hook - Prompt Templates
|
|
3
|
+
*
|
|
4
|
+
* Templates for security context injection into agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Security context header
|
|
8
|
+
*/
|
|
9
|
+
export const SECURITY_CONTEXT_HEADER = '[CLAWSEC SECURITY CONTEXT]';
|
|
10
|
+
/**
|
|
11
|
+
* Base security introduction
|
|
12
|
+
*/
|
|
13
|
+
export const BASE_SECURITY_INTRO = 'This session has security protections enabled:';
|
|
14
|
+
/**
|
|
15
|
+
* Category-specific security reminders
|
|
16
|
+
*/
|
|
17
|
+
export const CATEGORY_REMINDERS = {
|
|
18
|
+
purchase: '- Purchase Protection: Transactions require approval',
|
|
19
|
+
destructive: '- Destructive Commands: Commands like rm -rf, DROP TABLE are monitored',
|
|
20
|
+
secrets: '- Secrets Detection: API keys and credentials in outputs are filtered',
|
|
21
|
+
website: '- Website Control: Some domains may be restricted',
|
|
22
|
+
exfiltration: '- Data Exfiltration: Outbound data transfers are monitored',
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Instructions for when actions are blocked
|
|
26
|
+
*/
|
|
27
|
+
export const BLOCKED_ACTION_INSTRUCTIONS = `If an action is blocked:
|
|
28
|
+
1. You'll receive a message explaining why
|
|
29
|
+
2. For confirmable actions, retry with _clawsec_confirm="<approval-id>"
|
|
30
|
+
3. Some actions cannot be approved and are permanently blocked`;
|
|
31
|
+
/**
|
|
32
|
+
* Custom agent-confirm instructions with parameter name
|
|
33
|
+
*/
|
|
34
|
+
export function getAgentConfirmInstructions(parameterName) {
|
|
35
|
+
return `If an action is blocked:
|
|
36
|
+
1. You'll receive a message explaining why
|
|
37
|
+
2. For confirmable actions, retry with ${parameterName}="<approval-id>"
|
|
38
|
+
3. Some actions cannot be approved and are permanently blocked`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Footer for the security context
|
|
42
|
+
*/
|
|
43
|
+
export const SECURITY_CONTEXT_FOOTER = 'Work safely within these protections.';
|
|
44
|
+
/**
|
|
45
|
+
* Get enabled category reminders based on config
|
|
46
|
+
*/
|
|
47
|
+
export function getEnabledCategoryReminders(config) {
|
|
48
|
+
const reminders = [];
|
|
49
|
+
const rules = config.rules;
|
|
50
|
+
if (rules?.purchase?.enabled) {
|
|
51
|
+
reminders.push(CATEGORY_REMINDERS.purchase);
|
|
52
|
+
}
|
|
53
|
+
if (rules?.destructive?.enabled) {
|
|
54
|
+
reminders.push(CATEGORY_REMINDERS.destructive);
|
|
55
|
+
}
|
|
56
|
+
if (rules?.secrets?.enabled) {
|
|
57
|
+
reminders.push(CATEGORY_REMINDERS.secrets);
|
|
58
|
+
}
|
|
59
|
+
if (rules?.website?.enabled) {
|
|
60
|
+
reminders.push(CATEGORY_REMINDERS.website);
|
|
61
|
+
}
|
|
62
|
+
if (rules?.exfiltration?.enabled) {
|
|
63
|
+
reminders.push(CATEGORY_REMINDERS.exfiltration);
|
|
64
|
+
}
|
|
65
|
+
return reminders;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Build the full security context prompt
|
|
69
|
+
*
|
|
70
|
+
* @param config - Clawsec configuration
|
|
71
|
+
* @returns The complete security context prompt or undefined if no protections enabled
|
|
72
|
+
*/
|
|
73
|
+
export function buildSecurityContextPrompt(config) {
|
|
74
|
+
// Check if plugin is globally enabled
|
|
75
|
+
if (config.global?.enabled === false) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
// Get enabled category reminders
|
|
79
|
+
const reminders = getEnabledCategoryReminders(config);
|
|
80
|
+
// If no categories are enabled, return undefined
|
|
81
|
+
if (reminders.length === 0) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
// Build the prompt sections
|
|
85
|
+
const sections = [
|
|
86
|
+
SECURITY_CONTEXT_HEADER,
|
|
87
|
+
'',
|
|
88
|
+
BASE_SECURITY_INTRO,
|
|
89
|
+
'',
|
|
90
|
+
...reminders,
|
|
91
|
+
];
|
|
92
|
+
// Add agent-confirm instructions if enabled
|
|
93
|
+
if (config.approval?.agentConfirm?.enabled !== false) {
|
|
94
|
+
const parameterName = config.approval?.agentConfirm?.parameterName ?? '_clawsec_confirm';
|
|
95
|
+
sections.push('');
|
|
96
|
+
sections.push(getAgentConfirmInstructions(parameterName));
|
|
97
|
+
}
|
|
98
|
+
// Add footer
|
|
99
|
+
sections.push('');
|
|
100
|
+
sections.push(SECURITY_CONTEXT_FOOTER);
|
|
101
|
+
return sections.join('\n');
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/hooks/before-agent-start/prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,4BAA4B,CAAC;AAEpE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gDAAgD,CAAC;AAEpF;;GAEG;AACH,MA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CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAqB;IAC9D,sCAAsC;IACtC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,iCAAiC;IACjC,MAAM,SAAS,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAEtD,iDAAiD;IACjD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,4BAA4B;IAC5B,MAAM,QAAQ,GAAa;QACzB,uBAAuB;QACvB,EAAE;QACF,mBAAmB;QACnB,EAAE;QACF,GAAG,SAAS;KACb,CAAC;IAEF,4CAA4C;IAC5C,IAAI,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,KAAK,KAAK,EAAE,CAAC;QACrD,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,IAAI,kBAAkB,CAAC;QACzF,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClB,QAAQ,CAAC,IAAI,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,aAAa;IACb,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAEvC,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Before Tool Call Hook Handler
|
|
3
|
+
*
|
|
4
|
+
* Main hook handler that intercepts tool calls, runs detection,
|
|
5
|
+
* and blocks/confirms dangerous actions.
|
|
6
|
+
*/
|
|
7
|
+
import type { BeforeToolCallHandler } from '../../index.js';
|
|
8
|
+
import type { Analyzer } from '../../engine/types.js';
|
|
9
|
+
import type { ActionExecutor } from '../../actions/types.js';
|
|
10
|
+
import type { ClawsecConfig } from '../../config/schema.js';
|
|
11
|
+
import type { AgentConfirmHandler } from '../../approval/agent-confirm.js';
|
|
12
|
+
/**
|
|
13
|
+
* Options for creating a before-tool-call handler
|
|
14
|
+
*/
|
|
15
|
+
export interface BeforeToolCallHandlerOptions {
|
|
16
|
+
/** Custom analyzer instance */
|
|
17
|
+
analyzer?: Analyzer;
|
|
18
|
+
/** Custom action executor instance */
|
|
19
|
+
executor?: ActionExecutor;
|
|
20
|
+
/** Custom agent confirm handler instance */
|
|
21
|
+
agentConfirm?: AgentConfirmHandler;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create the before-tool-call handler
|
|
25
|
+
*
|
|
26
|
+
* Flow:
|
|
27
|
+
* 1. Check if plugin is enabled
|
|
28
|
+
* 2. Check for agent-confirm parameter -> validate and allow if valid
|
|
29
|
+
* 3. Run HybridAnalyzer on tool call context
|
|
30
|
+
* 4. Execute action based on analysis result
|
|
31
|
+
* 5. Return appropriate BeforeToolCallResult
|
|
32
|
+
*
|
|
33
|
+
* @param config - Clawsec configuration
|
|
34
|
+
* @param options - Optional custom components
|
|
35
|
+
* @returns BeforeToolCallHandler function
|
|
36
|
+
*/
|
|
37
|
+
export declare function createBeforeToolCallHandler(config: ClawsecConfig, options?: BeforeToolCallHandlerOptions): BeforeToolCallHandler;
|
|
38
|
+
/**
|
|
39
|
+
* Create a default before-tool-call handler with default configuration
|
|
40
|
+
*/
|
|
41
|
+
export declare function createDefaultBeforeToolCallHandler(): BeforeToolCallHandler;
|
|
42
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/hooks/before-tool-call/handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAGV,qBAAqB,EAGtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,QAAQ,EAGT,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,wBAAwB,CAAC;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAM3E;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,4CAA4C;IAC5C,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAiGD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,4BAA4B,GACrC,qBAAqB,CAsEvB;AAED;;GAEG;AACH,wBAAgB,kCAAkC,IAAI,qBAAqB,CAmE1E"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Before Tool Call Hook Handler
|
|
3
|
+
*
|
|
4
|
+
* Main hook handler that intercepts tool calls, runs detection,
|
|
5
|
+
* and blocks/confirms dangerous actions.
|
|
6
|
+
*/
|
|
7
|
+
import { createAnalyzer } from '../../engine/analyzer.js';
|
|
8
|
+
import { createActionExecutor } from '../../actions/executor.js';
|
|
9
|
+
import { createAgentConfirmHandler } from '../../approval/agent-confirm.js';
|
|
10
|
+
import { getDefaultApprovalStore } from '../../approval/store.js';
|
|
11
|
+
/**
|
|
12
|
+
* Convert hook ToolCallContext to engine ToolCallContext
|
|
13
|
+
* The engine context has a slightly different shape
|
|
14
|
+
*/
|
|
15
|
+
function toEngineContext(hookContext) {
|
|
16
|
+
return {
|
|
17
|
+
toolName: hookContext.toolName,
|
|
18
|
+
toolInput: hookContext.toolInput,
|
|
19
|
+
// url can be extracted from toolInput if present
|
|
20
|
+
url: typeof hookContext.toolInput.url === 'string' ? hookContext.toolInput.url : undefined,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Convert analysis result and action result to BeforeToolCallResult
|
|
25
|
+
*/
|
|
26
|
+
function toBeforeToolCallResult(actionResult, detection) {
|
|
27
|
+
const result = {
|
|
28
|
+
allow: actionResult.allowed,
|
|
29
|
+
};
|
|
30
|
+
// Add block message if not allowed
|
|
31
|
+
if (!actionResult.allowed && actionResult.message) {
|
|
32
|
+
result.blockMessage = actionResult.message;
|
|
33
|
+
}
|
|
34
|
+
// Add metadata from primary detection
|
|
35
|
+
if (detection) {
|
|
36
|
+
result.metadata = {
|
|
37
|
+
category: detection.category,
|
|
38
|
+
severity: detection.severity,
|
|
39
|
+
reason: detection.reason,
|
|
40
|
+
};
|
|
41
|
+
// Add rule if present in detection metadata
|
|
42
|
+
if (detection.metadata?.rule && typeof detection.metadata.rule === 'string') {
|
|
43
|
+
result.metadata.rule = detection.metadata.rule;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Add pending approval instructions to block message if present
|
|
47
|
+
if (actionResult.pendingApproval) {
|
|
48
|
+
const approvalInfo = `\n\nApproval ID: ${actionResult.pendingApproval.id}\nTimeout: ${actionResult.pendingApproval.timeout}s\nMethods: ${actionResult.pendingApproval.methods.join(', ')}`;
|
|
49
|
+
result.blockMessage = (result.blockMessage || 'Approval required') + approvalInfo;
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create the allow result for when no threats are detected
|
|
55
|
+
*/
|
|
56
|
+
function createAllowResult() {
|
|
57
|
+
return {
|
|
58
|
+
allow: true,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a result for valid agent-confirm flow
|
|
63
|
+
*/
|
|
64
|
+
function createAgentConfirmAllowResult(strippedInput) {
|
|
65
|
+
return {
|
|
66
|
+
allow: true,
|
|
67
|
+
modifiedInput: strippedInput,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Create a result for invalid agent-confirm flow
|
|
72
|
+
*/
|
|
73
|
+
function createAgentConfirmInvalidResult(error) {
|
|
74
|
+
return {
|
|
75
|
+
allow: false,
|
|
76
|
+
blockMessage: error || 'Invalid or expired approval confirmation',
|
|
77
|
+
metadata: {
|
|
78
|
+
reason: 'Agent confirmation parameter was present but invalid',
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Create a result for disabled plugin
|
|
84
|
+
*/
|
|
85
|
+
function createDisabledResult() {
|
|
86
|
+
return {
|
|
87
|
+
allow: true,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create the before-tool-call handler
|
|
92
|
+
*
|
|
93
|
+
* Flow:
|
|
94
|
+
* 1. Check if plugin is enabled
|
|
95
|
+
* 2. Check for agent-confirm parameter -> validate and allow if valid
|
|
96
|
+
* 3. Run HybridAnalyzer on tool call context
|
|
97
|
+
* 4. Execute action based on analysis result
|
|
98
|
+
* 5. Return appropriate BeforeToolCallResult
|
|
99
|
+
*
|
|
100
|
+
* @param config - Clawsec configuration
|
|
101
|
+
* @param options - Optional custom components
|
|
102
|
+
* @returns BeforeToolCallHandler function
|
|
103
|
+
*/
|
|
104
|
+
export function createBeforeToolCallHandler(config, options) {
|
|
105
|
+
// Create or use provided components
|
|
106
|
+
const analyzer = options?.analyzer ?? createAnalyzer(config);
|
|
107
|
+
const executor = options?.executor ?? createActionExecutor();
|
|
108
|
+
const agentConfirm = options?.agentConfirm ??
|
|
109
|
+
createAgentConfirmHandler({
|
|
110
|
+
enabled: config.approval?.agentConfirm?.enabled ?? true,
|
|
111
|
+
parameterName: config.approval?.agentConfirm?.parameterName,
|
|
112
|
+
store: getDefaultApprovalStore(),
|
|
113
|
+
});
|
|
114
|
+
// Get the parameter name from config
|
|
115
|
+
const confirmParamName = config.approval?.agentConfirm?.parameterName ?? '_clawsec_confirm';
|
|
116
|
+
return async (context) => {
|
|
117
|
+
// 1. Check if plugin is disabled
|
|
118
|
+
if (config.global?.enabled === false) {
|
|
119
|
+
return createDisabledResult();
|
|
120
|
+
}
|
|
121
|
+
// 2. Check for agent-confirm parameter
|
|
122
|
+
if (config.approval?.agentConfirm?.enabled !== false) {
|
|
123
|
+
const confirmResult = agentConfirm.checkConfirmation(context.toolInput, confirmParamName);
|
|
124
|
+
if (confirmResult.confirmed) {
|
|
125
|
+
// Agent is trying to confirm a previous action
|
|
126
|
+
const processResult = agentConfirm.processConfirmation(context.toolInput, confirmParamName);
|
|
127
|
+
if (processResult.valid) {
|
|
128
|
+
// Valid confirmation - strip the parameter and allow
|
|
129
|
+
const strippedInput = agentConfirm.stripConfirmParameter(context.toolInput, confirmParamName);
|
|
130
|
+
return createAgentConfirmAllowResult(strippedInput);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// Invalid confirmation - block
|
|
134
|
+
return createAgentConfirmInvalidResult(processResult.error);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// 3. Run the analyzer
|
|
139
|
+
const engineContext = toEngineContext(context);
|
|
140
|
+
const analysis = await analyzer.analyze(engineContext);
|
|
141
|
+
// 4. If no detections or action is allow/log/warn, handle appropriately
|
|
142
|
+
if (analysis.action === 'allow') {
|
|
143
|
+
return createAllowResult();
|
|
144
|
+
}
|
|
145
|
+
// 5. Execute the action
|
|
146
|
+
const actionContext = {
|
|
147
|
+
analysis,
|
|
148
|
+
toolCall: engineContext,
|
|
149
|
+
config,
|
|
150
|
+
};
|
|
151
|
+
const actionResult = await executor.execute(actionContext);
|
|
152
|
+
// 6. Convert to BeforeToolCallResult
|
|
153
|
+
return toBeforeToolCallResult(actionResult, analysis.primaryDetection);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Create a default before-tool-call handler with default configuration
|
|
158
|
+
*/
|
|
159
|
+
export function createDefaultBeforeToolCallHandler() {
|
|
160
|
+
const defaultConfig = {
|
|
161
|
+
version: '1.0',
|
|
162
|
+
global: {
|
|
163
|
+
enabled: true,
|
|
164
|
+
logLevel: 'info',
|
|
165
|
+
},
|
|
166
|
+
llm: {
|
|
167
|
+
enabled: true,
|
|
168
|
+
model: null,
|
|
169
|
+
},
|
|
170
|
+
rules: {
|
|
171
|
+
purchase: {
|
|
172
|
+
enabled: true,
|
|
173
|
+
severity: 'critical',
|
|
174
|
+
action: 'block',
|
|
175
|
+
spendLimits: { perTransaction: 100, daily: 500 },
|
|
176
|
+
domains: { mode: 'blocklist', blocklist: [] },
|
|
177
|
+
},
|
|
178
|
+
website: {
|
|
179
|
+
enabled: true,
|
|
180
|
+
mode: 'blocklist',
|
|
181
|
+
severity: 'high',
|
|
182
|
+
action: 'block',
|
|
183
|
+
blocklist: [],
|
|
184
|
+
allowlist: [],
|
|
185
|
+
},
|
|
186
|
+
destructive: {
|
|
187
|
+
enabled: true,
|
|
188
|
+
severity: 'critical',
|
|
189
|
+
action: 'confirm',
|
|
190
|
+
shell: { enabled: true },
|
|
191
|
+
cloud: { enabled: true },
|
|
192
|
+
code: { enabled: true },
|
|
193
|
+
},
|
|
194
|
+
secrets: {
|
|
195
|
+
enabled: true,
|
|
196
|
+
severity: 'critical',
|
|
197
|
+
action: 'block',
|
|
198
|
+
},
|
|
199
|
+
exfiltration: {
|
|
200
|
+
enabled: true,
|
|
201
|
+
severity: 'high',
|
|
202
|
+
action: 'block',
|
|
203
|
+
},
|
|
204
|
+
sanitization: {
|
|
205
|
+
enabled: true,
|
|
206
|
+
severity: 'high',
|
|
207
|
+
action: 'block',
|
|
208
|
+
minConfidence: 0.5,
|
|
209
|
+
redactMatches: false,
|
|
210
|
+
categories: {
|
|
211
|
+
instructionOverride: true,
|
|
212
|
+
systemLeak: true,
|
|
213
|
+
jailbreak: true,
|
|
214
|
+
encodedPayload: true,
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
approval: {
|
|
219
|
+
native: { enabled: true, timeout: 300 },
|
|
220
|
+
agentConfirm: { enabled: true, parameterName: '_clawsec_confirm' },
|
|
221
|
+
webhook: { enabled: false, url: undefined, timeout: 30, headers: {} },
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
return createBeforeToolCallHandler(defaultConfig);
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../../src/hooks/before-tool-call/handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAclE;;;GAGG;AACH,SAAS,eAAe,CAAC,WAAgC;IACvD,OAAO;QACL,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,iDAAiD;QACjD,GAAG,EAAE,OAAO,WAAW,CAAC,SAAS,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;KAC3F,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,sBAAsB,CAC7B,YAA0B,EAC1B,SAAqB;IAErB,MAAM,MAAM,GAAyB;QACnC,KAAK,EAAE,YAAY,CAAC,OAAO;KAC5B,CAAC;IAEF,mCAAmC;IACnC,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QAClD,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC;IAC7C,CAAC;IAED,sCA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AE,EAAE,OAAO,EAAE,EAAE,EAAE;SACtE;KACF,CAAC;IAEF,OAAO,2BAA2B,CAAC,aAAa,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Before Tool Call Hook
|
|
3
|
+
* Re-exports for the before-tool-call hook
|
|
4
|
+
*/
|
|
5
|
+
export type { BeforeToolCallHandlerOptions } from './handler.js';
|
|
6
|
+
export { createBeforeToolCallHandler, createDefaultBeforeToolCallHandler, } from './handler.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/before-tool-call/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/before-tool-call/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Filtering Logic for Tool Result Persist Hook
|
|
3
|
+
*
|
|
4
|
+
* Scans tool outputs for secrets/PII and redacts sensitive data
|
|
5
|
+
* before it's persisted.
|
|
6
|
+
*/
|
|
7
|
+
import type { SecretsDetectionResult } from '../../detectors/secrets/types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a single redaction made to the output
|
|
10
|
+
*/
|
|
11
|
+
export interface Redaction {
|
|
12
|
+
/** Type of secret that was redacted (e.g., 'openai-api-key', 'ssn', 'jwt') */
|
|
13
|
+
type: string;
|
|
14
|
+
/** Human-readable description of what was redacted */
|
|
15
|
+
description: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Result of filtering an output
|
|
19
|
+
*/
|
|
20
|
+
export interface FilterResult {
|
|
21
|
+
/** The filtered output with secrets redacted */
|
|
22
|
+
filteredOutput: unknown;
|
|
23
|
+
/** List of redactions made */
|
|
24
|
+
redactions: Redaction[];
|
|
25
|
+
/** Whether any redactions were made */
|
|
26
|
+
wasRedacted: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Redact a single string value using pattern matching
|
|
30
|
+
*
|
|
31
|
+
* @param text - The text to scan and redact
|
|
32
|
+
* @returns FilterResult with redacted text and list of redactions
|
|
33
|
+
*/
|
|
34
|
+
export declare function redactString(text: string): FilterResult;
|
|
35
|
+
/**
|
|
36
|
+
* Recursively filter an object, redacting secrets in string values
|
|
37
|
+
*
|
|
38
|
+
* @param obj - The object to filter
|
|
39
|
+
* @returns FilterResult with filtered object and aggregated redactions
|
|
40
|
+
*/
|
|
41
|
+
export declare function redactObject(obj: Record<string, unknown>): FilterResult;
|
|
42
|
+
/**
|
|
43
|
+
* Recursively filter an array, redacting secrets in string values
|
|
44
|
+
*
|
|
45
|
+
* @param arr - The array to filter
|
|
46
|
+
* @returns FilterResult with filtered array and aggregated redactions
|
|
47
|
+
*/
|
|
48
|
+
export declare function redactArray(arr: unknown[]): FilterResult;
|
|
49
|
+
/**
|
|
50
|
+
* Filter any value, dispatching to the appropriate handler based on type
|
|
51
|
+
*
|
|
52
|
+
* @param value - The value to filter (can be any type)
|
|
53
|
+
* @returns FilterResult with filtered value and redactions
|
|
54
|
+
*/
|
|
55
|
+
export declare function filterValue(value: unknown): FilterResult;
|
|
56
|
+
/**
|
|
57
|
+
* Convert secrets detection results to redactions
|
|
58
|
+
*
|
|
59
|
+
* @param detections - Array of detection results from the secrets detector
|
|
60
|
+
* @returns Array of redactions based on the detections
|
|
61
|
+
*/
|
|
62
|
+
export declare function detectionsToRedactions(detections: SecretsDetectionResult[]): Redaction[];
|
|
63
|
+
/**
|
|
64
|
+
* Main filter function that combines pattern-based filtering
|
|
65
|
+
* with detection-based redaction info
|
|
66
|
+
*
|
|
67
|
+
* @param output - The tool output to filter
|
|
68
|
+
* @param detections - Optional array of detection results for more accurate redaction types
|
|
69
|
+
* @returns FilterResult with filtered output and redactions
|
|
70
|
+
*/
|
|
71
|
+
export declare function filterOutput(output: unknown, detections?: SecretsDetectionResult[]): FilterResult;
|
|
72
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../src/hooks/tool-result-persist/filter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,cAAc,EAAE,OAAO,CAAC;IACxB,8BAA8B;IAC9B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,uCAAuC;IACvC,WAAW,EAAE,OAAO,CAAC;CACtB;AAqID;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAoCvD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAuBvE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,YAAY,CAuBxD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CA+BxD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,sBAAsB,EAAE,GACnC,SAAS,EAAE,CA4Bb;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,OAAO,EACf,UAAU,CAAC,EAAE,sBAAsB,EAAE,GACpC,YAAY,CAoBd"}
|