shield360 1.0.1 → 1.2.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/README.md +392 -37
- package/dist/__tests__/build-info.test.d.ts +1 -0
- package/dist/__tests__/build-info.test.js +196 -0
- package/dist/__tests__/build-info.test.js.map +1 -0
- package/dist/__tests__/code-location.test.d.ts +1 -0
- package/dist/__tests__/code-location.test.js +180 -0
- package/dist/__tests__/code-location.test.js.map +1 -0
- package/dist/__tests__/masking.test.d.ts +1 -0
- package/dist/__tests__/masking.test.js +66 -0
- package/dist/__tests__/masking.test.js.map +1 -0
- package/dist/__tests__/pricing-claude-5.test.js +3 -0
- package/dist/__tests__/pricing-claude-5.test.js.map +1 -1
- package/dist/__tests__/register.e2e.test.d.ts +1 -0
- package/dist/__tests__/register.e2e.test.js +264 -0
- package/dist/__tests__/register.e2e.test.js.map +1 -0
- package/dist/__tests__/register.test.js +60 -0
- package/dist/__tests__/register.test.js.map +1 -1
- package/dist/agents/__tests__/agents.test.d.ts +1 -0
- package/dist/agents/__tests__/agents.test.js +529 -0
- package/dist/agents/__tests__/agents.test.js.map +1 -0
- package/dist/agents/index.d.ts +15 -0
- package/dist/agents/index.js +25 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/passport.d.ts +92 -0
- package/dist/agents/passport.js +301 -0
- package/dist/agents/passport.js.map +1 -0
- package/dist/agents/policy.d.ts +24 -0
- package/dist/agents/policy.js +93 -0
- package/dist/agents/policy.js.map +1 -0
- package/dist/agents/replay.d.ts +20 -0
- package/dist/agents/replay.js +47 -0
- package/dist/agents/replay.js.map +1 -0
- package/dist/agents/report.d.ts +30 -0
- package/dist/agents/report.js +93 -0
- package/dist/agents/report.js.map +1 -0
- package/dist/agents/types.d.ts +148 -0
- package/dist/agents/types.js +37 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/agents/verifier.d.ts +33 -0
- package/dist/agents/verifier.js +276 -0
- package/dist/agents/verifier.js.map +1 -0
- package/dist/ai-security/__tests__/bench.test.d.ts +1 -0
- package/dist/ai-security/__tests__/bench.test.js +50 -0
- package/dist/ai-security/__tests__/bench.test.js.map +1 -0
- package/dist/ai-security/__tests__/checks.test.d.ts +1 -0
- package/dist/ai-security/__tests__/checks.test.js +248 -0
- package/dist/ai-security/__tests__/checks.test.js.map +1 -0
- package/dist/ai-security/__tests__/config.test.d.ts +1 -0
- package/dist/ai-security/__tests__/config.test.js +164 -0
- package/dist/ai-security/__tests__/config.test.js.map +1 -0
- package/dist/ai-security/__tests__/detection.test.d.ts +1 -0
- package/dist/ai-security/__tests__/detection.test.js +114 -0
- package/dist/ai-security/__tests__/detection.test.js.map +1 -0
- package/dist/ai-security/__tests__/fixtures.d.ts +8 -0
- package/dist/ai-security/__tests__/fixtures.js +30 -0
- package/dist/ai-security/__tests__/fixtures.js.map +1 -0
- package/dist/ai-security/__tests__/hooks.test.d.ts +1 -0
- package/dist/ai-security/__tests__/hooks.test.js +174 -0
- package/dist/ai-security/__tests__/hooks.test.js.map +1 -0
- package/dist/ai-security/__tests__/stream.test.d.ts +1 -0
- package/dist/ai-security/__tests__/stream.test.js +85 -0
- package/dist/ai-security/__tests__/stream.test.js.map +1 -0
- package/dist/ai-security/config.d.ts +94 -0
- package/dist/ai-security/config.js +241 -0
- package/dist/ai-security/config.js.map +1 -0
- package/dist/ai-security/context.d.ts +45 -0
- package/dist/ai-security/context.js +108 -0
- package/dist/ai-security/context.js.map +1 -0
- package/dist/ai-security/custom-kinds.d.ts +23 -0
- package/dist/ai-security/custom-kinds.js +97 -0
- package/dist/ai-security/custom-kinds.js.map +1 -0
- package/dist/ai-security/events.d.ts +77 -0
- package/dist/ai-security/events.js +153 -0
- package/dist/ai-security/events.js.map +1 -0
- package/dist/ai-security/hooks.d.ts +48 -0
- package/dist/ai-security/hooks.js +461 -0
- package/dist/ai-security/hooks.js.map +1 -0
- package/dist/ai-security/index.d.ts +209 -0
- package/dist/ai-security/index.js +587 -0
- package/dist/ai-security/index.js.map +1 -0
- package/dist/ai-security/injection-rules.json +1024 -0
- package/dist/ai-security/injection.d.ts +46 -0
- package/dist/ai-security/injection.js +635 -0
- package/dist/ai-security/injection.js.map +1 -0
- package/dist/ai-security/jailbreak.d.ts +38 -0
- package/dist/ai-security/jailbreak.js +73 -0
- package/dist/ai-security/jailbreak.js.map +1 -0
- package/dist/ai-security/limits.d.ts +84 -0
- package/dist/ai-security/limits.js +195 -0
- package/dist/ai-security/limits.js.map +1 -0
- package/dist/ai-security/mcp.d.ts +82 -0
- package/dist/ai-security/mcp.js +150 -0
- package/dist/ai-security/mcp.js.map +1 -0
- package/dist/ai-security/output.d.ts +107 -0
- package/dist/ai-security/output.js +390 -0
- package/dist/ai-security/output.js.map +1 -0
- package/dist/ai-security/policy.d.ts +125 -0
- package/dist/ai-security/policy.js +196 -0
- package/dist/ai-security/policy.js.map +1 -0
- package/dist/ai-security/rag.d.ts +70 -0
- package/dist/ai-security/rag.js +174 -0
- package/dist/ai-security/rag.js.map +1 -0
- package/dist/ai-security/tool-rules.json +203 -0
- package/dist/ai-security/tools.d.ts +46 -0
- package/dist/ai-security/tools.js +62 -0
- package/dist/ai-security/tools.js.map +1 -0
- package/dist/budgets/__tests__/budgets.test.d.ts +1 -0
- package/dist/budgets/__tests__/budgets.test.js +134 -0
- package/dist/budgets/__tests__/budgets.test.js.map +1 -0
- package/dist/budgets/auto.d.ts +25 -0
- package/dist/budgets/auto.js +63 -0
- package/dist/budgets/auto.js.map +1 -0
- package/dist/budgets/index.d.ts +110 -0
- package/dist/budgets/index.js +239 -0
- package/dist/budgets/index.js.map +1 -0
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/customer/__tests__/customer.test.d.ts +1 -0
- package/dist/customer/__tests__/customer.test.js +155 -0
- package/dist/customer/__tests__/customer.test.js.map +1 -0
- package/dist/customer/index.d.ts +48 -0
- package/dist/customer/index.js +132 -0
- package/dist/customer/index.js.map +1 -0
- package/dist/feedback/__tests__/feedback.test.d.ts +1 -0
- package/dist/feedback/__tests__/feedback.test.js +80 -0
- package/dist/feedback/__tests__/feedback.test.js.map +1 -0
- package/dist/feedback/index.d.ts +48 -0
- package/dist/feedback/index.js +97 -0
- package/dist/feedback/index.js.map +1 -0
- package/dist/flags/__tests__/flags.test.d.ts +1 -0
- package/dist/flags/__tests__/flags.test.js +301 -0
- package/dist/flags/__tests__/flags.test.js.map +1 -0
- package/dist/flags/client.d.ts +131 -0
- package/dist/flags/client.js +301 -0
- package/dist/flags/client.js.map +1 -0
- package/dist/flags/engine.d.ts +200 -0
- package/dist/flags/engine.js +677 -0
- package/dist/flags/engine.js.map +1 -0
- package/dist/flags/index.d.ts +4 -0
- package/dist/flags/index.js +16 -0
- package/dist/flags/index.js.map +1 -0
- package/dist/guard/__tests__/findings.test.js +28 -9
- package/dist/guard/__tests__/findings.test.js.map +1 -1
- package/dist/guard/__tests__/report.test.js +67 -0
- package/dist/guard/__tests__/report.test.js.map +1 -1
- package/dist/guard/base.d.ts +2 -0
- package/dist/guard/base.js +4 -0
- package/dist/guard/base.js.map +1 -1
- package/dist/guard/findings.d.ts +12 -2
- package/dist/guard/findings.js +19 -49
- package/dist/guard/findings.js.map +1 -1
- package/dist/guard/heartbeat.d.ts +34 -0
- package/dist/guard/heartbeat.js +83 -0
- package/dist/guard/heartbeat.js.map +1 -0
- package/dist/guard/integration.d.ts +33 -3
- package/dist/guard/integration.js +106 -32
- package/dist/guard/integration.js.map +1 -1
- package/dist/guard/pipeline.d.ts +10 -1
- package/dist/guard/pipeline.js +14 -0
- package/dist/guard/pipeline.js.map +1 -1
- package/dist/guard/report.d.ts +24 -1
- package/dist/guard/report.js +67 -18
- package/dist/guard/report.js.map +1 -1
- package/dist/index.d.ts +90 -0
- package/dist/index.js +225 -3
- package/dist/index.js.map +1 -1
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js +1 -1
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js.map +1 -1
- package/dist/instrumentation/anthropic/wrapper.js +4 -0
- package/dist/instrumentation/anthropic/wrapper.js.map +1 -1
- package/dist/instrumentation/mcp/wrapper.js +7 -1
- package/dist/instrumentation/mcp/wrapper.js.map +1 -1
- package/dist/instrumentation/openai/wrapper.js +6 -0
- package/dist/instrumentation/openai/wrapper.js.map +1 -1
- package/dist/masking.d.ts +42 -0
- package/dist/masking.js +197 -0
- package/dist/masking.js.map +1 -0
- package/dist/otel/__tests__/app-logs-safety.test.d.ts +1 -0
- package/dist/otel/__tests__/app-logs-safety.test.js +129 -0
- package/dist/otel/__tests__/app-logs-safety.test.js.map +1 -0
- package/dist/otel/__tests__/app-logs.test.d.ts +1 -0
- package/dist/otel/__tests__/app-logs.test.js +269 -0
- package/dist/otel/__tests__/app-logs.test.js.map +1 -0
- package/dist/otel/__tests__/log-auto.test.d.ts +1 -0
- package/dist/otel/__tests__/log-auto.test.js +125 -0
- package/dist/otel/__tests__/log-auto.test.js.map +1 -0
- package/dist/otel/__tests__/log-bridges.test.d.ts +1 -0
- package/dist/otel/__tests__/log-bridges.test.js +170 -0
- package/dist/otel/__tests__/log-bridges.test.js.map +1 -0
- package/dist/otel/__tests__/system-metrics.test.d.ts +1 -0
- package/dist/otel/__tests__/system-metrics.test.js +79 -0
- package/dist/otel/__tests__/system-metrics.test.js.map +1 -0
- package/dist/otel/app-logs.d.ts +80 -0
- package/dist/otel/app-logs.js +195 -0
- package/dist/otel/app-logs.js.map +1 -0
- package/dist/otel/build-info.d.ts +23 -0
- package/dist/otel/build-info.js +176 -0
- package/dist/otel/build-info.js.map +1 -0
- package/dist/otel/code-location.d.ts +49 -0
- package/dist/otel/code-location.js +233 -0
- package/dist/otel/code-location.js.map +1 -0
- package/dist/otel/events.d.ts +1 -0
- package/dist/otel/events.js +21 -12
- package/dist/otel/events.js.map +1 -1
- package/dist/otel/log-auto.d.ts +44 -0
- package/dist/otel/log-auto.js +200 -0
- package/dist/otel/log-auto.js.map +1 -0
- package/dist/otel/log-bridges.d.ts +54 -0
- package/dist/otel/log-bridges.js +307 -0
- package/dist/otel/log-bridges.js.map +1 -0
- package/dist/otel/system-metrics.d.ts +39 -0
- package/dist/otel/system-metrics.js +166 -0
- package/dist/otel/system-metrics.js.map +1 -0
- package/dist/otel/tracing.js +12 -1
- package/dist/otel/tracing.js.map +1 -1
- package/dist/pricing.json +100 -42
- package/dist/protect/__tests__/protect.test.d.ts +1 -0
- package/dist/protect/__tests__/protect.test.js +210 -0
- package/dist/protect/__tests__/protect.test.js.map +1 -0
- package/dist/protect/index.d.ts +103 -0
- package/dist/protect/index.js +196 -0
- package/dist/protect/index.js.map +1 -0
- package/dist/protect/mcp.d.ts +13 -0
- package/dist/protect/mcp.js +49 -0
- package/dist/protect/mcp.js.map +1 -0
- package/dist/protect/mode.d.ts +89 -0
- package/dist/protect/mode.js +134 -0
- package/dist/protect/mode.js.map +1 -0
- package/dist/rasp/__tests__/auto-http.test.d.ts +1 -0
- package/dist/rasp/__tests__/auto-http.test.js +136 -0
- package/dist/rasp/__tests__/auto-http.test.js.map +1 -0
- package/dist/rasp/__tests__/baseline.test.d.ts +1 -0
- package/dist/rasp/__tests__/baseline.test.js +86 -0
- package/dist/rasp/__tests__/baseline.test.js.map +1 -0
- package/dist/rasp/__tests__/benign-corpus.test.d.ts +1 -0
- package/dist/rasp/__tests__/benign-corpus.test.js +68 -0
- package/dist/rasp/__tests__/benign-corpus.test.js.map +1 -0
- package/dist/rasp/__tests__/capture-context.test.d.ts +1 -0
- package/dist/rasp/__tests__/capture-context.test.js +135 -0
- package/dist/rasp/__tests__/capture-context.test.js.map +1 -0
- package/dist/rasp/__tests__/code-hook.test.d.ts +1 -0
- package/dist/rasp/__tests__/code-hook.test.js +218 -0
- package/dist/rasp/__tests__/code-hook.test.js.map +1 -0
- package/dist/rasp/__tests__/config-client.test.d.ts +1 -0
- package/dist/rasp/__tests__/config-client.test.js +283 -0
- package/dist/rasp/__tests__/config-client.test.js.map +1 -0
- package/dist/rasp/__tests__/corpus.d.ts +13 -0
- package/dist/rasp/__tests__/corpus.js +111 -0
- package/dist/rasp/__tests__/corpus.js.map +1 -0
- package/dist/rasp/__tests__/custom-rules.test.d.ts +1 -0
- package/dist/rasp/__tests__/custom-rules.test.js +276 -0
- package/dist/rasp/__tests__/custom-rules.test.js.map +1 -0
- package/dist/rasp/__tests__/db-hook.test.d.ts +1 -0
- package/dist/rasp/__tests__/db-hook.test.js +438 -0
- package/dist/rasp/__tests__/db-hook.test.js.map +1 -0
- package/dist/rasp/__tests__/deception.test.d.ts +1 -0
- package/dist/rasp/__tests__/deception.test.js +567 -0
- package/dist/rasp/__tests__/deception.test.js.map +1 -0
- package/dist/rasp/__tests__/detect.test.d.ts +1 -0
- package/dist/rasp/__tests__/detect.test.js +276 -0
- package/dist/rasp/__tests__/detect.test.js.map +1 -0
- package/dist/rasp/__tests__/esm-exports.test.d.ts +1 -0
- package/dist/rasp/__tests__/esm-exports.test.js +20 -0
- package/dist/rasp/__tests__/esm-exports.test.js.map +1 -0
- package/dist/rasp/__tests__/fs-hook.test.d.ts +1 -0
- package/dist/rasp/__tests__/fs-hook.test.js +241 -0
- package/dist/rasp/__tests__/fs-hook.test.js.map +1 -0
- package/dist/rasp/__tests__/hook-contracts.test.d.ts +1 -0
- package/dist/rasp/__tests__/hook-contracts.test.js +201 -0
- package/dist/rasp/__tests__/hook-contracts.test.js.map +1 -0
- package/dist/rasp/__tests__/hook-kit.d.ts +42 -0
- package/dist/rasp/__tests__/hook-kit.js +139 -0
- package/dist/rasp/__tests__/hook-kit.js.map +1 -0
- package/dist/rasp/__tests__/http-hook.test.d.ts +1 -0
- package/dist/rasp/__tests__/http-hook.test.js +250 -0
- package/dist/rasp/__tests__/http-hook.test.js.map +1 -0
- package/dist/rasp/__tests__/iast.test.d.ts +1 -0
- package/dist/rasp/__tests__/iast.test.js +361 -0
- package/dist/rasp/__tests__/iast.test.js.map +1 -0
- package/dist/rasp/__tests__/include-hook.test.d.ts +1 -0
- package/dist/rasp/__tests__/include-hook.test.js +122 -0
- package/dist/rasp/__tests__/include-hook.test.js.map +1 -0
- package/dist/rasp/__tests__/middleware.test.d.ts +1 -0
- package/dist/rasp/__tests__/middleware.test.js +302 -0
- package/dist/rasp/__tests__/middleware.test.js.map +1 -0
- package/dist/rasp/__tests__/process-hook.test.d.ts +1 -0
- package/dist/rasp/__tests__/process-hook.test.js +238 -0
- package/dist/rasp/__tests__/process-hook.test.js.map +1 -0
- package/dist/rasp/__tests__/reporter.test.d.ts +1 -0
- package/dist/rasp/__tests__/reporter.test.js +114 -0
- package/dist/rasp/__tests__/reporter.test.js.map +1 -0
- package/dist/rasp/__tests__/route.test.d.ts +1 -0
- package/dist/rasp/__tests__/route.test.js +46 -0
- package/dist/rasp/__tests__/route.test.js.map +1 -0
- package/dist/rasp/__tests__/rule-expr.test.d.ts +1 -0
- package/dist/rasp/__tests__/rule-expr.test.js +151 -0
- package/dist/rasp/__tests__/rule-expr.test.js.map +1 -0
- package/dist/rasp/__tests__/rule-phases.test.d.ts +1 -0
- package/dist/rasp/__tests__/rule-phases.test.js +271 -0
- package/dist/rasp/__tests__/rule-phases.test.js.map +1 -0
- package/dist/rasp/__tests__/sinks-hook.test.d.ts +1 -0
- package/dist/rasp/__tests__/sinks-hook.test.js +177 -0
- package/dist/rasp/__tests__/sinks-hook.test.js.map +1 -0
- package/dist/rasp/__tests__/targets.test.d.ts +1 -0
- package/dist/rasp/__tests__/targets.test.js +82 -0
- package/dist/rasp/__tests__/targets.test.js.map +1 -0
- package/dist/rasp/__tests__/template-hook.test.d.ts +1 -0
- package/dist/rasp/__tests__/template-hook.test.js +254 -0
- package/dist/rasp/__tests__/template-hook.test.js.map +1 -0
- package/dist/rasp/__tests__/upload.test.d.ts +1 -0
- package/dist/rasp/__tests__/upload.test.js +81 -0
- package/dist/rasp/__tests__/upload.test.js.map +1 -0
- package/dist/rasp/__tests__/vpatch-engine.test.d.ts +1 -0
- package/dist/rasp/__tests__/vpatch-engine.test.js +177 -0
- package/dist/rasp/__tests__/vpatch-engine.test.js.map +1 -0
- package/dist/rasp/auto-http.d.ts +6 -0
- package/dist/rasp/auto-http.js +194 -0
- package/dist/rasp/auto-http.js.map +1 -0
- package/dist/rasp/baseline.d.ts +35 -0
- package/dist/rasp/baseline.js +91 -0
- package/dist/rasp/baseline.js.map +1 -0
- package/dist/rasp/capture.d.ts +76 -0
- package/dist/rasp/capture.js +304 -0
- package/dist/rasp/capture.js.map +1 -0
- package/dist/rasp/config-client.d.ts +122 -0
- package/dist/rasp/config-client.js +337 -0
- package/dist/rasp/config-client.js.map +1 -0
- package/dist/rasp/context.d.ts +65 -0
- package/dist/rasp/context.js +68 -0
- package/dist/rasp/context.js.map +1 -0
- package/dist/rasp/custom-rules.d.ts +68 -0
- package/dist/rasp/custom-rules.js +222 -0
- package/dist/rasp/custom-rules.js.map +1 -0
- package/dist/rasp/data/default-rules.json +199 -0
- package/dist/rasp/data/default-sinks.json +4 -0
- package/dist/rasp/data/dnslog-domains.json +11 -0
- package/dist/rasp/deception.d.ts +70 -0
- package/dist/rasp/deception.js +220 -0
- package/dist/rasp/deception.js.map +1 -0
- package/dist/rasp/detect.d.ts +68 -0
- package/dist/rasp/detect.js +671 -0
- package/dist/rasp/detect.js.map +1 -0
- package/dist/rasp/engine.d.ts +107 -0
- package/dist/rasp/engine.js +330 -0
- package/dist/rasp/engine.js.map +1 -0
- package/dist/rasp/hooks/code.d.ts +20 -0
- package/dist/rasp/hooks/code.js +334 -0
- package/dist/rasp/hooks/code.js.map +1 -0
- package/dist/rasp/hooks/db.d.ts +48 -0
- package/dist/rasp/hooks/db.js +322 -0
- package/dist/rasp/hooks/db.js.map +1 -0
- package/dist/rasp/hooks/esm.d.ts +7 -0
- package/dist/rasp/hooks/esm.js +18 -0
- package/dist/rasp/hooks/esm.js.map +1 -0
- package/dist/rasp/hooks/fs.d.ts +3 -0
- package/dist/rasp/hooks/fs.js +206 -0
- package/dist/rasp/hooks/fs.js.map +1 -0
- package/dist/rasp/hooks/http.d.ts +4 -0
- package/dist/rasp/hooks/http.js +213 -0
- package/dist/rasp/hooks/http.js.map +1 -0
- package/dist/rasp/hooks/include.d.ts +9 -0
- package/dist/rasp/hooks/include.js +79 -0
- package/dist/rasp/hooks/include.js.map +1 -0
- package/dist/rasp/hooks/marks.d.ts +2 -0
- package/dist/rasp/hooks/marks.js +16 -0
- package/dist/rasp/hooks/marks.js.map +1 -0
- package/dist/rasp/hooks/process.d.ts +22 -0
- package/dist/rasp/hooks/process.js +191 -0
- package/dist/rasp/hooks/process.js.map +1 -0
- package/dist/rasp/hooks/sinks.d.ts +54 -0
- package/dist/rasp/hooks/sinks.js +329 -0
- package/dist/rasp/hooks/sinks.js.map +1 -0
- package/dist/rasp/hooks/template.d.ts +21 -0
- package/dist/rasp/hooks/template.js +152 -0
- package/dist/rasp/hooks/template.js.map +1 -0
- package/dist/rasp/iast-rules.d.ts +82 -0
- package/dist/rasp/iast-rules.js +240 -0
- package/dist/rasp/iast-rules.js.map +1 -0
- package/dist/rasp/iast-scope.d.ts +29 -0
- package/dist/rasp/iast-scope.js +54 -0
- package/dist/rasp/iast-scope.js.map +1 -0
- package/dist/rasp/iast.d.ts +81 -0
- package/dist/rasp/iast.js +272 -0
- package/dist/rasp/iast.js.map +1 -0
- package/dist/rasp/index.d.ts +52 -0
- package/dist/rasp/index.js +280 -0
- package/dist/rasp/index.js.map +1 -0
- package/dist/rasp/lexers.d.ts +32 -0
- package/dist/rasp/lexers.js +444 -0
- package/dist/rasp/lexers.js.map +1 -0
- package/dist/rasp/middleware.d.ts +155 -0
- package/dist/rasp/middleware.js +568 -0
- package/dist/rasp/middleware.js.map +1 -0
- package/dist/rasp/model-output.d.ts +14 -0
- package/dist/rasp/model-output.js +107 -0
- package/dist/rasp/model-output.js.map +1 -0
- package/dist/rasp/normalize.d.ts +23 -0
- package/dist/rasp/normalize.js +140 -0
- package/dist/rasp/normalize.js.map +1 -0
- package/dist/rasp/reporter.d.ts +60 -0
- package/dist/rasp/reporter.js +230 -0
- package/dist/rasp/reporter.js.map +1 -0
- package/dist/rasp/rule-expr.d.ts +236 -0
- package/dist/rasp/rule-expr.js +1253 -0
- package/dist/rasp/rule-expr.js.map +1 -0
- package/dist/rasp/template.d.ts +53 -0
- package/dist/rasp/template.js +336 -0
- package/dist/rasp/template.js.map +1 -0
- package/dist/rasp/types.d.ts +110 -0
- package/dist/rasp/types.js +51 -0
- package/dist/rasp/types.js.map +1 -0
- package/dist/rasp/vpatch.d.ts +55 -0
- package/dist/rasp/vpatch.js +120 -0
- package/dist/rasp/vpatch.js.map +1 -0
- package/dist/register.js +52 -11
- package/dist/register.js.map +1 -1
- package/dist/semantic-convention.d.ts +2 -0
- package/dist/semantic-convention.js +5 -0
- package/dist/semantic-convention.js.map +1 -1
- package/dist/types.d.ts +96 -0
- package/dist/zero-code.d.ts +8 -0
- package/dist/zero-code.js +38 -0
- package/dist/zero-code.js.map +1 -0
- package/package.json +18 -2
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SuspiciousTable = exports.DECEPTION_SINK = exports.SUSPICIOUS_RULE = exports.HIT_RULE = exports.MAX_SUSPICIOUS = exports.MAX_TTL_S = exports.DEFAULT_TTL_S = exports.MAX_DECOY_LENGTH = exports.MAX_DECOYS = void 0;
|
|
4
|
+
exports.parseDeception = parseDeception;
|
|
5
|
+
exports.matchDecoy = matchDecoy;
|
|
6
|
+
exports.suspiciousTable = suspiciousTable;
|
|
7
|
+
exports.setSuspiciousTable = setSuspiciousTable;
|
|
8
|
+
exports.checkDeception = checkDeception;
|
|
9
|
+
/**
|
|
10
|
+
* Deception (README "Deception"): decoy paths from the signed config's
|
|
11
|
+
* `deception` block. A request for a decoy never reaches the app: it gets the
|
|
12
|
+
* not-found answer and its client address is marked suspicious for
|
|
13
|
+
* `ttlSeconds`; later requests from that address are reported, and blocked
|
|
14
|
+
* when the decision is `blocked`.
|
|
15
|
+
*
|
|
16
|
+
* The config reader and the matcher are pure; the suspicious-address table is
|
|
17
|
+
* in memory, per process. Every adapter calls `checkDeception` first, before
|
|
18
|
+
* capture, and it fails open: any error lets the request through.
|
|
19
|
+
*/
|
|
20
|
+
const context_1 = require("./context");
|
|
21
|
+
const engine_1 = require("./engine");
|
|
22
|
+
const types_1 = require("./types");
|
|
23
|
+
exports.MAX_DECOYS = 64;
|
|
24
|
+
exports.MAX_DECOY_LENGTH = 256;
|
|
25
|
+
exports.DEFAULT_TTL_S = 900;
|
|
26
|
+
exports.MAX_TTL_S = 86400;
|
|
27
|
+
exports.MAX_SUSPICIOUS = 10000;
|
|
28
|
+
exports.HIT_RULE = 'deception.hit';
|
|
29
|
+
exports.SUSPICIOUS_RULE = 'deception.suspicious';
|
|
30
|
+
exports.DECEPTION_SINK = 'http.deception';
|
|
31
|
+
/** Reads the signed config's `deception` value ("Deception", "Config"); null when deception is off. */
|
|
32
|
+
function parseDeception(v) {
|
|
33
|
+
if (!v || typeof v !== 'object' || Array.isArray(v))
|
|
34
|
+
return null;
|
|
35
|
+
const o = v;
|
|
36
|
+
if (!Array.isArray(o.paths))
|
|
37
|
+
return null;
|
|
38
|
+
const paths = [];
|
|
39
|
+
for (const p of o.paths) {
|
|
40
|
+
if (paths.length >= exports.MAX_DECOYS)
|
|
41
|
+
break;
|
|
42
|
+
if (typeof p !== 'string' || p.length > exports.MAX_DECOY_LENGTH || !p.startsWith('/'))
|
|
43
|
+
continue;
|
|
44
|
+
const trimmed = p.endsWith('/') ? p.slice(0, -1) : p;
|
|
45
|
+
if (trimmed === '' || trimmed === '/')
|
|
46
|
+
continue;
|
|
47
|
+
paths.push(trimmed);
|
|
48
|
+
}
|
|
49
|
+
if (!paths.length)
|
|
50
|
+
return null;
|
|
51
|
+
const ttl = o.ttlSeconds;
|
|
52
|
+
return {
|
|
53
|
+
paths,
|
|
54
|
+
action: o.action === 'block' ? 'block' : 'monitor',
|
|
55
|
+
ttlSeconds: typeof ttl === 'number' && Number.isFinite(ttl) && ttl >= 1 ? Math.min(Math.floor(ttl), exports.MAX_TTL_S) : exports.DEFAULT_TTL_S,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const NON_ASCII = /[\u0080-\uffff]/;
|
|
59
|
+
const hex = (c) => (c >= 48 && c <= 57 ? c - 48 : c >= 65 && c <= 70 ? c - 55 : c >= 97 && c <= 102 ? c - 87 : -1);
|
|
60
|
+
/**
|
|
61
|
+
* The decoy a request target hits, or null ("Deception", "Matching"). The
|
|
62
|
+
* path (before the first `?`) is percent-decoded once and compared byte for
|
|
63
|
+
* byte with each decoy's UTF-8. Both sides are kept as binary strings (one
|
|
64
|
+
* character per byte): Node's `req.url` already holds the target's bytes that
|
|
65
|
+
* way (it reads them as latin1); a character above U+00FF, which only a
|
|
66
|
+
* caller's own string can hold, counts as its UTF-8 bytes.
|
|
67
|
+
*/
|
|
68
|
+
function matchDecoy(target, decoys) {
|
|
69
|
+
const q = target.indexOf('?');
|
|
70
|
+
const raw = q >= 0 ? target.slice(0, q) : target;
|
|
71
|
+
let path = raw;
|
|
72
|
+
if (raw.includes('%') || NON_ASCII.test(raw)) {
|
|
73
|
+
path = '';
|
|
74
|
+
for (let i = 0; i < raw.length; i++) {
|
|
75
|
+
const c = raw.charCodeAt(i);
|
|
76
|
+
if (c === 37) {
|
|
77
|
+
const h = hex(raw.charCodeAt(i + 1));
|
|
78
|
+
const l = hex(raw.charCodeAt(i + 2));
|
|
79
|
+
if (h < 0 || l < 0)
|
|
80
|
+
return null;
|
|
81
|
+
path += String.fromCharCode(h * 16 + l);
|
|
82
|
+
i += 2;
|
|
83
|
+
}
|
|
84
|
+
else if (c <= 0xff) {
|
|
85
|
+
path += raw[i];
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const cp = raw.codePointAt(i);
|
|
89
|
+
path += Buffer.from(String.fromCodePoint(cp), 'utf8').toString('latin1');
|
|
90
|
+
if (cp > 0xffff)
|
|
91
|
+
i++;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (const d of decoys) {
|
|
96
|
+
const b = NON_ASCII.test(d) ? Buffer.from(d, 'utf8').toString('latin1') : d;
|
|
97
|
+
if (path === b || path.startsWith(`${b}/`))
|
|
98
|
+
return d;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Suspicious client addresses, at most `cap` entries, kept in expiry order
|
|
104
|
+
* (soonest first; equal expiries in marking order), so a TTL lowered by a new
|
|
105
|
+
* config never leaves an expired mark behind a live one. Marking a new
|
|
106
|
+
* address when full first drops every expired mark, then the mark closest to
|
|
107
|
+
* expiring. Single threaded, so no locking.
|
|
108
|
+
*/
|
|
109
|
+
class SuspiciousTable {
|
|
110
|
+
constructor(cap = exports.MAX_SUSPICIOUS, now = Date.now) {
|
|
111
|
+
this.cap = cap;
|
|
112
|
+
this.now = now;
|
|
113
|
+
this.marks = new Map();
|
|
114
|
+
}
|
|
115
|
+
unlink(m) {
|
|
116
|
+
if (m.prev)
|
|
117
|
+
m.prev.next = m.next;
|
|
118
|
+
else
|
|
119
|
+
this.head = m.next;
|
|
120
|
+
if (m.next)
|
|
121
|
+
m.next.prev = m.prev;
|
|
122
|
+
else
|
|
123
|
+
this.tail = m.prev;
|
|
124
|
+
m.prev = m.next = undefined;
|
|
125
|
+
this.marks.delete(m.ip);
|
|
126
|
+
}
|
|
127
|
+
/** Marks (or marks again, restarting the time) an address for `ttlSeconds`. */
|
|
128
|
+
mark(ip, ttlSeconds) {
|
|
129
|
+
const now = this.now();
|
|
130
|
+
const until = now + ttlSeconds * 1000;
|
|
131
|
+
const old = this.marks.get(ip);
|
|
132
|
+
if (old)
|
|
133
|
+
this.unlink(old);
|
|
134
|
+
else if (this.marks.size >= this.cap) {
|
|
135
|
+
while (this.head && this.head.until <= now)
|
|
136
|
+
this.unlink(this.head);
|
|
137
|
+
if (this.marks.size >= this.cap && this.head)
|
|
138
|
+
this.unlink(this.head);
|
|
139
|
+
}
|
|
140
|
+
// After the last mark that expires no later: an append while the TTL stays the same.
|
|
141
|
+
let after = this.tail;
|
|
142
|
+
while (after && after.until > until)
|
|
143
|
+
after = after.prev;
|
|
144
|
+
const m = { ip, until, prev: after, next: after ? after.next : this.head };
|
|
145
|
+
if (m.next)
|
|
146
|
+
m.next.prev = m;
|
|
147
|
+
else
|
|
148
|
+
this.tail = m;
|
|
149
|
+
if (after)
|
|
150
|
+
after.next = m;
|
|
151
|
+
else
|
|
152
|
+
this.head = m;
|
|
153
|
+
this.marks.set(ip, m);
|
|
154
|
+
}
|
|
155
|
+
/** Whether an address is marked; an expired mark is dropped. Never extends a mark. */
|
|
156
|
+
isMarked(ip) {
|
|
157
|
+
const m = this.marks.get(ip);
|
|
158
|
+
if (!m)
|
|
159
|
+
return false;
|
|
160
|
+
if (m.until <= this.now()) {
|
|
161
|
+
this.unlink(m);
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
get size() {
|
|
167
|
+
return this.marks.size;
|
|
168
|
+
}
|
|
169
|
+
/** The marked addresses, soonest to expire first (tests). */
|
|
170
|
+
keys() {
|
|
171
|
+
const out = [];
|
|
172
|
+
for (let m = this.head; m; m = m.next)
|
|
173
|
+
out.push(m.ip);
|
|
174
|
+
return out;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.SuspiciousTable = SuspiciousTable;
|
|
178
|
+
let table = new SuspiciousTable();
|
|
179
|
+
/** The process's table (tests). */
|
|
180
|
+
function suspiciousTable() {
|
|
181
|
+
return table;
|
|
182
|
+
}
|
|
183
|
+
/** Replaces the process's table (tests: a small cap, a fake clock). */
|
|
184
|
+
function setSuspiciousTable(t) {
|
|
185
|
+
table = t;
|
|
186
|
+
}
|
|
187
|
+
const PASS = {};
|
|
188
|
+
/**
|
|
189
|
+
* Runs deception for a request ("Deception", "Decision"). Call it only while
|
|
190
|
+
* RASP is active, before anything else. Never throws: an error lets the
|
|
191
|
+
* request through as if deception were off.
|
|
192
|
+
*/
|
|
193
|
+
function checkDeception(r) {
|
|
194
|
+
try {
|
|
195
|
+
const cfg = (0, engine_1.deceptionConfig)();
|
|
196
|
+
if (!cfg)
|
|
197
|
+
return PASS;
|
|
198
|
+
const mode = (0, engine_1.deceptionMode)();
|
|
199
|
+
if (!mode)
|
|
200
|
+
return PASS;
|
|
201
|
+
const block = cfg.action === 'block' && mode === 'block';
|
|
202
|
+
const extra = { framework: r.framework, method: r.method };
|
|
203
|
+
const decoy = matchDecoy(r.url, cfg.paths);
|
|
204
|
+
if (decoy !== null) {
|
|
205
|
+
if (r.ip)
|
|
206
|
+
table.mark(r.ip, cfg.ttlSeconds);
|
|
207
|
+
(0, engine_1.reportDeception)(exports.HIT_RULE, block, { ...extra, route: decoy });
|
|
208
|
+
return { notFound: true };
|
|
209
|
+
}
|
|
210
|
+
if (!r.ip || !table.isMarked(r.ip))
|
|
211
|
+
return PASS;
|
|
212
|
+
const q = r.url.indexOf('?');
|
|
213
|
+
const eventId = (0, engine_1.reportDeception)(exports.SUSPICIOUS_RULE, block, { ...extra, route: (0, context_1.eventRouteOf)(q >= 0 ? r.url.slice(0, q) : r.url) });
|
|
214
|
+
return block ? { blocked: new types_1.RaspBlockedError('deception', exports.SUSPICIOUS_RULE, eventId) } : PASS;
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
return PASS;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=deception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deception.js","sourceRoot":"","sources":["../../src/rasp/deception.ts"],"names":[],"mappings":";;;AA2BA,wCAmBC;AAaD,gCA4BC;AA6ED,0CAEC;AAGD,gDAEC;AAeD,wCAqBC;AA/MD;;;;;;;;;;GAUG;AACH,uCAAyC;AACzC,qCAA2E;AAC3E,mCAA2C;AAI9B,QAAA,UAAU,GAAG,EAAE,CAAC;AAChB,QAAA,gBA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CAAC,CAAC;QAC3C,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,CAAC,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;YAC3C,IAAA,wBAAe,EAAC,gBAAQ,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YAC7D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QAChD,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,OAAO,GAAG,IAAA,wBAAe,EAAC,uBAAe,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,IAAA,sBAAY,EAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC/H,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,wBAAgB,CAAC,WAAW,EAAE,uBAAe,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACjG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type SqlDialect } from './lexers';
|
|
2
|
+
import type { Finding, RaspInput } from './types';
|
|
3
|
+
export declare function detectSql(query: string, inputs: RaspInput[], dialect?: SqlDialect): Finding | null;
|
|
4
|
+
export declare function detectNoSql(doc: unknown, trees: unknown[], inputs: RaspInput[]): Finding | null;
|
|
5
|
+
export declare const SHELLS: Set<string>;
|
|
6
|
+
export declare const DOWNLOADERS: Set<string>;
|
|
7
|
+
export declare function exeName(p: string): string;
|
|
8
|
+
export declare function detectCommand(command: string, inputs: RaspInput[]): Finding | null;
|
|
9
|
+
/** argv spawns: the executable equals an input. */
|
|
10
|
+
export declare function detectArgv(argv: string[], inputs: RaspInput[]): Finding | null;
|
|
11
|
+
/** shell_spawn: a shell or downloader started during a request, or curl|sh at any time. */
|
|
12
|
+
export declare function detectShellSpawn(opts: {
|
|
13
|
+
argv0?: string;
|
|
14
|
+
command?: string;
|
|
15
|
+
inRequest: boolean;
|
|
16
|
+
allow: string[];
|
|
17
|
+
}): Finding | null;
|
|
18
|
+
/** The script of `sh -c <script>` style argv, if any. */
|
|
19
|
+
export declare function shellScriptOf(argv: string[]): string | null;
|
|
20
|
+
export declare function normPath(p: string): string;
|
|
21
|
+
export declare function resolvePath(p: string, cwd?: string): string;
|
|
22
|
+
export declare const SCRIPT_FILE: RegExp;
|
|
23
|
+
export declare function underRoot(resolved: string, root: string): boolean;
|
|
24
|
+
/** The directory path.outside_root reports: the resolved path up to its last `/` (README "Allow-list targets"). */
|
|
25
|
+
export declare function targetDirectory(resolved: string): string;
|
|
26
|
+
export type FileOp = 'read' | 'write' | 'append' | 'delete' | 'rename' | 'list' | 'open';
|
|
27
|
+
export declare function detectPath(path: string, op: FileOp, inputs: RaspInput[], fileRoots?: string[], inRequest?: boolean): Finding | null;
|
|
28
|
+
export declare const METADATA_HOSTS: string[];
|
|
29
|
+
/** Scheme and raw host as written (the WHATWG parser would rewrite numeric hosts). */
|
|
30
|
+
export declare function rawUrl(url: string): {
|
|
31
|
+
scheme: string;
|
|
32
|
+
host: string;
|
|
33
|
+
} | null;
|
|
34
|
+
/** Private, loopback, link-local or unique-local, IPv4-mapped/compatible decoded. */
|
|
35
|
+
export declare function isPrivateAddress(addr: string): boolean;
|
|
36
|
+
export declare function isIpLiteral(host: string): boolean;
|
|
37
|
+
export declare function hostMatches(host: string, pattern: string): boolean;
|
|
38
|
+
/** Whether an input taints the URL's host. */
|
|
39
|
+
export declare function taintOf(url: string, host: string, inputs: RaspInput[]): RaspInput | undefined;
|
|
40
|
+
export declare function detectSsrf(url: string, inputs: RaspInput[], resolved?: string[]): Finding | null;
|
|
41
|
+
/** outbound.not_allowed: host matches none of the allow-list (always-allowed hosts aside). */
|
|
42
|
+
export declare function detectOutbound(url: string, allow: string[], alwaysAllowed?: string[]): Finding | null;
|
|
43
|
+
/** Data is tainted when equal to an input, contained in one, or containing one of length >= 8. */
|
|
44
|
+
export declare function taintedData(data: string, inputs: RaspInput[]): RaspInput | undefined;
|
|
45
|
+
export type DeserFormat = 'pickle' | 'marshal' | 'yaml' | 'jsonpickle' | 'node_serialize' | 'funcster' | 'binaryformatter' | 'typename' | 'java' | 'snakeyaml';
|
|
46
|
+
export declare function detectDeserialization(format: DeserFormat, data: string, inputs: RaspInput[]): Finding | null;
|
|
47
|
+
export declare function detectCode(code: string, inputs: RaspInput[]): Finding | null;
|
|
48
|
+
/** code.include: a module specifier that is, or carries a path from, an input. */
|
|
49
|
+
export declare function detectInclude(specifier: string, inputs: RaspInput[]): Finding | null;
|
|
50
|
+
/** file_write.upload: an uploaded file whose name is a script (README "Path"). */
|
|
51
|
+
export declare function detectUpload(input: RaspInput): Finding | null;
|
|
52
|
+
type EntityDecl = {
|
|
53
|
+
name: string;
|
|
54
|
+
external: boolean;
|
|
55
|
+
uri: string;
|
|
56
|
+
value: string;
|
|
57
|
+
};
|
|
58
|
+
/** Reads the DOCTYPE: external DTD id and entity declarations. */
|
|
59
|
+
export declare function parseDoctype(xml: string): {
|
|
60
|
+
hasDoctype: boolean;
|
|
61
|
+
externalDtd: string | null;
|
|
62
|
+
entities: EntityDecl[];
|
|
63
|
+
};
|
|
64
|
+
export declare function detectXml(xml: string, inputs: RaspInput[], resolvesExternal: boolean): Finding | null;
|
|
65
|
+
export declare const MAX_XSS_BODY: number;
|
|
66
|
+
export declare function detectXss(contentType: string | undefined, body: string, inputs: RaspInput[]): Finding | null;
|
|
67
|
+
export type { SqlDialect };
|
|
68
|
+
export { detectTemplate, type TemplateEngine } from './template';
|