@oculum/scanner 1.0.14 → 1.0.15
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/dist/detect/ai-code/index.d.ts +6 -11
- package/dist/detect/ai-code/index.d.ts.map +1 -1
- package/dist/detect/ai-code/index.js +6 -24
- package/dist/detect/ai-code/index.js.map +1 -1
- package/dist/detect/ast-rules/agent-tools-ast.d.ts +14 -0
- package/dist/detect/ast-rules/agent-tools-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/agent-tools-ast.js +809 -0
- package/dist/detect/ast-rules/agent-tools-ast.js.map +1 -0
- package/dist/detect/ast-rules/ai-fingerprinting-ast.d.ts +14 -0
- package/dist/detect/ast-rules/ai-fingerprinting-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/ai-fingerprinting-ast.js +344 -0
- package/dist/detect/ast-rules/ai-fingerprinting-ast.js.map +1 -0
- package/dist/detect/ast-rules/auth-patterns-ast.d.ts +14 -0
- package/dist/detect/ast-rules/auth-patterns-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/auth-patterns-ast.js +280 -0
- package/dist/detect/ast-rules/auth-patterns-ast.js.map +1 -0
- package/dist/detect/ast-rules/byok-ast.d.ts +13 -0
- package/dist/detect/ast-rules/byok-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/byok-ast.js +180 -0
- package/dist/detect/ast-rules/byok-ast.js.map +1 -0
- package/dist/detect/ast-rules/child-process-ast.d.ts +13 -0
- package/dist/detect/ast-rules/child-process-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/child-process-ast.js +252 -0
- package/dist/detect/ast-rules/child-process-ast.js.map +1 -0
- package/dist/detect/ast-rules/dangerous-eval-ast.d.ts +13 -0
- package/dist/detect/ast-rules/dangerous-eval-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/dangerous-eval-ast.js +218 -0
- package/dist/detect/ast-rules/dangerous-eval-ast.js.map +1 -0
- package/dist/detect/ast-rules/data-exposure-ast.d.ts +13 -0
- package/dist/detect/ast-rules/data-exposure-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/data-exposure-ast.js +158 -0
- package/dist/detect/ast-rules/data-exposure-ast.js.map +1 -0
- package/dist/detect/ast-rules/dom-xss-ast.d.ts +14 -0
- package/dist/detect/ast-rules/dom-xss-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/dom-xss-ast.js +217 -0
- package/dist/detect/ast-rules/dom-xss-ast.js.map +1 -0
- package/dist/detect/ast-rules/endpoint-protection-ast.d.ts +13 -0
- package/dist/detect/ast-rules/endpoint-protection-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/endpoint-protection-ast.js +228 -0
- package/dist/detect/ast-rules/endpoint-protection-ast.js.map +1 -0
- package/dist/detect/ast-rules/entropy-ast.d.ts +17 -0
- package/dist/detect/ast-rules/entropy-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/entropy-ast.js +265 -0
- package/dist/detect/ast-rules/entropy-ast.js.map +1 -0
- package/dist/detect/ast-rules/flask-debug-ast.d.ts +10 -0
- package/dist/detect/ast-rules/flask-debug-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/flask-debug-ast.js +125 -0
- package/dist/detect/ast-rules/flask-debug-ast.js.map +1 -0
- package/dist/detect/ast-rules/framework-checks-ast.d.ts +13 -0
- package/dist/detect/ast-rules/framework-checks-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/framework-checks-ast.js +185 -0
- package/dist/detect/ast-rules/framework-checks-ast.js.map +1 -0
- package/dist/detect/ast-rules/helpers/call-analysis.d.ts +62 -0
- package/dist/detect/ast-rules/helpers/call-analysis.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/call-analysis.js +217 -0
- package/dist/detect/ast-rules/helpers/call-analysis.js.map +1 -0
- package/dist/detect/ast-rules/helpers/context-detection.d.ts +33 -0
- package/dist/detect/ast-rules/helpers/context-detection.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/context-detection.js +256 -0
- package/dist/detect/ast-rules/helpers/context-detection.js.map +1 -0
- package/dist/detect/ast-rules/helpers/control-flow.d.ts +40 -0
- package/dist/detect/ast-rules/helpers/control-flow.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/control-flow.js +174 -0
- package/dist/detect/ast-rules/helpers/control-flow.js.map +1 -0
- package/dist/detect/ast-rules/helpers/import-analysis.d.ts +43 -0
- package/dist/detect/ast-rules/helpers/import-analysis.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/import-analysis.js +149 -0
- package/dist/detect/ast-rules/helpers/import-analysis.js.map +1 -0
- package/dist/detect/ast-rules/helpers/index.d.ts +16 -0
- package/dist/detect/ast-rules/helpers/index.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/index.js +112 -0
- package/dist/detect/ast-rules/helpers/index.js.map +1 -0
- package/dist/detect/ast-rules/helpers/python-helpers.d.ts +215 -0
- package/dist/detect/ast-rules/helpers/python-helpers.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/python-helpers.js +935 -0
- package/dist/detect/ast-rules/helpers/python-helpers.js.map +1 -0
- package/dist/detect/ast-rules/helpers/scope-analysis.d.ts +50 -0
- package/dist/detect/ast-rules/helpers/scope-analysis.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/scope-analysis.js +194 -0
- package/dist/detect/ast-rules/helpers/scope-analysis.js.map +1 -0
- package/dist/detect/ast-rules/helpers/string-analysis.d.ts +57 -0
- package/dist/detect/ast-rules/helpers/string-analysis.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/string-analysis.js +184 -0
- package/dist/detect/ast-rules/helpers/string-analysis.js.map +1 -0
- package/dist/detect/ast-rules/helpers/type-extraction.d.ts +44 -0
- package/dist/detect/ast-rules/helpers/type-extraction.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/type-extraction.js +125 -0
- package/dist/detect/ast-rules/helpers/type-extraction.js.map +1 -0
- package/dist/detect/ast-rules/helpers/user-input.d.ts +35 -0
- package/dist/detect/ast-rules/helpers/user-input.d.ts.map +1 -0
- package/dist/detect/ast-rules/helpers/user-input.js +243 -0
- package/dist/detect/ast-rules/helpers/user-input.js.map +1 -0
- package/dist/detect/ast-rules/index.d.ts +112 -0
- package/dist/detect/ast-rules/index.d.ts.map +1 -0
- package/dist/detect/ast-rules/index.js +232 -0
- package/dist/detect/ast-rules/index.js.map +1 -0
- package/dist/detect/ast-rules/json-parse-ast.d.ts +13 -0
- package/dist/detect/ast-rules/json-parse-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/json-parse-ast.js +143 -0
- package/dist/detect/ast-rules/json-parse-ast.js.map +1 -0
- package/dist/detect/ast-rules/log-injection-ast.d.ts +14 -0
- package/dist/detect/ast-rules/log-injection-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/log-injection-ast.js +235 -0
- package/dist/detect/ast-rules/log-injection-ast.js.map +1 -0
- package/dist/detect/ast-rules/logic-gates-ast.d.ts +14 -0
- package/dist/detect/ast-rules/logic-gates-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/logic-gates-ast.js +312 -0
- package/dist/detect/ast-rules/logic-gates-ast.js.map +1 -0
- package/dist/detect/ast-rules/mcp-security-ast.d.ts +14 -0
- package/dist/detect/ast-rules/mcp-security-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/mcp-security-ast.js +755 -0
- package/dist/detect/ast-rules/mcp-security-ast.js.map +1 -0
- package/dist/detect/ast-rules/model-supply-chain-ast.d.ts +13 -0
- package/dist/detect/ast-rules/model-supply-chain-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/model-supply-chain-ast.js +188 -0
- package/dist/detect/ast-rules/model-supply-chain-ast.js.map +1 -0
- package/dist/detect/ast-rules/package-hallucination-ast.d.ts +13 -0
- package/dist/detect/ast-rules/package-hallucination-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/package-hallucination-ast.js +607 -0
- package/dist/detect/ast-rules/package-hallucination-ast.js.map +1 -0
- package/dist/detect/ast-rules/prompt-hygiene-ast.d.ts +15 -0
- package/dist/detect/ast-rules/prompt-hygiene-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/prompt-hygiene-ast.js +332 -0
- package/dist/detect/ast-rules/prompt-hygiene-ast.js.map +1 -0
- package/dist/detect/ast-rules/rag-safety-ast.d.ts +18 -0
- package/dist/detect/ast-rules/rag-safety-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/rag-safety-ast.js +640 -0
- package/dist/detect/ast-rules/rag-safety-ast.js.map +1 -0
- package/dist/detect/ast-rules/request-validation-ast.d.ts +13 -0
- package/dist/detect/ast-rules/request-validation-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/request-validation-ast.js +116 -0
- package/dist/detect/ast-rules/request-validation-ast.js.map +1 -0
- package/dist/detect/ast-rules/risky-imports-ast.d.ts +14 -0
- package/dist/detect/ast-rules/risky-imports-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/risky-imports-ast.js +114 -0
- package/dist/detect/ast-rules/risky-imports-ast.js.map +1 -0
- package/dist/detect/ast-rules/schema-validation-ast.d.ts +14 -0
- package/dist/detect/ast-rules/schema-validation-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/schema-validation-ast.js +233 -0
- package/dist/detect/ast-rules/schema-validation-ast.js.map +1 -0
- package/dist/detect/ast-rules/secret-patterns-ast.d.ts +17 -0
- package/dist/detect/ast-rules/secret-patterns-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/secret-patterns-ast.js +199 -0
- package/dist/detect/ast-rules/secret-patterns-ast.js.map +1 -0
- package/dist/detect/ast-rules/security-headers-ast.d.ts +14 -0
- package/dist/detect/ast-rules/security-headers-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/security-headers-ast.js +187 -0
- package/dist/detect/ast-rules/security-headers-ast.js.map +1 -0
- package/dist/detect/ast-rules/sql-injection-ast.d.ts +17 -0
- package/dist/detect/ast-rules/sql-injection-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/sql-injection-ast.js +497 -0
- package/dist/detect/ast-rules/sql-injection-ast.js.map +1 -0
- package/dist/detect/ast-rules/ssrf-ast.d.ts +14 -0
- package/dist/detect/ast-rules/ssrf-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/ssrf-ast.js +573 -0
- package/dist/detect/ast-rules/ssrf-ast.js.map +1 -0
- package/dist/detect/ast-rules/taint-fix-templates.d.ts +18 -0
- package/dist/detect/ast-rules/taint-fix-templates.d.ts.map +1 -0
- package/dist/detect/ast-rules/taint-fix-templates.js +92 -0
- package/dist/detect/ast-rules/taint-fix-templates.js.map +1 -0
- package/dist/detect/ast-rules/taint-flow-ast.d.ts +24 -0
- package/dist/detect/ast-rules/taint-flow-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/taint-flow-ast.js +340 -0
- package/dist/detect/ast-rules/taint-flow-ast.js.map +1 -0
- package/dist/detect/ast-rules/variables-ast.d.ts +24 -0
- package/dist/detect/ast-rules/variables-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/variables-ast.js +362 -0
- package/dist/detect/ast-rules/variables-ast.js.map +1 -0
- package/dist/detect/ast-rules/weak-crypto-ast.d.ts +15 -0
- package/dist/detect/ast-rules/weak-crypto-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/weak-crypto-ast.js +406 -0
- package/dist/detect/ast-rules/weak-crypto-ast.js.map +1 -0
- package/dist/detect/ast-rules/xxe-ast.d.ts +13 -0
- package/dist/detect/ast-rules/xxe-ast.d.ts.map +1 -0
- package/dist/detect/ast-rules/xxe-ast.js +157 -0
- package/dist/detect/ast-rules/xxe-ast.js.map +1 -0
- package/dist/detect/config/agent-skill-injection.d.ts.map +1 -1
- package/dist/detect/config/agent-skill-injection.js +2 -24
- package/dist/detect/config/agent-skill-injection.js.map +1 -1
- package/dist/detect/config/index.d.ts +1 -0
- package/dist/detect/config/index.d.ts.map +1 -1
- package/dist/detect/config/index.js +3 -1
- package/dist/detect/config/index.js.map +1 -1
- package/dist/detect/config/osv-check.d.ts.map +1 -1
- package/dist/detect/config/osv-check.js +6 -1
- package/dist/detect/config/osv-check.js.map +1 -1
- package/dist/detect/config/package-check.d.ts.map +1 -1
- package/dist/detect/config/package-check.js +6 -1
- package/dist/detect/config/package-check.js.map +1 -1
- package/dist/detect/config/rules-file-backdoor.d.ts +36 -0
- package/dist/detect/config/rules-file-backdoor.d.ts.map +1 -0
- package/dist/detect/config/rules-file-backdoor.js +379 -0
- package/dist/detect/config/rules-file-backdoor.js.map +1 -0
- package/dist/detect/index.d.ts +43 -6
- package/dist/detect/index.d.ts.map +1 -1
- package/dist/detect/index.js +70 -7
- package/dist/detect/index.js.map +1 -1
- package/dist/detect/secrets/config-audit.d.ts.map +1 -1
- package/dist/detect/secrets/config-audit.js +36 -3
- package/dist/detect/secrets/config-audit.js.map +1 -1
- package/dist/detect/secrets/entropy.d.ts.map +1 -1
- package/dist/detect/secrets/entropy.js +180 -0
- package/dist/detect/secrets/entropy.js.map +1 -1
- package/dist/detect/secrets/index.d.ts +0 -2
- package/dist/detect/secrets/index.d.ts.map +1 -1
- package/dist/detect/secrets/index.js +7 -17
- package/dist/detect/secrets/index.js.map +1 -1
- package/dist/detect/structural/index.d.ts +15 -28
- package/dist/detect/structural/index.d.ts.map +1 -1
- package/dist/detect/structural/index.js +20 -497
- package/dist/detect/structural/index.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/model/auth-helper-detector.d.ts.map +1 -1
- package/dist/model/auth-helper-detector.js +2 -7
- package/dist/model/auth-helper-detector.js.map +1 -1
- package/dist/model/import-resolver.d.ts.map +1 -1
- package/dist/model/import-resolver.js +94 -0
- package/dist/model/import-resolver.js.map +1 -1
- package/dist/model/imported-auth-detector.js +8 -8
- package/dist/model/imported-auth-detector.js.map +1 -1
- package/dist/model/index.d.ts +8 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +198 -73
- package/dist/model/index.js.map +1 -1
- package/dist/model/module-graph.d.ts.map +1 -1
- package/dist/model/module-graph.js +22 -9
- package/dist/model/module-graph.js.map +1 -1
- package/dist/model/project-context.d.ts +1 -1
- package/dist/model/project-context.d.ts.map +1 -1
- package/dist/model/project-context.js +34 -0
- package/dist/model/project-context.js.map +1 -1
- package/dist/model/route-auth-resolver.d.ts.map +1 -1
- package/dist/model/route-auth-resolver.js +17 -2
- package/dist/model/route-auth-resolver.js.map +1 -1
- package/dist/model/route-discovery/index.js +1 -1
- package/dist/model/route-discovery/index.js.map +1 -1
- package/dist/model/route-discovery/nextjs.js +1 -1
- package/dist/model/route-discovery/nextjs.js.map +1 -1
- package/dist/model/route-discovery/python.d.ts +6 -3
- package/dist/model/route-discovery/python.d.ts.map +1 -1
- package/dist/model/route-discovery/python.js +132 -9
- package/dist/model/route-discovery/python.js.map +1 -1
- package/dist/model/route-discovery/types.d.ts +1 -1
- package/dist/model/route-discovery/types.d.ts.map +1 -1
- package/dist/model/route-discovery/utils.d.ts +8 -0
- package/dist/model/route-discovery/utils.d.ts.map +1 -1
- package/dist/model/route-discovery/utils.js +70 -0
- package/dist/model/route-discovery/utils.js.map +1 -1
- package/dist/model/taint-types.d.ts +0 -4
- package/dist/model/taint-types.d.ts.map +1 -1
- package/dist/parse/ast.d.ts +58 -0
- package/dist/parse/ast.d.ts.map +1 -0
- package/dist/parse/ast.js +230 -0
- package/dist/parse/ast.js.map +1 -0
- package/dist/parse/call-graph.d.ts +41 -0
- package/dist/parse/call-graph.d.ts.map +1 -0
- package/dist/parse/call-graph.js +386 -0
- package/dist/parse/call-graph.js.map +1 -0
- package/dist/parse/file-classifier.d.ts +11 -0
- package/dist/parse/file-classifier.d.ts.map +1 -1
- package/dist/parse/file-classifier.js +63 -15
- package/dist/parse/file-classifier.js.map +1 -1
- package/dist/parse/node-index.d.ts +32 -0
- package/dist/parse/node-index.d.ts.map +1 -0
- package/dist/parse/node-index.js +103 -0
- package/dist/parse/node-index.js.map +1 -0
- package/dist/parse/type-extractor.d.ts +50 -0
- package/dist/parse/type-extractor.d.ts.map +1 -0
- package/dist/parse/type-extractor.js +243 -0
- package/dist/parse/type-extractor.js.map +1 -0
- package/dist/pipeline/config.d.ts +7 -1
- package/dist/pipeline/config.d.ts.map +1 -1
- package/dist/pipeline/config.js.map +1 -1
- package/dist/pipeline/index.d.ts +3 -3
- package/dist/pipeline/index.d.ts.map +1 -1
- package/dist/pipeline/index.js +192 -64
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/modes/incremental.d.ts.map +1 -1
- package/dist/pipeline/modes/incremental.js +2 -7
- package/dist/pipeline/modes/incremental.js.map +1 -1
- package/dist/postprocess/dedup.d.ts +5 -2
- package/dist/postprocess/dedup.d.ts.map +1 -1
- package/dist/postprocess/dedup.js +47 -16
- package/dist/postprocess/dedup.js.map +1 -1
- package/dist/report/build-result.d.ts +9 -4
- package/dist/report/build-result.d.ts.map +1 -1
- package/dist/report/build-result.js +15 -4
- package/dist/report/build-result.js.map +1 -1
- package/dist/report/formatters/cli-terminal.d.ts +1 -1
- package/dist/report/formatters/cli-terminal.d.ts.map +1 -1
- package/dist/report/formatters/cli-terminal.js +434 -231
- package/dist/report/formatters/cli-terminal.js.map +1 -1
- package/dist/report/sanitize.d.ts +10 -0
- package/dist/report/sanitize.d.ts.map +1 -0
- package/dist/report/sanitize.js +19 -0
- package/dist/report/sanitize.js.map +1 -0
- package/dist/score/adjustments.d.ts +20 -2
- package/dist/score/adjustments.d.ts.map +1 -1
- package/dist/score/adjustments.js +108 -37
- package/dist/score/adjustments.js.map +1 -1
- package/dist/score/confidence.d.ts +6 -0
- package/dist/score/confidence.d.ts.map +1 -1
- package/dist/score/confidence.js +10 -4
- package/dist/score/confidence.js.map +1 -1
- package/dist/score/evidence.d.ts +25 -0
- package/dist/score/evidence.d.ts.map +1 -0
- package/dist/score/evidence.js +51 -0
- package/dist/score/evidence.js.map +1 -0
- package/dist/score/index.d.ts +3 -1
- package/dist/score/index.d.ts.map +1 -1
- package/dist/score/index.js +25 -50
- package/dist/score/index.js.map +1 -1
- package/dist/score/types.d.ts +5 -1
- package/dist/score/types.d.ts.map +1 -1
- package/dist/shared/category-filter.d.ts.map +1 -1
- package/dist/shared/category-filter.js +12 -0
- package/dist/shared/category-filter.js.map +1 -1
- package/dist/shared/regex-utils.d.ts +3 -0
- package/dist/shared/regex-utils.d.ts.map +1 -0
- package/dist/shared/regex-utils.js +8 -0
- package/dist/shared/regex-utils.js.map +1 -0
- package/dist/shared/registry-clients.d.ts +7 -0
- package/dist/shared/registry-clients.d.ts.map +1 -1
- package/dist/shared/registry-clients.js +94 -17
- package/dist/shared/registry-clients.js.map +1 -1
- package/dist/shared/rules/metadata.d.ts.map +1 -1
- package/dist/shared/rules/metadata.js +17 -0
- package/dist/shared/rules/metadata.js.map +1 -1
- package/dist/shared/types.d.ts +59 -15
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js +38 -21
- package/dist/shared/types.js.map +1 -1
- package/dist/taint/async-flow.d.ts +44 -0
- package/dist/taint/async-flow.d.ts.map +1 -0
- package/dist/taint/async-flow.js +271 -0
- package/dist/taint/async-flow.js.map +1 -0
- package/dist/taint/cfg-builder.d.ts +35 -0
- package/dist/taint/cfg-builder.d.ts.map +1 -0
- package/dist/taint/cfg-builder.js +980 -0
- package/dist/taint/cfg-builder.js.map +1 -0
- package/dist/taint/cfg-types.d.ts +76 -0
- package/dist/taint/cfg-types.d.ts.map +1 -0
- package/dist/taint/cfg-types.js +13 -0
- package/dist/taint/cfg-types.js.map +1 -0
- package/dist/taint/constant-propagation.d.ts +34 -0
- package/dist/taint/constant-propagation.d.ts.map +1 -0
- package/dist/taint/constant-propagation.js +164 -0
- package/dist/taint/constant-propagation.js.map +1 -0
- package/dist/taint/cross-file-analyzer.d.ts +27 -0
- package/dist/taint/cross-file-analyzer.d.ts.map +1 -0
- package/dist/taint/cross-file-analyzer.js +99 -0
- package/dist/taint/cross-file-analyzer.js.map +1 -0
- package/dist/taint/cross-file-index.d.ts +59 -0
- package/dist/taint/cross-file-index.d.ts.map +1 -0
- package/dist/taint/cross-file-index.js +183 -0
- package/dist/taint/cross-file-index.js.map +1 -0
- package/dist/taint/def-use.d.ts +27 -0
- package/dist/taint/def-use.d.ts.map +1 -0
- package/dist/taint/def-use.js +519 -0
- package/dist/taint/def-use.js.map +1 -0
- package/dist/taint/file-analysis-cache.d.ts +47 -0
- package/dist/taint/file-analysis-cache.d.ts.map +1 -0
- package/dist/taint/file-analysis-cache.js +107 -0
- package/dist/taint/file-analysis-cache.js.map +1 -0
- package/dist/taint/framework-models.d.ts +77 -0
- package/dist/taint/framework-models.d.ts.map +1 -0
- package/dist/taint/framework-models.js +258 -0
- package/dist/taint/framework-models.js.map +1 -0
- package/dist/taint/helpers.d.ts +31 -0
- package/dist/taint/helpers.d.ts.map +1 -0
- package/dist/taint/helpers.js +130 -0
- package/dist/taint/helpers.js.map +1 -0
- package/dist/taint/index.d.ts +28 -0
- package/dist/taint/index.d.ts.map +1 -0
- package/dist/taint/index.js +77 -0
- package/dist/taint/index.js.map +1 -0
- package/dist/taint/llm-registry.d.ts +47 -0
- package/dist/taint/llm-registry.d.ts.map +1 -0
- package/dist/taint/llm-registry.js +152 -0
- package/dist/taint/llm-registry.js.map +1 -0
- package/dist/taint/llm-risk-scoring.d.ts +54 -0
- package/dist/taint/llm-risk-scoring.d.ts.map +1 -0
- package/dist/taint/llm-risk-scoring.js +376 -0
- package/dist/taint/llm-risk-scoring.js.map +1 -0
- package/dist/taint/propagation-types.d.ts +104 -0
- package/dist/taint/propagation-types.d.ts.map +1 -0
- package/dist/taint/propagation-types.js +98 -0
- package/dist/taint/propagation-types.js.map +1 -0
- package/dist/taint/propagation.d.ts +111 -0
- package/dist/taint/propagation.d.ts.map +1 -0
- package/dist/taint/propagation.js +1576 -0
- package/dist/taint/propagation.js.map +1 -0
- package/dist/taint/sanitizer-registry.d.ts +26 -0
- package/dist/taint/sanitizer-registry.d.ts.map +1 -0
- package/dist/taint/sanitizer-registry.js +422 -0
- package/dist/taint/sanitizer-registry.js.map +1 -0
- package/dist/taint/sink-classifier.d.ts +27 -0
- package/dist/taint/sink-classifier.d.ts.map +1 -0
- package/dist/taint/sink-classifier.js +1166 -0
- package/dist/taint/sink-classifier.js.map +1 -0
- package/dist/taint/source-classifier.d.ts +29 -0
- package/dist/taint/source-classifier.d.ts.map +1 -0
- package/dist/taint/source-classifier.js +814 -0
- package/dist/taint/source-classifier.js.map +1 -0
- package/dist/taint/taint-analyzer.d.ts +33 -0
- package/dist/taint/taint-analyzer.d.ts.map +1 -0
- package/dist/taint/taint-analyzer.js +88 -0
- package/dist/taint/taint-analyzer.js.map +1 -0
- package/dist/taint/taint-summary.d.ts +37 -0
- package/dist/taint/taint-summary.d.ts.map +1 -0
- package/dist/taint/taint-summary.js +293 -0
- package/dist/taint/taint-summary.js.map +1 -0
- package/dist/taint/types.d.ts +47 -0
- package/dist/taint/types.d.ts.map +1 -0
- package/dist/taint/types.js +19 -0
- package/dist/taint/types.js.map +1 -0
- package/dist/validate/clients.d.ts +2 -1
- package/dist/validate/clients.d.ts.map +1 -1
- package/dist/validate/clients.js +3 -2
- package/dist/validate/clients.js.map +1 -1
- package/dist/validate/index.d.ts +5 -6
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +22 -21
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/prompts/modules/ai-patterns.d.ts +1 -1
- package/dist/validate/prompts/modules/ai-patterns.d.ts.map +1 -1
- package/dist/validate/prompts/modules/ai-patterns.js +16 -0
- package/dist/validate/prompts/modules/ai-patterns.js.map +1 -1
- package/dist/validate/prompts/modules/common.d.ts +1 -1
- package/dist/validate/prompts/modules/common.d.ts.map +1 -1
- package/dist/validate/prompts/modules/common.js +12 -3
- package/dist/validate/prompts/modules/common.js.map +1 -1
- package/dist/validate/providers/anthropic.d.ts +4 -4
- package/dist/validate/providers/anthropic.d.ts.map +1 -1
- package/dist/validate/providers/anthropic.js +85 -58
- package/dist/validate/providers/anthropic.js.map +1 -1
- package/dist/validate/providers/openai.d.ts +4 -4
- package/dist/validate/providers/openai.d.ts.map +1 -1
- package/dist/validate/providers/openai.js +149 -99
- package/dist/validate/providers/openai.js.map +1 -1
- package/dist/validate/request-builder.d.ts +2 -8
- package/dist/validate/request-builder.d.ts.map +1 -1
- package/dist/validate/request-builder.js +4 -34
- package/dist/validate/request-builder.js.map +1 -1
- package/dist/validate/types.d.ts +9 -0
- package/dist/validate/types.d.ts.map +1 -1
- package/dist/validate/types.js.map +1 -1
- package/dist/validate/utils/path-helpers.js +2 -2
- package/dist/validate/utils/path-helpers.js.map +1 -1
- package/dist/validate/utils/response-parser.d.ts +10 -0
- package/dist/validate/utils/response-parser.d.ts.map +1 -1
- package/dist/validate/utils/response-parser.js +21 -2
- package/dist/validate/utils/response-parser.js.map +1 -1
- package/dist/validate/utils/retry.d.ts.map +1 -1
- package/dist/validate/utils/retry.js +19 -4
- package/dist/validate/utils/retry.js.map +1 -1
- package/package.json +7 -4
- package/src/__tests__/benchmark/fixtures/layer2/ai-execution-sinks.ts +1 -1
- package/src/__tests__/benchmark/planted-benchmark.test.ts +337 -0
- package/src/__tests__/benchmark/utils/test-runner.ts +38 -4
- package/src/__tests__/category-filter.test.ts +5 -1
- package/src/__tests__/context-engine/route-discovery/python.test.ts +726 -0
- package/src/__tests__/detect/ast-rules.test.ts +1043 -0
- package/src/__tests__/detect/offline-mode.test.ts +147 -0
- package/src/__tests__/detect/python-ast-rules.test.ts +569 -0
- package/src/__tests__/detect/python-helpers.test.ts +536 -0
- package/src/__tests__/detect/python-sast-rules.test.ts +453 -0
- package/src/__tests__/detect/rules-file-backdoor-decoders.test.ts +151 -0
- package/src/__tests__/detect/rules-file-backdoor.test.ts +284 -0
- package/src/__tests__/detect/taint-fix-templates.test.ts +150 -0
- package/src/__tests__/detect/taint-path-serialization.test.ts +170 -0
- package/src/__tests__/parse/call-graph.test.ts +300 -0
- package/src/__tests__/parse/python-parser.test.ts +274 -0
- package/src/__tests__/regression/known-false-positives.test.ts +491 -9
- package/src/__tests__/regression/rules-file-backdoor.test.ts +137 -0
- package/src/__tests__/score/adjustments.test.ts +34 -16
- package/src/__tests__/score/confidence.test.ts +84 -57
- package/src/__tests__/score/evidence-scoring.test.ts +249 -0
- package/src/__tests__/score/evidence.test.ts +144 -0
- package/src/__tests__/score/scoring-integration.test.ts +56 -34
- package/src/__tests__/score/taint-adjustments.test.ts +14 -228
- package/src/__tests__/snapshots/__snapshots__/scan-depth.test.ts.snap +65 -59
- package/src/__tests__/snapshots/scan-depth.test.ts +39 -7
- package/src/__tests__/taint/async-flow.test.ts +247 -0
- package/src/__tests__/taint/cfg-builder.test.ts +835 -0
- package/src/__tests__/taint/constant-propagation.test.ts +302 -0
- package/src/__tests__/taint/cross-file-index.test.ts +683 -0
- package/src/__tests__/taint/cross-file-integration.test.ts +275 -0
- package/src/__tests__/taint/cross-file-propagation.test.ts +910 -0
- package/src/__tests__/taint/def-use.test.ts +132 -0
- package/src/__tests__/taint/field-sensitive-sinks.test.ts +179 -0
- package/src/__tests__/taint/field-sensitivity.test.ts +342 -0
- package/src/__tests__/taint/file-analysis-cache.test.ts +290 -0
- package/src/__tests__/taint/framework-models.test.ts +227 -0
- package/src/__tests__/taint/llm-flow-graph.test.ts +850 -0
- package/src/__tests__/taint/llm-risk-scoring.test.ts +439 -0
- package/src/__tests__/taint/performance-parity.test.ts +315 -0
- package/src/__tests__/taint/propagation.test.ts +621 -0
- package/src/__tests__/taint/python-cross-file.test.ts +494 -0
- package/src/__tests__/taint/python-taint.test.ts +1344 -0
- package/src/__tests__/taint/sanitizer-registry.test.ts +304 -0
- package/src/__tests__/taint/sanitizer-regression.test.ts +111 -0
- package/src/__tests__/taint/sink-classifier.test.ts +537 -0
- package/src/__tests__/taint/source-classifier.test.ts +367 -0
- package/src/__tests__/taint/taint-pipeline.test.ts +418 -0
- package/src/__tests__/taint/taint-smoke.test.ts +400 -0
- package/src/__tests__/taint/taint-summary.test.ts +472 -0
- package/src/detect/ai-code/index.ts +6 -11
- package/src/detect/ast-rules/agent-tools-ast.ts +861 -0
- package/src/detect/ast-rules/ai-fingerprinting-ast.ts +451 -0
- package/src/detect/ast-rules/auth-patterns-ast.ts +304 -0
- package/src/detect/ast-rules/byok-ast.ts +195 -0
- package/src/detect/ast-rules/child-process-ast.ts +276 -0
- package/src/detect/ast-rules/dangerous-eval-ast.ts +227 -0
- package/src/detect/ast-rules/data-exposure-ast.ts +162 -0
- package/src/detect/ast-rules/dom-xss-ast.ts +260 -0
- package/src/detect/ast-rules/endpoint-protection-ast.ts +231 -0
- package/src/detect/ast-rules/entropy-ast.ts +268 -0
- package/src/detect/ast-rules/flask-debug-ast.ts +148 -0
- package/src/detect/ast-rules/framework-checks-ast.ts +200 -0
- package/src/detect/ast-rules/helpers/call-analysis.ts +256 -0
- package/src/detect/ast-rules/helpers/context-detection.ts +277 -0
- package/src/detect/ast-rules/helpers/control-flow.ts +179 -0
- package/src/detect/ast-rules/helpers/import-analysis.ts +185 -0
- package/src/detect/ast-rules/helpers/index.ts +133 -0
- package/src/detect/ast-rules/helpers/python-helpers.ts +1054 -0
- package/src/detect/ast-rules/helpers/scope-analysis.ts +224 -0
- package/src/detect/ast-rules/helpers/string-analysis.ts +215 -0
- package/src/detect/ast-rules/helpers/type-extraction.ts +138 -0
- package/src/detect/ast-rules/helpers/user-input.ts +256 -0
- package/src/detect/ast-rules/index.ts +311 -0
- package/src/detect/ast-rules/json-parse-ast.ts +162 -0
- package/src/detect/ast-rules/log-injection-ast.ts +243 -0
- package/src/detect/ast-rules/logic-gates-ast.ts +343 -0
- package/src/detect/ast-rules/mcp-security-ast.ts +808 -0
- package/src/detect/ast-rules/model-supply-chain-ast.ts +202 -0
- package/src/detect/ast-rules/package-hallucination-ast.ts +664 -0
- package/src/detect/ast-rules/prompt-hygiene-ast.ts +329 -0
- package/src/detect/ast-rules/rag-safety-ast.ts +689 -0
- package/src/detect/ast-rules/request-validation-ast.ts +122 -0
- package/src/detect/ast-rules/risky-imports-ast.ts +133 -0
- package/src/detect/ast-rules/schema-validation-ast.ts +244 -0
- package/src/detect/ast-rules/secret-patterns-ast.ts +223 -0
- package/src/detect/ast-rules/security-headers-ast.ts +206 -0
- package/src/detect/ast-rules/sql-injection-ast.ts +614 -0
- package/src/detect/ast-rules/ssrf-ast.ts +601 -0
- package/src/detect/ast-rules/taint-fix-templates.ts +108 -0
- package/src/detect/ast-rules/taint-flow-ast.ts +416 -0
- package/src/detect/ast-rules/variables-ast.ts +446 -0
- package/src/detect/ast-rules/weak-crypto-ast.ts +441 -0
- package/src/detect/ast-rules/xxe-ast.ts +184 -0
- package/src/detect/config/agent-skill-injection.ts +2 -24
- package/src/detect/config/index.ts +1 -0
- package/src/detect/config/osv-check.ts +6 -1
- package/src/detect/config/package-check.ts +6 -1
- package/src/detect/config/rules-file-backdoor.ts +438 -0
- package/src/detect/index.ts +146 -52
- package/src/detect/secrets/config-audit.ts +37 -3
- package/src/detect/secrets/entropy.ts +195 -0
- package/src/detect/secrets/index.ts +7 -16
- package/src/detect/structural/index.ts +23 -566
- package/src/index.ts +7 -0
- package/src/model/auth-helper-detector.ts +1 -7
- package/src/model/import-resolver.ts +104 -0
- package/src/model/imported-auth-detector.ts +1 -1
- package/src/model/index.ts +240 -80
- package/src/model/module-graph.ts +17 -5
- package/src/model/project-context.ts +28 -1
- package/src/model/route-auth-resolver.ts +18 -3
- package/src/model/route-discovery/index.ts +1 -1
- package/src/model/route-discovery/nextjs.ts +1 -1
- package/src/model/route-discovery/python.ts +156 -9
- package/src/model/route-discovery/types.ts +1 -1
- package/src/model/route-discovery/utils.ts +73 -0
- package/src/model/taint-types.ts +1 -6
- package/src/parse/ast.ts +271 -0
- package/src/parse/call-graph.ts +419 -0
- package/src/parse/file-classifier.ts +69 -15
- package/src/parse/node-index.ts +118 -0
- package/src/parse/type-extractor.ts +293 -0
- package/src/pipeline/config.ts +7 -0
- package/src/pipeline/index.ts +464 -199
- package/src/pipeline/modes/incremental.ts +1 -7
- package/src/postprocess/dedup.ts +48 -17
- package/src/report/build-result.ts +57 -29
- package/src/report/formatters/cli-terminal.ts +731 -415
- package/src/report/sanitize.ts +27 -0
- package/src/score/adjustments.ts +113 -40
- package/src/score/confidence.ts +10 -5
- package/src/score/evidence.ts +55 -0
- package/src/score/index.ts +27 -55
- package/src/score/types.ts +4 -0
- package/src/shared/category-filter.ts +12 -0
- package/src/shared/regex-utils.ts +4 -0
- package/src/shared/registry-clients.ts +106 -18
- package/src/shared/rules/__tests__/metadata.test.ts +5 -1
- package/src/shared/rules/metadata.ts +19 -0
- package/src/shared/types.ts +372 -253
- package/src/taint/async-flow.ts +301 -0
- package/src/taint/cfg-builder.ts +1127 -0
- package/src/taint/cfg-types.ts +110 -0
- package/src/taint/constant-propagation.ts +170 -0
- package/src/taint/cross-file-analyzer.ts +118 -0
- package/src/taint/cross-file-index.ts +275 -0
- package/src/taint/def-use.ts +556 -0
- package/src/taint/file-analysis-cache.ts +145 -0
- package/src/taint/framework-models.ts +313 -0
- package/src/taint/helpers.ts +138 -0
- package/src/taint/index.ts +71 -0
- package/src/taint/llm-registry.ts +174 -0
- package/src/taint/llm-risk-scoring.ts +412 -0
- package/src/taint/propagation-types.ts +188 -0
- package/src/taint/propagation.ts +1750 -0
- package/src/taint/sanitizer-registry.ts +490 -0
- package/src/taint/sink-classifier.ts +1402 -0
- package/src/taint/source-classifier.ts +859 -0
- package/src/taint/taint-analyzer.ts +112 -0
- package/src/taint/taint-summary.ts +341 -0
- package/src/taint/types.ts +86 -0
- package/src/validate/clients.ts +3 -2
- package/src/validate/index.ts +89 -53
- package/src/validate/prompts/modules/ai-patterns.ts +16 -0
- package/src/validate/prompts/modules/common.ts +12 -3
- package/src/validate/providers/anthropic.ts +254 -148
- package/src/validate/providers/openai.ts +363 -218
- package/src/validate/request-builder.ts +2 -45
- package/src/validate/types.ts +9 -0
- package/src/validate/utils/path-helpers.ts +2 -2
- package/src/validate/utils/response-parser.ts +32 -3
- package/src/validate/utils/retry.ts +19 -4
- package/dist/ai-context/index.d.ts +0 -6
- package/dist/ai-context/index.d.ts.map +0 -1
- package/dist/ai-context/index.js +0 -13
- package/dist/ai-context/index.js.map +0 -1
- package/dist/ai-context/manager.d.ts +0 -67
- package/dist/ai-context/manager.d.ts.map +0 -1
- package/dist/ai-context/manager.js +0 -104
- package/dist/ai-context/manager.js.map +0 -1
- package/dist/baseline/diff.d.ts +0 -32
- package/dist/baseline/diff.d.ts.map +0 -1
- package/dist/baseline/diff.js +0 -119
- package/dist/baseline/diff.js.map +0 -1
- package/dist/baseline/index.d.ts +0 -9
- package/dist/baseline/index.d.ts.map +0 -1
- package/dist/baseline/index.js +0 -19
- package/dist/baseline/index.js.map +0 -1
- package/dist/baseline/manager.d.ts +0 -67
- package/dist/baseline/manager.d.ts.map +0 -1
- package/dist/baseline/manager.js +0 -180
- package/dist/baseline/manager.js.map +0 -1
- package/dist/baseline/types.d.ts +0 -91
- package/dist/baseline/types.d.ts.map +0 -1
- package/dist/baseline/types.js +0 -12
- package/dist/baseline/types.js.map +0 -1
- package/dist/category-filter.d.ts +0 -125
- package/dist/category-filter.d.ts.map +0 -1
- package/dist/category-filter.js +0 -360
- package/dist/category-filter.js.map +0 -1
- package/dist/detect/ai-code/agent-tools.d.ts +0 -22
- package/dist/detect/ai-code/agent-tools.d.ts.map +0 -1
- package/dist/detect/ai-code/agent-tools.js +0 -1509
- package/dist/detect/ai-code/agent-tools.js.map +0 -1
- package/dist/detect/ai-code/byok-patterns.d.ts +0 -15
- package/dist/detect/ai-code/byok-patterns.d.ts.map +0 -1
- package/dist/detect/ai-code/byok-patterns.js +0 -313
- package/dist/detect/ai-code/byok-patterns.js.map +0 -1
- package/dist/detect/ai-code/endpoint-protection.d.ts +0 -38
- package/dist/detect/ai-code/endpoint-protection.d.ts.map +0 -1
- package/dist/detect/ai-code/endpoint-protection.js +0 -349
- package/dist/detect/ai-code/endpoint-protection.js.map +0 -1
- package/dist/detect/ai-code/execution-sinks.d.ts +0 -21
- package/dist/detect/ai-code/execution-sinks.d.ts.map +0 -1
- package/dist/detect/ai-code/execution-sinks.js +0 -1158
- package/dist/detect/ai-code/execution-sinks.js.map +0 -1
- package/dist/detect/ai-code/fingerprinting.d.ts +0 -10
- package/dist/detect/ai-code/fingerprinting.d.ts.map +0 -1
- package/dist/detect/ai-code/fingerprinting.js +0 -665
- package/dist/detect/ai-code/fingerprinting.js.map +0 -1
- package/dist/detect/ai-code/mcp-security.d.ts +0 -20
- package/dist/detect/ai-code/mcp-security.d.ts.map +0 -1
- package/dist/detect/ai-code/mcp-security.js +0 -880
- package/dist/detect/ai-code/mcp-security.js.map +0 -1
- package/dist/detect/ai-code/model-supply-chain.d.ts +0 -23
- package/dist/detect/ai-code/model-supply-chain.d.ts.map +0 -1
- package/dist/detect/ai-code/model-supply-chain.js +0 -447
- package/dist/detect/ai-code/model-supply-chain.js.map +0 -1
- package/dist/detect/ai-code/package-hallucination.d.ts +0 -22
- package/dist/detect/ai-code/package-hallucination.d.ts.map +0 -1
- package/dist/detect/ai-code/package-hallucination.js +0 -841
- package/dist/detect/ai-code/package-hallucination.js.map +0 -1
- package/dist/detect/ai-code/prompt-hygiene.d.ts +0 -22
- package/dist/detect/ai-code/prompt-hygiene.d.ts.map +0 -1
- package/dist/detect/ai-code/prompt-hygiene.js +0 -1177
- package/dist/detect/ai-code/prompt-hygiene.js.map +0 -1
- package/dist/detect/ai-code/rag-safety.d.ts +0 -24
- package/dist/detect/ai-code/rag-safety.d.ts.map +0 -1
- package/dist/detect/ai-code/rag-safety.js +0 -913
- package/dist/detect/ai-code/rag-safety.js.map +0 -1
- package/dist/detect/ai-code/schema-validation.d.ts +0 -28
- package/dist/detect/ai-code/schema-validation.d.ts.map +0 -1
- package/dist/detect/ai-code/schema-validation.js +0 -378
- package/dist/detect/ai-code/schema-validation.js.map +0 -1
- package/dist/detect/secrets/patterns.d.ts +0 -11
- package/dist/detect/secrets/patterns.d.ts.map +0 -1
- package/dist/detect/secrets/patterns.js +0 -518
- package/dist/detect/secrets/patterns.js.map +0 -1
- package/dist/detect/secrets/weak-crypto.d.ts +0 -10
- package/dist/detect/secrets/weak-crypto.d.ts.map +0 -1
- package/dist/detect/secrets/weak-crypto.js +0 -432
- package/dist/detect/secrets/weak-crypto.js.map +0 -1
- package/dist/detect/structural/auth-patterns.d.ts +0 -22
- package/dist/detect/structural/auth-patterns.d.ts.map +0 -1
- package/dist/detect/structural/auth-patterns.js +0 -533
- package/dist/detect/structural/auth-patterns.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/child-process.d.ts +0 -16
- package/dist/detect/structural/dangerous-functions/child-process.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/child-process.js +0 -74
- package/dist/detect/structural/dangerous-functions/child-process.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/dom-xss.d.ts +0 -34
- package/dist/detect/structural/dangerous-functions/dom-xss.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/dom-xss.js +0 -230
- package/dist/detect/structural/dangerous-functions/dom-xss.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/index.d.ts +0 -16
- package/dist/detect/structural/dangerous-functions/index.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/index.js +0 -1193
- package/dist/detect/structural/dangerous-functions/index.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/json-parse.d.ts +0 -31
- package/dist/detect/structural/dangerous-functions/json-parse.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/json-parse.js +0 -326
- package/dist/detect/structural/dangerous-functions/json-parse.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/math-random.d.ts +0 -111
- package/dist/detect/structural/dangerous-functions/math-random.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/math-random.js +0 -684
- package/dist/detect/structural/dangerous-functions/math-random.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/patterns.d.ts +0 -21
- package/dist/detect/structural/dangerous-functions/patterns.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/patterns.js +0 -163
- package/dist/detect/structural/dangerous-functions/patterns.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/request-validation.d.ts +0 -13
- package/dist/detect/structural/dangerous-functions/request-validation.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/request-validation.js +0 -126
- package/dist/detect/structural/dangerous-functions/request-validation.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/utils/control-flow.d.ts +0 -24
- package/dist/detect/structural/dangerous-functions/utils/control-flow.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/utils/control-flow.js +0 -70
- package/dist/detect/structural/dangerous-functions/utils/control-flow.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/utils/helpers.d.ts +0 -31
- package/dist/detect/structural/dangerous-functions/utils/helpers.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/utils/helpers.js +0 -147
- package/dist/detect/structural/dangerous-functions/utils/helpers.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/utils/index.d.ts +0 -9
- package/dist/detect/structural/dangerous-functions/utils/index.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/utils/index.js +0 -23
- package/dist/detect/structural/dangerous-functions/utils/index.js.map +0 -1
- package/dist/detect/structural/dangerous-functions/utils/schema-validation.d.ts +0 -22
- package/dist/detect/structural/dangerous-functions/utils/schema-validation.d.ts.map +0 -1
- package/dist/detect/structural/dangerous-functions/utils/schema-validation.js +0 -102
- package/dist/detect/structural/dangerous-functions/utils/schema-validation.js.map +0 -1
- package/dist/detect/structural/data-exposure.d.ts +0 -19
- package/dist/detect/structural/data-exposure.d.ts.map +0 -1
- package/dist/detect/structural/data-exposure.js +0 -262
- package/dist/detect/structural/data-exposure.js.map +0 -1
- package/dist/detect/structural/framework-checks.d.ts +0 -10
- package/dist/detect/structural/framework-checks.d.ts.map +0 -1
- package/dist/detect/structural/framework-checks.js +0 -389
- package/dist/detect/structural/framework-checks.js.map +0 -1
- package/dist/detect/structural/log-injection.d.ts +0 -18
- package/dist/detect/structural/log-injection.d.ts.map +0 -1
- package/dist/detect/structural/log-injection.js +0 -217
- package/dist/detect/structural/log-injection.js.map +0 -1
- package/dist/detect/structural/logic-gates.d.ts +0 -10
- package/dist/detect/structural/logic-gates.d.ts.map +0 -1
- package/dist/detect/structural/logic-gates.js +0 -227
- package/dist/detect/structural/logic-gates.js.map +0 -1
- package/dist/detect/structural/risky-imports.d.ts +0 -10
- package/dist/detect/structural/risky-imports.d.ts.map +0 -1
- package/dist/detect/structural/risky-imports.js +0 -168
- package/dist/detect/structural/risky-imports.js.map +0 -1
- package/dist/detect/structural/security-headers.d.ts +0 -18
- package/dist/detect/structural/security-headers.d.ts.map +0 -1
- package/dist/detect/structural/security-headers.js +0 -196
- package/dist/detect/structural/security-headers.js.map +0 -1
- package/dist/detect/structural/ssrf-detection.d.ts +0 -18
- package/dist/detect/structural/ssrf-detection.d.ts.map +0 -1
- package/dist/detect/structural/ssrf-detection.js +0 -263
- package/dist/detect/structural/ssrf-detection.js.map +0 -1
- package/dist/detect/structural/variables.d.ts +0 -11
- package/dist/detect/structural/variables.d.ts.map +0 -1
- package/dist/detect/structural/variables.js +0 -159
- package/dist/detect/structural/variables.js.map +0 -1
- package/dist/detect/structural/xxe-detection.d.ts +0 -18
- package/dist/detect/structural/xxe-detection.d.ts.map +0 -1
- package/dist/detect/structural/xxe-detection.js +0 -245
- package/dist/detect/structural/xxe-detection.js.map +0 -1
- package/dist/filtering/context-adjustments.d.ts +0 -23
- package/dist/filtering/context-adjustments.d.ts.map +0 -1
- package/dist/filtering/context-adjustments.js +0 -100
- package/dist/filtering/context-adjustments.js.map +0 -1
- package/dist/filtering/index.d.ts +0 -3
- package/dist/filtering/index.d.ts.map +0 -1
- package/dist/filtering/index.js +0 -8
- package/dist/filtering/index.js.map +0 -1
- package/dist/filtering/pipeline.d.ts +0 -48
- package/dist/filtering/pipeline.d.ts.map +0 -1
- package/dist/filtering/pipeline.js +0 -76
- package/dist/filtering/pipeline.js.map +0 -1
- package/dist/formatters/ai-context.d.ts +0 -23
- package/dist/formatters/ai-context.d.ts.map +0 -1
- package/dist/formatters/ai-context.js +0 -238
- package/dist/formatters/ai-context.js.map +0 -1
- package/dist/formatters/cli-terminal.d.ts +0 -65
- package/dist/formatters/cli-terminal.d.ts.map +0 -1
- package/dist/formatters/cli-terminal.js +0 -735
- package/dist/formatters/cli-terminal.js.map +0 -1
- package/dist/formatters/github-comment.d.ts +0 -41
- package/dist/formatters/github-comment.d.ts.map +0 -1
- package/dist/formatters/github-comment.js +0 -370
- package/dist/formatters/github-comment.js.map +0 -1
- package/dist/formatters/grouping.d.ts +0 -52
- package/dist/formatters/grouping.d.ts.map +0 -1
- package/dist/formatters/grouping.js +0 -152
- package/dist/formatters/grouping.js.map +0 -1
- package/dist/formatters/ide/claude-code.d.ts +0 -17
- package/dist/formatters/ide/claude-code.d.ts.map +0 -1
- package/dist/formatters/ide/claude-code.js +0 -94
- package/dist/formatters/ide/claude-code.js.map +0 -1
- package/dist/formatters/ide/cursor.d.ts +0 -13
- package/dist/formatters/ide/cursor.d.ts.map +0 -1
- package/dist/formatters/ide/cursor.js +0 -125
- package/dist/formatters/ide/cursor.js.map +0 -1
- package/dist/formatters/ide/index.d.ts +0 -62
- package/dist/formatters/ide/index.d.ts.map +0 -1
- package/dist/formatters/ide/index.js +0 -184
- package/dist/formatters/ide/index.js.map +0 -1
- package/dist/formatters/ide/windsurf.d.ts +0 -13
- package/dist/formatters/ide/windsurf.d.ts.map +0 -1
- package/dist/formatters/ide/windsurf.js +0 -117
- package/dist/formatters/ide/windsurf.js.map +0 -1
- package/dist/formatters/index.d.ts +0 -11
- package/dist/formatters/index.d.ts.map +0 -1
- package/dist/formatters/index.js +0 -54
- package/dist/formatters/index.js.map +0 -1
- package/dist/formatters/vscode-diagnostic.d.ts +0 -103
- package/dist/formatters/vscode-diagnostic.d.ts.map +0 -1
- package/dist/formatters/vscode-diagnostic.js +0 -151
- package/dist/formatters/vscode-diagnostic.js.map +0 -1
- package/dist/layer1/comments.d.ts +0 -11
- package/dist/layer1/comments.d.ts.map +0 -1
- package/dist/layer1/comments.js +0 -203
- package/dist/layer1/comments.js.map +0 -1
- package/dist/layer1/config-audit.d.ts +0 -11
- package/dist/layer1/config-audit.d.ts.map +0 -1
- package/dist/layer1/config-audit.js +0 -311
- package/dist/layer1/config-audit.js.map +0 -1
- package/dist/layer1/config-mcp-audit.d.ts +0 -23
- package/dist/layer1/config-mcp-audit.d.ts.map +0 -1
- package/dist/layer1/config-mcp-audit.js +0 -239
- package/dist/layer1/config-mcp-audit.js.map +0 -1
- package/dist/layer1/entropy.d.ts +0 -11
- package/dist/layer1/entropy.d.ts.map +0 -1
- package/dist/layer1/entropy.js +0 -741
- package/dist/layer1/entropy.js.map +0 -1
- package/dist/layer1/file-flags.d.ts +0 -10
- package/dist/layer1/file-flags.d.ts.map +0 -1
- package/dist/layer1/file-flags.js +0 -119
- package/dist/layer1/file-flags.js.map +0 -1
- package/dist/layer1/index.d.ts +0 -38
- package/dist/layer1/index.d.ts.map +0 -1
- package/dist/layer1/index.js +0 -170
- package/dist/layer1/index.js.map +0 -1
- package/dist/layer1/patterns.d.ts +0 -11
- package/dist/layer1/patterns.d.ts.map +0 -1
- package/dist/layer1/patterns.js +0 -512
- package/dist/layer1/patterns.js.map +0 -1
- package/dist/layer1/urls.d.ts +0 -11
- package/dist/layer1/urls.d.ts.map +0 -1
- package/dist/layer1/urls.js +0 -444
- package/dist/layer1/urls.js.map +0 -1
- package/dist/layer1/weak-crypto.d.ts +0 -10
- package/dist/layer1/weak-crypto.d.ts.map +0 -1
- package/dist/layer1/weak-crypto.js +0 -428
- package/dist/layer1/weak-crypto.js.map +0 -1
- package/dist/layer2/ai-agent-tools.d.ts +0 -22
- package/dist/layer2/ai-agent-tools.d.ts.map +0 -1
- package/dist/layer2/ai-agent-tools.js +0 -1490
- package/dist/layer2/ai-agent-tools.js.map +0 -1
- package/dist/layer2/ai-endpoint-protection.d.ts +0 -38
- package/dist/layer2/ai-endpoint-protection.d.ts.map +0 -1
- package/dist/layer2/ai-endpoint-protection.js +0 -346
- package/dist/layer2/ai-endpoint-protection.js.map +0 -1
- package/dist/layer2/ai-execution-sinks.d.ts +0 -21
- package/dist/layer2/ai-execution-sinks.d.ts.map +0 -1
- package/dist/layer2/ai-execution-sinks.js +0 -1155
- package/dist/layer2/ai-execution-sinks.js.map +0 -1
- package/dist/layer2/ai-fingerprinting.d.ts +0 -10
- package/dist/layer2/ai-fingerprinting.d.ts.map +0 -1
- package/dist/layer2/ai-fingerprinting.js +0 -650
- package/dist/layer2/ai-fingerprinting.js.map +0 -1
- package/dist/layer2/ai-mcp-security.d.ts +0 -20
- package/dist/layer2/ai-mcp-security.d.ts.map +0 -1
- package/dist/layer2/ai-mcp-security.js +0 -877
- package/dist/layer2/ai-mcp-security.js.map +0 -1
- package/dist/layer2/ai-package-hallucination.d.ts +0 -22
- package/dist/layer2/ai-package-hallucination.d.ts.map +0 -1
- package/dist/layer2/ai-package-hallucination.js +0 -828
- package/dist/layer2/ai-package-hallucination.js.map +0 -1
- package/dist/layer2/ai-prompt-hygiene.d.ts +0 -22
- package/dist/layer2/ai-prompt-hygiene.d.ts.map +0 -1
- package/dist/layer2/ai-prompt-hygiene.js +0 -1156
- package/dist/layer2/ai-prompt-hygiene.js.map +0 -1
- package/dist/layer2/ai-rag-safety.d.ts +0 -24
- package/dist/layer2/ai-rag-safety.d.ts.map +0 -1
- package/dist/layer2/ai-rag-safety.js +0 -910
- package/dist/layer2/ai-rag-safety.js.map +0 -1
- package/dist/layer2/ai-schema-validation.d.ts +0 -28
- package/dist/layer2/ai-schema-validation.d.ts.map +0 -1
- package/dist/layer2/ai-schema-validation.js +0 -375
- package/dist/layer2/ai-schema-validation.js.map +0 -1
- package/dist/layer2/auth-antipatterns.d.ts +0 -22
- package/dist/layer2/auth-antipatterns.d.ts.map +0 -1
- package/dist/layer2/auth-antipatterns.js +0 -522
- package/dist/layer2/auth-antipatterns.js.map +0 -1
- package/dist/layer2/byok-patterns.d.ts +0 -15
- package/dist/layer2/byok-patterns.d.ts.map +0 -1
- package/dist/layer2/byok-patterns.js +0 -302
- package/dist/layer2/byok-patterns.js.map +0 -1
- package/dist/layer2/dangerous-functions/child-process.d.ts +0 -16
- package/dist/layer2/dangerous-functions/child-process.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/child-process.js +0 -74
- package/dist/layer2/dangerous-functions/child-process.js.map +0 -1
- package/dist/layer2/dangerous-functions/dom-xss.d.ts +0 -34
- package/dist/layer2/dangerous-functions/dom-xss.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/dom-xss.js +0 -230
- package/dist/layer2/dangerous-functions/dom-xss.js.map +0 -1
- package/dist/layer2/dangerous-functions/index.d.ts +0 -16
- package/dist/layer2/dangerous-functions/index.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/index.js +0 -1152
- package/dist/layer2/dangerous-functions/index.js.map +0 -1
- package/dist/layer2/dangerous-functions/json-parse.d.ts +0 -31
- package/dist/layer2/dangerous-functions/json-parse.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/json-parse.js +0 -319
- package/dist/layer2/dangerous-functions/json-parse.js.map +0 -1
- package/dist/layer2/dangerous-functions/math-random.d.ts +0 -111
- package/dist/layer2/dangerous-functions/math-random.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/math-random.js +0 -684
- package/dist/layer2/dangerous-functions/math-random.js.map +0 -1
- package/dist/layer2/dangerous-functions/patterns.d.ts +0 -21
- package/dist/layer2/dangerous-functions/patterns.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/patterns.js +0 -163
- package/dist/layer2/dangerous-functions/patterns.js.map +0 -1
- package/dist/layer2/dangerous-functions/request-validation.d.ts +0 -13
- package/dist/layer2/dangerous-functions/request-validation.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/request-validation.js +0 -119
- package/dist/layer2/dangerous-functions/request-validation.js.map +0 -1
- package/dist/layer2/dangerous-functions/utils/control-flow.d.ts +0 -24
- package/dist/layer2/dangerous-functions/utils/control-flow.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/utils/control-flow.js +0 -70
- package/dist/layer2/dangerous-functions/utils/control-flow.js.map +0 -1
- package/dist/layer2/dangerous-functions/utils/helpers.d.ts +0 -31
- package/dist/layer2/dangerous-functions/utils/helpers.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/utils/helpers.js +0 -147
- package/dist/layer2/dangerous-functions/utils/helpers.js.map +0 -1
- package/dist/layer2/dangerous-functions/utils/index.d.ts +0 -9
- package/dist/layer2/dangerous-functions/utils/index.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/utils/index.js +0 -23
- package/dist/layer2/dangerous-functions/utils/index.js.map +0 -1
- package/dist/layer2/dangerous-functions/utils/schema-validation.d.ts +0 -22
- package/dist/layer2/dangerous-functions/utils/schema-validation.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions/utils/schema-validation.js +0 -102
- package/dist/layer2/dangerous-functions/utils/schema-validation.js.map +0 -1
- package/dist/layer2/data-exposure.d.ts +0 -19
- package/dist/layer2/data-exposure.d.ts.map +0 -1
- package/dist/layer2/data-exposure.js +0 -255
- package/dist/layer2/data-exposure.js.map +0 -1
- package/dist/layer2/framework-checks.d.ts +0 -10
- package/dist/layer2/framework-checks.d.ts.map +0 -1
- package/dist/layer2/framework-checks.js +0 -384
- package/dist/layer2/framework-checks.js.map +0 -1
- package/dist/layer2/index.d.ts +0 -74
- package/dist/layer2/index.d.ts.map +0 -1
- package/dist/layer2/index.js +0 -544
- package/dist/layer2/index.js.map +0 -1
- package/dist/layer2/log-injection.d.ts +0 -18
- package/dist/layer2/log-injection.d.ts.map +0 -1
- package/dist/layer2/log-injection.js +0 -214
- package/dist/layer2/log-injection.js.map +0 -1
- package/dist/layer2/logic-gates.d.ts +0 -10
- package/dist/layer2/logic-gates.d.ts.map +0 -1
- package/dist/layer2/logic-gates.js +0 -220
- package/dist/layer2/logic-gates.js.map +0 -1
- package/dist/layer2/model-supply-chain.d.ts +0 -23
- package/dist/layer2/model-supply-chain.d.ts.map +0 -1
- package/dist/layer2/model-supply-chain.js +0 -444
- package/dist/layer2/model-supply-chain.js.map +0 -1
- package/dist/layer2/risky-imports.d.ts +0 -10
- package/dist/layer2/risky-imports.d.ts.map +0 -1
- package/dist/layer2/risky-imports.js +0 -165
- package/dist/layer2/risky-imports.js.map +0 -1
- package/dist/layer2/security-headers.d.ts +0 -18
- package/dist/layer2/security-headers.d.ts.map +0 -1
- package/dist/layer2/security-headers.js +0 -187
- package/dist/layer2/security-headers.js.map +0 -1
- package/dist/layer2/ssrf-detection.d.ts +0 -18
- package/dist/layer2/ssrf-detection.d.ts.map +0 -1
- package/dist/layer2/ssrf-detection.js +0 -252
- package/dist/layer2/ssrf-detection.js.map +0 -1
- package/dist/layer2/variables.d.ts +0 -11
- package/dist/layer2/variables.d.ts.map +0 -1
- package/dist/layer2/variables.js +0 -156
- package/dist/layer2/variables.js.map +0 -1
- package/dist/layer2/xxe-detection.d.ts +0 -18
- package/dist/layer2/xxe-detection.d.ts.map +0 -1
- package/dist/layer2/xxe-detection.js +0 -242
- package/dist/layer2/xxe-detection.js.map +0 -1
- package/dist/layer3/anthropic/auto-dismiss.d.ts +0 -24
- package/dist/layer3/anthropic/auto-dismiss.d.ts.map +0 -1
- package/dist/layer3/anthropic/auto-dismiss.js +0 -199
- package/dist/layer3/anthropic/auto-dismiss.js.map +0 -1
- package/dist/layer3/anthropic/clients.d.ts +0 -44
- package/dist/layer3/anthropic/clients.d.ts.map +0 -1
- package/dist/layer3/anthropic/clients.js +0 -81
- package/dist/layer3/anthropic/clients.js.map +0 -1
- package/dist/layer3/anthropic/index.d.ts +0 -41
- package/dist/layer3/anthropic/index.d.ts.map +0 -1
- package/dist/layer3/anthropic/index.js +0 -141
- package/dist/layer3/anthropic/index.js.map +0 -1
- package/dist/layer3/anthropic/prompts/index.d.ts +0 -8
- package/dist/layer3/anthropic/prompts/index.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/index.js +0 -16
- package/dist/layer3/anthropic/prompts/index.js.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/ai-patterns.d.ts +0 -19
- package/dist/layer3/anthropic/prompts/modules/ai-patterns.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/ai-patterns.js +0 -156
- package/dist/layer3/anthropic/prompts/modules/ai-patterns.js.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/auth-access.d.ts +0 -9
- package/dist/layer3/anthropic/prompts/modules/auth-access.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/auth-access.js +0 -25
- package/dist/layer3/anthropic/prompts/modules/auth-access.js.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/common.d.ts +0 -11
- package/dist/layer3/anthropic/prompts/modules/common.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/common.js +0 -152
- package/dist/layer3/anthropic/prompts/modules/common.js.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/index.d.ts +0 -54
- package/dist/layer3/anthropic/prompts/modules/index.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/index.js +0 -185
- package/dist/layer3/anthropic/prompts/modules/index.js.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/owasp-classic.d.ts +0 -8
- package/dist/layer3/anthropic/prompts/modules/owasp-classic.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/owasp-classic.js +0 -84
- package/dist/layer3/anthropic/prompts/modules/owasp-classic.js.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/secrets-crypto.d.ts +0 -8
- package/dist/layer3/anthropic/prompts/modules/secrets-crypto.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/secrets-crypto.js +0 -68
- package/dist/layer3/anthropic/prompts/modules/secrets-crypto.js.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/xss-prompt.d.ts +0 -8
- package/dist/layer3/anthropic/prompts/modules/xss-prompt.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/modules/xss-prompt.js +0 -22
- package/dist/layer3/anthropic/prompts/modules/xss-prompt.js.map +0 -1
- package/dist/layer3/anthropic/prompts/semantic-analysis.d.ts +0 -15
- package/dist/layer3/anthropic/prompts/semantic-analysis.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/semantic-analysis.js +0 -169
- package/dist/layer3/anthropic/prompts/semantic-analysis.js.map +0 -1
- package/dist/layer3/anthropic/prompts/validation.d.ts +0 -18
- package/dist/layer3/anthropic/prompts/validation.d.ts.map +0 -1
- package/dist/layer3/anthropic/prompts/validation.js +0 -25
- package/dist/layer3/anthropic/prompts/validation.js.map +0 -1
- package/dist/layer3/anthropic/providers/anthropic.d.ts +0 -21
- package/dist/layer3/anthropic/providers/anthropic.d.ts.map +0 -1
- package/dist/layer3/anthropic/providers/anthropic.js +0 -269
- package/dist/layer3/anthropic/providers/anthropic.js.map +0 -1
- package/dist/layer3/anthropic/providers/index.d.ts +0 -8
- package/dist/layer3/anthropic/providers/index.d.ts.map +0 -1
- package/dist/layer3/anthropic/providers/index.js +0 -15
- package/dist/layer3/anthropic/providers/index.js.map +0 -1
- package/dist/layer3/anthropic/providers/openai.d.ts +0 -18
- package/dist/layer3/anthropic/providers/openai.d.ts.map +0 -1
- package/dist/layer3/anthropic/providers/openai.js +0 -343
- package/dist/layer3/anthropic/providers/openai.js.map +0 -1
- package/dist/layer3/anthropic/request-builder.d.ts +0 -27
- package/dist/layer3/anthropic/request-builder.d.ts.map +0 -1
- package/dist/layer3/anthropic/request-builder.js +0 -150
- package/dist/layer3/anthropic/request-builder.js.map +0 -1
- package/dist/layer3/anthropic/types.d.ts +0 -88
- package/dist/layer3/anthropic/types.d.ts.map +0 -1
- package/dist/layer3/anthropic/types.js +0 -38
- package/dist/layer3/anthropic/types.js.map +0 -1
- package/dist/layer3/anthropic/utils/context-extractor.d.ts +0 -55
- package/dist/layer3/anthropic/utils/context-extractor.d.ts.map +0 -1
- package/dist/layer3/anthropic/utils/context-extractor.js +0 -161
- package/dist/layer3/anthropic/utils/context-extractor.js.map +0 -1
- package/dist/layer3/anthropic/utils/index.d.ts +0 -11
- package/dist/layer3/anthropic/utils/index.d.ts.map +0 -1
- package/dist/layer3/anthropic/utils/index.js +0 -27
- package/dist/layer3/anthropic/utils/index.js.map +0 -1
- package/dist/layer3/anthropic/utils/path-helpers.d.ts +0 -21
- package/dist/layer3/anthropic/utils/path-helpers.d.ts.map +0 -1
- package/dist/layer3/anthropic/utils/path-helpers.js +0 -69
- package/dist/layer3/anthropic/utils/path-helpers.js.map +0 -1
- package/dist/layer3/anthropic/utils/response-parser.d.ts +0 -40
- package/dist/layer3/anthropic/utils/response-parser.d.ts.map +0 -1
- package/dist/layer3/anthropic/utils/response-parser.js +0 -285
- package/dist/layer3/anthropic/utils/response-parser.js.map +0 -1
- package/dist/layer3/anthropic/utils/retry.d.ts +0 -15
- package/dist/layer3/anthropic/utils/retry.d.ts.map +0 -1
- package/dist/layer3/anthropic/utils/retry.js +0 -62
- package/dist/layer3/anthropic/utils/retry.js.map +0 -1
- package/dist/layer3/index.d.ts +0 -27
- package/dist/layer3/index.d.ts.map +0 -1
- package/dist/layer3/index.js +0 -150
- package/dist/layer3/index.js.map +0 -1
- package/dist/layer3/osv-check.d.ts +0 -75
- package/dist/layer3/osv-check.d.ts.map +0 -1
- package/dist/layer3/osv-check.js +0 -308
- package/dist/layer3/osv-check.js.map +0 -1
- package/dist/layer3/package-check.d.ts +0 -63
- package/dist/layer3/package-check.d.ts.map +0 -1
- package/dist/layer3/package-check.js +0 -508
- package/dist/layer3/package-check.js.map +0 -1
- package/dist/model/cross-file-taint.d.ts +0 -40
- package/dist/model/cross-file-taint.d.ts.map +0 -1
- package/dist/model/cross-file-taint.js +0 -290
- package/dist/model/cross-file-taint.js.map +0 -1
- package/dist/model/function-classifier.d.ts +0 -32
- package/dist/model/function-classifier.d.ts.map +0 -1
- package/dist/model/function-classifier.js +0 -143
- package/dist/model/function-classifier.js.map +0 -1
- package/dist/model/sanitiser-detection.d.ts +0 -27
- package/dist/model/sanitiser-detection.d.ts.map +0 -1
- package/dist/model/sanitiser-detection.js +0 -224
- package/dist/model/sanitiser-detection.js.map +0 -1
- package/dist/model/sink-matcher.d.ts +0 -17
- package/dist/model/sink-matcher.d.ts.map +0 -1
- package/dist/model/sink-matcher.js +0 -141
- package/dist/model/sink-matcher.js.map +0 -1
- package/dist/model/sink-patterns.d.ts +0 -19
- package/dist/model/sink-patterns.d.ts.map +0 -1
- package/dist/model/sink-patterns.js +0 -88
- package/dist/model/sink-patterns.js.map +0 -1
- package/dist/model/source-discovery.d.ts +0 -15
- package/dist/model/source-discovery.d.ts.map +0 -1
- package/dist/model/source-discovery.js +0 -170
- package/dist/model/source-discovery.js.map +0 -1
- package/dist/model/taint-tracker.d.ts +0 -21
- package/dist/model/taint-tracker.d.ts.map +0 -1
- package/dist/model/taint-tracker.js +0 -281
- package/dist/model/taint-tracker.js.map +0 -1
- package/dist/modes/incremental.d.ts +0 -66
- package/dist/modes/incremental.d.ts.map +0 -1
- package/dist/modes/incremental.js +0 -200
- package/dist/modes/incremental.js.map +0 -1
- package/dist/rules/framework-fixes.d.ts +0 -48
- package/dist/rules/framework-fixes.d.ts.map +0 -1
- package/dist/rules/framework-fixes.js +0 -439
- package/dist/rules/framework-fixes.js.map +0 -1
- package/dist/rules/index.d.ts +0 -8
- package/dist/rules/index.d.ts.map +0 -1
- package/dist/rules/index.js +0 -18
- package/dist/rules/index.js.map +0 -1
- package/dist/rules/metadata.d.ts +0 -43
- package/dist/rules/metadata.d.ts.map +0 -1
- package/dist/rules/metadata.js +0 -800
- package/dist/rules/metadata.js.map +0 -1
- package/dist/score/auto-dismiss.d.ts +0 -28
- package/dist/score/auto-dismiss.d.ts.map +0 -1
- package/dist/score/auto-dismiss.js +0 -200
- package/dist/score/auto-dismiss.js.map +0 -1
- package/dist/suppression/config-loader.d.ts +0 -74
- package/dist/suppression/config-loader.d.ts.map +0 -1
- package/dist/suppression/config-loader.js +0 -424
- package/dist/suppression/config-loader.js.map +0 -1
- package/dist/suppression/hash.d.ts +0 -48
- package/dist/suppression/hash.d.ts.map +0 -1
- package/dist/suppression/hash.js +0 -88
- package/dist/suppression/hash.js.map +0 -1
- package/dist/suppression/index.d.ts +0 -11
- package/dist/suppression/index.d.ts.map +0 -1
- package/dist/suppression/index.js +0 -39
- package/dist/suppression/index.js.map +0 -1
- package/dist/suppression/inline-parser.d.ts +0 -39
- package/dist/suppression/inline-parser.d.ts.map +0 -1
- package/dist/suppression/inline-parser.js +0 -218
- package/dist/suppression/inline-parser.js.map +0 -1
- package/dist/suppression/manager.d.ts +0 -94
- package/dist/suppression/manager.d.ts.map +0 -1
- package/dist/suppression/manager.js +0 -292
- package/dist/suppression/manager.js.map +0 -1
- package/dist/suppression/types.d.ts +0 -151
- package/dist/suppression/types.d.ts.map +0 -1
- package/dist/suppression/types.js +0 -28
- package/dist/suppression/types.js.map +0 -1
- package/dist/types.d.ts +0 -331
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -124
- package/dist/types.js.map +0 -1
- package/dist/utils/auth-helper-detector.d.ts +0 -56
- package/dist/utils/auth-helper-detector.d.ts.map +0 -1
- package/dist/utils/auth-helper-detector.js +0 -360
- package/dist/utils/auth-helper-detector.js.map +0 -1
- package/dist/utils/code-analysis.d.ts +0 -39
- package/dist/utils/code-analysis.d.ts.map +0 -1
- package/dist/utils/code-analysis.js +0 -159
- package/dist/utils/code-analysis.js.map +0 -1
- package/dist/utils/comment-analyzer.d.ts +0 -38
- package/dist/utils/comment-analyzer.d.ts.map +0 -1
- package/dist/utils/comment-analyzer.js +0 -218
- package/dist/utils/comment-analyzer.js.map +0 -1
- package/dist/utils/context-helpers.d.ts +0 -219
- package/dist/utils/context-helpers.d.ts.map +0 -1
- package/dist/utils/context-helpers.js +0 -886
- package/dist/utils/context-helpers.js.map +0 -1
- package/dist/utils/diff-detector.d.ts +0 -53
- package/dist/utils/diff-detector.d.ts.map +0 -1
- package/dist/utils/diff-detector.js +0 -104
- package/dist/utils/diff-detector.js.map +0 -1
- package/dist/utils/diff-parser.d.ts +0 -80
- package/dist/utils/diff-parser.d.ts.map +0 -1
- package/dist/utils/diff-parser.js +0 -202
- package/dist/utils/diff-parser.js.map +0 -1
- package/dist/utils/environment-context.d.ts +0 -76
- package/dist/utils/environment-context.d.ts.map +0 -1
- package/dist/utils/environment-context.js +0 -271
- package/dist/utils/environment-context.js.map +0 -1
- package/dist/utils/imported-auth-detector.d.ts +0 -37
- package/dist/utils/imported-auth-detector.d.ts.map +0 -1
- package/dist/utils/imported-auth-detector.js +0 -251
- package/dist/utils/imported-auth-detector.js.map +0 -1
- package/dist/utils/intent-detector.d.ts +0 -66
- package/dist/utils/intent-detector.d.ts.map +0 -1
- package/dist/utils/intent-detector.js +0 -282
- package/dist/utils/intent-detector.js.map +0 -1
- package/dist/utils/middleware-detector.d.ts +0 -55
- package/dist/utils/middleware-detector.d.ts.map +0 -1
- package/dist/utils/middleware-detector.js +0 -260
- package/dist/utils/middleware-detector.js.map +0 -1
- package/dist/utils/oauth-flow-detector.d.ts +0 -41
- package/dist/utils/oauth-flow-detector.d.ts.map +0 -1
- package/dist/utils/oauth-flow-detector.js +0 -202
- package/dist/utils/oauth-flow-detector.js.map +0 -1
- package/dist/utils/parsed-file.d.ts +0 -51
- package/dist/utils/parsed-file.d.ts.map +0 -1
- package/dist/utils/parsed-file.js +0 -95
- package/dist/utils/parsed-file.js.map +0 -1
- package/dist/utils/path-exclusions.d.ts +0 -55
- package/dist/utils/path-exclusions.d.ts.map +0 -1
- package/dist/utils/path-exclusions.js +0 -224
- package/dist/utils/path-exclusions.js.map +0 -1
- package/dist/utils/project-context-builder.d.ts +0 -119
- package/dist/utils/project-context-builder.d.ts.map +0 -1
- package/dist/utils/project-context-builder.js +0 -534
- package/dist/utils/project-context-builder.js.map +0 -1
- package/dist/utils/registry-clients.d.ts +0 -93
- package/dist/utils/registry-clients.d.ts.map +0 -1
- package/dist/utils/registry-clients.js +0 -273
- package/dist/utils/registry-clients.js.map +0 -1
- package/dist/utils/route-hierarchy.d.ts +0 -50
- package/dist/utils/route-hierarchy.d.ts.map +0 -1
- package/dist/utils/route-hierarchy.js +0 -226
- package/dist/utils/route-hierarchy.js.map +0 -1
- package/dist/utils/schema-semantics.d.ts +0 -45
- package/dist/utils/schema-semantics.d.ts.map +0 -1
- package/dist/utils/schema-semantics.js +0 -193
- package/dist/utils/schema-semantics.js.map +0 -1
- package/dist/utils/trpc-analyzer.d.ts +0 -78
- package/dist/utils/trpc-analyzer.d.ts.map +0 -1
- package/dist/utils/trpc-analyzer.js +0 -297
- package/dist/utils/trpc-analyzer.js.map +0 -1
- package/src/__tests__/context-engine/cross-file-taint.test.ts +0 -284
- package/src/__tests__/context-engine/function-classifier.test.ts +0 -146
- package/src/__tests__/context-engine/integration.test.ts +0 -320
- package/src/__tests__/context-engine/sanitiser-detection.test.ts +0 -187
- package/src/__tests__/context-engine/sink-matcher.test.ts +0 -251
- package/src/__tests__/context-engine/source-discovery.test.ts +0 -186
- package/src/__tests__/context-engine/taint-tracker.test.ts +0 -182
- package/src/__tests__/snapshots/__snapshots__/anthropic-validation-refactor.test.ts.snap +0 -750
- package/src/__tests__/snapshots/__snapshots__/dangerous-functions-refactor.test.ts.snap +0 -555
- package/src/__tests__/snapshots/anthropic-validation-refactor.test.ts +0 -321
- package/src/__tests__/snapshots/dangerous-functions-refactor.test.ts +0 -439
- package/src/detect/ai-code/agent-tools.ts +0 -1662
- package/src/detect/ai-code/byok-patterns.ts +0 -354
- package/src/detect/ai-code/endpoint-protection.ts +0 -406
- package/src/detect/ai-code/execution-sinks.ts +0 -1310
- package/src/detect/ai-code/fingerprinting.ts +0 -774
- package/src/detect/ai-code/mcp-security.ts +0 -937
- package/src/detect/ai-code/model-supply-chain.ts +0 -535
- package/src/detect/ai-code/package-hallucination.ts +0 -955
- package/src/detect/ai-code/prompt-hygiene.ts +0 -1314
- package/src/detect/ai-code/rag-safety.ts +0 -977
- package/src/detect/ai-code/schema-validation.ts +0 -427
- package/src/detect/secrets/patterns.ts +0 -561
- package/src/detect/secrets/weak-crypto.ts +0 -485
- package/src/detect/structural/__tests__/math-random-enhanced.test.ts +0 -405
- package/src/detect/structural/auth-patterns.ts +0 -621
- package/src/detect/structural/dangerous-functions/child-process.ts +0 -98
- package/src/detect/structural/dangerous-functions/dom-xss.ts +0 -292
- package/src/detect/structural/dangerous-functions/index.ts +0 -1556
- package/src/detect/structural/dangerous-functions/json-parse.ts +0 -393
- package/src/detect/structural/dangerous-functions/math-random.ts +0 -789
- package/src/detect/structural/dangerous-functions/patterns.ts +0 -176
- package/src/detect/structural/dangerous-functions/request-validation.ts +0 -153
- package/src/detect/structural/dangerous-functions/utils/control-flow.ts +0 -35
- package/src/detect/structural/dangerous-functions/utils/helpers.ts +0 -170
- package/src/detect/structural/dangerous-functions/utils/index.ts +0 -25
- package/src/detect/structural/dangerous-functions/utils/schema-validation.ts +0 -106
- package/src/detect/structural/data-exposure.ts +0 -302
- package/src/detect/structural/framework-checks.ts +0 -439
- package/src/detect/structural/log-injection.ts +0 -254
- package/src/detect/structural/logic-gates.ts +0 -256
- package/src/detect/structural/risky-imports.ts +0 -197
- package/src/detect/structural/security-headers.ts +0 -231
- package/src/detect/structural/ssrf-detection.ts +0 -300
- package/src/detect/structural/variables.ts +0 -177
- package/src/detect/structural/xxe-detection.ts +0 -295
- package/src/model/cross-file-taint.ts +0 -374
- package/src/model/function-classifier.ts +0 -184
- package/src/model/sanitiser-detection.ts +0 -268
- package/src/model/sink-matcher.ts +0 -178
- package/src/model/sink-patterns.ts +0 -109
- package/src/model/source-discovery.ts +0 -209
- package/src/model/taint-tracker.ts +0 -333
- package/src/score/auto-dismiss.ts +0 -224
|
@@ -0,0 +1,859 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST-Based Source Classifier
|
|
3
|
+
*
|
|
4
|
+
* Identifies taint sources (user input, LLM output, etc.) using AST analysis.
|
|
5
|
+
* Replaces regex-based model/source-discovery.ts with structural understanding.
|
|
6
|
+
*
|
|
7
|
+
* Key improvements over regex:
|
|
8
|
+
* - Handles destructuring: `const { email } = await req.json()`
|
|
9
|
+
* - Type-aware: `function handler(req: NextRequest)` → req is a source
|
|
10
|
+
* - Deep property access: `req.body.user.email` → user input
|
|
11
|
+
* - AI sources: `response.choices[0].message.content` with appropriate taint kinds
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type Parser from 'tree-sitter'
|
|
15
|
+
import type { ParsedAST } from '../parse/ast'
|
|
16
|
+
import { walkAST, findEnclosingFunction } from '../parse/ast'
|
|
17
|
+
import { extractTypeRegistry } from '../parse/type-extractor'
|
|
18
|
+
import type { TaintSource, TaintSourceType, TaintKind } from './types'
|
|
19
|
+
import { ALL_TAINT_KINDS } from './types'
|
|
20
|
+
import { isKnownLLMCall } from './llm-registry'
|
|
21
|
+
import { collectImportBindings } from './helpers'
|
|
22
|
+
import { collectPythonImportBindings } from '../detect/ast-rules/helpers/python-helpers'
|
|
23
|
+
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Source Type → Default Taint Kinds
|
|
26
|
+
// ============================================================================
|
|
27
|
+
|
|
28
|
+
const SOURCE_TAINT_MAP: Record<TaintSourceType, readonly TaintKind[]> = {
|
|
29
|
+
http_body: ALL_TAINT_KINDS,
|
|
30
|
+
http_query: ALL_TAINT_KINDS,
|
|
31
|
+
http_params: ALL_TAINT_KINDS,
|
|
32
|
+
http_headers: ['xss', 'command', 'ssrf'],
|
|
33
|
+
url_search_params: ALL_TAINT_KINDS,
|
|
34
|
+
form_data: ALL_TAINT_KINDS,
|
|
35
|
+
file_upload: ['path', 'command', 'xss'],
|
|
36
|
+
websocket_message: ALL_TAINT_KINDS,
|
|
37
|
+
cli_args: ALL_TAINT_KINDS,
|
|
38
|
+
env_var: ['command'],
|
|
39
|
+
database_result: ['xss', 'command', 'prompt'],
|
|
40
|
+
external_api: ALL_TAINT_KINDS,
|
|
41
|
+
llm_output: ['command', 'sql', 'xss', 'path', 'prompt'],
|
|
42
|
+
tool_input: ALL_TAINT_KINDS,
|
|
43
|
+
tool_output: ALL_TAINT_KINDS,
|
|
44
|
+
rag_retrieval: ['xss', 'prompt', 'command'],
|
|
45
|
+
conversation_history: ['prompt', 'xss', 'command'],
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ============================================================================
|
|
49
|
+
// AST User Input Patterns
|
|
50
|
+
// ============================================================================
|
|
51
|
+
|
|
52
|
+
interface MemberAccessPattern {
|
|
53
|
+
objectPattern: RegExp
|
|
54
|
+
property: string | RegExp
|
|
55
|
+
sourceType: TaintSourceType
|
|
56
|
+
framework: string
|
|
57
|
+
confidence: 'high' | 'medium' | 'low'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const MEMBER_ACCESS_PATTERNS: MemberAccessPattern[] = [
|
|
61
|
+
// ──────────── Express / generic ────────────
|
|
62
|
+
{ objectPattern: /^req(uest)?$/, property: 'body', sourceType: 'http_body', framework: 'express', confidence: 'high' },
|
|
63
|
+
{ objectPattern: /^req(uest)?$/, property: 'query', sourceType: 'http_query', framework: 'express', confidence: 'high' },
|
|
64
|
+
{ objectPattern: /^req(uest)?$/, property: 'params', sourceType: 'http_params', framework: 'express', confidence: 'high' },
|
|
65
|
+
{ objectPattern: /^req(uest)?$/, property: 'headers', sourceType: 'http_headers', framework: 'express', confidence: 'high' },
|
|
66
|
+
{ objectPattern: /^req(uest)?$/, property: 'cookies', sourceType: 'http_headers', framework: 'express', confidence: 'high' },
|
|
67
|
+
{ objectPattern: /^req(uest)?$/, property: /^(get|header)$/, sourceType: 'http_headers', framework: 'express', confidence: 'high' },
|
|
68
|
+
{ objectPattern: /^req(uest)?$/, property: 'files', sourceType: 'file_upload', framework: 'express', confidence: 'high' },
|
|
69
|
+
{ objectPattern: /^req(uest)?$/, property: 'file', sourceType: 'file_upload', framework: 'express', confidence: 'high' },
|
|
70
|
+
// ──────────── Koa ────────────
|
|
71
|
+
{ objectPattern: /^ctx\.request$/, property: 'body', sourceType: 'http_body', framework: 'koa', confidence: 'high' },
|
|
72
|
+
{ objectPattern: /^ctx\.request$/, property: 'query', sourceType: 'http_query', framework: 'koa', confidence: 'high' },
|
|
73
|
+
{ objectPattern: /^ctx$/, property: 'query', sourceType: 'http_query', framework: 'koa', confidence: 'high' },
|
|
74
|
+
{ objectPattern: /^ctx$/, property: 'params', sourceType: 'http_params', framework: 'koa', confidence: 'high' },
|
|
75
|
+
// ──────────── Next.js App Router ────────────
|
|
76
|
+
{ objectPattern: /^(req|request)$/, property: 'json', sourceType: 'http_body', framework: 'nextjs', confidence: 'high' },
|
|
77
|
+
{ objectPattern: /^(req|request)$/, property: 'text', sourceType: 'http_body', framework: 'nextjs', confidence: 'high' },
|
|
78
|
+
{ objectPattern: /^(req|request)$/, property: 'formData', sourceType: 'form_data', framework: 'nextjs', confidence: 'high' },
|
|
79
|
+
// ──────────── Fastify ────────────
|
|
80
|
+
{ objectPattern: /^(req|request)$/, property: 'body', sourceType: 'http_body', framework: 'fastify', confidence: 'high' },
|
|
81
|
+
{ objectPattern: /^(req|request)$/, property: 'query', sourceType: 'http_query', framework: 'fastify', confidence: 'high' },
|
|
82
|
+
{ objectPattern: /^(req|request)$/, property: 'params', sourceType: 'http_params', framework: 'fastify', confidence: 'high' },
|
|
83
|
+
// ──────────── Hono ────────────
|
|
84
|
+
{ objectPattern: /^c$/, property: 'req', sourceType: 'http_body', framework: 'hono', confidence: 'medium' },
|
|
85
|
+
// ──────────── Nest.js ────────────
|
|
86
|
+
// @Body(), @Query(), @Param() decorators produce direct param access
|
|
87
|
+
// but also: req.body, req.query, req.params via @Req() — already covered by Express
|
|
88
|
+
// Nest.js pipes: context.switchToHttp().getRequest()
|
|
89
|
+
{ objectPattern: /^context$/, property: 'switchToHttp', sourceType: 'http_body', framework: 'nestjs', confidence: 'medium' },
|
|
90
|
+
// ──────────── tRPC ────────────
|
|
91
|
+
// tRPC input is the validated input object in procedures
|
|
92
|
+
{ objectPattern: /^(input|ctx\.input|opts\.input)$/, property: /.*/, sourceType: 'http_body', framework: 'trpc', confidence: 'medium' },
|
|
93
|
+
// ──────────── Remix / React Router ────────────
|
|
94
|
+
// action/loader: request.formData(), request.json()
|
|
95
|
+
// Also: new URL(request.url).searchParams
|
|
96
|
+
{ objectPattern: /^(args|actionArgs|loaderArgs)$/, property: 'request', sourceType: 'http_body', framework: 'remix', confidence: 'medium' },
|
|
97
|
+
// ──────────── SvelteKit ────────────
|
|
98
|
+
// load({ params, url, request }) — all are sources
|
|
99
|
+
{ objectPattern: /^(event|requestEvent)$/, property: 'request', sourceType: 'http_body', framework: 'sveltekit', confidence: 'medium' },
|
|
100
|
+
{ objectPattern: /^(event|requestEvent)$/, property: 'params', sourceType: 'http_params', framework: 'sveltekit', confidence: 'medium' },
|
|
101
|
+
{ objectPattern: /^(event|requestEvent)$/, property: 'url', sourceType: 'url_search_params', framework: 'sveltekit', confidence: 'medium' },
|
|
102
|
+
// ──────────── GraphQL resolvers ────────────
|
|
103
|
+
// resolver(parent, args, context) — args is user input
|
|
104
|
+
{ objectPattern: /^args$/, property: /.*/, sourceType: 'http_body', framework: 'graphql', confidence: 'medium' },
|
|
105
|
+
{ objectPattern: /^(input|variables)$/, property: /.*/, sourceType: 'http_body', framework: 'graphql', confidence: 'medium' },
|
|
106
|
+
// ──────────── URL search params ────────────
|
|
107
|
+
{ objectPattern: /searchParams/, property: /^(get|getAll)$/, sourceType: 'url_search_params', framework: 'web', confidence: 'high' },
|
|
108
|
+
// ──────────── AWS Lambda ────────────
|
|
109
|
+
{ objectPattern: /^event$/, property: 'body', sourceType: 'http_body', framework: 'aws-lambda', confidence: 'high' },
|
|
110
|
+
{ objectPattern: /^event$/, property: 'queryStringParameters', sourceType: 'http_query', framework: 'aws-lambda', confidence: 'high' },
|
|
111
|
+
{ objectPattern: /^event$/, property: 'pathParameters', sourceType: 'http_params', framework: 'aws-lambda', confidence: 'high' },
|
|
112
|
+
{ objectPattern: /^event$/, property: 'headers', sourceType: 'http_headers', framework: 'aws-lambda', confidence: 'high' },
|
|
113
|
+
{ objectPattern: /^event$/, property: 'multiValueQueryStringParameters', sourceType: 'http_query', framework: 'aws-lambda', confidence: 'high' },
|
|
114
|
+
// ──────────── Google Cloud Functions ────────────
|
|
115
|
+
{ objectPattern: /^req$/, property: 'rawBody', sourceType: 'http_body', framework: 'gcloud', confidence: 'high' },
|
|
116
|
+
// ──────────── Azure Functions ────────────
|
|
117
|
+
{ objectPattern: /^(context\.req|request)$/, property: 'body', sourceType: 'http_body', framework: 'azure', confidence: 'high' },
|
|
118
|
+
{ objectPattern: /^(context\.req|request)$/, property: 'query', sourceType: 'http_query', framework: 'azure', confidence: 'high' },
|
|
119
|
+
// ──────────── Browser APIs ────────────
|
|
120
|
+
{ objectPattern: /^(document|window)$/, property: 'location', sourceType: 'url_search_params', framework: 'browser', confidence: 'medium' },
|
|
121
|
+
{ objectPattern: /^location$/, property: /^(search|hash|href|pathname)$/, sourceType: 'url_search_params', framework: 'browser', confidence: 'medium' },
|
|
122
|
+
{ objectPattern: /^document$/, property: 'cookie', sourceType: 'http_headers', framework: 'browser', confidence: 'medium' },
|
|
123
|
+
{ objectPattern: /^document$/, property: 'referrer', sourceType: 'http_headers', framework: 'browser', confidence: 'medium' },
|
|
124
|
+
{ objectPattern: /^window$/, property: 'name', sourceType: 'url_search_params', framework: 'browser', confidence: 'medium' },
|
|
125
|
+
// ──────────── postMessage ────────────
|
|
126
|
+
{ objectPattern: /^(event|e)$/, property: 'data', sourceType: 'websocket_message', framework: 'browser', confidence: 'medium' },
|
|
127
|
+
// ──────────── WebSocket ────────────
|
|
128
|
+
{ objectPattern: /^(message|data|msg)$/, property: /^(data|payload)$/, sourceType: 'websocket_message', framework: 'websocket', confidence: 'medium' },
|
|
129
|
+
// ──────────── CLI ────────────
|
|
130
|
+
{ objectPattern: /^process$/, property: 'argv', sourceType: 'cli_args', framework: 'node', confidence: 'low' },
|
|
131
|
+
{ objectPattern: /^process$/, property: 'env', sourceType: 'env_var', framework: 'node', confidence: 'low' },
|
|
132
|
+
// ──────────── Flask (also matches flask_request, http_request aliases) ────────────
|
|
133
|
+
{ objectPattern: /^(?:flask_|http_)?request$/, property: 'form', sourceType: 'http_body', framework: 'flask', confidence: 'high' },
|
|
134
|
+
{ objectPattern: /^(?:flask_|http_)?request$/, property: 'args', sourceType: 'http_query', framework: 'flask', confidence: 'high' },
|
|
135
|
+
{ objectPattern: /^(?:flask_|http_)?request$/, property: 'json', sourceType: 'http_body', framework: 'flask', confidence: 'high' },
|
|
136
|
+
{ objectPattern: /^(?:flask_|http_)?request$/, property: 'data', sourceType: 'http_body', framework: 'flask', confidence: 'high' },
|
|
137
|
+
{ objectPattern: /^(?:flask_|http_)?request$/, property: 'files', sourceType: 'file_upload', framework: 'flask', confidence: 'high' },
|
|
138
|
+
{ objectPattern: /^(?:flask_|http_)?request$/, property: 'values', sourceType: 'http_body', framework: 'flask', confidence: 'high' },
|
|
139
|
+
// ──────────── Django (also matches django_request alias) ────────────
|
|
140
|
+
{ objectPattern: /^(?:django_|http_)?request$/, property: 'GET', sourceType: 'http_query', framework: 'django', confidence: 'high' },
|
|
141
|
+
{ objectPattern: /^(?:django_|http_)?request$/, property: 'POST', sourceType: 'http_body', framework: 'django', confidence: 'high' },
|
|
142
|
+
{ objectPattern: /^(?:django_|http_)?request$/, property: 'FILES', sourceType: 'file_upload', framework: 'django', confidence: 'high' },
|
|
143
|
+
{ objectPattern: /^(?:django_|http_)?request$/, property: 'META', sourceType: 'http_headers', framework: 'django', confidence: 'high' },
|
|
144
|
+
{ objectPattern: /^(?:django_|http_)?request$/, property: 'COOKIES', sourceType: 'http_headers', framework: 'django', confidence: 'high' },
|
|
145
|
+
// ──────────── FastAPI (Starlette Request object) ────────────
|
|
146
|
+
{ objectPattern: /^(?:http_)?request$/, property: 'query_params', sourceType: 'http_query', framework: 'fastapi', confidence: 'high' },
|
|
147
|
+
{ objectPattern: /^(?:http_)?request$/, property: 'path_params', sourceType: 'http_params', framework: 'fastapi', confidence: 'high' },
|
|
148
|
+
{ objectPattern: /^(?:http_)?request$/, property: 'headers', sourceType: 'http_headers', framework: 'fastapi', confidence: 'high' },
|
|
149
|
+
{ objectPattern: /^(?:http_)?request$/, property: 'cookies', sourceType: 'http_headers', framework: 'fastapi', confidence: 'high' },
|
|
150
|
+
// ──────────── Python General ────────────
|
|
151
|
+
{ objectPattern: /^sys$/, property: 'argv', sourceType: 'cli_args', framework: 'python', confidence: 'low' },
|
|
152
|
+
{ objectPattern: /^sys$/, property: 'stdin', sourceType: 'cli_args', framework: 'python', confidence: 'medium' },
|
|
153
|
+
{ objectPattern: /^os$/, property: 'environ', sourceType: 'env_var', framework: 'python', confidence: 'low' },
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
// ============================================================================
|
|
157
|
+
// LLM Output Patterns
|
|
158
|
+
// ============================================================================
|
|
159
|
+
|
|
160
|
+
const LLM_OUTPUT_PATTERNS: Array<{
|
|
161
|
+
pattern: RegExp
|
|
162
|
+
sourceType: TaintSourceType
|
|
163
|
+
framework: string
|
|
164
|
+
}> = [
|
|
165
|
+
// OpenAI / standard chat completions
|
|
166
|
+
{ pattern: /response\.choices\[?\d*\]?\.message\.content/, sourceType: 'llm_output', framework: 'openai' },
|
|
167
|
+
{ pattern: /completion\.choices\[?\d*\]?\.message\.content/, sourceType: 'llm_output', framework: 'openai' },
|
|
168
|
+
{ pattern: /result\.choices\[?\d*\]?\.message\.content/, sourceType: 'llm_output', framework: 'openai' },
|
|
169
|
+
{ pattern: /response\.data\.choices/, sourceType: 'llm_output', framework: 'openai' },
|
|
170
|
+
// Anthropic SDK
|
|
171
|
+
{ pattern: /response\.content\[?\d*\]?\.text/, sourceType: 'llm_output', framework: 'anthropic' },
|
|
172
|
+
{ pattern: /message\.content\[?\d*\]?\.text/, sourceType: 'llm_output', framework: 'anthropic' },
|
|
173
|
+
// Generic LLM output
|
|
174
|
+
{ pattern: /\.generated_text/, sourceType: 'llm_output', framework: 'generic' },
|
|
175
|
+
{ pattern: /\.output_text/, sourceType: 'llm_output', framework: 'generic' },
|
|
176
|
+
// Tool call results
|
|
177
|
+
{ pattern: /toolResult\.(?:output|content|data)/, sourceType: 'tool_output', framework: 'generic' },
|
|
178
|
+
{ pattern: /tool_call\.(?:result|output)/, sourceType: 'tool_output', framework: 'generic' },
|
|
179
|
+
// RAG retrieval
|
|
180
|
+
{ pattern: /(?:retriev|search|query)(?:Result|Response)s?\.(?:documents|results|hits|matches)/, sourceType: 'rag_retrieval', framework: 'generic' },
|
|
181
|
+
// Langchain-specific: `doc.pageContent`, `doc.page_content` — but NOT bare `.text` (too broad)
|
|
182
|
+
{ pattern: /\.(?:pageContent|page_content)/, sourceType: 'rag_retrieval', framework: 'langchain' },
|
|
183
|
+
// Vector DB results
|
|
184
|
+
{ pattern: /(?:pinecone|weaviate|qdrant|chroma|milvus).*\.(?:matches|results|documents)/, sourceType: 'rag_retrieval', framework: 'vectordb' },
|
|
185
|
+
// Google AI
|
|
186
|
+
{ pattern: /response\.candidates\[?\d*\]?\.content/, sourceType: 'llm_output', framework: 'google-ai' },
|
|
187
|
+
// Cohere
|
|
188
|
+
{ pattern: /response\.generations\[?\d*\]?\.text/, sourceType: 'llm_output', framework: 'cohere' },
|
|
189
|
+
// Ollama
|
|
190
|
+
{ pattern: /response\.message\.content/, sourceType: 'llm_output', framework: 'ollama' },
|
|
191
|
+
]
|
|
192
|
+
|
|
193
|
+
// ============================================================================
|
|
194
|
+
// Request Type Patterns (for type-based source detection)
|
|
195
|
+
// ============================================================================
|
|
196
|
+
|
|
197
|
+
const REQUEST_TYPE_PATTERNS = [
|
|
198
|
+
/Request/,
|
|
199
|
+
/NextRequest/,
|
|
200
|
+
/NextApiRequest/,
|
|
201
|
+
/IncomingMessage/,
|
|
202
|
+
/FastifyRequest/,
|
|
203
|
+
/HonoRequest/,
|
|
204
|
+
/KoaContext/,
|
|
205
|
+
/^(Context|KoaContext|HonoContext)$/, // Hono, Koa context types (anchored to avoid ThemeContext, AppContext, etc.)
|
|
206
|
+
/APIGatewayProxyEvent/, // AWS Lambda
|
|
207
|
+
/APIGatewayEvent/, // AWS Lambda
|
|
208
|
+
/HttpRequest/, // Azure Functions, generic
|
|
209
|
+
]
|
|
210
|
+
|
|
211
|
+
// ============================================================================
|
|
212
|
+
// Internal helpers
|
|
213
|
+
// ============================================================================
|
|
214
|
+
|
|
215
|
+
function matchesMemberPattern(
|
|
216
|
+
objText: string,
|
|
217
|
+
propText: string,
|
|
218
|
+
pattern: MemberAccessPattern
|
|
219
|
+
): boolean {
|
|
220
|
+
const objMatch = pattern.objectPattern.test(objText)
|
|
221
|
+
if (!objMatch) return false
|
|
222
|
+
if (typeof pattern.property === 'string') {
|
|
223
|
+
return propText === pattern.property
|
|
224
|
+
}
|
|
225
|
+
return pattern.property.test(propText)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Try to extract the variable name that receives tainted data.
|
|
230
|
+
* Walks up the AST to find variable declarations or destructuring patterns.
|
|
231
|
+
*/
|
|
232
|
+
/**
|
|
233
|
+
* Expression types we walk through when searching for a receiving variable.
|
|
234
|
+
* Source member accesses like `req.query` can be nested deep inside
|
|
235
|
+
* ternaries, binary ops, template literals, etc. We walk up through all
|
|
236
|
+
* of these until we find a variable_declarator or assignment, or hit a
|
|
237
|
+
* statement boundary.
|
|
238
|
+
*/
|
|
239
|
+
const EXPRESSION_WALK_TYPES = new Set([
|
|
240
|
+
'member_expression',
|
|
241
|
+
'subscript_expression',
|
|
242
|
+
'call_expression',
|
|
243
|
+
'await_expression',
|
|
244
|
+
'binary_expression',
|
|
245
|
+
'ternary_expression',
|
|
246
|
+
'parenthesized_expression',
|
|
247
|
+
'template_string',
|
|
248
|
+
'template_substitution',
|
|
249
|
+
'arguments',
|
|
250
|
+
'as_expression',
|
|
251
|
+
'type_assertion',
|
|
252
|
+
'non_null_expression',
|
|
253
|
+
'satisfies_expression',
|
|
254
|
+
'unary_expression',
|
|
255
|
+
'update_expression',
|
|
256
|
+
'new_expression',
|
|
257
|
+
'spread_element',
|
|
258
|
+
'pair', // { key: req.body } in object literals
|
|
259
|
+
'object', // object literal containing source
|
|
260
|
+
'array', // array literal containing source
|
|
261
|
+
// Python equivalents
|
|
262
|
+
'attribute', // Python member access
|
|
263
|
+
'subscript', // Python subscript
|
|
264
|
+
'call', // Python call
|
|
265
|
+
'await', // Python await
|
|
266
|
+
'conditional_expression', // Python ternary
|
|
267
|
+
'keyword_argument', // Python keyword arg
|
|
268
|
+
'argument_list', // Python args
|
|
269
|
+
'tuple', // Python tuple
|
|
270
|
+
'list', // Python list
|
|
271
|
+
'dictionary', // Python dict
|
|
272
|
+
'binary_operator', // Python binary op
|
|
273
|
+
'boolean_operator', // Python boolean op
|
|
274
|
+
])
|
|
275
|
+
|
|
276
|
+
function extractReceivingVariable(node: Parser.SyntaxNode): string | null {
|
|
277
|
+
let current: Parser.SyntaxNode | null = node.parent
|
|
278
|
+
|
|
279
|
+
while (current) {
|
|
280
|
+
// variable_declarator: const data = <source>
|
|
281
|
+
if (current.type === 'variable_declarator') {
|
|
282
|
+
const nameNode = current.childForFieldName('name')
|
|
283
|
+
if (nameNode?.type === 'identifier') return nameNode.text
|
|
284
|
+
// Destructuring: const { a, b } = <source>
|
|
285
|
+
// Return the whole pattern text as a hint (individual vars tracked separately)
|
|
286
|
+
if (nameNode?.type === 'object_pattern' || nameNode?.type === 'array_pattern') {
|
|
287
|
+
return nameNode.text
|
|
288
|
+
}
|
|
289
|
+
break
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// assignment_expression: data = <source> (JS)
|
|
293
|
+
// assignment: data = <source> (Python)
|
|
294
|
+
if (current.type === 'assignment_expression' || current.type === 'assignment') {
|
|
295
|
+
const left = current.childForFieldName('left')
|
|
296
|
+
if (left?.type === 'identifier') return left.text
|
|
297
|
+
break
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Walk through expression types (ternary, binary, template, member, etc.)
|
|
301
|
+
if (EXPRESSION_WALK_TYPES.has(current.type)) {
|
|
302
|
+
current = current.parent
|
|
303
|
+
continue
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
break
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return null
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Extract destructured variable names from an object_pattern or array_pattern.
|
|
314
|
+
*/
|
|
315
|
+
function extractDestructuredNames(patternNode: Parser.SyntaxNode): string[] {
|
|
316
|
+
const names: string[] = []
|
|
317
|
+
|
|
318
|
+
if (patternNode.type === 'object_pattern') {
|
|
319
|
+
for (const child of patternNode.namedChildren) {
|
|
320
|
+
if (child.type === 'shorthand_property_identifier_pattern') {
|
|
321
|
+
names.push(child.text)
|
|
322
|
+
} else if (child.type === 'pair_pattern') {
|
|
323
|
+
const value = child.childForFieldName('value')
|
|
324
|
+
if (value?.type === 'identifier') {
|
|
325
|
+
names.push(value.text)
|
|
326
|
+
} else if (value?.type === 'object_pattern' || value?.type === 'array_pattern') {
|
|
327
|
+
names.push(...extractDestructuredNames(value))
|
|
328
|
+
}
|
|
329
|
+
} else if (child.type === 'rest_pattern') {
|
|
330
|
+
const arg = child.namedChildren[0]
|
|
331
|
+
if (arg?.type === 'identifier') names.push(arg.text)
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
} else if (patternNode.type === 'array_pattern') {
|
|
335
|
+
for (const child of patternNode.namedChildren) {
|
|
336
|
+
if (child.type === 'identifier') {
|
|
337
|
+
names.push(child.text)
|
|
338
|
+
} else if (child.type === 'object_pattern' || child.type === 'array_pattern') {
|
|
339
|
+
names.push(...extractDestructuredNames(child))
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return names
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Check if a variable_declarator's name is a destructuring pattern and the
|
|
349
|
+
* init references a known source. Returns destructured variable names.
|
|
350
|
+
*/
|
|
351
|
+
function getDestructuredSourceVars(declarator: Parser.SyntaxNode): string[] {
|
|
352
|
+
const nameNode = declarator.childForFieldName('name')
|
|
353
|
+
if (!nameNode) return []
|
|
354
|
+
if (nameNode.type !== 'object_pattern' && nameNode.type !== 'array_pattern') return []
|
|
355
|
+
return extractDestructuredNames(nameNode)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// ============================================================================
|
|
359
|
+
// Quick Pre-Filter (conservative over-approximation)
|
|
360
|
+
// ============================================================================
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Fast regex check to determine if file content could possibly contain taint sources.
|
|
364
|
+
* Conservative: returns true for any file that MIGHT have sources (false positives OK).
|
|
365
|
+
* Used to skip full AST source classification for the ~82% of files with no sources.
|
|
366
|
+
*/
|
|
367
|
+
const SOURCE_QUICK_CHECK = new RegExp(
|
|
368
|
+
// HTTP request patterns (Express, Koa, Next.js, Fastify, Hono, NestJS, etc.)
|
|
369
|
+
'req(?:uest)?\\.(?:body|query|params|headers|cookies|files?|rawBody|json|text|formData|get|header)' +
|
|
370
|
+
'|ctx\\.(?:request|query|params)' +
|
|
371
|
+
'|c\\.req\\b' +
|
|
372
|
+
'|context\\.switchToHttp' +
|
|
373
|
+
// SvelteKit / Remix
|
|
374
|
+
'|(?:event|requestEvent)\\.(?:request|params|url)' +
|
|
375
|
+
'|(?:actionArgs|loaderArgs)\\.request' +
|
|
376
|
+
// AWS Lambda / Azure
|
|
377
|
+
'|event\\.(?:body|queryStringParameters|pathParameters|headers|multiValueQueryStringParameters)' +
|
|
378
|
+
'|context\\.req\\b' +
|
|
379
|
+
// URL search params
|
|
380
|
+
'|searchParams\\.(?:get|getAll)' +
|
|
381
|
+
// Browser APIs
|
|
382
|
+
'|(?:document|window)\\.(?:location|cookie|referrer|name)' +
|
|
383
|
+
'|location\\.(?:search|hash|href|pathname)' +
|
|
384
|
+
// Node
|
|
385
|
+
'|process\\.(?:argv|env)' +
|
|
386
|
+
// LLM output patterns
|
|
387
|
+
'|\\.choices\\[' +
|
|
388
|
+
'|\\.candidates\\[' +
|
|
389
|
+
'|\\.generations\\[' +
|
|
390
|
+
'|\\.generated_text' +
|
|
391
|
+
'|\\.output_text' +
|
|
392
|
+
'|\\.pageContent' +
|
|
393
|
+
'|\\.page_content' +
|
|
394
|
+
'|toolResult\\.' +
|
|
395
|
+
'|tool_call\\.' +
|
|
396
|
+
// LLM SDK imports (for import-aware return value detection)
|
|
397
|
+
'|from\\s+[\'"](?:openai|@anthropic-ai\\/sdk|anthropic|ai|@ai-sdk\\/|@langchain\\/|langchain|@google\\/generative-ai|cohere|ollama)' +
|
|
398
|
+
'|require\\([\'"](?:openai|@anthropic-ai\\/sdk|anthropic|ai|@ai-sdk\\/|@langchain\\/|langchain|@google\\/generative-ai|cohere|ollama)' +
|
|
399
|
+
// Request type annotations
|
|
400
|
+
'|:\\s*(?:Request|NextRequest|NextApiRequest|IncomingMessage|FastifyRequest|HonoRequest|KoaContext|HonoContext|APIGatewayProxyEvent|APIGatewayEvent|HttpRequest)\\b' +
|
|
401
|
+
// WebSocket / postMessage
|
|
402
|
+
'|(?:message|msg)\\.(?:data|payload)' +
|
|
403
|
+
// Vector DB patterns
|
|
404
|
+
'|(?:pinecone|weaviate|qdrant|chroma|milvus)' +
|
|
405
|
+
// Python Flask/Django (including common aliases)
|
|
406
|
+
'|(?:flask_|http_)?request\\.(?:form|args|values|data|GET|POST|FILES|META|COOKIES)' +
|
|
407
|
+
// Python general
|
|
408
|
+
'|sys\\.(?:argv|stdin)' +
|
|
409
|
+
'|os\\.environ' +
|
|
410
|
+
'|\\binput\\s*\\(' +
|
|
411
|
+
// Python framework imports
|
|
412
|
+
'|from\\s+(?:flask|django|fastapi)\\s+import' +
|
|
413
|
+
// Python LLM SDK imports (for import-aware return value detection)
|
|
414
|
+
'|from\\s+(?:openai|anthropic|langchain|langchain_openai|langchain_anthropic|langchain_core|litellm|llama_index|transformers|google\\.generativeai)\\s+import' +
|
|
415
|
+
// FastAPI dependency injection
|
|
416
|
+
'|(?:Query|Body|Form|File|Header|Cookie|Path)\\s*\\('
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
export function hasLikelySources(content: string): boolean {
|
|
420
|
+
return SOURCE_QUICK_CHECK.test(content)
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// ============================================================================
|
|
424
|
+
// Main Classifier
|
|
425
|
+
// ============================================================================
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Classify all taint sources in a parsed AST.
|
|
429
|
+
*
|
|
430
|
+
* Walks the AST looking for:
|
|
431
|
+
* 1. Member access patterns (req.body, req.query, etc.)
|
|
432
|
+
* 2. LLM output patterns (response.choices[0].message.content, etc.)
|
|
433
|
+
* 3. Type-based sources (parameters typed as Request, NextRequest, etc.)
|
|
434
|
+
* 4. Destructuring from source objects
|
|
435
|
+
*/
|
|
436
|
+
export function classifySources(
|
|
437
|
+
ast: ParsedAST,
|
|
438
|
+
imports?: Map<string, { module: string; originalName: string }>,
|
|
439
|
+
): TaintSource[] {
|
|
440
|
+
const sources: TaintSource[] = []
|
|
441
|
+
const seen = new Set<string>()
|
|
442
|
+
const root = ast.tree.rootNode
|
|
443
|
+
|
|
444
|
+
// Phase 1: Walk AST for member access and LLM output patterns
|
|
445
|
+
walkAST(root, (node) => {
|
|
446
|
+
// --- Member expression sources (JS: member_expression, Python: attribute) ---
|
|
447
|
+
if (node.type === 'member_expression' || node.type === 'attribute') {
|
|
448
|
+
const obj = node.childForFieldName('object')
|
|
449
|
+
const prop = node.type === 'attribute'
|
|
450
|
+
? node.childForFieldName('attribute')
|
|
451
|
+
: node.childForFieldName('property')
|
|
452
|
+
if (!obj || !prop) return false
|
|
453
|
+
|
|
454
|
+
for (const pattern of MEMBER_ACCESS_PATTERNS) {
|
|
455
|
+
if (matchesMemberPattern(obj.text, prop.text, pattern)) {
|
|
456
|
+
const variable = extractReceivingVariable(node) ?? node.text
|
|
457
|
+
const key = `${node.startPosition.row}:${node.startPosition.column}:${pattern.sourceType}`
|
|
458
|
+
if (seen.has(key)) break
|
|
459
|
+
seen.add(key)
|
|
460
|
+
|
|
461
|
+
const taintKinds = new Set(SOURCE_TAINT_MAP[pattern.sourceType])
|
|
462
|
+
|
|
463
|
+
sources.push({
|
|
464
|
+
node,
|
|
465
|
+
line: node.startPosition.row + 1,
|
|
466
|
+
variable,
|
|
467
|
+
expression: node.text,
|
|
468
|
+
sourceType: pattern.sourceType,
|
|
469
|
+
taintKinds,
|
|
470
|
+
confidence: pattern.confidence,
|
|
471
|
+
framework: pattern.framework,
|
|
472
|
+
})
|
|
473
|
+
|
|
474
|
+
return true // skip children — don't double-count nested access
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// Check for LLM output patterns
|
|
479
|
+
const fullText = node.text
|
|
480
|
+
for (const llmPattern of LLM_OUTPUT_PATTERNS) {
|
|
481
|
+
if (llmPattern.pattern.test(fullText)) {
|
|
482
|
+
const variable = extractReceivingVariable(node) ?? node.text
|
|
483
|
+
const key = `${node.startPosition.row}:${node.startPosition.column}:${llmPattern.sourceType}`
|
|
484
|
+
if (seen.has(key)) break
|
|
485
|
+
seen.add(key)
|
|
486
|
+
|
|
487
|
+
const taintKinds = new Set(SOURCE_TAINT_MAP[llmPattern.sourceType])
|
|
488
|
+
|
|
489
|
+
sources.push({
|
|
490
|
+
node,
|
|
491
|
+
line: node.startPosition.row + 1,
|
|
492
|
+
variable,
|
|
493
|
+
expression: node.text,
|
|
494
|
+
sourceType: llmPattern.sourceType,
|
|
495
|
+
taintKinds,
|
|
496
|
+
confidence: 'medium',
|
|
497
|
+
framework: llmPattern.framework,
|
|
498
|
+
})
|
|
499
|
+
|
|
500
|
+
return true
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// Also check subscript_expression / subscript for LLM patterns like response.choices[0].message.content
|
|
506
|
+
if (node.type === 'subscript_expression' || node.type === 'subscript') {
|
|
507
|
+
const fullText = node.text
|
|
508
|
+
for (const llmPattern of LLM_OUTPUT_PATTERNS) {
|
|
509
|
+
if (llmPattern.pattern.test(fullText)) {
|
|
510
|
+
const variable = extractReceivingVariable(node) ?? node.text
|
|
511
|
+
const key = `${node.startPosition.row}:${node.startPosition.column}:${llmPattern.sourceType}`
|
|
512
|
+
if (seen.has(key)) break
|
|
513
|
+
seen.add(key)
|
|
514
|
+
|
|
515
|
+
const taintKinds = new Set(SOURCE_TAINT_MAP[llmPattern.sourceType])
|
|
516
|
+
|
|
517
|
+
sources.push({
|
|
518
|
+
node,
|
|
519
|
+
line: node.startPosition.row + 1,
|
|
520
|
+
variable,
|
|
521
|
+
expression: node.text,
|
|
522
|
+
sourceType: llmPattern.sourceType,
|
|
523
|
+
taintKinds,
|
|
524
|
+
confidence: 'medium',
|
|
525
|
+
framework: llmPattern.framework,
|
|
526
|
+
})
|
|
527
|
+
|
|
528
|
+
return true
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// --- Python input() builtin as direct call source ---
|
|
534
|
+
if (node.type === 'call') {
|
|
535
|
+
const fn = node.childForFieldName('function')
|
|
536
|
+
if (fn?.type === 'identifier' && fn.text === 'input') {
|
|
537
|
+
const variable = extractReceivingVariable(node) ?? 'input()'
|
|
538
|
+
const key = `${node.startPosition.row}:${node.startPosition.column}:cli_args`
|
|
539
|
+
if (!seen.has(key)) {
|
|
540
|
+
seen.add(key)
|
|
541
|
+
sources.push({
|
|
542
|
+
node,
|
|
543
|
+
line: node.startPosition.row + 1,
|
|
544
|
+
variable,
|
|
545
|
+
expression: node.text,
|
|
546
|
+
sourceType: 'cli_args',
|
|
547
|
+
taintKinds: new Set(SOURCE_TAINT_MAP.cli_args),
|
|
548
|
+
confidence: 'high',
|
|
549
|
+
framework: 'python',
|
|
550
|
+
})
|
|
551
|
+
}
|
|
552
|
+
return true
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return false
|
|
557
|
+
})
|
|
558
|
+
|
|
559
|
+
// Phase 2a: FastAPI dependency injection parameter sources
|
|
560
|
+
// FastAPI: def search(q: str = Query(...), body: SearchModel = Body(...))
|
|
561
|
+
if (ast.language === 'python') {
|
|
562
|
+
const pyImports = collectPythonImportBindings(root)
|
|
563
|
+
const FASTAPI_DI_MAP: Record<string, TaintSourceType> = {
|
|
564
|
+
Query: 'http_query',
|
|
565
|
+
Body: 'http_body',
|
|
566
|
+
Form: 'form_data',
|
|
567
|
+
File: 'file_upload',
|
|
568
|
+
Header: 'http_headers',
|
|
569
|
+
Cookie: 'http_headers',
|
|
570
|
+
Path: 'http_params',
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
walkAST(root, (node) => {
|
|
574
|
+
if (node.type !== 'default_parameter' && node.type !== 'typed_default_parameter') return false
|
|
575
|
+
// Check if the default value is a call to a FastAPI DI function
|
|
576
|
+
const defaultValue = node.childForFieldName('value')
|
|
577
|
+
if (!defaultValue || defaultValue.type !== 'call') return false
|
|
578
|
+
|
|
579
|
+
const fn = defaultValue.childForFieldName('function')
|
|
580
|
+
if (!fn || fn.type !== 'identifier') return false
|
|
581
|
+
|
|
582
|
+
const sourceType = FASTAPI_DI_MAP[fn.text]
|
|
583
|
+
if (!sourceType) return false
|
|
584
|
+
|
|
585
|
+
// Verify it's imported from fastapi
|
|
586
|
+
const binding = pyImports.get(fn.text)
|
|
587
|
+
if (!binding || !/^fastapi$/.test(binding.module)) return false
|
|
588
|
+
|
|
589
|
+
// The parameter name is the first identifier child
|
|
590
|
+
const paramName = node.namedChildren.find(c => c.type === 'identifier')
|
|
591
|
+
if (!paramName) return false
|
|
592
|
+
|
|
593
|
+
const key = `fastapi_di:${node.startPosition.row}:${paramName.text}`
|
|
594
|
+
if (seen.has(key)) return false
|
|
595
|
+
seen.add(key)
|
|
596
|
+
|
|
597
|
+
sources.push({
|
|
598
|
+
node,
|
|
599
|
+
line: node.startPosition.row + 1,
|
|
600
|
+
variable: paramName.text,
|
|
601
|
+
expression: node.text,
|
|
602
|
+
sourceType,
|
|
603
|
+
taintKinds: new Set(SOURCE_TAINT_MAP[sourceType]),
|
|
604
|
+
confidence: 'high',
|
|
605
|
+
framework: 'fastapi',
|
|
606
|
+
})
|
|
607
|
+
|
|
608
|
+
return false
|
|
609
|
+
})
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// Phase 2b: Import-aware LLM call return value detection
|
|
613
|
+
// When a known LLM API call result is assigned to a variable, tag it as llm_output
|
|
614
|
+
if (!imports) imports = collectImportBindings(root)
|
|
615
|
+
walkAST(root, (node) => {
|
|
616
|
+
// Look for call_expression/call and await_expression/await nodes
|
|
617
|
+
let callNode: Parser.SyntaxNode | null = null
|
|
618
|
+
if (node.type === 'call_expression' || node.type === 'call') {
|
|
619
|
+
callNode = node
|
|
620
|
+
} else if (node.type === 'await_expression' || node.type === 'await') {
|
|
621
|
+
const operand = node.namedChildren[0]
|
|
622
|
+
if (operand?.type === 'call_expression' || operand?.type === 'call') {
|
|
623
|
+
callNode = operand
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
if (!callNode) return false
|
|
628
|
+
|
|
629
|
+
// Check if this is a known LLM API call
|
|
630
|
+
const fn = callNode.childForFieldName('function')
|
|
631
|
+
if (!fn) return false
|
|
632
|
+
|
|
633
|
+
let targetName: string
|
|
634
|
+
let targetObject: string | undefined
|
|
635
|
+
|
|
636
|
+
if (fn.type === 'identifier') {
|
|
637
|
+
targetName = fn.text
|
|
638
|
+
targetObject = undefined
|
|
639
|
+
} else if (fn.type === 'member_expression') {
|
|
640
|
+
const prop = fn.childForFieldName('property')
|
|
641
|
+
const obj = fn.childForFieldName('object')
|
|
642
|
+
if (!prop) return false
|
|
643
|
+
targetName = prop.text
|
|
644
|
+
targetObject = obj?.text
|
|
645
|
+
} else if (fn.type === 'attribute') {
|
|
646
|
+
// Python attribute access: obj.method
|
|
647
|
+
const attr = fn.childForFieldName('attribute')
|
|
648
|
+
const obj = fn.childForFieldName('object')
|
|
649
|
+
if (!attr) return false
|
|
650
|
+
targetName = attr.text
|
|
651
|
+
targetObject = obj?.text
|
|
652
|
+
} else {
|
|
653
|
+
return false
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (!isKnownLLMCall(targetName, targetObject, imports)) return false
|
|
657
|
+
|
|
658
|
+
// Find the receiving variable
|
|
659
|
+
const variable = extractReceivingVariable(node)
|
|
660
|
+
if (!variable) return false
|
|
661
|
+
|
|
662
|
+
const key = `llm_call:${node.startPosition.row}:${node.startPosition.column}`
|
|
663
|
+
if (seen.has(key)) return false
|
|
664
|
+
seen.add(key)
|
|
665
|
+
|
|
666
|
+
const taintKinds = new Set(SOURCE_TAINT_MAP.llm_output)
|
|
667
|
+
|
|
668
|
+
// Check if it's destructured — each destructured var gets its own source
|
|
669
|
+
const declarator = findParentDeclarator(node)
|
|
670
|
+
if (declarator) {
|
|
671
|
+
const nameNode = declarator.childForFieldName('name')
|
|
672
|
+
if (nameNode && (nameNode.type === 'object_pattern' || nameNode.type === 'array_pattern')) {
|
|
673
|
+
const destructuredNames = extractDestructuredNames(nameNode)
|
|
674
|
+
for (const name of destructuredNames) {
|
|
675
|
+
const dKey = `llm_call_d:${node.startPosition.row}:${name}`
|
|
676
|
+
if (seen.has(dKey)) continue
|
|
677
|
+
seen.add(dKey)
|
|
678
|
+
sources.push({
|
|
679
|
+
node: nameNode,
|
|
680
|
+
line: node.startPosition.row + 1,
|
|
681
|
+
variable: name,
|
|
682
|
+
expression: node.text.slice(0, 200),
|
|
683
|
+
sourceType: 'llm_output',
|
|
684
|
+
taintKinds: new Set(taintKinds),
|
|
685
|
+
confidence: 'high',
|
|
686
|
+
framework: inferLLMFramework(targetName, targetObject, imports),
|
|
687
|
+
})
|
|
688
|
+
}
|
|
689
|
+
return false
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
sources.push({
|
|
694
|
+
node,
|
|
695
|
+
line: node.startPosition.row + 1,
|
|
696
|
+
variable,
|
|
697
|
+
expression: node.text.slice(0, 200),
|
|
698
|
+
sourceType: 'llm_output',
|
|
699
|
+
taintKinds: new Set(taintKinds),
|
|
700
|
+
confidence: 'high',
|
|
701
|
+
framework: inferLLMFramework(targetName, targetObject, imports),
|
|
702
|
+
})
|
|
703
|
+
|
|
704
|
+
return false
|
|
705
|
+
})
|
|
706
|
+
|
|
707
|
+
// Phase 3: Type-based source detection
|
|
708
|
+
// Parameters typed as Request/NextRequest/etc. make the parameter a taint source
|
|
709
|
+
const typeRegistry = extractTypeRegistry(ast)
|
|
710
|
+
for (const [funcName, paramTypes] of typeRegistry.parameterTypes) {
|
|
711
|
+
for (const paramType of paramTypes) {
|
|
712
|
+
for (const requestPattern of REQUEST_TYPE_PATTERNS) {
|
|
713
|
+
if (requestPattern.test(paramType.text)) {
|
|
714
|
+
// Find the function node to get the parameter name
|
|
715
|
+
const paramSources = findRequestParamSources(root, funcName, paramType.text)
|
|
716
|
+
for (const ps of paramSources) {
|
|
717
|
+
const key = `type:${ps.line}:${ps.variable}`
|
|
718
|
+
if (seen.has(key)) continue
|
|
719
|
+
seen.add(key)
|
|
720
|
+
sources.push(ps)
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
return sources
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* Find function parameters typed as a request type and create TaintSources for them.
|
|
732
|
+
*/
|
|
733
|
+
function findRequestParamSources(
|
|
734
|
+
root: Parser.SyntaxNode,
|
|
735
|
+
funcName: string,
|
|
736
|
+
typeText: string
|
|
737
|
+
): TaintSource[] {
|
|
738
|
+
const results: TaintSource[] = []
|
|
739
|
+
|
|
740
|
+
const functionTypes = [
|
|
741
|
+
'function_declaration', 'function_expression', 'arrow_function',
|
|
742
|
+
'method_definition', 'generator_function_declaration',
|
|
743
|
+
]
|
|
744
|
+
|
|
745
|
+
walkAST(root, (node) => {
|
|
746
|
+
if (!functionTypes.includes(node.type)) return false
|
|
747
|
+
|
|
748
|
+
// Match by function name
|
|
749
|
+
const name = getFunctionNameForNode(node)
|
|
750
|
+
if (name !== funcName) return false
|
|
751
|
+
|
|
752
|
+
const params = node.childForFieldName('parameters')
|
|
753
|
+
if (!params) return false
|
|
754
|
+
|
|
755
|
+
for (const param of params.namedChildren) {
|
|
756
|
+
if (param.type !== 'required_parameter' && param.type !== 'optional_parameter') continue
|
|
757
|
+
|
|
758
|
+
const typeAnnotation = param.childForFieldName('type')
|
|
759
|
+
if (!typeAnnotation) continue
|
|
760
|
+
|
|
761
|
+
const annotationText = typeAnnotation.text.replace(/^:\s*/, '')
|
|
762
|
+
if (annotationText !== typeText && !annotationText.includes(typeText)) continue
|
|
763
|
+
|
|
764
|
+
const pattern = param.childForFieldName('pattern')
|
|
765
|
+
const paramName = pattern?.text ?? param.text
|
|
766
|
+
|
|
767
|
+
results.push({
|
|
768
|
+
node: param,
|
|
769
|
+
line: param.startPosition.row + 1,
|
|
770
|
+
variable: paramName,
|
|
771
|
+
expression: `${paramName}: ${annotationText}`,
|
|
772
|
+
sourceType: 'http_body',
|
|
773
|
+
taintKinds: new Set(ALL_TAINT_KINDS),
|
|
774
|
+
confidence: 'high',
|
|
775
|
+
framework: inferFrameworkFromType(annotationText),
|
|
776
|
+
})
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
return true // found the function, skip its children
|
|
780
|
+
})
|
|
781
|
+
|
|
782
|
+
return results
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
function getFunctionNameForNode(node: Parser.SyntaxNode): string | null {
|
|
786
|
+
if (node.type === 'function_declaration' || node.type === 'generator_function_declaration' || node.type === 'method_definition') {
|
|
787
|
+
return node.childForFieldName('name')?.text ?? null
|
|
788
|
+
}
|
|
789
|
+
if (node.type === 'arrow_function' || node.type === 'function_expression') {
|
|
790
|
+
const parent = node.parent
|
|
791
|
+
if (parent?.type === 'variable_declarator') {
|
|
792
|
+
return parent.childForFieldName('name')?.text ?? null
|
|
793
|
+
}
|
|
794
|
+
if (parent?.type === 'pair') {
|
|
795
|
+
return parent.childForFieldName('key')?.text ?? null
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
return null
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Walk up to find a parent variable_declarator node.
|
|
803
|
+
*/
|
|
804
|
+
function findParentDeclarator(node: Parser.SyntaxNode): Parser.SyntaxNode | null {
|
|
805
|
+
let current: Parser.SyntaxNode | null = node.parent
|
|
806
|
+
while (current) {
|
|
807
|
+
if (current.type === 'variable_declarator') return current
|
|
808
|
+
if (current.type === 'expression_statement' || current.type === 'return_statement') return null
|
|
809
|
+
current = current.parent
|
|
810
|
+
}
|
|
811
|
+
return null
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Infer LLM framework from call target info.
|
|
816
|
+
*/
|
|
817
|
+
function inferLLMFramework(
|
|
818
|
+
targetName: string,
|
|
819
|
+
targetObject: string | undefined,
|
|
820
|
+
imports: Map<string, { module: string; originalName: string }>
|
|
821
|
+
): string {
|
|
822
|
+
// Check direct function imports
|
|
823
|
+
const binding = imports.get(targetName)
|
|
824
|
+
if (binding) {
|
|
825
|
+
if (/^ai$|^@ai-sdk\//.test(binding.module)) return 'vercel-ai'
|
|
826
|
+
if (/^openai$/.test(binding.module)) return 'openai'
|
|
827
|
+
if (/^@anthropic-ai\/sdk$|^anthropic$/.test(binding.module)) return 'anthropic'
|
|
828
|
+
if (/^@langchain\/|^langchain/.test(binding.module)) return 'langchain'
|
|
829
|
+
if (/^langchain_openai$|^langchain_anthropic$|^langchain_core|^langchain_community/.test(binding.module)) return 'langchain'
|
|
830
|
+
if (/^@google\/generative-ai$|^google\.generativeai$/.test(binding.module)) return 'google-ai'
|
|
831
|
+
if (/^cohere/.test(binding.module)) return 'cohere'
|
|
832
|
+
if (/^ollama$/.test(binding.module)) return 'ollama'
|
|
833
|
+
if (/^litellm$/.test(binding.module)) return 'litellm'
|
|
834
|
+
if (/^llama_index/.test(binding.module)) return 'llamaindex'
|
|
835
|
+
if (/^transformers$/.test(binding.module)) return 'huggingface'
|
|
836
|
+
}
|
|
837
|
+
// Check object import
|
|
838
|
+
if (targetObject) {
|
|
839
|
+
const rootObj = targetObject.split('.')[0]
|
|
840
|
+
const objBinding = imports.get(rootObj)
|
|
841
|
+
if (objBinding) {
|
|
842
|
+
if (/^openai$/.test(objBinding.module)) return 'openai'
|
|
843
|
+
if (/^@anthropic-ai\/sdk$|^anthropic$/.test(objBinding.module)) return 'anthropic'
|
|
844
|
+
if (/^@google\/generative-ai$|^google\.generativeai$/.test(objBinding.module)) return 'google-ai'
|
|
845
|
+
if (/^@langchain\/|^langchain/.test(objBinding.module)) return 'langchain'
|
|
846
|
+
if (/^langchain_openai$|^langchain_anthropic$|^langchain_core|^langchain_community/.test(objBinding.module)) return 'langchain'
|
|
847
|
+
if (/^litellm$/.test(objBinding.module)) return 'litellm'
|
|
848
|
+
if (/^llama_index/.test(objBinding.module)) return 'llamaindex'
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return 'generic'
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
function inferFrameworkFromType(typeText: string): string {
|
|
855
|
+
if (/NextRequest|NextApiRequest|NextApiResponse/.test(typeText)) return 'nextjs'
|
|
856
|
+
if (/FastifyRequest/.test(typeText)) return 'fastify'
|
|
857
|
+
if (/IncomingMessage/.test(typeText)) return 'node'
|
|
858
|
+
return 'generic'
|
|
859
|
+
}
|