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,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CUSTOM_RULE_ACTIONS = exports.CUSTOM_RULE_PREFIX = exports.CUSTOM_RULE_ID = exports.MAX_RULE_APPS = exports.MAX_CUSTOM_RULES = void 0;
|
|
4
|
+
exports.resetCustomRuleWarnings = resetCustomRuleWarnings;
|
|
5
|
+
exports.parseCustomRules = parseCustomRules;
|
|
6
|
+
exports.actionMode = actionMode;
|
|
7
|
+
exports.customFinding = customFinding;
|
|
8
|
+
exports.requestSubject = requestSubject;
|
|
9
|
+
exports.ruleState = ruleState;
|
|
10
|
+
exports.matchRequestRules = matchRequestRules;
|
|
11
|
+
exports.matchFindingRules = matchFindingRules;
|
|
12
|
+
/**
|
|
13
|
+
* Custom rules (README "Custom rules"): the organization's own rules, written
|
|
14
|
+
* in the expression language of rule-expr.ts and delivered inside the signed
|
|
15
|
+
* config (`customRules`). They are data: each expression is parsed and
|
|
16
|
+
* type-checked when the config arrives and evaluated against the request (or
|
|
17
|
+
* a built-in finding) as a value. An invalid rule is skipped with one
|
|
18
|
+
* warning and never breaks the config; evaluation fails open.
|
|
19
|
+
*
|
|
20
|
+
* This file turns rules and the request context into the language's terms;
|
|
21
|
+
* the engine and capture decide what a match does.
|
|
22
|
+
*/
|
|
23
|
+
const context_1 = require("./context");
|
|
24
|
+
const rule_expr_1 = require("./rule-expr");
|
|
25
|
+
exports.MAX_CUSTOM_RULES = 64;
|
|
26
|
+
exports.MAX_RULE_APPS = 32;
|
|
27
|
+
/** Lower-case, so the event rule `custom.<id>` fits the platform's rule shape. */
|
|
28
|
+
exports.CUSTOM_RULE_ID = /^[a-z0-9][a-z0-9_-]{0,47}$/;
|
|
29
|
+
exports.CUSTOM_RULE_PREFIX = 'custom.';
|
|
30
|
+
exports.CUSTOM_RULE_ACTIONS = ['block', 'monitor', 'alert'];
|
|
31
|
+
const warned = new Set();
|
|
32
|
+
function defaultWarn(s) {
|
|
33
|
+
console.warn(`Shield360 RASP: custom rule ${s.id ? `"${s.id}"` : `#${s.index + 1}`} was skipped (${s.reason}); the other rules apply.`);
|
|
34
|
+
}
|
|
35
|
+
/** Tests only: lets the once-per-rule warnings fire again. */
|
|
36
|
+
function resetCustomRuleWarnings() {
|
|
37
|
+
warned.clear();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The rules of a signed config that apply to this app: invalid rules are
|
|
41
|
+
* skipped (one warning per rule and reason, per process), disabled rules and
|
|
42
|
+
* rules scoped to other apps are left out silently. At most 64.
|
|
43
|
+
*/
|
|
44
|
+
function parseCustomRules(raw, app, warn = defaultWarn) {
|
|
45
|
+
if (!Array.isArray(raw))
|
|
46
|
+
return [];
|
|
47
|
+
const out = [];
|
|
48
|
+
const ids = new Set();
|
|
49
|
+
const skip = (s, expression) => {
|
|
50
|
+
const key = `${s.id ?? s.index}\u0000${s.reason}\u0000${typeof expression === 'string' ? expression : ''}`;
|
|
51
|
+
if (warned.has(key))
|
|
52
|
+
return;
|
|
53
|
+
if (warned.size > 1024)
|
|
54
|
+
warned.clear();
|
|
55
|
+
warned.add(key);
|
|
56
|
+
try {
|
|
57
|
+
warn(s);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// never
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
for (let index = 0; index < raw.length; index++) {
|
|
64
|
+
try {
|
|
65
|
+
const r = raw[index];
|
|
66
|
+
if (!r || typeof r !== 'object' || Array.isArray(r)) {
|
|
67
|
+
skip({ index, reason: 'not an object' });
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const id = typeof r.id === 'string' && exports.CUSTOM_RULE_ID.test(r.id) ? r.id : undefined;
|
|
71
|
+
if (!id) {
|
|
72
|
+
skip({ index, reason: 'invalid id' });
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (ids.has(id)) {
|
|
76
|
+
skip({ index, id, reason: 'duplicate id' });
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
ids.add(id);
|
|
80
|
+
if (typeof r.enabled !== 'boolean') {
|
|
81
|
+
skip({ index, id, reason: 'invalid enabled flag' });
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (!exports.CUSTOM_RULE_ACTIONS.includes(r.action)) {
|
|
85
|
+
skip({ index, id, reason: 'invalid action' });
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (r.name !== undefined && typeof r.name !== 'string') {
|
|
89
|
+
skip({ index, id, reason: 'invalid name' });
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (r.apps !== undefined && r.apps !== null && !(Array.isArray(r.apps) && r.apps.length <= exports.MAX_RULE_APPS && r.apps.every((a) => typeof a === 'string'))) {
|
|
93
|
+
skip({ index, id, reason: 'invalid apps' });
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const compiled = (0, rule_expr_1.compileRuleExpr)(r.expression);
|
|
97
|
+
if (!compiled.ok) {
|
|
98
|
+
skip({ index, id, reason: `expression: ${compiled.error.code}` }, r.expression);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (!r.enabled)
|
|
102
|
+
continue;
|
|
103
|
+
const apps = Array.isArray(r.apps) && r.apps.length ? r.apps : undefined;
|
|
104
|
+
if (apps && !apps.includes(app))
|
|
105
|
+
continue;
|
|
106
|
+
if (out.length >= exports.MAX_CUSTOM_RULES) {
|
|
107
|
+
skip({ index, id, reason: 'more than 64 rules' });
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
out.push({ id, name: typeof r.name === 'string' ? r.name : id, action: r.action, ...(apps ? { apps } : {}), expr: compiled.expr });
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
skip({ index, reason: 'unreadable' });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
/** The most a rule does: `alert` reports like `monitor` (the platform raises the alert). */
|
|
119
|
+
function actionMode(a) {
|
|
120
|
+
return a === 'block' ? 'block' : 'monitor';
|
|
121
|
+
}
|
|
122
|
+
/** The finding a matched rule reports (attack type `custom_rule`, rule `custom.<id>`). */
|
|
123
|
+
function customFinding(rule, input) {
|
|
124
|
+
return { attack: 'custom_rule', rule: `${exports.CUSTOM_RULE_PREFIX}${rule.id}`, action: actionMode(rule.action), ...(input ? { input } : {}) };
|
|
125
|
+
}
|
|
126
|
+
const joined = (v) => (v === undefined ? undefined : Array.isArray(v) ? v.join(', ') : String(v));
|
|
127
|
+
/** The request as the language sees it (README "Custom rules: fields"). */
|
|
128
|
+
function requestSubject(ctx, app, inputs) {
|
|
129
|
+
if (!ctx)
|
|
130
|
+
return { app, inputs: [] };
|
|
131
|
+
const list = inputs ?? ctx.inputs;
|
|
132
|
+
const headers = {};
|
|
133
|
+
const raw = ctx.vp?.req.headers;
|
|
134
|
+
if (raw) {
|
|
135
|
+
for (const k of Object.keys(raw)) {
|
|
136
|
+
const v = joined(raw[k]);
|
|
137
|
+
if (v !== undefined)
|
|
138
|
+
headers[k.toLowerCase()] = v;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const query = {};
|
|
142
|
+
const body = {};
|
|
143
|
+
for (const i of list) {
|
|
144
|
+
if (i.source !== 'request')
|
|
145
|
+
continue;
|
|
146
|
+
if (i.key.startsWith('query.')) {
|
|
147
|
+
const k = i.key.slice(6);
|
|
148
|
+
if (!Object.prototype.hasOwnProperty.call(query, k))
|
|
149
|
+
query[k] = i.value;
|
|
150
|
+
}
|
|
151
|
+
else if (i.key.startsWith('body.')) {
|
|
152
|
+
const k = i.key.slice(5);
|
|
153
|
+
if (!Object.prototype.hasOwnProperty.call(body, k))
|
|
154
|
+
body[k] = i.value;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const path = ctx.path ?? null;
|
|
158
|
+
return {
|
|
159
|
+
app,
|
|
160
|
+
request: ctx.inRequest
|
|
161
|
+
? {
|
|
162
|
+
method: ctx.method ? ctx.method.toUpperCase() : null,
|
|
163
|
+
path,
|
|
164
|
+
route: ctx.route ?? (path ? (0, context_1.routeOf)(path) : null),
|
|
165
|
+
ip: ctx.ip ?? null,
|
|
166
|
+
headers,
|
|
167
|
+
query,
|
|
168
|
+
body,
|
|
169
|
+
}
|
|
170
|
+
: null,
|
|
171
|
+
inputs: list.map((i) => ({ value: i.value, key: i.key, source: i.source })),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function ruleState(ctx) {
|
|
175
|
+
if (!ctx.rules)
|
|
176
|
+
ctx.rules = { matched: new Set(), budget: { steps: rule_expr_1.DEFAULT_RULE_BUDGET }, ranHead: false, ranBody: false };
|
|
177
|
+
return ctx.rules;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The request rules to judge in a phase, matched in order. `head`: every
|
|
181
|
+
* request rule that does not read the body. `body`: rules that read the body,
|
|
182
|
+
* and rules reading `input.*` that did not match at `head` (the body added
|
|
183
|
+
* inputs). A rule matches at most once per request.
|
|
184
|
+
*/
|
|
185
|
+
function matchRequestRules(rules, ctx, phase, subject) {
|
|
186
|
+
const st = ruleState(ctx);
|
|
187
|
+
const out = [];
|
|
188
|
+
for (const rule of rules) {
|
|
189
|
+
const e = rule.expr;
|
|
190
|
+
if (st.budget.steps < 0)
|
|
191
|
+
break;
|
|
192
|
+
if (e.phase !== 'request' || st.matched.has(rule.id))
|
|
193
|
+
continue;
|
|
194
|
+
if (phase === 'head' ? e.usesBody : !(e.usesBody || e.usesInput))
|
|
195
|
+
continue;
|
|
196
|
+
const r = (0, rule_expr_1.evaluateRuleExpr)(e, subject, st.budget);
|
|
197
|
+
if (r.exhausted)
|
|
198
|
+
break;
|
|
199
|
+
if (!r.matched)
|
|
200
|
+
continue;
|
|
201
|
+
st.matched.add(rule.id);
|
|
202
|
+
out.push({ rule, input: r.input });
|
|
203
|
+
}
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
/** The finding rules a built-in finding matches, in order. */
|
|
207
|
+
function matchFindingRules(rules, subject, budget) {
|
|
208
|
+
const out = [];
|
|
209
|
+
for (const rule of rules) {
|
|
210
|
+
if (budget.steps < 0)
|
|
211
|
+
break;
|
|
212
|
+
if (rule.expr.phase !== 'finding')
|
|
213
|
+
continue;
|
|
214
|
+
const r = (0, rule_expr_1.evaluateRuleExpr)(rule.expr, subject, budget);
|
|
215
|
+
if (r.exhausted)
|
|
216
|
+
break;
|
|
217
|
+
if (r.matched)
|
|
218
|
+
out.push({ rule, input: r.input });
|
|
219
|
+
}
|
|
220
|
+
return out;
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=custom-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-rules.js","sourceRoot":"","sources":["../../src/rasp/custom-rules.ts"],"names":[],"mappings":";;;AAwCA,0DAEC;AAOD,4CAkEC;AAGD,gCAEC;AAGD,sCAEC;AAKD,wCAuCC;AAKD,8BAGC;AAUD,8CAeC;AAGD,8CAUC;AA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I,CAAC,CAAC,SAAS;YAAE,MAAM;QACvB,IAAI,CAAC,CAAC,CAAC,OAAO;YAAE,SAAS;QACzB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAA8B,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,8DAA8D;AAC9D,SAAgB,iBAAiB,CAAC,KAAmB,EAAE,OAAoB,EAAE,MAAkB;IAC7F,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,MAAM,CAAC,KAAK,GAAG,CAAC;YAAE,MAAM;QAC5B,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS;YAAE,SAAS;QAC5C,MAAM,CAAC,GAAG,IAAA,4BAAgB,EAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,SAAS;YAAE,MAAM;QACvB,IAAI,CAAC,CAAC,OAAO;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAA8B,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2026-10-29.1",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "vp.react2shell",
|
|
6
|
+
"title": "React Server Components Flight deserialization RCE (React2Shell) in a Next.js server action",
|
|
7
|
+
"cves": [
|
|
8
|
+
"CVE-2025-55182",
|
|
9
|
+
"CVE-2025-66478"
|
|
10
|
+
],
|
|
11
|
+
"references": [
|
|
12
|
+
"https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components",
|
|
13
|
+
"https://vercel.com/changelog/cve-2025-55182",
|
|
14
|
+
"https://www.trendmicro.com/en_us/research/25/l/CVE-2025-55182-analysis-poc-itw.html"
|
|
15
|
+
],
|
|
16
|
+
"severity": "critical",
|
|
17
|
+
"example": false,
|
|
18
|
+
"runtimes": [
|
|
19
|
+
"node"
|
|
20
|
+
],
|
|
21
|
+
"action": "block",
|
|
22
|
+
"match": [
|
|
23
|
+
{
|
|
24
|
+
"target": "method",
|
|
25
|
+
"op": "equals",
|
|
26
|
+
"values": [
|
|
27
|
+
"POST"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"target": "header:next-action",
|
|
32
|
+
"op": "present"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"target": "body",
|
|
36
|
+
"op": "contains_any",
|
|
37
|
+
"values": [
|
|
38
|
+
"resolved_model",
|
|
39
|
+
"constructor:constructor",
|
|
40
|
+
"_formData.get",
|
|
41
|
+
":then:constructor",
|
|
42
|
+
":__proto__:"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"note": "Body markers are the request shape Trend Micro documents for public exploits; CVE-2025-66478 is Next.js's identifier for the same flaw."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "vp.react2shell-flight",
|
|
50
|
+
"title": "React Server Components Flight deserialization RCE (React2Shell) without a Next-Action header",
|
|
51
|
+
"cves": [
|
|
52
|
+
"CVE-2025-55182"
|
|
53
|
+
],
|
|
54
|
+
"references": [
|
|
55
|
+
"https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components"
|
|
56
|
+
],
|
|
57
|
+
"severity": "critical",
|
|
58
|
+
"example": false,
|
|
59
|
+
"runtimes": [
|
|
60
|
+
"node"
|
|
61
|
+
],
|
|
62
|
+
"action": "block",
|
|
63
|
+
"match": [
|
|
64
|
+
{
|
|
65
|
+
"target": "method",
|
|
66
|
+
"op": "equals",
|
|
67
|
+
"values": [
|
|
68
|
+
"POST"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"target": "body",
|
|
73
|
+
"op": "contains_any",
|
|
74
|
+
"values": [
|
|
75
|
+
"resolved_model"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"target": "body",
|
|
80
|
+
"op": "contains_any",
|
|
81
|
+
"values": [
|
|
82
|
+
"constructor:constructor",
|
|
83
|
+
"_formData.get",
|
|
84
|
+
":then:constructor"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "vp.next-middleware-bypass",
|
|
91
|
+
"title": "Next.js middleware authorization bypass with x-middleware-subrequest",
|
|
92
|
+
"cves": [
|
|
93
|
+
"CVE-2025-29927"
|
|
94
|
+
],
|
|
95
|
+
"references": [
|
|
96
|
+
"https://github.com/vercel/next.js/security/advisories/GHSA-f82v-jwr5-mffw"
|
|
97
|
+
],
|
|
98
|
+
"severity": "critical",
|
|
99
|
+
"example": false,
|
|
100
|
+
"runtimes": [
|
|
101
|
+
"node"
|
|
102
|
+
],
|
|
103
|
+
"action": "block",
|
|
104
|
+
"match": [
|
|
105
|
+
{
|
|
106
|
+
"target": "header:x-middleware-subrequest",
|
|
107
|
+
"op": "present"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"id": "vp.node-serialize-iife",
|
|
113
|
+
"title": "node-serialize unserialize() code execution through an immediately invoked function",
|
|
114
|
+
"cves": [
|
|
115
|
+
"CVE-2017-5941"
|
|
116
|
+
],
|
|
117
|
+
"references": [
|
|
118
|
+
"https://nvd.nist.gov/vuln/detail/CVE-2017-5941"
|
|
119
|
+
],
|
|
120
|
+
"severity": "critical",
|
|
121
|
+
"example": false,
|
|
122
|
+
"runtimes": [
|
|
123
|
+
"node"
|
|
124
|
+
],
|
|
125
|
+
"action": "block",
|
|
126
|
+
"match": [
|
|
127
|
+
{
|
|
128
|
+
"target": "request",
|
|
129
|
+
"op": "contains_any",
|
|
130
|
+
"values": [
|
|
131
|
+
"_$$ND_FUNC$$_"
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"id": "vp.node2shell-brotli",
|
|
138
|
+
"title": "Node2Shell: Brotli decoder out-of-bounds write; refuses Brotli-encoded request bodies on unpatched Node.js",
|
|
139
|
+
"cves": [
|
|
140
|
+
"CVE-2026-111497"
|
|
141
|
+
],
|
|
142
|
+
"references": [
|
|
143
|
+
"https://www.ox.security/blog/node-js-brotli-decoder-out-of-bounds-write-rce-cve-2026-111497/",
|
|
144
|
+
"https://thehackernews.com/2026/10/nodejs-brotli-decoder-bug-could-allow.html"
|
|
145
|
+
],
|
|
146
|
+
"severity": "high",
|
|
147
|
+
"example": false,
|
|
148
|
+
"runtimes": [
|
|
149
|
+
"node"
|
|
150
|
+
],
|
|
151
|
+
"runtimeVersions": {
|
|
152
|
+
"node": [
|
|
153
|
+
[
|
|
154
|
+
"22.0.0",
|
|
155
|
+
"22.23.4"
|
|
156
|
+
],
|
|
157
|
+
[
|
|
158
|
+
"24.0.0",
|
|
159
|
+
"24.22.1"
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
"26.0.0",
|
|
163
|
+
"26.12.1"
|
|
164
|
+
]
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
"action": "block",
|
|
168
|
+
"match": [
|
|
169
|
+
{
|
|
170
|
+
"target": "header:content-encoding",
|
|
171
|
+
"op": "contains_any",
|
|
172
|
+
"values": [
|
|
173
|
+
"br"
|
|
174
|
+
],
|
|
175
|
+
"ignoreCase": true
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"confirmation": "third-party: OX Security, The Hacker News and Rescana report CVE-2026-111497 and the fixed releases 22.23.4, 24.22.1, 26.12.1; the nodejs.org advisory was not read when this rule was written"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"id": "vp.example-test-header",
|
|
182
|
+
"title": "Example rule: matches the test header x-shield360-rasp-test: exploit (not a real advisory)",
|
|
183
|
+
"cves": [],
|
|
184
|
+
"references": [],
|
|
185
|
+
"severity": "info",
|
|
186
|
+
"example": true,
|
|
187
|
+
"action": "block",
|
|
188
|
+
"match": [
|
|
189
|
+
{
|
|
190
|
+
"target": "header:x-shield360-rasp-test",
|
|
191
|
+
"op": "equals",
|
|
192
|
+
"values": [
|
|
193
|
+
"exploit"
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"source": "Adapted from Baidu OpenRASP plugins/official/plugin.js dnsLogDomains (Apache-2.0); requestbin/interactsh entries added by Shield360.",
|
|
3
|
+
"domains": [
|
|
4
|
+
".vuleye.pw", ".ceye.io", ".exeye.io", ".vcap.me", ".xip.name", ".xip.io", ".sslip.io", ".nip.io", ".oastify.com", ".eyes.sh",
|
|
5
|
+
".burpcollaborator.net", ".tu4.org", ".2xss.cc", ".bxss.me", ".godns.vip", ".dnslog.cn", ".0kee.360.cn", ".r87.me", ".ngrok.io",
|
|
6
|
+
".xn--9tr.com", ".pipedream.net", ".vxtrans.com", ".vxtrans.link", ".hopto.org", ".zapto.org", ".sytes.net", ".ddns.net",
|
|
7
|
+
".canarytokens.com", ".interact.sh", ".oast.fun", ".oast.pro", ".oast.live", ".oast.site", ".oast.online", ".oast.me",
|
|
8
|
+
".requestbin.net", ".requestcatcher.com", ".webhook.site"
|
|
9
|
+
],
|
|
10
|
+
"hosts": ["requestb.in", "transfer.sh", "webhook.site"]
|
|
11
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { RaspBlockedError } from './types';
|
|
2
|
+
export type DeceptionConfig = {
|
|
3
|
+
paths: string[];
|
|
4
|
+
action: 'block' | 'monitor';
|
|
5
|
+
ttlSeconds: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const MAX_DECOYS = 64;
|
|
8
|
+
export declare const MAX_DECOY_LENGTH = 256;
|
|
9
|
+
export declare const DEFAULT_TTL_S = 900;
|
|
10
|
+
export declare const MAX_TTL_S = 86400;
|
|
11
|
+
export declare const MAX_SUSPICIOUS = 10000;
|
|
12
|
+
export declare const HIT_RULE = "deception.hit";
|
|
13
|
+
export declare const SUSPICIOUS_RULE = "deception.suspicious";
|
|
14
|
+
export declare const DECEPTION_SINK = "http.deception";
|
|
15
|
+
/** Reads the signed config's `deception` value ("Deception", "Config"); null when deception is off. */
|
|
16
|
+
export declare function parseDeception(v: unknown): DeceptionConfig | null;
|
|
17
|
+
/**
|
|
18
|
+
* The decoy a request target hits, or null ("Deception", "Matching"). The
|
|
19
|
+
* path (before the first `?`) is percent-decoded once and compared byte for
|
|
20
|
+
* byte with each decoy's UTF-8. Both sides are kept as binary strings (one
|
|
21
|
+
* character per byte): Node's `req.url` already holds the target's bytes that
|
|
22
|
+
* way (it reads them as latin1); a character above U+00FF, which only a
|
|
23
|
+
* caller's own string can hold, counts as its UTF-8 bytes.
|
|
24
|
+
*/
|
|
25
|
+
export declare function matchDecoy(target: string, decoys: readonly string[]): string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Suspicious client addresses, at most `cap` entries, kept in expiry order
|
|
28
|
+
* (soonest first; equal expiries in marking order), so a TTL lowered by a new
|
|
29
|
+
* config never leaves an expired mark behind a live one. Marking a new
|
|
30
|
+
* address when full first drops every expired mark, then the mark closest to
|
|
31
|
+
* expiring. Single threaded, so no locking.
|
|
32
|
+
*/
|
|
33
|
+
export declare class SuspiciousTable {
|
|
34
|
+
private readonly cap;
|
|
35
|
+
private readonly now;
|
|
36
|
+
private readonly marks;
|
|
37
|
+
private head?;
|
|
38
|
+
private tail?;
|
|
39
|
+
constructor(cap?: number, now?: () => number);
|
|
40
|
+
private unlink;
|
|
41
|
+
/** Marks (or marks again, restarting the time) an address for `ttlSeconds`. */
|
|
42
|
+
mark(ip: string, ttlSeconds: number): void;
|
|
43
|
+
/** Whether an address is marked; an expired mark is dropped. Never extends a mark. */
|
|
44
|
+
isMarked(ip: string): boolean;
|
|
45
|
+
get size(): number;
|
|
46
|
+
/** The marked addresses, soonest to expire first (tests). */
|
|
47
|
+
keys(): string[];
|
|
48
|
+
}
|
|
49
|
+
/** The process's table (tests). */
|
|
50
|
+
export declare function suspiciousTable(): SuspiciousTable;
|
|
51
|
+
/** Replaces the process's table (tests: a small cap, a fake clock). */
|
|
52
|
+
export declare function setSuspiciousTable(t: SuspiciousTable): void;
|
|
53
|
+
/** A request as deception sees it: the raw target (path and query as received) and the client address `request.ip` uses. */
|
|
54
|
+
export type DeceptionRequest = {
|
|
55
|
+
framework: string;
|
|
56
|
+
method: string;
|
|
57
|
+
url: string;
|
|
58
|
+
ip?: string;
|
|
59
|
+
};
|
|
60
|
+
/** What the adapter does: go on, answer its not-found, or answer the block response. */
|
|
61
|
+
export type DeceptionOutcome = {
|
|
62
|
+
notFound?: true;
|
|
63
|
+
blocked?: RaspBlockedError;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Runs deception for a request ("Deception", "Decision"). Call it only while
|
|
67
|
+
* RASP is active, before anything else. Never throws: an error lets the
|
|
68
|
+
* request through as if deception were off.
|
|
69
|
+
*/
|
|
70
|
+
export declare function checkDeception(r: DeceptionRequest): DeceptionOutcome;
|