@oculum/scanner 1.0.11 → 1.0.13
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/ai-context/index.d.ts +6 -0
- package/dist/ai-context/index.d.ts.map +1 -0
- package/dist/ai-context/index.js +13 -0
- package/dist/ai-context/index.js.map +1 -0
- package/dist/ai-context/manager.d.ts +67 -0
- package/dist/ai-context/manager.d.ts.map +1 -0
- package/dist/ai-context/manager.js +104 -0
- package/dist/ai-context/manager.js.map +1 -0
- package/dist/category-filter.d.ts +125 -0
- package/dist/category-filter.d.ts.map +1 -0
- package/dist/category-filter.js +360 -0
- package/dist/category-filter.js.map +1 -0
- package/dist/detect/ai-code/agent-tools.d.ts +22 -0
- package/dist/detect/ai-code/agent-tools.d.ts.map +1 -0
- package/dist/detect/ai-code/agent-tools.js +1509 -0
- package/dist/detect/ai-code/agent-tools.js.map +1 -0
- package/dist/detect/ai-code/byok-patterns.d.ts +15 -0
- package/dist/detect/ai-code/byok-patterns.d.ts.map +1 -0
- package/dist/detect/ai-code/byok-patterns.js +313 -0
- package/dist/detect/ai-code/byok-patterns.js.map +1 -0
- package/dist/detect/ai-code/endpoint-protection.d.ts +38 -0
- package/dist/detect/ai-code/endpoint-protection.d.ts.map +1 -0
- package/dist/detect/ai-code/endpoint-protection.js +349 -0
- package/dist/detect/ai-code/endpoint-protection.js.map +1 -0
- package/dist/detect/ai-code/execution-sinks.d.ts +21 -0
- package/dist/detect/ai-code/execution-sinks.d.ts.map +1 -0
- package/dist/detect/ai-code/execution-sinks.js +1158 -0
- package/dist/detect/ai-code/execution-sinks.js.map +1 -0
- package/dist/detect/ai-code/fingerprinting.d.ts +10 -0
- package/dist/detect/ai-code/fingerprinting.d.ts.map +1 -0
- package/dist/detect/ai-code/fingerprinting.js +665 -0
- package/dist/detect/ai-code/fingerprinting.js.map +1 -0
- package/dist/detect/ai-code/index.d.ts +12 -0
- package/dist/detect/ai-code/index.d.ts.map +1 -0
- package/dist/detect/ai-code/index.js +26 -0
- package/dist/detect/ai-code/index.js.map +1 -0
- package/dist/detect/ai-code/mcp-security.d.ts +20 -0
- package/dist/detect/ai-code/mcp-security.d.ts.map +1 -0
- package/dist/detect/ai-code/mcp-security.js +880 -0
- package/dist/detect/ai-code/mcp-security.js.map +1 -0
- package/dist/detect/ai-code/model-supply-chain.d.ts +23 -0
- package/dist/detect/ai-code/model-supply-chain.d.ts.map +1 -0
- package/dist/detect/ai-code/model-supply-chain.js +447 -0
- package/dist/detect/ai-code/model-supply-chain.js.map +1 -0
- package/dist/detect/ai-code/package-hallucination.d.ts +22 -0
- package/dist/detect/ai-code/package-hallucination.d.ts.map +1 -0
- package/dist/detect/ai-code/package-hallucination.js +841 -0
- package/dist/detect/ai-code/package-hallucination.js.map +1 -0
- package/dist/detect/ai-code/prompt-hygiene.d.ts +22 -0
- package/dist/detect/ai-code/prompt-hygiene.d.ts.map +1 -0
- package/dist/detect/ai-code/prompt-hygiene.js +1177 -0
- package/dist/detect/ai-code/prompt-hygiene.js.map +1 -0
- package/dist/detect/ai-code/rag-safety.d.ts +24 -0
- package/dist/detect/ai-code/rag-safety.d.ts.map +1 -0
- package/dist/detect/ai-code/rag-safety.js +913 -0
- package/dist/detect/ai-code/rag-safety.js.map +1 -0
- package/dist/detect/ai-code/schema-validation.d.ts +28 -0
- package/dist/detect/ai-code/schema-validation.d.ts.map +1 -0
- package/dist/detect/ai-code/schema-validation.js +378 -0
- package/dist/detect/ai-code/schema-validation.js.map +1 -0
- package/dist/detect/config/agent-skill-injection.d.ts +27 -0
- package/dist/detect/config/agent-skill-injection.d.ts.map +1 -0
- package/dist/detect/config/agent-skill-injection.js +472 -0
- package/dist/detect/config/agent-skill-injection.js.map +1 -0
- package/dist/detect/config/comments.d.ts +11 -0
- package/dist/detect/config/comments.d.ts.map +1 -0
- package/dist/detect/config/comments.js +206 -0
- package/dist/detect/config/comments.js.map +1 -0
- package/dist/detect/config/file-flags.d.ts +10 -0
- package/dist/detect/config/file-flags.d.ts.map +1 -0
- package/dist/detect/config/file-flags.js +124 -0
- package/dist/detect/config/file-flags.js.map +1 -0
- package/dist/detect/config/index.d.ts +7 -0
- package/dist/detect/config/index.d.ts.map +1 -0
- package/dist/detect/config/index.js +17 -0
- package/dist/detect/config/index.js.map +1 -0
- package/dist/detect/config/osv-check.d.ts +75 -0
- package/dist/detect/config/osv-check.d.ts.map +1 -0
- package/dist/detect/config/osv-check.js +309 -0
- package/dist/detect/config/osv-check.js.map +1 -0
- package/dist/detect/config/package-check.d.ts +63 -0
- package/dist/detect/config/package-check.d.ts.map +1 -0
- package/dist/detect/config/package-check.js +509 -0
- package/dist/detect/config/package-check.js.map +1 -0
- package/dist/detect/config/urls.d.ts +11 -0
- package/dist/detect/config/urls.d.ts.map +1 -0
- package/dist/detect/config/urls.js +450 -0
- package/dist/detect/config/urls.js.map +1 -0
- package/dist/detect/index.d.ts +37 -0
- package/dist/detect/index.d.ts.map +1 -0
- package/dist/detect/index.js +77 -0
- package/dist/detect/index.js.map +1 -0
- package/dist/detect/secrets/config-audit.d.ts +11 -0
- package/dist/detect/secrets/config-audit.d.ts.map +1 -0
- package/dist/detect/secrets/config-audit.js +315 -0
- package/dist/detect/secrets/config-audit.js.map +1 -0
- package/dist/detect/secrets/config-mcp-audit.d.ts +23 -0
- package/dist/detect/secrets/config-mcp-audit.d.ts.map +1 -0
- package/dist/detect/secrets/config-mcp-audit.js +243 -0
- package/dist/detect/secrets/config-mcp-audit.js.map +1 -0
- package/dist/detect/secrets/entropy.d.ts +11 -0
- package/dist/detect/secrets/entropy.d.ts.map +1 -0
- package/dist/detect/secrets/entropy.js +751 -0
- package/dist/detect/secrets/entropy.js.map +1 -0
- package/dist/detect/secrets/index.d.ts +36 -0
- package/dist/detect/secrets/index.d.ts.map +1 -0
- package/dist/detect/secrets/index.js +174 -0
- package/dist/detect/secrets/index.js.map +1 -0
- package/dist/detect/secrets/patterns.d.ts +11 -0
- package/dist/detect/secrets/patterns.d.ts.map +1 -0
- package/dist/detect/secrets/patterns.js +518 -0
- package/dist/detect/secrets/patterns.js.map +1 -0
- package/dist/detect/secrets/weak-crypto.d.ts +10 -0
- package/dist/detect/secrets/weak-crypto.d.ts.map +1 -0
- package/dist/detect/secrets/weak-crypto.js +432 -0
- package/dist/detect/secrets/weak-crypto.js.map +1 -0
- package/dist/detect/structural/auth-patterns.d.ts +22 -0
- package/dist/detect/structural/auth-patterns.d.ts.map +1 -0
- package/dist/detect/structural/auth-patterns.js +533 -0
- package/dist/detect/structural/auth-patterns.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/child-process.d.ts +16 -0
- package/dist/detect/structural/dangerous-functions/child-process.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/child-process.js +74 -0
- package/dist/detect/structural/dangerous-functions/child-process.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/dom-xss.d.ts +34 -0
- package/dist/detect/structural/dangerous-functions/dom-xss.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/dom-xss.js +230 -0
- package/dist/detect/structural/dangerous-functions/dom-xss.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/index.d.ts +16 -0
- package/dist/detect/structural/dangerous-functions/index.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/index.js +1193 -0
- package/dist/detect/structural/dangerous-functions/index.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/json-parse.d.ts +31 -0
- package/dist/detect/structural/dangerous-functions/json-parse.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/json-parse.js +326 -0
- package/dist/detect/structural/dangerous-functions/json-parse.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/math-random.d.ts +111 -0
- package/dist/detect/structural/dangerous-functions/math-random.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/math-random.js +684 -0
- package/dist/detect/structural/dangerous-functions/math-random.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/patterns.d.ts +21 -0
- package/dist/detect/structural/dangerous-functions/patterns.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/patterns.js +163 -0
- package/dist/detect/structural/dangerous-functions/patterns.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/request-validation.d.ts +13 -0
- package/dist/detect/structural/dangerous-functions/request-validation.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/request-validation.js +126 -0
- package/dist/detect/structural/dangerous-functions/request-validation.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/utils/control-flow.d.ts +24 -0
- package/dist/detect/structural/dangerous-functions/utils/control-flow.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/utils/control-flow.js +70 -0
- package/dist/detect/structural/dangerous-functions/utils/control-flow.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/utils/helpers.d.ts +31 -0
- package/dist/detect/structural/dangerous-functions/utils/helpers.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/utils/helpers.js +147 -0
- package/dist/detect/structural/dangerous-functions/utils/helpers.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/utils/index.d.ts +9 -0
- package/dist/detect/structural/dangerous-functions/utils/index.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/utils/index.js +23 -0
- package/dist/detect/structural/dangerous-functions/utils/index.js.map +1 -0
- package/dist/detect/structural/dangerous-functions/utils/schema-validation.d.ts +22 -0
- package/dist/detect/structural/dangerous-functions/utils/schema-validation.d.ts.map +1 -0
- package/dist/detect/structural/dangerous-functions/utils/schema-validation.js +102 -0
- package/dist/detect/structural/dangerous-functions/utils/schema-validation.js.map +1 -0
- package/dist/detect/structural/data-exposure.d.ts +19 -0
- package/dist/detect/structural/data-exposure.d.ts.map +1 -0
- package/dist/detect/structural/data-exposure.js +262 -0
- package/dist/detect/structural/data-exposure.js.map +1 -0
- package/dist/detect/structural/framework-checks.d.ts +10 -0
- package/dist/detect/structural/framework-checks.d.ts.map +1 -0
- package/dist/detect/structural/framework-checks.js +389 -0
- package/dist/detect/structural/framework-checks.js.map +1 -0
- package/dist/detect/structural/index.d.ts +71 -0
- package/dist/detect/structural/index.d.ts.map +1 -0
- package/dist/detect/structural/index.js +510 -0
- package/dist/detect/structural/index.js.map +1 -0
- package/dist/detect/structural/log-injection.d.ts +18 -0
- package/dist/detect/structural/log-injection.d.ts.map +1 -0
- package/dist/detect/structural/log-injection.js +217 -0
- package/dist/detect/structural/log-injection.js.map +1 -0
- package/dist/detect/structural/logic-gates.d.ts +10 -0
- package/dist/detect/structural/logic-gates.d.ts.map +1 -0
- package/dist/detect/structural/logic-gates.js +227 -0
- package/dist/detect/structural/logic-gates.js.map +1 -0
- package/dist/detect/structural/risky-imports.d.ts +10 -0
- package/dist/detect/structural/risky-imports.d.ts.map +1 -0
- package/dist/detect/structural/risky-imports.js +168 -0
- package/dist/detect/structural/risky-imports.js.map +1 -0
- package/dist/detect/structural/security-headers.d.ts +18 -0
- package/dist/detect/structural/security-headers.d.ts.map +1 -0
- package/dist/detect/structural/security-headers.js +196 -0
- package/dist/detect/structural/security-headers.js.map +1 -0
- package/dist/detect/structural/ssrf-detection.d.ts +18 -0
- package/dist/detect/structural/ssrf-detection.d.ts.map +1 -0
- package/dist/detect/structural/ssrf-detection.js +263 -0
- package/dist/detect/structural/ssrf-detection.js.map +1 -0
- package/dist/detect/structural/variables.d.ts +11 -0
- package/dist/detect/structural/variables.d.ts.map +1 -0
- package/dist/detect/structural/variables.js +159 -0
- package/dist/detect/structural/variables.js.map +1 -0
- package/dist/detect/structural/xxe-detection.d.ts +18 -0
- package/dist/detect/structural/xxe-detection.d.ts.map +1 -0
- package/dist/detect/structural/xxe-detection.js +245 -0
- package/dist/detect/structural/xxe-detection.js.map +1 -0
- package/dist/filtering/context-adjustments.d.ts +23 -0
- package/dist/filtering/context-adjustments.d.ts.map +1 -0
- package/dist/filtering/context-adjustments.js +100 -0
- package/dist/filtering/context-adjustments.js.map +1 -0
- package/dist/filtering/index.d.ts +3 -0
- package/dist/filtering/index.d.ts.map +1 -0
- package/dist/filtering/index.js +8 -0
- package/dist/filtering/index.js.map +1 -0
- package/dist/filtering/pipeline.d.ts +48 -0
- package/dist/filtering/pipeline.d.ts.map +1 -0
- package/dist/filtering/pipeline.js +76 -0
- package/dist/filtering/pipeline.js.map +1 -0
- package/dist/formatters/ai-context.d.ts +23 -0
- package/dist/formatters/ai-context.d.ts.map +1 -0
- package/dist/formatters/ai-context.js +238 -0
- package/dist/formatters/ai-context.js.map +1 -0
- package/dist/formatters/github-comment.d.ts +1 -1
- package/dist/formatters/github-comment.d.ts.map +1 -1
- package/dist/formatters/github-comment.js +2 -2
- package/dist/formatters/github-comment.js.map +1 -1
- package/dist/formatters/ide/claude-code.d.ts +17 -0
- package/dist/formatters/ide/claude-code.d.ts.map +1 -0
- package/dist/formatters/ide/claude-code.js +94 -0
- package/dist/formatters/ide/claude-code.js.map +1 -0
- package/dist/formatters/ide/cursor.d.ts +13 -0
- package/dist/formatters/ide/cursor.d.ts.map +1 -0
- package/dist/formatters/ide/cursor.js +125 -0
- package/dist/formatters/ide/cursor.js.map +1 -0
- package/dist/formatters/ide/index.d.ts +62 -0
- package/dist/formatters/ide/index.d.ts.map +1 -0
- package/dist/formatters/ide/index.js +184 -0
- package/dist/formatters/ide/index.js.map +1 -0
- package/dist/formatters/ide/windsurf.d.ts +13 -0
- package/dist/formatters/ide/windsurf.d.ts.map +1 -0
- package/dist/formatters/ide/windsurf.js +117 -0
- package/dist/formatters/ide/windsurf.js.map +1 -0
- package/dist/formatters/index.d.ts +2 -0
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +17 -1
- package/dist/formatters/index.js.map +1 -1
- package/dist/index.d.ts +17 -60
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +67 -824
- package/dist/index.js.map +1 -1
- package/dist/layer1/comments.d.ts +4 -1
- package/dist/layer1/comments.d.ts.map +1 -1
- package/dist/layer1/comments.js +1 -1
- package/dist/layer1/comments.js.map +1 -1
- package/dist/layer1/config-audit.d.ts +4 -1
- package/dist/layer1/config-audit.d.ts.map +1 -1
- package/dist/layer1/config-audit.js +45 -11
- package/dist/layer1/config-audit.js.map +1 -1
- package/dist/layer1/config-mcp-audit.d.ts +4 -1
- package/dist/layer1/config-mcp-audit.d.ts.map +1 -1
- package/dist/layer1/config-mcp-audit.js +2 -2
- package/dist/layer1/config-mcp-audit.js.map +1 -1
- package/dist/layer1/entropy.d.ts +4 -1
- package/dist/layer1/entropy.d.ts.map +1 -1
- package/dist/layer1/entropy.js +212 -1
- package/dist/layer1/entropy.js.map +1 -1
- package/dist/layer1/file-flags.d.ts +4 -1
- package/dist/layer1/file-flags.d.ts.map +1 -1
- package/dist/layer1/file-flags.js +12 -5
- package/dist/layer1/file-flags.js.map +1 -1
- package/dist/layer1/index.d.ts.map +1 -1
- package/dist/layer1/index.js +14 -19
- package/dist/layer1/index.js.map +1 -1
- package/dist/layer1/patterns.d.ts +4 -1
- package/dist/layer1/patterns.d.ts.map +1 -1
- package/dist/layer1/patterns.js +34 -4
- package/dist/layer1/patterns.js.map +1 -1
- package/dist/layer1/urls.d.ts +4 -1
- package/dist/layer1/urls.d.ts.map +1 -1
- package/dist/layer1/urls.js +162 -14
- package/dist/layer1/urls.js.map +1 -1
- package/dist/layer1/weak-crypto.d.ts +4 -1
- package/dist/layer1/weak-crypto.d.ts.map +1 -1
- package/dist/layer1/weak-crypto.js +144 -7
- package/dist/layer1/weak-crypto.js.map +1 -1
- package/dist/layer2/ai-agent-tools.d.ts +4 -1
- package/dist/layer2/ai-agent-tools.d.ts.map +1 -1
- package/dist/layer2/ai-agent-tools.js +661 -2
- package/dist/layer2/ai-agent-tools.js.map +1 -1
- package/dist/layer2/ai-endpoint-protection.d.ts +2 -0
- package/dist/layer2/ai-endpoint-protection.d.ts.map +1 -1
- package/dist/layer2/ai-endpoint-protection.js +1 -1
- package/dist/layer2/ai-endpoint-protection.js.map +1 -1
- package/dist/layer2/ai-execution-sinks.d.ts +4 -1
- package/dist/layer2/ai-execution-sinks.d.ts.map +1 -1
- package/dist/layer2/ai-execution-sinks.js +252 -43
- package/dist/layer2/ai-execution-sinks.js.map +1 -1
- package/dist/layer2/ai-fingerprinting.d.ts +4 -1
- package/dist/layer2/ai-fingerprinting.d.ts.map +1 -1
- package/dist/layer2/ai-fingerprinting.js +25 -32
- package/dist/layer2/ai-fingerprinting.js.map +1 -1
- package/dist/layer2/ai-mcp-security.d.ts +4 -1
- package/dist/layer2/ai-mcp-security.d.ts.map +1 -1
- package/dist/layer2/ai-mcp-security.js +200 -2
- package/dist/layer2/ai-mcp-security.js.map +1 -1
- package/dist/layer2/ai-package-hallucination.d.ts +4 -1
- package/dist/layer2/ai-package-hallucination.d.ts.map +1 -1
- package/dist/layer2/ai-package-hallucination.js +136 -4
- package/dist/layer2/ai-package-hallucination.js.map +1 -1
- package/dist/layer2/ai-prompt-hygiene.d.ts +4 -1
- package/dist/layer2/ai-prompt-hygiene.d.ts.map +1 -1
- package/dist/layer2/ai-prompt-hygiene.js +342 -28
- package/dist/layer2/ai-prompt-hygiene.js.map +1 -1
- package/dist/layer2/ai-rag-safety.d.ts +4 -1
- package/dist/layer2/ai-rag-safety.d.ts.map +1 -1
- package/dist/layer2/ai-rag-safety.js +82 -2
- package/dist/layer2/ai-rag-safety.js.map +1 -1
- package/dist/layer2/ai-schema-validation.d.ts +4 -1
- package/dist/layer2/ai-schema-validation.d.ts.map +1 -1
- package/dist/layer2/ai-schema-validation.js +2 -2
- package/dist/layer2/ai-schema-validation.js.map +1 -1
- package/dist/layer2/auth-antipatterns.d.ts +2 -0
- package/dist/layer2/auth-antipatterns.d.ts.map +1 -1
- package/dist/layer2/auth-antipatterns.js +205 -20
- package/dist/layer2/auth-antipatterns.js.map +1 -1
- package/dist/layer2/byok-patterns.d.ts +4 -1
- package/dist/layer2/byok-patterns.d.ts.map +1 -1
- package/dist/layer2/byok-patterns.js +2 -2
- package/dist/layer2/byok-patterns.js.map +1 -1
- package/dist/layer2/dangerous-functions/dom-xss.d.ts +9 -4
- package/dist/layer2/dangerous-functions/dom-xss.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/dom-xss.js +73 -22
- package/dist/layer2/dangerous-functions/dom-xss.js.map +1 -1
- package/dist/layer2/dangerous-functions/index.d.ts +4 -1
- package/dist/layer2/dangerous-functions/index.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/index.js +551 -20
- package/dist/layer2/dangerous-functions/index.js.map +1 -1
- package/dist/layer2/dangerous-functions/math-random.d.ts +54 -4
- package/dist/layer2/dangerous-functions/math-random.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/math-random.js +241 -16
- package/dist/layer2/dangerous-functions/math-random.js.map +1 -1
- package/dist/layer2/dangerous-functions/patterns.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/patterns.js +3 -1
- package/dist/layer2/dangerous-functions/patterns.js.map +1 -1
- package/dist/layer2/dangerous-functions/utils/control-flow.d.ts +3 -2
- package/dist/layer2/dangerous-functions/utils/control-flow.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/utils/control-flow.js +41 -120
- package/dist/layer2/dangerous-functions/utils/control-flow.js.map +1 -1
- package/dist/layer2/dangerous-functions/utils/helpers.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/utils/helpers.js +26 -3
- package/dist/layer2/dangerous-functions/utils/helpers.js.map +1 -1
- package/dist/layer2/dangerous-functions/utils/schema-validation.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/utils/schema-validation.js +14 -1
- package/dist/layer2/dangerous-functions/utils/schema-validation.js.map +1 -1
- package/dist/layer2/data-exposure.d.ts +4 -1
- package/dist/layer2/data-exposure.d.ts.map +1 -1
- package/dist/layer2/data-exposure.js +11 -38
- package/dist/layer2/data-exposure.js.map +1 -1
- package/dist/layer2/framework-checks.d.ts +4 -1
- package/dist/layer2/framework-checks.d.ts.map +1 -1
- package/dist/layer2/framework-checks.js +3 -10
- package/dist/layer2/framework-checks.js.map +1 -1
- package/dist/layer2/index.d.ts +13 -1
- package/dist/layer2/index.d.ts.map +1 -1
- package/dist/layer2/index.js +107 -52
- package/dist/layer2/index.js.map +1 -1
- package/dist/layer2/log-injection.d.ts +18 -0
- package/dist/layer2/log-injection.d.ts.map +1 -0
- package/dist/layer2/log-injection.js +214 -0
- package/dist/layer2/log-injection.js.map +1 -0
- package/dist/layer2/logic-gates.d.ts +4 -1
- package/dist/layer2/logic-gates.d.ts.map +1 -1
- package/dist/layer2/logic-gates.js +54 -20
- package/dist/layer2/logic-gates.js.map +1 -1
- package/dist/layer2/model-supply-chain.d.ts +4 -1
- package/dist/layer2/model-supply-chain.d.ts.map +1 -1
- package/dist/layer2/model-supply-chain.js +72 -4
- package/dist/layer2/model-supply-chain.js.map +1 -1
- package/dist/layer2/risky-imports.d.ts +4 -1
- package/dist/layer2/risky-imports.d.ts.map +1 -1
- package/dist/layer2/risky-imports.js +2 -2
- package/dist/layer2/risky-imports.js.map +1 -1
- package/dist/layer2/security-headers.d.ts +18 -0
- package/dist/layer2/security-headers.d.ts.map +1 -0
- package/dist/layer2/security-headers.js +187 -0
- package/dist/layer2/security-headers.js.map +1 -0
- package/dist/layer2/ssrf-detection.d.ts +18 -0
- package/dist/layer2/ssrf-detection.d.ts.map +1 -0
- package/dist/layer2/ssrf-detection.js +252 -0
- package/dist/layer2/ssrf-detection.js.map +1 -0
- package/dist/layer2/variables.d.ts +4 -1
- package/dist/layer2/variables.d.ts.map +1 -1
- package/dist/layer2/variables.js +2 -2
- package/dist/layer2/variables.js.map +1 -1
- package/dist/layer2/xxe-detection.d.ts +18 -0
- package/dist/layer2/xxe-detection.d.ts.map +1 -0
- package/dist/layer2/xxe-detection.js +242 -0
- package/dist/layer2/xxe-detection.js.map +1 -0
- package/dist/layer3/anthropic/auto-dismiss.d.ts.map +1 -1
- package/dist/layer3/anthropic/auto-dismiss.js +11 -0
- package/dist/layer3/anthropic/auto-dismiss.js.map +1 -1
- package/dist/layer3/anthropic/prompts/index.d.ts +1 -1
- package/dist/layer3/anthropic/prompts/index.d.ts.map +1 -1
- package/dist/layer3/anthropic/prompts/index.js +3 -1
- package/dist/layer3/anthropic/prompts/index.js.map +1 -1
- package/dist/layer3/anthropic/prompts/modules/ai-patterns.d.ts +19 -0
- package/dist/layer3/anthropic/prompts/modules/ai-patterns.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/ai-patterns.js +156 -0
- package/dist/layer3/anthropic/prompts/modules/ai-patterns.js.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/auth-access.d.ts +9 -0
- package/dist/layer3/anthropic/prompts/modules/auth-access.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/auth-access.js +25 -0
- package/dist/layer3/anthropic/prompts/modules/auth-access.js.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/common.d.ts +11 -0
- package/dist/layer3/anthropic/prompts/modules/common.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/common.js +152 -0
- package/dist/layer3/anthropic/prompts/modules/common.js.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/index.d.ts +54 -0
- package/dist/layer3/anthropic/prompts/modules/index.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/index.js +185 -0
- package/dist/layer3/anthropic/prompts/modules/index.js.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/owasp-classic.d.ts +8 -0
- package/dist/layer3/anthropic/prompts/modules/owasp-classic.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/owasp-classic.js +84 -0
- package/dist/layer3/anthropic/prompts/modules/owasp-classic.js.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/secrets-crypto.d.ts +8 -0
- package/dist/layer3/anthropic/prompts/modules/secrets-crypto.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/secrets-crypto.js +68 -0
- package/dist/layer3/anthropic/prompts/modules/secrets-crypto.js.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/xss-prompt.d.ts +8 -0
- package/dist/layer3/anthropic/prompts/modules/xss-prompt.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/modules/xss-prompt.js +22 -0
- package/dist/layer3/anthropic/prompts/modules/xss-prompt.js.map +1 -0
- package/dist/layer3/anthropic/prompts/validation.d.ts +9 -3
- package/dist/layer3/anthropic/prompts/validation.d.ts.map +1 -1
- package/dist/layer3/anthropic/prompts/validation.js +14 -410
- package/dist/layer3/anthropic/prompts/validation.js.map +1 -1
- package/dist/layer3/anthropic/providers/anthropic.d.ts.map +1 -1
- package/dist/layer3/anthropic/providers/anthropic.js +6 -3
- package/dist/layer3/anthropic/providers/anthropic.js.map +1 -1
- package/dist/layer3/anthropic/providers/openai.d.ts.map +1 -1
- package/dist/layer3/anthropic/providers/openai.js +6 -3
- package/dist/layer3/anthropic/providers/openai.js.map +1 -1
- package/dist/layer3/anthropic/request-builder.d.ts +11 -4
- package/dist/layer3/anthropic/request-builder.d.ts.map +1 -1
- package/dist/layer3/anthropic/request-builder.js +32 -16
- package/dist/layer3/anthropic/request-builder.js.map +1 -1
- package/dist/layer3/anthropic/utils/context-extractor.d.ts +55 -0
- package/dist/layer3/anthropic/utils/context-extractor.d.ts.map +1 -0
- package/dist/layer3/anthropic/utils/context-extractor.js +161 -0
- package/dist/layer3/anthropic/utils/context-extractor.js.map +1 -0
- package/dist/layer3/anthropic/utils/index.d.ts +2 -0
- package/dist/layer3/anthropic/utils/index.d.ts.map +1 -1
- package/dist/layer3/anthropic/utils/index.js +4 -1
- package/dist/layer3/anthropic/utils/index.js.map +1 -1
- package/dist/model/auth-helper-detector.d.ts +56 -0
- package/dist/model/auth-helper-detector.d.ts.map +1 -0
- package/dist/model/auth-helper-detector.js +360 -0
- package/dist/model/auth-helper-detector.js.map +1 -0
- package/dist/model/cross-file-taint.d.ts +40 -0
- package/dist/model/cross-file-taint.d.ts.map +1 -0
- package/dist/model/cross-file-taint.js +290 -0
- package/dist/model/cross-file-taint.js.map +1 -0
- package/dist/model/framework-models/django.d.ts +9 -0
- package/dist/model/framework-models/django.d.ts.map +1 -0
- package/dist/model/framework-models/django.js +82 -0
- package/dist/model/framework-models/django.js.map +1 -0
- package/dist/model/framework-models/express.d.ts +9 -0
- package/dist/model/framework-models/express.d.ts.map +1 -0
- package/dist/model/framework-models/express.js +52 -0
- package/dist/model/framework-models/express.js.map +1 -0
- package/dist/model/framework-models/index.d.ts +20 -0
- package/dist/model/framework-models/index.d.ts.map +1 -0
- package/dist/model/framework-models/index.js +102 -0
- package/dist/model/framework-models/index.js.map +1 -0
- package/dist/model/framework-models/nextjs.d.ts +9 -0
- package/dist/model/framework-models/nextjs.d.ts.map +1 -0
- package/dist/model/framework-models/nextjs.js +71 -0
- package/dist/model/framework-models/nextjs.js.map +1 -0
- package/dist/model/framework-models/prisma.d.ts +10 -0
- package/dist/model/framework-models/prisma.d.ts.map +1 -0
- package/dist/model/framework-models/prisma.js +54 -0
- package/dist/model/framework-models/prisma.js.map +1 -0
- package/dist/model/framework-models/react.d.ts +9 -0
- package/dist/model/framework-models/react.d.ts.map +1 -0
- package/dist/model/framework-models/react.js +67 -0
- package/dist/model/framework-models/react.js.map +1 -0
- package/dist/model/framework-models/sequelize.d.ts +9 -0
- package/dist/model/framework-models/sequelize.d.ts.map +1 -0
- package/dist/model/framework-models/sequelize.js +62 -0
- package/dist/model/framework-models/sequelize.js.map +1 -0
- package/dist/model/framework-models/types.d.ts +43 -0
- package/dist/model/framework-models/types.d.ts.map +1 -0
- package/dist/model/framework-models/types.js +10 -0
- package/dist/model/framework-models/types.js.map +1 -0
- package/dist/model/function-classifier.d.ts +32 -0
- package/dist/model/function-classifier.d.ts.map +1 -0
- package/dist/model/function-classifier.js +143 -0
- package/dist/model/function-classifier.js.map +1 -0
- package/dist/model/import-resolver.d.ts +45 -0
- package/dist/model/import-resolver.d.ts.map +1 -0
- package/dist/model/import-resolver.js +410 -0
- package/dist/model/import-resolver.js.map +1 -0
- package/dist/model/imported-auth-detector.d.ts +38 -0
- package/dist/model/imported-auth-detector.d.ts.map +1 -0
- package/dist/model/imported-auth-detector.js +199 -0
- package/dist/model/imported-auth-detector.js.map +1 -0
- package/dist/model/index.d.ts +63 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +272 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/middleware-detector.d.ts +55 -0
- package/dist/model/middleware-detector.d.ts.map +1 -0
- package/dist/model/middleware-detector.js +382 -0
- package/dist/model/middleware-detector.js.map +1 -0
- package/dist/model/module-graph.d.ts +46 -0
- package/dist/model/module-graph.d.ts.map +1 -0
- package/dist/model/module-graph.js +187 -0
- package/dist/model/module-graph.js.map +1 -0
- package/dist/model/oauth-flow-detector.d.ts +41 -0
- package/dist/model/oauth-flow-detector.d.ts.map +1 -0
- package/dist/model/oauth-flow-detector.js +202 -0
- package/dist/model/oauth-flow-detector.js.map +1 -0
- package/dist/model/project-context.d.ts +119 -0
- package/dist/model/project-context.d.ts.map +1 -0
- package/dist/model/project-context.js +534 -0
- package/dist/model/project-context.js.map +1 -0
- package/dist/model/route-auth-resolver.d.ts +27 -0
- package/dist/model/route-auth-resolver.d.ts.map +1 -0
- package/dist/model/route-auth-resolver.js +182 -0
- package/dist/model/route-auth-resolver.js.map +1 -0
- package/dist/model/route-discovery/express.d.ts +25 -0
- package/dist/model/route-discovery/express.d.ts.map +1 -0
- package/dist/model/route-discovery/express.js +225 -0
- package/dist/model/route-discovery/express.js.map +1 -0
- package/dist/model/route-discovery/index.d.ts +21 -0
- package/dist/model/route-discovery/index.d.ts.map +1 -0
- package/dist/model/route-discovery/index.js +67 -0
- package/dist/model/route-discovery/index.js.map +1 -0
- package/dist/model/route-discovery/nextjs.d.ts +16 -0
- package/dist/model/route-discovery/nextjs.d.ts.map +1 -0
- package/dist/model/route-discovery/nextjs.js +179 -0
- package/dist/model/route-discovery/nextjs.js.map +1 -0
- package/dist/model/route-discovery/python.d.ts +16 -0
- package/dist/model/route-discovery/python.d.ts.map +1 -0
- package/dist/model/route-discovery/python.js +181 -0
- package/dist/model/route-discovery/python.js.map +1 -0
- package/dist/model/route-discovery/types.d.ts +36 -0
- package/dist/model/route-discovery/types.d.ts.map +1 -0
- package/dist/model/route-discovery/types.js +16 -0
- package/dist/model/route-discovery/types.js.map +1 -0
- package/dist/model/route-discovery/utils.d.ts +18 -0
- package/dist/model/route-discovery/utils.d.ts.map +1 -0
- package/dist/model/route-discovery/utils.js +55 -0
- package/dist/model/route-discovery/utils.js.map +1 -0
- package/dist/model/route-hierarchy.d.ts +50 -0
- package/dist/model/route-hierarchy.d.ts.map +1 -0
- package/dist/model/route-hierarchy.js +226 -0
- package/dist/model/route-hierarchy.js.map +1 -0
- package/dist/model/sanitiser-detection.d.ts +27 -0
- package/dist/model/sanitiser-detection.d.ts.map +1 -0
- package/dist/model/sanitiser-detection.js +224 -0
- package/dist/model/sanitiser-detection.js.map +1 -0
- package/dist/model/sink-matcher.d.ts +17 -0
- package/dist/model/sink-matcher.d.ts.map +1 -0
- package/dist/model/sink-matcher.js +141 -0
- package/dist/model/sink-matcher.js.map +1 -0
- package/dist/model/sink-patterns.d.ts +19 -0
- package/dist/model/sink-patterns.d.ts.map +1 -0
- package/dist/model/sink-patterns.js +88 -0
- package/dist/model/sink-patterns.js.map +1 -0
- package/dist/model/source-discovery.d.ts +15 -0
- package/dist/model/source-discovery.d.ts.map +1 -0
- package/dist/model/source-discovery.js +170 -0
- package/dist/model/source-discovery.js.map +1 -0
- package/dist/model/taint-tracker.d.ts +21 -0
- package/dist/model/taint-tracker.d.ts.map +1 -0
- package/dist/model/taint-tracker.js +281 -0
- package/dist/model/taint-tracker.js.map +1 -0
- package/dist/model/taint-types.d.ts +74 -0
- package/dist/model/taint-types.d.ts.map +1 -0
- package/dist/model/taint-types.js +9 -0
- package/dist/model/taint-types.js.map +1 -0
- package/dist/model/trpc-analyzer.d.ts +78 -0
- package/dist/model/trpc-analyzer.d.ts.map +1 -0
- package/dist/model/trpc-analyzer.js +297 -0
- package/dist/model/trpc-analyzer.js.map +1 -0
- package/dist/modes/incremental.js +1 -1
- package/dist/parse/file-classifier.d.ts +228 -0
- package/dist/parse/file-classifier.d.ts.map +1 -0
- package/dist/parse/file-classifier.js +933 -0
- package/dist/parse/file-classifier.js.map +1 -0
- package/dist/parse/path-exclusions.d.ts +55 -0
- package/dist/parse/path-exclusions.d.ts.map +1 -0
- package/dist/parse/path-exclusions.js +224 -0
- package/dist/parse/path-exclusions.js.map +1 -0
- package/dist/pipeline/config.d.ts +39 -0
- package/dist/pipeline/config.d.ts.map +1 -0
- package/dist/pipeline/config.js +46 -0
- package/dist/pipeline/config.js.map +1 -0
- package/dist/pipeline/index.d.ts +34 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +377 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/modes/incremental.d.ts +66 -0
- package/dist/pipeline/modes/incremental.d.ts.map +1 -0
- package/dist/pipeline/modes/incremental.js +200 -0
- package/dist/pipeline/modes/incremental.js.map +1 -0
- package/dist/postprocess/aggregation.d.ts +14 -0
- package/dist/postprocess/aggregation.d.ts.map +1 -0
- package/dist/postprocess/aggregation.js +63 -0
- package/dist/postprocess/aggregation.js.map +1 -0
- package/dist/postprocess/contradictions.d.ts +18 -0
- package/dist/postprocess/contradictions.d.ts.map +1 -0
- package/dist/postprocess/contradictions.js +99 -0
- package/dist/postprocess/contradictions.js.map +1 -0
- package/dist/postprocess/dedup.d.ts +13 -0
- package/dist/postprocess/dedup.d.ts.map +1 -0
- package/dist/postprocess/dedup.js +58 -0
- package/dist/postprocess/dedup.js.map +1 -0
- package/dist/postprocess/filtering/context-adjustments.d.ts +23 -0
- package/dist/postprocess/filtering/context-adjustments.d.ts.map +1 -0
- package/dist/postprocess/filtering/context-adjustments.js +100 -0
- package/dist/postprocess/filtering/context-adjustments.js.map +1 -0
- package/dist/postprocess/filtering/index.d.ts +3 -0
- package/dist/postprocess/filtering/index.d.ts.map +1 -0
- package/dist/postprocess/filtering/index.js +8 -0
- package/dist/postprocess/filtering/index.js.map +1 -0
- package/dist/postprocess/filtering/pipeline.d.ts +48 -0
- package/dist/postprocess/filtering/pipeline.d.ts.map +1 -0
- package/dist/postprocess/filtering/pipeline.js +76 -0
- package/dist/postprocess/filtering/pipeline.js.map +1 -0
- package/dist/postprocess/index.d.ts +41 -0
- package/dist/postprocess/index.d.ts.map +1 -0
- package/dist/postprocess/index.js +85 -0
- package/dist/postprocess/index.js.map +1 -0
- package/dist/postprocess/suppression/config-loader.d.ts +74 -0
- package/dist/postprocess/suppression/config-loader.d.ts.map +1 -0
- package/dist/postprocess/suppression/config-loader.js +424 -0
- package/dist/postprocess/suppression/config-loader.js.map +1 -0
- package/dist/postprocess/suppression/hash.d.ts +48 -0
- package/dist/postprocess/suppression/hash.d.ts.map +1 -0
- package/dist/postprocess/suppression/hash.js +88 -0
- package/dist/postprocess/suppression/hash.js.map +1 -0
- package/dist/postprocess/suppression/index.d.ts +11 -0
- package/dist/postprocess/suppression/index.d.ts.map +1 -0
- package/dist/postprocess/suppression/index.js +39 -0
- package/dist/postprocess/suppression/index.js.map +1 -0
- package/dist/postprocess/suppression/inline-parser.d.ts +39 -0
- package/dist/postprocess/suppression/inline-parser.d.ts.map +1 -0
- package/dist/postprocess/suppression/inline-parser.js +218 -0
- package/dist/postprocess/suppression/inline-parser.js.map +1 -0
- package/dist/postprocess/suppression/manager.d.ts +94 -0
- package/dist/postprocess/suppression/manager.d.ts.map +1 -0
- package/dist/postprocess/suppression/manager.js +292 -0
- package/dist/postprocess/suppression/manager.js.map +1 -0
- package/dist/postprocess/suppression/types.d.ts +151 -0
- package/dist/postprocess/suppression/types.d.ts.map +1 -0
- package/dist/postprocess/suppression/types.js +28 -0
- package/dist/postprocess/suppression/types.js.map +1 -0
- package/dist/postprocess/validation-cap.d.ts +17 -0
- package/dist/postprocess/validation-cap.d.ts.map +1 -0
- package/dist/postprocess/validation-cap.js +64 -0
- package/dist/postprocess/validation-cap.js.map +1 -0
- package/dist/report/build-result.d.ts +33 -0
- package/dist/report/build-result.d.ts.map +1 -0
- package/dist/report/build-result.js +59 -0
- package/dist/report/build-result.js.map +1 -0
- package/dist/report/enrichment.d.ts +19 -0
- package/dist/report/enrichment.d.ts.map +1 -0
- package/dist/report/enrichment.js +44 -0
- package/dist/report/enrichment.js.map +1 -0
- package/dist/report/formatters/ai-context.d.ts +23 -0
- package/dist/report/formatters/ai-context.d.ts.map +1 -0
- package/dist/report/formatters/ai-context.js +238 -0
- package/dist/report/formatters/ai-context.js.map +1 -0
- package/dist/report/formatters/cli-terminal.d.ts +65 -0
- package/dist/report/formatters/cli-terminal.d.ts.map +1 -0
- package/dist/report/formatters/cli-terminal.js +735 -0
- package/dist/report/formatters/cli-terminal.js.map +1 -0
- package/dist/report/formatters/github-comment.d.ts +41 -0
- package/dist/report/formatters/github-comment.d.ts.map +1 -0
- package/dist/report/formatters/github-comment.js +370 -0
- package/dist/report/formatters/github-comment.js.map +1 -0
- package/dist/report/formatters/grouping.d.ts +52 -0
- package/dist/report/formatters/grouping.d.ts.map +1 -0
- package/dist/report/formatters/grouping.js +152 -0
- package/dist/report/formatters/grouping.js.map +1 -0
- package/dist/report/formatters/ide/claude-code.d.ts +17 -0
- package/dist/report/formatters/ide/claude-code.d.ts.map +1 -0
- package/dist/report/formatters/ide/claude-code.js +94 -0
- package/dist/report/formatters/ide/claude-code.js.map +1 -0
- package/dist/report/formatters/ide/cursor.d.ts +13 -0
- package/dist/report/formatters/ide/cursor.d.ts.map +1 -0
- package/dist/report/formatters/ide/cursor.js +125 -0
- package/dist/report/formatters/ide/cursor.js.map +1 -0
- package/dist/report/formatters/ide/index.d.ts +62 -0
- package/dist/report/formatters/ide/index.d.ts.map +1 -0
- package/dist/report/formatters/ide/index.js +184 -0
- package/dist/report/formatters/ide/index.js.map +1 -0
- package/dist/report/formatters/ide/windsurf.d.ts +13 -0
- package/dist/report/formatters/ide/windsurf.d.ts.map +1 -0
- package/dist/report/formatters/ide/windsurf.js +117 -0
- package/dist/report/formatters/ide/windsurf.js.map +1 -0
- package/dist/report/formatters/index.d.ts +11 -0
- package/dist/report/formatters/index.d.ts.map +1 -0
- package/dist/report/formatters/index.js +54 -0
- package/dist/report/formatters/index.js.map +1 -0
- package/dist/report/formatters/vscode-diagnostic.d.ts +103 -0
- package/dist/report/formatters/vscode-diagnostic.d.ts.map +1 -0
- package/dist/report/formatters/vscode-diagnostic.js +151 -0
- package/dist/report/formatters/vscode-diagnostic.js.map +1 -0
- package/dist/report/summary.d.ts +27 -0
- package/dist/report/summary.d.ts.map +1 -0
- package/dist/report/summary.js +57 -0
- package/dist/report/summary.js.map +1 -0
- package/dist/rules/metadata.d.ts.map +1 -1
- package/dist/rules/metadata.js +66 -0
- package/dist/rules/metadata.js.map +1 -1
- package/dist/score/adjustments.d.ts +22 -0
- package/dist/score/adjustments.d.ts.map +1 -0
- package/dist/score/adjustments.js +373 -0
- package/dist/score/adjustments.js.map +1 -0
- package/dist/score/auto-dismiss.d.ts +28 -0
- package/dist/score/auto-dismiss.d.ts.map +1 -0
- package/dist/score/auto-dismiss.js +200 -0
- package/dist/score/auto-dismiss.js.map +1 -0
- package/dist/score/confidence.d.ts +19 -0
- package/dist/score/confidence.d.ts.map +1 -0
- package/dist/score/confidence.js +52 -0
- package/dist/score/confidence.js.map +1 -0
- package/dist/score/index.d.ts +61 -0
- package/dist/score/index.d.ts.map +1 -0
- package/dist/score/index.js +250 -0
- package/dist/score/index.js.map +1 -0
- package/dist/score/types.d.ts +160 -0
- package/dist/score/types.d.ts.map +1 -0
- package/dist/score/types.js +14 -0
- package/dist/score/types.js.map +1 -0
- package/dist/shared/ai-context/index.d.ts +6 -0
- package/dist/shared/ai-context/index.d.ts.map +1 -0
- package/dist/shared/ai-context/index.js +13 -0
- package/dist/shared/ai-context/index.js.map +1 -0
- package/dist/shared/ai-context/manager.d.ts +67 -0
- package/dist/shared/ai-context/manager.d.ts.map +1 -0
- package/dist/shared/ai-context/manager.js +104 -0
- package/dist/shared/ai-context/manager.js.map +1 -0
- package/dist/shared/baseline/diff.d.ts +32 -0
- package/dist/shared/baseline/diff.d.ts.map +1 -0
- package/dist/shared/baseline/diff.js +119 -0
- package/dist/shared/baseline/diff.js.map +1 -0
- package/dist/shared/baseline/index.d.ts +9 -0
- package/dist/shared/baseline/index.d.ts.map +1 -0
- package/dist/shared/baseline/index.js +19 -0
- package/dist/shared/baseline/index.js.map +1 -0
- package/dist/shared/baseline/manager.d.ts +67 -0
- package/dist/shared/baseline/manager.d.ts.map +1 -0
- package/dist/shared/baseline/manager.js +180 -0
- package/dist/shared/baseline/manager.js.map +1 -0
- package/dist/shared/baseline/types.d.ts +91 -0
- package/dist/shared/baseline/types.d.ts.map +1 -0
- package/dist/shared/baseline/types.js +12 -0
- package/dist/shared/baseline/types.js.map +1 -0
- package/dist/shared/category-filter.d.ts +125 -0
- package/dist/shared/category-filter.d.ts.map +1 -0
- package/dist/shared/category-filter.js +360 -0
- package/dist/shared/category-filter.js.map +1 -0
- package/dist/shared/code-analysis.d.ts +39 -0
- package/dist/shared/code-analysis.d.ts.map +1 -0
- package/dist/shared/code-analysis.js +159 -0
- package/dist/shared/code-analysis.js.map +1 -0
- package/dist/shared/comment-analyzer.d.ts +38 -0
- package/dist/shared/comment-analyzer.d.ts.map +1 -0
- package/dist/shared/comment-analyzer.js +218 -0
- package/dist/shared/comment-analyzer.js.map +1 -0
- package/dist/shared/diff-detector.d.ts +53 -0
- package/dist/shared/diff-detector.d.ts.map +1 -0
- package/dist/shared/diff-detector.js +104 -0
- package/dist/shared/diff-detector.js.map +1 -0
- package/dist/shared/diff-parser.d.ts +80 -0
- package/dist/shared/diff-parser.d.ts.map +1 -0
- package/dist/shared/diff-parser.js +202 -0
- package/dist/shared/diff-parser.js.map +1 -0
- package/dist/shared/environment-context.d.ts +76 -0
- package/dist/shared/environment-context.d.ts.map +1 -0
- package/dist/shared/environment-context.js +271 -0
- package/dist/shared/environment-context.js.map +1 -0
- package/dist/shared/intent-detector.d.ts +66 -0
- package/dist/shared/intent-detector.d.ts.map +1 -0
- package/dist/shared/intent-detector.js +282 -0
- package/dist/shared/intent-detector.js.map +1 -0
- package/dist/shared/parsed-file.d.ts +51 -0
- package/dist/shared/parsed-file.d.ts.map +1 -0
- package/dist/shared/parsed-file.js +95 -0
- package/dist/shared/parsed-file.js.map +1 -0
- package/dist/shared/registry-clients.d.ts +93 -0
- package/dist/shared/registry-clients.d.ts.map +1 -0
- package/dist/shared/registry-clients.js +273 -0
- package/dist/shared/registry-clients.js.map +1 -0
- package/dist/shared/rules/framework-fixes.d.ts +48 -0
- package/dist/shared/rules/framework-fixes.d.ts.map +1 -0
- package/dist/shared/rules/framework-fixes.js +439 -0
- package/dist/shared/rules/framework-fixes.js.map +1 -0
- package/dist/shared/rules/index.d.ts +8 -0
- package/dist/shared/rules/index.d.ts.map +1 -0
- package/dist/shared/rules/index.js +18 -0
- package/dist/shared/rules/index.js.map +1 -0
- package/dist/shared/rules/metadata.d.ts +43 -0
- package/dist/shared/rules/metadata.d.ts.map +1 -0
- package/dist/shared/rules/metadata.js +819 -0
- package/dist/shared/rules/metadata.js.map +1 -0
- package/dist/shared/schema-semantics.d.ts +45 -0
- package/dist/shared/schema-semantics.d.ts.map +1 -0
- package/dist/shared/schema-semantics.js +193 -0
- package/dist/shared/schema-semantics.js.map +1 -0
- package/dist/shared/types.d.ts +337 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +126 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/tiers.d.ts +4 -4
- package/dist/tiers.d.ts.map +1 -1
- package/dist/tiers.js +17 -7
- package/dist/tiers.js.map +1 -1
- package/dist/types.d.ts +79 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +34 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/code-analysis.d.ts +39 -0
- package/dist/utils/code-analysis.d.ts.map +1 -0
- package/dist/utils/code-analysis.js +159 -0
- package/dist/utils/code-analysis.js.map +1 -0
- package/dist/utils/comment-analyzer.d.ts +38 -0
- package/dist/utils/comment-analyzer.d.ts.map +1 -0
- package/dist/utils/comment-analyzer.js +218 -0
- package/dist/utils/comment-analyzer.js.map +1 -0
- package/dist/utils/context-helpers.d.ts +108 -1
- package/dist/utils/context-helpers.d.ts.map +1 -1
- package/dist/utils/context-helpers.js +351 -2
- package/dist/utils/context-helpers.js.map +1 -1
- package/dist/utils/environment-context.d.ts +76 -0
- package/dist/utils/environment-context.d.ts.map +1 -0
- package/dist/utils/environment-context.js +271 -0
- package/dist/utils/environment-context.js.map +1 -0
- package/dist/utils/intent-detector.d.ts +66 -0
- package/dist/utils/intent-detector.d.ts.map +1 -0
- package/dist/utils/intent-detector.js +282 -0
- package/dist/utils/intent-detector.js.map +1 -0
- package/dist/utils/parsed-file.d.ts +51 -0
- package/dist/utils/parsed-file.d.ts.map +1 -0
- package/dist/utils/parsed-file.js +95 -0
- package/dist/utils/parsed-file.js.map +1 -0
- package/dist/utils/route-hierarchy.d.ts +50 -0
- package/dist/utils/route-hierarchy.d.ts.map +1 -0
- package/dist/utils/route-hierarchy.js +226 -0
- package/dist/utils/route-hierarchy.js.map +1 -0
- package/dist/utils/schema-semantics.d.ts +45 -0
- package/dist/utils/schema-semantics.d.ts.map +1 -0
- package/dist/utils/schema-semantics.js +193 -0
- package/dist/utils/schema-semantics.js.map +1 -0
- package/dist/validate/clients.d.ts +44 -0
- package/dist/validate/clients.d.ts.map +1 -0
- package/dist/validate/clients.js +81 -0
- package/dist/validate/clients.js.map +1 -0
- package/dist/validate/index.d.ts +41 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/dist/validate/index.js +141 -0
- package/dist/validate/index.js.map +1 -0
- package/dist/validate/prompts/index.d.ts +8 -0
- package/dist/validate/prompts/index.d.ts.map +1 -0
- package/dist/validate/prompts/index.js +16 -0
- package/dist/validate/prompts/index.js.map +1 -0
- package/dist/validate/prompts/modules/ai-patterns.d.ts +19 -0
- package/dist/validate/prompts/modules/ai-patterns.d.ts.map +1 -0
- package/dist/validate/prompts/modules/ai-patterns.js +156 -0
- package/dist/validate/prompts/modules/ai-patterns.js.map +1 -0
- package/dist/validate/prompts/modules/auth-access.d.ts +9 -0
- package/dist/validate/prompts/modules/auth-access.d.ts.map +1 -0
- package/dist/validate/prompts/modules/auth-access.js +25 -0
- package/dist/validate/prompts/modules/auth-access.js.map +1 -0
- package/dist/validate/prompts/modules/common.d.ts +11 -0
- package/dist/validate/prompts/modules/common.d.ts.map +1 -0
- package/dist/validate/prompts/modules/common.js +186 -0
- package/dist/validate/prompts/modules/common.js.map +1 -0
- package/dist/validate/prompts/modules/index.d.ts +54 -0
- package/dist/validate/prompts/modules/index.d.ts.map +1 -0
- package/dist/validate/prompts/modules/index.js +186 -0
- package/dist/validate/prompts/modules/index.js.map +1 -0
- package/dist/validate/prompts/modules/owasp-classic.d.ts +8 -0
- package/dist/validate/prompts/modules/owasp-classic.d.ts.map +1 -0
- package/dist/validate/prompts/modules/owasp-classic.js +84 -0
- package/dist/validate/prompts/modules/owasp-classic.js.map +1 -0
- package/dist/validate/prompts/modules/secrets-crypto.d.ts +8 -0
- package/dist/validate/prompts/modules/secrets-crypto.d.ts.map +1 -0
- package/dist/validate/prompts/modules/secrets-crypto.js +68 -0
- package/dist/validate/prompts/modules/secrets-crypto.js.map +1 -0
- package/dist/validate/prompts/modules/xss-prompt.d.ts +8 -0
- package/dist/validate/prompts/modules/xss-prompt.d.ts.map +1 -0
- package/dist/validate/prompts/modules/xss-prompt.js +22 -0
- package/dist/validate/prompts/modules/xss-prompt.js.map +1 -0
- package/dist/validate/prompts/semantic-analysis.d.ts +15 -0
- package/dist/validate/prompts/semantic-analysis.d.ts.map +1 -0
- package/dist/validate/prompts/semantic-analysis.js +169 -0
- package/dist/validate/prompts/semantic-analysis.js.map +1 -0
- package/dist/validate/prompts/validation.d.ts +18 -0
- package/dist/validate/prompts/validation.d.ts.map +1 -0
- package/dist/validate/prompts/validation.js +25 -0
- package/dist/validate/prompts/validation.js.map +1 -0
- package/dist/validate/providers/anthropic.d.ts +17 -0
- package/dist/validate/providers/anthropic.d.ts.map +1 -0
- package/dist/validate/providers/anthropic.js +260 -0
- package/dist/validate/providers/anthropic.js.map +1 -0
- package/dist/validate/providers/index.d.ts +8 -0
- package/dist/validate/providers/index.d.ts.map +1 -0
- package/dist/validate/providers/index.js +13 -0
- package/dist/validate/providers/index.js.map +1 -0
- package/dist/validate/providers/openai.d.ts +14 -0
- package/dist/validate/providers/openai.d.ts.map +1 -0
- package/dist/validate/providers/openai.js +336 -0
- package/dist/validate/providers/openai.js.map +1 -0
- package/dist/validate/request-builder.d.ts +61 -0
- package/dist/validate/request-builder.d.ts.map +1 -0
- package/dist/validate/request-builder.js +346 -0
- package/dist/validate/request-builder.js.map +1 -0
- package/dist/validate/types.d.ts +88 -0
- package/dist/validate/types.d.ts.map +1 -0
- package/dist/validate/types.js +38 -0
- package/dist/validate/types.js.map +1 -0
- package/dist/validate/utils/context-extractor.d.ts +55 -0
- package/dist/validate/utils/context-extractor.d.ts.map +1 -0
- package/dist/validate/utils/context-extractor.js +161 -0
- package/dist/validate/utils/context-extractor.js.map +1 -0
- package/dist/validate/utils/index.d.ts +11 -0
- package/dist/validate/utils/index.d.ts.map +1 -0
- package/dist/validate/utils/index.js +27 -0
- package/dist/validate/utils/index.js.map +1 -0
- package/dist/validate/utils/path-helpers.d.ts +21 -0
- package/dist/validate/utils/path-helpers.d.ts.map +1 -0
- package/dist/validate/utils/path-helpers.js +69 -0
- package/dist/validate/utils/path-helpers.js.map +1 -0
- package/dist/validate/utils/response-parser.d.ts +40 -0
- package/dist/validate/utils/response-parser.d.ts.map +1 -0
- package/dist/validate/utils/response-parser.js +286 -0
- package/dist/validate/utils/response-parser.js.map +1 -0
- package/dist/validate/utils/retry.d.ts +15 -0
- package/dist/validate/utils/retry.d.ts.map +1 -0
- package/dist/validate/utils/retry.js +62 -0
- package/dist/validate/utils/retry.js.map +1 -0
- package/package.json +8 -7
- package/src/__tests__/benchmark/fixtures/layer1/agent-skill-injection.ts +204 -0
- package/src/__tests__/benchmark/fixtures/layer1/index.ts +3 -0
- package/src/__tests__/benchmark/fixtures/layer2/index.ts +27 -0
- package/src/__tests__/benchmark/fixtures/layer2/log-injection.ts +147 -0
- package/src/__tests__/benchmark/fixtures/layer2/phase5-excessive-agency.ts +580 -0
- package/src/__tests__/benchmark/fixtures/layer2/security-headers.ts +197 -0
- package/src/__tests__/benchmark/fixtures/layer2/sprint6-ai-enhancements.ts +515 -0
- package/src/__tests__/benchmark/fixtures/layer2/ssrf-detection.ts +210 -0
- package/src/__tests__/benchmark/fixtures/layer2/xxe-detection.ts +195 -0
- package/src/__tests__/benchmark/run-depth-validation.ts +12 -12
- package/src/__tests__/benchmark/run-real-world-test.ts +4 -4
- package/src/__tests__/benchmark/types.ts +1 -1
- package/src/__tests__/benchmark/utils/test-runner.ts +3 -3
- package/src/__tests__/category-filter.test.ts +478 -0
- package/src/__tests__/context-engine/cross-file-taint.test.ts +284 -0
- package/src/__tests__/context-engine/framework-models.test.ts +457 -0
- package/src/__tests__/context-engine/function-classifier.test.ts +146 -0
- package/src/__tests__/context-engine/import-resolver.test.ts +328 -0
- package/src/__tests__/context-engine/integration.test.ts +320 -0
- package/src/__tests__/context-engine/module-graph.test.ts +159 -0
- package/src/__tests__/context-engine/route-discovery/auth-resolver.test.ts +353 -0
- package/src/__tests__/context-engine/route-discovery/express.test.ts +150 -0
- package/src/__tests__/context-engine/route-discovery/nextjs.test.ts +138 -0
- package/src/__tests__/context-engine/route-discovery/python.test.ts +95 -0
- package/src/__tests__/context-engine/sanitiser-detection.test.ts +187 -0
- package/src/__tests__/context-engine/sink-matcher.test.ts +251 -0
- package/src/__tests__/context-engine/source-discovery.test.ts +186 -0
- package/src/__tests__/context-engine/taint-tracker.test.ts +182 -0
- package/src/__tests__/regression/agent-skill-benign.test.ts +174 -0
- package/src/__tests__/regression/known-false-positives.test.ts +801 -3
- package/src/__tests__/score/adjustments.test.ts +385 -0
- package/src/__tests__/score/confidence.test.ts +283 -0
- package/src/__tests__/score/framework-scoring.test.ts +275 -0
- package/src/__tests__/score/route-scoring.test.ts +156 -0
- package/src/__tests__/score/scoring-integration.test.ts +165 -0
- package/src/__tests__/score/taint-adjustments.test.ts +244 -0
- package/src/__tests__/snapshots/__snapshots__/anthropic-validation-refactor.test.ts.snap +50 -58
- package/src/__tests__/snapshots/__snapshots__/dangerous-functions-refactor.test.ts.snap +52 -0
- package/src/__tests__/snapshots/__snapshots__/scan-depth.test.ts.snap +3 -12
- package/src/__tests__/snapshots/anthropic-validation-refactor.test.ts +3 -3
- package/src/__tests__/snapshots/dangerous-functions-refactor.test.ts +1 -1
- package/src/__tests__/snapshots/scan-depth.test.ts +3 -3
- package/src/__tests__/validate/route-annotations.test.ts +138 -0
- package/src/__tests__/validation/analyze-results.ts +1 -1
- package/src/__tests__/validation/extract-for-triage.ts +1 -1
- package/src/__tests__/validation/fp-deep-analysis.ts +1 -1
- package/src/__tests__/validation/run-validation.ts +7 -7
- package/src/{layer2/ai-agent-tools.ts → detect/ai-code/agent-tools.ts} +729 -4
- package/src/{layer2 → detect/ai-code}/byok-patterns.ts +20 -6
- package/src/{layer2/ai-endpoint-protection.ts → detect/ai-code/endpoint-protection.ts} +10 -4
- package/src/{layer2/ai-execution-sinks.ts → detect/ai-code/execution-sinks.ts} +272 -46
- package/src/{layer2/ai-fingerprinting.ts → detect/ai-code/fingerprinting.ts} +46 -34
- package/src/detect/ai-code/index.ts +11 -0
- package/src/{layer2/ai-mcp-security.ts → detect/ai-code/mcp-security.ts} +212 -5
- package/src/{layer2 → detect/ai-code}/model-supply-chain.ts +85 -6
- package/src/{layer2/ai-package-hallucination.ts → detect/ai-code/package-hallucination.ts} +170 -6
- package/src/{layer2/ai-prompt-hygiene.ts → detect/ai-code/prompt-hygiene.ts} +393 -28
- package/src/{layer2/ai-rag-safety.ts → detect/ai-code/rag-safety.ts} +91 -4
- package/src/{layer2/ai-schema-validation.ts → detect/ai-code/schema-validation.ts} +10 -4
- package/src/detect/config/agent-skill-injection.ts +551 -0
- package/src/{layer1 → detect/config}/comments.ts +8 -2
- package/src/{layer1 → detect/config}/file-flags.ts +23 -6
- package/src/detect/config/index.ts +6 -0
- package/src/{layer3 → detect/config}/osv-check.ts +3 -2
- package/src/{layer3 → detect/config}/package-check.ts +3 -2
- package/src/{layer1 → detect/config}/urls.ts +196 -15
- package/src/detect/index.ts +131 -0
- package/src/{layer1 → detect/secrets}/config-audit.ts +56 -12
- package/src/{layer1 → detect/secrets}/config-mcp-audit.ts +11 -4
- package/src/{layer1 → detect/secrets}/entropy.ts +256 -11
- package/src/{layer1 → detect/secrets}/index.ts +43 -46
- package/src/{layer1 → detect/secrets}/patterns.ts +51 -6
- package/src/{layer1 → detect/secrets}/weak-crypto.ts +174 -17
- package/src/{layer2/auth-antipatterns.ts → detect/structural/auth-patterns.ts} +249 -27
- package/src/{layer2 → detect/structural}/dangerous-functions/dom-xss.ts +94 -22
- package/src/{layer2 → detect/structural}/dangerous-functions/index.ts +672 -65
- package/src/{layer2 → detect/structural}/dangerous-functions/json-parse.ts +10 -2
- package/src/{layer2 → detect/structural}/dangerous-functions/math-random.ts +269 -17
- package/src/{layer2 → detect/structural}/dangerous-functions/patterns.ts +4 -2
- package/src/{layer2 → detect/structural}/dangerous-functions/request-validation.ts +10 -2
- package/src/detect/structural/dangerous-functions/utils/control-flow.ts +35 -0
- package/src/{layer2 → detect/structural}/dangerous-functions/utils/schema-validation.ts +16 -1
- package/src/{layer2 → detect/structural}/data-exposure.ts +23 -40
- package/src/{layer2 → detect/structural}/framework-checks.ts +13 -12
- package/src/{layer2 → detect/structural}/index.ts +144 -122
- package/src/detect/structural/log-injection.ts +254 -0
- package/src/{layer2 → detect/structural}/logic-gates.ts +69 -24
- package/src/{layer2 → detect/structural}/risky-imports.ts +10 -4
- package/src/detect/structural/security-headers.ts +231 -0
- package/src/detect/structural/ssrf-detection.ts +300 -0
- package/src/{layer2 → detect/structural}/variables.ts +10 -4
- package/src/detect/structural/xxe-detection.ts +295 -0
- package/src/index.ts +64 -1038
- package/src/{utils → model}/auth-helper-detector.ts +1 -1
- package/src/model/cross-file-taint.ts +374 -0
- package/src/model/framework-models/django.ts +82 -0
- package/src/model/framework-models/express.ts +54 -0
- package/src/model/framework-models/index.ts +116 -0
- package/src/model/framework-models/nextjs.ts +69 -0
- package/src/model/framework-models/prisma.ts +57 -0
- package/src/model/framework-models/react.ts +63 -0
- package/src/model/framework-models/sequelize.ts +63 -0
- package/src/model/framework-models/types.ts +46 -0
- package/src/model/function-classifier.ts +184 -0
- package/src/model/import-resolver.ts +453 -0
- package/src/{utils → model}/imported-auth-detector.ts +21 -85
- package/src/model/index.ts +353 -0
- package/src/{utils → model}/middleware-detector.ts +156 -17
- package/src/model/module-graph.ts +254 -0
- package/src/{utils → model}/oauth-flow-detector.ts +1 -1
- package/src/{utils/project-context-builder.ts → model/project-context.ts} +1 -1
- package/src/model/route-auth-resolver.ts +216 -0
- package/src/model/route-discovery/express.ts +251 -0
- package/src/model/route-discovery/index.ts +83 -0
- package/src/model/route-discovery/nextjs.ts +216 -0
- package/src/model/route-discovery/python.ts +214 -0
- package/src/model/route-discovery/types.ts +48 -0
- package/src/model/route-discovery/utils.ts +54 -0
- package/src/model/route-hierarchy.ts +250 -0
- package/src/model/sanitiser-detection.ts +268 -0
- package/src/model/sink-matcher.ts +178 -0
- package/src/model/sink-patterns.ts +109 -0
- package/src/model/source-discovery.ts +209 -0
- package/src/model/taint-tracker.ts +333 -0
- package/src/model/taint-types.ts +149 -0
- package/src/{utils → model}/trpc-analyzer.ts +1 -1
- package/src/{utils/context-helpers.ts → parse/file-classifier.ts} +462 -2
- package/src/{utils → parse}/path-exclusions.ts +1 -1
- package/src/pipeline/config.ts +81 -0
- package/src/pipeline/index.ts +437 -0
- package/src/{modes → pipeline/modes}/incremental.ts +6 -6
- package/src/postprocess/aggregation.ts +74 -0
- package/src/postprocess/contradictions.ts +128 -0
- package/src/postprocess/dedup.ts +62 -0
- package/src/postprocess/filtering/__tests__/pipeline.test.ts +134 -0
- package/src/postprocess/filtering/context-adjustments.ts +111 -0
- package/src/postprocess/filtering/index.ts +10 -0
- package/src/postprocess/filtering/pipeline.ts +130 -0
- package/src/postprocess/index.ts +118 -0
- package/src/{suppression → postprocess/suppression}/config-loader.ts +1 -1
- package/src/{suppression → postprocess/suppression}/hash.ts +1 -1
- package/src/{suppression → postprocess/suppression}/inline-parser.ts +1 -1
- package/src/{suppression → postprocess/suppression}/manager.ts +1 -1
- package/src/{suppression → postprocess/suppression}/types.ts +2 -2
- package/src/postprocess/validation-cap.ts +66 -0
- package/src/report/build-result.ts +94 -0
- package/src/report/enrichment.ts +52 -0
- package/src/report/formatters/__tests__/ai-context.test.ts +254 -0
- package/src/report/formatters/ai-context.ts +302 -0
- package/src/{formatters → report/formatters}/cli-terminal.ts +11 -11
- package/src/{formatters → report/formatters}/github-comment.ts +4 -4
- package/src/{formatters → report/formatters}/grouping.ts +8 -8
- package/src/report/formatters/ide/__tests__/ide.test.ts +319 -0
- package/src/report/formatters/ide/claude-code.ts +110 -0
- package/src/report/formatters/ide/cursor.ts +147 -0
- package/src/report/formatters/ide/index.ts +216 -0
- package/src/report/formatters/ide/windsurf.ts +135 -0
- package/src/{formatters → report/formatters}/index.ts +24 -0
- package/src/{formatters → report/formatters}/vscode-diagnostic.ts +1 -1
- package/src/report/summary.ts +70 -0
- package/src/score/adjustments.ts +387 -0
- package/src/{layer3/anthropic → score}/auto-dismiss.ts +26 -14
- package/src/score/confidence.ts +66 -0
- package/src/score/index.ts +316 -0
- package/src/score/types.ts +187 -0
- package/src/shared/__tests__/code-analysis.test.ts +165 -0
- package/src/shared/__tests__/parsed-file.test.ts +124 -0
- package/src/shared/ai-context/__tests__/manager.test.ts +193 -0
- package/src/shared/ai-context/index.ts +15 -0
- package/src/shared/ai-context/manager.ts +145 -0
- package/src/{baseline → shared/baseline}/__tests__/diff.test.ts +2 -2
- package/src/{baseline → shared/baseline}/__tests__/manager.test.ts +2 -2
- package/src/{baseline → shared/baseline}/diff.ts +1 -1
- package/src/{baseline → shared/baseline}/manager.ts +1 -1
- package/src/shared/category-filter.ts +400 -0
- package/src/{layer2/dangerous-functions/utils/control-flow.ts → shared/code-analysis.ts} +56 -39
- package/src/shared/comment-analyzer.ts +249 -0
- package/src/shared/environment-context.ts +304 -0
- package/src/shared/intent-detector.ts +318 -0
- package/src/shared/parsed-file.ts +103 -0
- package/src/{rules → shared/rules}/__tests__/metadata.test.ts +7 -0
- package/src/{rules → shared/rules}/framework-fixes.ts +1 -1
- package/src/{rules → shared/rules}/metadata.ts +94 -0
- package/src/shared/schema-semantics.ts +233 -0
- package/src/{types.ts → shared/types.ts} +142 -11
- package/src/tiers.ts +27 -10
- package/src/validate/__tests__/context-extractor.test.ts +191 -0
- package/src/validate/__tests__/prompt-assembly.test.ts +233 -0
- package/src/validate/__tests__/request-builder.test.ts +347 -0
- package/src/{layer3/anthropic → validate}/index.ts +8 -7
- package/src/{layer3/anthropic → validate}/prompts/index.ts +2 -0
- package/src/validate/prompts/modules/ai-patterns.ts +153 -0
- package/src/validate/prompts/modules/auth-access.ts +22 -0
- package/src/validate/prompts/modules/common.ts +183 -0
- package/src/validate/prompts/modules/index.ts +204 -0
- package/src/validate/prompts/modules/owasp-classic.ts +81 -0
- package/src/validate/prompts/modules/secrets-crypto.ts +65 -0
- package/src/validate/prompts/modules/xss-prompt.ts +19 -0
- package/src/validate/prompts/validation.ts +20 -0
- package/src/{layer3/anthropic → validate}/providers/anthropic.ts +28 -27
- package/src/validate/providers/index.ts +8 -0
- package/src/{layer3/anthropic → validate}/providers/openai.ts +30 -25
- package/src/validate/request-builder.ts +448 -0
- package/src/{layer3/anthropic → validate}/types.ts +1 -1
- package/src/validate/utils/context-extractor.ts +220 -0
- package/src/{layer3/anthropic → validate}/utils/index.ts +10 -0
- package/src/{layer3/anthropic → validate}/utils/response-parser.ts +2 -1
- package/src/layer3/anthropic/prompts/validation.ts +0 -419
- package/src/layer3/anthropic/providers/index.ts +0 -8
- package/src/layer3/anthropic/request-builder.ts +0 -150
- package/src/layer3/index.ts +0 -168
- /package/src/{layer3 → detect/config}/__tests__/osv-check.test.ts +0 -0
- /package/src/{layer2 → detect/structural}/__tests__/math-random-enhanced.test.ts +0 -0
- /package/src/{layer2 → detect/structural}/dangerous-functions/child-process.ts +0 -0
- /package/src/{layer2 → detect/structural}/dangerous-functions/utils/helpers.ts +0 -0
- /package/src/{layer2 → detect/structural}/dangerous-functions/utils/index.ts +0 -0
- /package/src/{suppression → postprocess/suppression}/__tests__/config-loader.test.ts +0 -0
- /package/src/{suppression → postprocess/suppression}/__tests__/hash.test.ts +0 -0
- /package/src/{suppression → postprocess/suppression}/__tests__/inline-parser.test.ts +0 -0
- /package/src/{suppression → postprocess/suppression}/__tests__/manager.test.ts +0 -0
- /package/src/{suppression → postprocess/suppression}/index.ts +0 -0
- /package/src/{baseline → shared/baseline}/index.ts +0 -0
- /package/src/{baseline → shared/baseline}/types.ts +0 -0
- /package/src/{utils → shared}/diff-detector.ts +0 -0
- /package/src/{utils → shared}/diff-parser.ts +0 -0
- /package/src/{utils → shared}/registry-clients.ts +0 -0
- /package/src/{rules → shared/rules}/__tests__/framework-fixes.test.ts +0 -0
- /package/src/{rules → shared/rules}/index.ts +0 -0
- /package/src/{layer3/anthropic → validate}/clients.ts +0 -0
- /package/src/{layer3/anthropic → validate}/prompts/semantic-analysis.ts +0 -0
- /package/src/{layer3/anthropic → validate}/utils/path-helpers.ts +0 -0
- /package/src/{layer3/anthropic → validate}/utils/retry.ts +0 -0
|
@@ -0,0 +1,933 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared Context Helpers
|
|
4
|
+
* Centralized utility functions for detecting file and code context
|
|
5
|
+
* Used across Layer 1 and Layer 2 scanners to reduce false positives
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.isToolingDirectory = isToolingDirectory;
|
|
9
|
+
exports.isServerOnlyFile = isServerOnlyFile;
|
|
10
|
+
exports.isTestOrMockFile = isTestOrMockFile;
|
|
11
|
+
exports.isExampleFile = isExampleFile;
|
|
12
|
+
exports.isExampleDirectory = isExampleDirectory;
|
|
13
|
+
exports.isLibraryCode = isLibraryCode;
|
|
14
|
+
exports.isFixtureFile = isFixtureFile;
|
|
15
|
+
exports.isDocumentationFile = isDocumentationFile;
|
|
16
|
+
exports.isLocaleFile = isLocaleFile;
|
|
17
|
+
exports.isScannerOrFixtureFile = isScannerOrFixtureFile;
|
|
18
|
+
exports.isClientBundledFile = isClientBundledFile;
|
|
19
|
+
exports.isSeedOrDataGenFile = isSeedOrDataGenFile;
|
|
20
|
+
exports.isEducationalVulnerabilityFile = isEducationalVulnerabilityFile;
|
|
21
|
+
exports.isTestConfigFile = isTestConfigFile;
|
|
22
|
+
exports.isPythonFile = isPythonFile;
|
|
23
|
+
exports.isInsidePythonDocstring = isInsidePythonDocstring;
|
|
24
|
+
exports.isDesktopAppContext = isDesktopAppContext;
|
|
25
|
+
exports.isMcpServerContext = isMcpServerContext;
|
|
26
|
+
exports.isFileLoaderContext = isFileLoaderContext;
|
|
27
|
+
exports.isAgentSkillFile = isAgentSkillFile;
|
|
28
|
+
exports.isEnvVarReference = isEnvVarReference;
|
|
29
|
+
exports.isNextPublicEnvVar = isNextPublicEnvVar;
|
|
30
|
+
exports.isComment = isComment;
|
|
31
|
+
exports.isInsideMultiLineComment = isInsideMultiLineComment;
|
|
32
|
+
exports.isCommentedOutCode = isCommentedOutCode;
|
|
33
|
+
exports.hasLinterIgnoreComment = hasLinterIgnoreComment;
|
|
34
|
+
exports.isPlaceholderValue = isPlaceholderValue;
|
|
35
|
+
exports.isPublicEndpoint = isPublicEndpoint;
|
|
36
|
+
exports.hasWebhookSignatureVerification = hasWebhookSignatureVerification;
|
|
37
|
+
exports.hasAuthCheckNearby = hasAuthCheckNearby;
|
|
38
|
+
exports.isBYOKContext = isBYOKContext;
|
|
39
|
+
exports.isKeyProperlyHandled = isKeyProperlyHandled;
|
|
40
|
+
exports.getServiceRoleKeyContext = getServiceRoleKeyContext;
|
|
41
|
+
exports.isConfigFile = isConfigFile;
|
|
42
|
+
exports.buildFileContext = buildFileContext;
|
|
43
|
+
// ============================================================================
|
|
44
|
+
// File Path Context Detection
|
|
45
|
+
// ============================================================================
|
|
46
|
+
/**
|
|
47
|
+
* Check if file is in a tooling/scripts directory
|
|
48
|
+
* Files in these directories are typically build tools, CLI utilities, or dev scripts
|
|
49
|
+
* and should have reduced severity for findings like file path patterns
|
|
50
|
+
*/
|
|
51
|
+
function isToolingDirectory(filePath) {
|
|
52
|
+
return /\/(scripts?|cli|tools?|bin|devtools|build|tasks)\//i.test(filePath);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if file is server-only (not bundled to client)
|
|
56
|
+
* Server-only files can safely use service role keys and other admin secrets
|
|
57
|
+
*/
|
|
58
|
+
function isServerOnlyFile(filePath) {
|
|
59
|
+
const serverPatterns = [
|
|
60
|
+
/lib\/supabase\/(server|admin|middleware)\.(ts|js)$/i,
|
|
61
|
+
/\/api\//i, // Next.js API routes
|
|
62
|
+
/\/server\//i, // Server directories
|
|
63
|
+
/\.server\.(ts|js|tsx|jsx)$/i, // .server.ts files
|
|
64
|
+
/\/actions\//i, // Server actions
|
|
65
|
+
/middleware\.(ts|js)$/i, // Middleware files
|
|
66
|
+
/\/cron\//i, // Cron jobs
|
|
67
|
+
/\/workers?\//i, // Worker files
|
|
68
|
+
/\/scripts?\//i, // Scripts
|
|
69
|
+
/\/seed\//i, // Database seeds
|
|
70
|
+
/\/migrations?\//i, // Database migrations
|
|
71
|
+
/\/lib\/[^/]+\/server/i, // lib/*/server patterns
|
|
72
|
+
/\/utils\/server/i, // utils/server
|
|
73
|
+
/\/helpers\/server/i, // helpers/server
|
|
74
|
+
/\.action\.(ts|js)$/i, // .action.ts files
|
|
75
|
+
/route\.(ts|js)$/i, // Next.js route handlers
|
|
76
|
+
];
|
|
77
|
+
return serverPatterns.some(pattern => pattern.test(filePath));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Check if file is a test, mock, or fixture file
|
|
81
|
+
* These files often contain fake secrets and should have lower severity
|
|
82
|
+
*/
|
|
83
|
+
function isTestOrMockFile(filePath) {
|
|
84
|
+
const testPatterns = [
|
|
85
|
+
/\.(test|spec)\.(ts|tsx|js|jsx)$/i,
|
|
86
|
+
/\/__tests__\//i,
|
|
87
|
+
/\/test\//i,
|
|
88
|
+
/\/tests\//i,
|
|
89
|
+
/\/testing\//i, // testing directories (e.g., docker/testing/)
|
|
90
|
+
/\/mock/i,
|
|
91
|
+
/\/mocks\//i,
|
|
92
|
+
/\/fixtures?\//i,
|
|
93
|
+
/\.mock\.(ts|tsx|js|jsx)$/i,
|
|
94
|
+
/\.stub\.(ts|tsx|js|jsx)$/i,
|
|
95
|
+
/\.(stories|story)\.(ts|tsx|js|jsx)$/i, // Storybook
|
|
96
|
+
/\/e2e\//i, // E2E tests
|
|
97
|
+
/\/cypress\//i, // Cypress tests
|
|
98
|
+
/\/playwright\//i, // Playwright tests
|
|
99
|
+
/\/vitest\//i, // Vitest
|
|
100
|
+
/\/jest\//i, // Jest
|
|
101
|
+
];
|
|
102
|
+
return testPatterns.some(pattern => pattern.test(filePath));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Check if file is an example/sample/template file
|
|
106
|
+
* These files should be skipped or have significantly reduced severity
|
|
107
|
+
*/
|
|
108
|
+
function isExampleFile(filePath) {
|
|
109
|
+
return (filePath.includes('.example') ||
|
|
110
|
+
filePath.includes('.sample') ||
|
|
111
|
+
filePath.includes('.template') ||
|
|
112
|
+
filePath.includes('README') ||
|
|
113
|
+
filePath.includes('/examples/') ||
|
|
114
|
+
filePath.includes('/example/') ||
|
|
115
|
+
filePath.includes('/demo/') ||
|
|
116
|
+
filePath.includes('/demos/'));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Check if file is in an examples/demo directory
|
|
120
|
+
* Stronger check than isExampleFile - specifically for directories
|
|
121
|
+
* These are typically tutorial/demo code, not production patterns
|
|
122
|
+
*/
|
|
123
|
+
function isExampleDirectory(filePath) {
|
|
124
|
+
const examplePatterns = [
|
|
125
|
+
/\/examples?\//i,
|
|
126
|
+
/\/demos?\//i,
|
|
127
|
+
/\/templates?\//i,
|
|
128
|
+
/\/samples?\//i,
|
|
129
|
+
/\/tutorials?\//i,
|
|
130
|
+
/\/cookbook\//i,
|
|
131
|
+
/\/quickstart\//i,
|
|
132
|
+
/\/getting-started\//i,
|
|
133
|
+
];
|
|
134
|
+
return examplePatterns.some(pattern => pattern.test(filePath));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Check if file is library/framework code (base classes, utilities)
|
|
138
|
+
* Library code is intentionally generic - consumers add security
|
|
139
|
+
* This applies to: langchain, vercel/ai, llamaindex, etc.
|
|
140
|
+
*/
|
|
141
|
+
function isLibraryCode(filePath) {
|
|
142
|
+
const libraryPatterns = [
|
|
143
|
+
// Package source directories in monorepos
|
|
144
|
+
/\/libs\/[^/]+\/src\//i,
|
|
145
|
+
/\/packages\/[^/]+\/src\//i,
|
|
146
|
+
// Common library patterns
|
|
147
|
+
/\/langchain-/i,
|
|
148
|
+
/\/llamaindex/i,
|
|
149
|
+
// Source files that aren't examples or tests
|
|
150
|
+
/\/src\/(?!.*(?:examples?|demos?|tests?)\/).*\.(ts|js)$/i,
|
|
151
|
+
];
|
|
152
|
+
// Must match library pattern AND not be example/test
|
|
153
|
+
return (libraryPatterns.some(pattern => pattern.test(filePath)) &&
|
|
154
|
+
!isExampleDirectory(filePath) &&
|
|
155
|
+
!isTestOrMockFile(filePath));
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Check if file is a fixture file (test data, mock responses)
|
|
159
|
+
* Fixtures contain fake data and should have reduced severity
|
|
160
|
+
*/
|
|
161
|
+
function isFixtureFile(filePath) {
|
|
162
|
+
const fixturePatterns = [
|
|
163
|
+
/__fixtures__\//i,
|
|
164
|
+
/\.fixture\./i,
|
|
165
|
+
/fixtures?\//i,
|
|
166
|
+
/testdata\//i,
|
|
167
|
+
/test-data\//i,
|
|
168
|
+
/test_data\//i,
|
|
169
|
+
/mock-data\//i,
|
|
170
|
+
/mockdata\//i,
|
|
171
|
+
/\.mock\./i,
|
|
172
|
+
/\.stub\./i,
|
|
173
|
+
];
|
|
174
|
+
return fixturePatterns.some(pattern => pattern.test(filePath));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Check if file is documentation (README, CHANGELOG, etc.)
|
|
178
|
+
* These files should typically be skipped for security scanning
|
|
179
|
+
*/
|
|
180
|
+
function isDocumentationFile(filePath) {
|
|
181
|
+
const docPatterns = [
|
|
182
|
+
/README/i,
|
|
183
|
+
/CHANGELOG/i,
|
|
184
|
+
/CONTRIBUTING/i,
|
|
185
|
+
/LICENSE/i,
|
|
186
|
+
/\.md$/i,
|
|
187
|
+
/\.mdx$/i,
|
|
188
|
+
/\/docs\//i,
|
|
189
|
+
/\/documentation\//i,
|
|
190
|
+
];
|
|
191
|
+
return docPatterns.some(pattern => pattern.test(filePath));
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Check if file is a locale/i18n/translation file
|
|
195
|
+
* These files contain natural language translations, not code, and should be skipped entirely
|
|
196
|
+
* They often contain placeholder URLs (http://localhost) and other patterns that trigger false positives
|
|
197
|
+
*/
|
|
198
|
+
function isLocaleFile(filePath) {
|
|
199
|
+
const lowerPath = filePath.toLowerCase();
|
|
200
|
+
// Directory-based detection
|
|
201
|
+
if (lowerPath.includes('/locales/') ||
|
|
202
|
+
lowerPath.includes('/locale/') ||
|
|
203
|
+
lowerPath.includes('/i18n/') ||
|
|
204
|
+
lowerPath.includes('/translations/') ||
|
|
205
|
+
lowerPath.includes('/translation/') ||
|
|
206
|
+
lowerPath.includes('/lang/') ||
|
|
207
|
+
lowerPath.includes('/languages/') ||
|
|
208
|
+
lowerPath.includes('/messages/') ||
|
|
209
|
+
lowerPath.includes('/intl/')) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
// File naming patterns (language codes)
|
|
213
|
+
// e.g., en.json, zh-CN.json, pt-BR.json, messages.en.json
|
|
214
|
+
const localeFilePatterns = [
|
|
215
|
+
// Direct language code files: en.json, zh-CN.json, pt-BR.json
|
|
216
|
+
/\/(en|fr|de|es|it|pt|ja|ko|zh|ru|ar|nl|pl|tr|vi|th|id|ms|hi|bn|uk|el|he|fa|sv|no|da|fi|cs|sk|hu|ro|bg|sr|hr|sl|ca|eu|gl|et|lv|lt|mk|sq|is|mt|ga|cy|af|sw|zu|xh|am|ne|si|km|lo|my|ka|hy|az|uz|kk|ky|tg|tk|mn|bo|dz)(-[a-z]{2,4})?\.json$/i,
|
|
217
|
+
// Prefixed language files: messages.en.json, strings.zh-CN.json
|
|
218
|
+
/\/(messages|strings|labels|text|content|copy)\.[a-z]{2}(-[a-z]{2,4})?\.json$/i,
|
|
219
|
+
// Common locale file names
|
|
220
|
+
/\/translation\.json$/i,
|
|
221
|
+
/\/translations\.json$/i,
|
|
222
|
+
/\/messages\.json$/i,
|
|
223
|
+
/\/strings\.json$/i,
|
|
224
|
+
];
|
|
225
|
+
return localeFilePatterns.some(pattern => pattern.test(lowerPath));
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Check if file is scanner code, fixture, or rule definition
|
|
229
|
+
* Avoid flagging the scanner's own code/test cases
|
|
230
|
+
*
|
|
231
|
+
* Note: Uses (?:^|\/) to match both:
|
|
232
|
+
* - paths with leading segments: packages/scanner/src/...
|
|
233
|
+
* - paths starting with the pattern: scanner/src/...
|
|
234
|
+
*/
|
|
235
|
+
function isScannerOrFixtureFile(filePath) {
|
|
236
|
+
const scannerPatterns = [
|
|
237
|
+
/(?:^|\/)scanner\//i,
|
|
238
|
+
/(?:^|\/)detector\//i,
|
|
239
|
+
/(?:^|\/)security\//i,
|
|
240
|
+
/(?:^|\/)rules?\//i,
|
|
241
|
+
/(?:^|\/)patterns?\//i,
|
|
242
|
+
/(?:^|\/)fixtures?\//i,
|
|
243
|
+
/(?:^|\/)testdata\//i,
|
|
244
|
+
/(?:^|\/)test-data\//i,
|
|
245
|
+
/(?:^|\/)test_data\//i,
|
|
246
|
+
];
|
|
247
|
+
return scannerPatterns.some(pattern => pattern.test(filePath));
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Check if file is likely client-bundled (exposed to browser)
|
|
251
|
+
*/
|
|
252
|
+
function isClientBundledFile(filePath) {
|
|
253
|
+
// Files in these locations are typically client-bundled
|
|
254
|
+
const clientPatterns = [
|
|
255
|
+
/\/components\//i,
|
|
256
|
+
/\/pages\//i, // Next.js pages (can be SSR, but code visible)
|
|
257
|
+
/\/app\/.*page\.(ts|tsx|js|jsx)$/i, // Next.js app router pages
|
|
258
|
+
/\/hooks\//i,
|
|
259
|
+
/\/contexts?\//i,
|
|
260
|
+
/\/providers?\//i,
|
|
261
|
+
/\/stores?\//i, // State management
|
|
262
|
+
/\.client\.(ts|js|tsx|jsx)$/i, // .client.ts files
|
|
263
|
+
];
|
|
264
|
+
// But not if they're also server files
|
|
265
|
+
if (isServerOnlyFile(filePath)) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
return clientPatterns.some(pattern => pattern.test(filePath));
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Check if file is a seed or data generation file
|
|
272
|
+
* These files generate test/demo data and Math.random() usage is acceptable
|
|
273
|
+
* Used to reduce false positives for Math.random() detection
|
|
274
|
+
*/
|
|
275
|
+
function isSeedOrDataGenFile(filePath) {
|
|
276
|
+
const patterns = [
|
|
277
|
+
/\/seed\//i,
|
|
278
|
+
/\/seeds\//i,
|
|
279
|
+
/seed-database\.(ts|js)$/i,
|
|
280
|
+
/\/seeder\./i,
|
|
281
|
+
/datacreator\.(ts|js)$/i,
|
|
282
|
+
/\/data\/.*creator/i,
|
|
283
|
+
/\/fixtures\//i,
|
|
284
|
+
/\.fixture\./i,
|
|
285
|
+
/\/generators?\//i,
|
|
286
|
+
/\/factories\//i,
|
|
287
|
+
/factory\.(ts|js)$/i,
|
|
288
|
+
];
|
|
289
|
+
return patterns.some(p => p.test(filePath));
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Check if file is educational/intentional vulnerability code
|
|
293
|
+
* These files (e.g., OWASP Juice Shop) contain intentional vulnerabilities for training
|
|
294
|
+
* Should be skipped entirely to avoid false positives
|
|
295
|
+
*/
|
|
296
|
+
function isEducationalVulnerabilityFile(filePath) {
|
|
297
|
+
const patterns = [
|
|
298
|
+
/\/insecurity\.(ts|js)$/i,
|
|
299
|
+
/\/vulnerable\.(ts|js)$/i,
|
|
300
|
+
/\/intentionally-vulnerable/i,
|
|
301
|
+
/\/security-examples?\//i,
|
|
302
|
+
/\/vuln-examples?\//i,
|
|
303
|
+
/\/challenge-\d+/i, // OWASP Juice Shop challenges
|
|
304
|
+
/\/exploit-examples?\//i,
|
|
305
|
+
];
|
|
306
|
+
return patterns.some(p => p.test(filePath));
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Check if file is a test configuration file
|
|
310
|
+
* These files (jest.config, vitest.config, etc.) are always dev/test contexts
|
|
311
|
+
* Localhost URLs and similar patterns should not be flagged in these files
|
|
312
|
+
*/
|
|
313
|
+
function isTestConfigFile(filePath) {
|
|
314
|
+
const testConfigPatterns = [
|
|
315
|
+
/jest\.config\.[jt]s$/i,
|
|
316
|
+
/jest\.config\.mjs$/i,
|
|
317
|
+
/vitest\.config\.[jt]s$/i,
|
|
318
|
+
/vitest\.config\.mts$/i,
|
|
319
|
+
/cypress\.config\.[jt]s$/i,
|
|
320
|
+
/cypress\.config\.mjs$/i,
|
|
321
|
+
/playwright\.config\.[jt]s$/i,
|
|
322
|
+
/playwright\.config\.mts$/i,
|
|
323
|
+
/karma\.conf\.[jt]s$/i,
|
|
324
|
+
/\.mocharc\.[jt]s$/i,
|
|
325
|
+
/\.mocharc\.json$/i,
|
|
326
|
+
/setupTests\.[jt]s$/i,
|
|
327
|
+
/setupTests\.tsx?$/i,
|
|
328
|
+
/test\.setup\.[jt]s$/i,
|
|
329
|
+
/jest\.setup\.[jt]s$/i,
|
|
330
|
+
/vitest\.setup\.[jt]s$/i,
|
|
331
|
+
/testEnvironment\.[jt]s$/i,
|
|
332
|
+
/globalSetup\.[jt]s$/i,
|
|
333
|
+
/globalTeardown\.[jt]s$/i,
|
|
334
|
+
/ava\.config\.[jt]s$/i,
|
|
335
|
+
/nyc\.config\.js$/i, // Code coverage config
|
|
336
|
+
];
|
|
337
|
+
return testConfigPatterns.some(pattern => pattern.test(filePath));
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Check if file is a Python file
|
|
341
|
+
*/
|
|
342
|
+
function isPythonFile(filePath) {
|
|
343
|
+
return /\.py$/i.test(filePath);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Check if a line is inside a Python docstring
|
|
347
|
+
* Python docstrings are delimited by triple quotes (''' or """)
|
|
348
|
+
* Content inside docstrings (like example URLs, connection strings) should be ignored
|
|
349
|
+
*
|
|
350
|
+
* @param lines - Array of all lines in the file
|
|
351
|
+
* @param lineIndex - The 0-indexed line number to check
|
|
352
|
+
* @returns true if the line is inside a docstring
|
|
353
|
+
*/
|
|
354
|
+
function isInsidePythonDocstring(lines, lineIndex) {
|
|
355
|
+
let inDocstring = false;
|
|
356
|
+
let docstringChar = null;
|
|
357
|
+
for (let i = 0; i <= lineIndex; i++) {
|
|
358
|
+
const line = lines[i];
|
|
359
|
+
// Count triple quote occurrences in this line
|
|
360
|
+
// We need to track both """ and '''
|
|
361
|
+
const tripleDoubleCount = (line.match(/"""/g) || []).length;
|
|
362
|
+
const tripleSingleCount = (line.match(/'''/g) || []).length;
|
|
363
|
+
// Process triple double quotes
|
|
364
|
+
for (let j = 0; j < tripleDoubleCount; j++) {
|
|
365
|
+
if (!inDocstring) {
|
|
366
|
+
inDocstring = true;
|
|
367
|
+
docstringChar = '"""';
|
|
368
|
+
}
|
|
369
|
+
else if (docstringChar === '"""') {
|
|
370
|
+
inDocstring = false;
|
|
371
|
+
docstringChar = null;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// Process triple single quotes
|
|
375
|
+
for (let j = 0; j < tripleSingleCount; j++) {
|
|
376
|
+
if (!inDocstring) {
|
|
377
|
+
inDocstring = true;
|
|
378
|
+
docstringChar = "'''";
|
|
379
|
+
}
|
|
380
|
+
else if (docstringChar === "'''") {
|
|
381
|
+
inDocstring = false;
|
|
382
|
+
docstringChar = null;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return inDocstring;
|
|
387
|
+
}
|
|
388
|
+
// ============================================================================
|
|
389
|
+
// Desktop/Electron App Context Detection
|
|
390
|
+
// ============================================================================
|
|
391
|
+
/**
|
|
392
|
+
* Check if file is in a desktop app context (Electron, Tauri, etc.)
|
|
393
|
+
* Desktop apps legitimately access filesystem and spawn processes,
|
|
394
|
+
* so findings in these contexts should have reduced severity.
|
|
395
|
+
*
|
|
396
|
+
* Used by:
|
|
397
|
+
* - Dynamic file path detection (downgrade to INFO)
|
|
398
|
+
* - child_process detection (downgrade to MEDIUM)
|
|
399
|
+
*/
|
|
400
|
+
function isDesktopAppContext(filePath) {
|
|
401
|
+
const desktopPatterns = [
|
|
402
|
+
// Directory patterns
|
|
403
|
+
/\/apps\/desktop\//i,
|
|
404
|
+
/\/electron\//i,
|
|
405
|
+
/\/tauri\//i,
|
|
406
|
+
/\/src-electron\//i,
|
|
407
|
+
/\/src-tauri\//i,
|
|
408
|
+
/\/desktop-app\//i,
|
|
409
|
+
/\/desktop\//i,
|
|
410
|
+
// File patterns (Electron conventions)
|
|
411
|
+
/\/main\.(ts|js)$/i, // Main process
|
|
412
|
+
/\/preload\.(ts|js)$/i, // Preload scripts
|
|
413
|
+
/\/ipc[A-Z]\w*\.(ts|js)$/i, // IPC handlers
|
|
414
|
+
/Ctr\.(ts|js)$/i, // Controller pattern
|
|
415
|
+
// Package patterns
|
|
416
|
+
/packages\/.*electron/i,
|
|
417
|
+
/packages\/.*desktop/i,
|
|
418
|
+
];
|
|
419
|
+
return desktopPatterns.some(p => p.test(filePath));
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Check if file is an MCP (Model Context Protocol) server
|
|
423
|
+
* MCP servers legitimately spawn processes to provide tool capabilities
|
|
424
|
+
*/
|
|
425
|
+
function isMcpServerContext(filePath) {
|
|
426
|
+
const mcpPatterns = [
|
|
427
|
+
/mcp/i,
|
|
428
|
+
/model-context-protocol/i,
|
|
429
|
+
/\/servers?\//i, // Common MCP server directory structure
|
|
430
|
+
];
|
|
431
|
+
return mcpPatterns.some(p => p.test(filePath));
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Check if file is a file loader/processor
|
|
435
|
+
* File loaders legitimately access filesystem to process files
|
|
436
|
+
*/
|
|
437
|
+
function isFileLoaderContext(filePath) {
|
|
438
|
+
const loaderPatterns = [
|
|
439
|
+
/file-loaders?\//i,
|
|
440
|
+
/loaders?\/(pdf|docx|excel|text|csv|xml|json)/i,
|
|
441
|
+
/document-loaders?\//i,
|
|
442
|
+
/parsers?\//i,
|
|
443
|
+
];
|
|
444
|
+
return loaderPatterns.some(p => p.test(filePath));
|
|
445
|
+
}
|
|
446
|
+
// ============================================================================
|
|
447
|
+
// Agent Skill File Detection
|
|
448
|
+
// ============================================================================
|
|
449
|
+
/**
|
|
450
|
+
* Check if file is an AI agent skill/configuration file
|
|
451
|
+
* These files define agent behavior and are targets for prompt injection,
|
|
452
|
+
* data exfiltration, and hidden execution attacks.
|
|
453
|
+
*
|
|
454
|
+
* Note: Root CLAUDE.md is NOT matched. Only .claude/commands/, .claude/skills/,
|
|
455
|
+
* .claude/tools/ subdirectories are flagged.
|
|
456
|
+
*/
|
|
457
|
+
function isAgentSkillFile(filePath) {
|
|
458
|
+
const skillPatterns = [
|
|
459
|
+
// Skill definition files
|
|
460
|
+
/\/SKILL\.md$/i,
|
|
461
|
+
/\/AGENTS\.md$/i,
|
|
462
|
+
/\/skills\.json$/i,
|
|
463
|
+
/\/skills\.ya?ml$/i,
|
|
464
|
+
/\/agent\.ya?ml$/i,
|
|
465
|
+
/\/agent\.config\./i,
|
|
466
|
+
/\/agent-skills\//i,
|
|
467
|
+
/\/tools\.json$/i,
|
|
468
|
+
// Cursor
|
|
469
|
+
/\/\.cursor\/rules\//i,
|
|
470
|
+
/\/\.cursorrules$/i,
|
|
471
|
+
// Claude (skill-specific paths, NOT root CLAUDE.md)
|
|
472
|
+
/\/\.claude\/commands\//i,
|
|
473
|
+
/\/\.claude\/skills\//i,
|
|
474
|
+
/\/\.claude\/tools\//i,
|
|
475
|
+
// GitHub Copilot
|
|
476
|
+
/\/\.github\/copilot-instructions\.md$/i,
|
|
477
|
+
/\/\.github\/agents\//i,
|
|
478
|
+
// Moltbot/OpenClaw
|
|
479
|
+
/\/\.moltbot\//i,
|
|
480
|
+
/\/moltbot\.config\./i,
|
|
481
|
+
/\/\.openclaw\//i,
|
|
482
|
+
// Aider
|
|
483
|
+
/\/\.aider/i,
|
|
484
|
+
// MCP configs (complements existing config-mcp-audit.ts)
|
|
485
|
+
/\/mcp\.json$/i,
|
|
486
|
+
/\/mcp-config\.json$/i,
|
|
487
|
+
/\/\.mcp\//i,
|
|
488
|
+
/\/claude[-_]desktop[-_]config\.json$/i,
|
|
489
|
+
];
|
|
490
|
+
return skillPatterns.some(p => p.test(filePath));
|
|
491
|
+
}
|
|
492
|
+
// ============================================================================
|
|
493
|
+
// Code Line Context Detection
|
|
494
|
+
// ============================================================================
|
|
495
|
+
/**
|
|
496
|
+
* Check if line uses environment variable reference (not hardcoded)
|
|
497
|
+
*/
|
|
498
|
+
function isEnvVarReference(line) {
|
|
499
|
+
return (/process\.env\.[A-Z_]+/.test(line) ||
|
|
500
|
+
/\$\{?[A-Z_]+\}?/.test(line) ||
|
|
501
|
+
/import\.meta\.env\.[A-Z_]+/.test(line) ||
|
|
502
|
+
/Deno\.env\.get\(/.test(line) ||
|
|
503
|
+
/os\.environ\[/.test(line) || // Python
|
|
504
|
+
/os\.getenv\(/.test(line) || // Python
|
|
505
|
+
/ENV\[['"]/.test(line) || // Ruby
|
|
506
|
+
/env\(["']/.test(line) // Laravel PHP
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Check if line uses NEXT_PUBLIC_ prefix (client-exposed)
|
|
511
|
+
*/
|
|
512
|
+
function isNextPublicEnvVar(line) {
|
|
513
|
+
return /NEXT_PUBLIC_[A-Z_]+/.test(line);
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Check if line is a comment (single-line check)
|
|
517
|
+
*/
|
|
518
|
+
function isComment(lineContent) {
|
|
519
|
+
const trimmed = lineContent.trim();
|
|
520
|
+
return (trimmed.startsWith('//') ||
|
|
521
|
+
trimmed.startsWith('#') ||
|
|
522
|
+
trimmed.startsWith('*') ||
|
|
523
|
+
trimmed.startsWith('/*') ||
|
|
524
|
+
trimmed.startsWith('"""') ||
|
|
525
|
+
trimmed.startsWith("'''") ||
|
|
526
|
+
trimmed.startsWith('<!--'));
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Check if a line is inside a multi-line comment block
|
|
530
|
+
* Used to properly skip code that's been commented out
|
|
531
|
+
*
|
|
532
|
+
* @param lines - Array of all lines in the file
|
|
533
|
+
* @param lineIndex - The 0-indexed line number to check
|
|
534
|
+
* @returns true if the line is inside a multi-line comment
|
|
535
|
+
*/
|
|
536
|
+
function isInsideMultiLineComment(lines, lineIndex) {
|
|
537
|
+
let inComment = false;
|
|
538
|
+
for (let i = 0; i <= lineIndex; i++) {
|
|
539
|
+
const line = lines[i];
|
|
540
|
+
// Check for comment start/end in this line
|
|
541
|
+
// Handle multiple occurrences in same line
|
|
542
|
+
let searchStart = 0;
|
|
543
|
+
while (searchStart < line.length) {
|
|
544
|
+
const openIdx = line.indexOf('/*', searchStart);
|
|
545
|
+
const closeIdx = line.indexOf('*/', searchStart);
|
|
546
|
+
if (!inComment) {
|
|
547
|
+
// Not in comment - look for opening
|
|
548
|
+
if (openIdx !== -1 && (closeIdx === -1 || openIdx < closeIdx)) {
|
|
549
|
+
inComment = true;
|
|
550
|
+
searchStart = openIdx + 2;
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
else {
|
|
555
|
+
// In comment - look for closing
|
|
556
|
+
if (closeIdx !== -1 && (openIdx === -1 || closeIdx < openIdx)) {
|
|
557
|
+
inComment = false;
|
|
558
|
+
searchStart = closeIdx + 2;
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return inComment;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Check if a line is commented out code (either single-line or multi-line comment)
|
|
569
|
+
* Combines single-line and multi-line comment detection
|
|
570
|
+
*
|
|
571
|
+
* @param lines - Array of all lines in the file
|
|
572
|
+
* @param lineIndex - The 0-indexed line number to check
|
|
573
|
+
* @returns true if the line is commented out
|
|
574
|
+
*/
|
|
575
|
+
function isCommentedOutCode(lines, lineIndex) {
|
|
576
|
+
const line = lines[lineIndex];
|
|
577
|
+
if (!line)
|
|
578
|
+
return false;
|
|
579
|
+
// Check single-line comment
|
|
580
|
+
if (isComment(line)) {
|
|
581
|
+
return true;
|
|
582
|
+
}
|
|
583
|
+
// Check if inside multi-line comment block
|
|
584
|
+
if (isInsideMultiLineComment(lines, lineIndex)) {
|
|
585
|
+
return true;
|
|
586
|
+
}
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Check if a line has a linter/security ignore comment
|
|
591
|
+
* These comments indicate the developer has acknowledged and accepted the risk
|
|
592
|
+
*
|
|
593
|
+
* @param lines - Array of all lines in the file
|
|
594
|
+
* @param lineIndex - The 0-indexed line number to check
|
|
595
|
+
* @returns object with hasIgnore flag and the ignore type if found
|
|
596
|
+
*/
|
|
597
|
+
function hasLinterIgnoreComment(lines, lineIndex) {
|
|
598
|
+
// Check current line and previous line for ignore comments
|
|
599
|
+
const linesToCheck = [
|
|
600
|
+
lines[lineIndex],
|
|
601
|
+
lineIndex > 0 ? lines[lineIndex - 1] : '',
|
|
602
|
+
];
|
|
603
|
+
const ignorePatterns = [
|
|
604
|
+
// ESLint
|
|
605
|
+
{ pattern: /eslint-disable-next-line/i, type: 'eslint' },
|
|
606
|
+
{ pattern: /eslint-disable-line/i, type: 'eslint' },
|
|
607
|
+
{ pattern: /eslint-disable\s/i, type: 'eslint' },
|
|
608
|
+
// Biome
|
|
609
|
+
{ pattern: /biome-ignore/i, type: 'biome' },
|
|
610
|
+
// TypeScript
|
|
611
|
+
{ pattern: /@ts-ignore/i, type: 'typescript' },
|
|
612
|
+
{ pattern: /@ts-expect-error/i, type: 'typescript' },
|
|
613
|
+
{ pattern: /@ts-nocheck/i, type: 'typescript' },
|
|
614
|
+
// Security scanners
|
|
615
|
+
{ pattern: /nosec/i, type: 'security' },
|
|
616
|
+
{ pattern: /nolint/i, type: 'security' },
|
|
617
|
+
{ pattern: /# noqa/i, type: 'security' }, // Python
|
|
618
|
+
{ pattern: /# type:\s*ignore/i, type: 'mypy' },
|
|
619
|
+
{ pattern: /NOSONAR/i, type: 'sonar' },
|
|
620
|
+
{ pattern: /SuppressWarnings/i, type: 'java' },
|
|
621
|
+
{ pattern: /pragma:\s*no cover/i, type: 'coverage' },
|
|
622
|
+
// Prettier
|
|
623
|
+
{ pattern: /prettier-ignore/i, type: 'prettier' },
|
|
624
|
+
// Stylelint
|
|
625
|
+
{ pattern: /stylelint-disable/i, type: 'stylelint' },
|
|
626
|
+
];
|
|
627
|
+
for (const line of linesToCheck) {
|
|
628
|
+
if (!line)
|
|
629
|
+
continue;
|
|
630
|
+
for (const { pattern, type } of ignorePatterns) {
|
|
631
|
+
if (pattern.test(line)) {
|
|
632
|
+
return { hasIgnore: true, ignoreType: type };
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
return { hasIgnore: false };
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Check if value/line appears to be a placeholder
|
|
640
|
+
*/
|
|
641
|
+
function isPlaceholderValue(value, line) {
|
|
642
|
+
const placeholderPatterns = [
|
|
643
|
+
/xxx/i,
|
|
644
|
+
/your[-_]?/i,
|
|
645
|
+
/YOUR[-_]?/i,
|
|
646
|
+
/placeholder/i,
|
|
647
|
+
/example/i,
|
|
648
|
+
/REPLACE[-_]?/i,
|
|
649
|
+
/CHANGEME/i,
|
|
650
|
+
/<[a-z_-]+>/i, // <your-api-key>
|
|
651
|
+
/\[\s*[a-z_-]+\s*\]/i, // [API_KEY]
|
|
652
|
+
/todo/i,
|
|
653
|
+
/fixme/i,
|
|
654
|
+
];
|
|
655
|
+
// Common test passwords that appear in connection strings
|
|
656
|
+
// e.g., postgres://user:password@host:5432/db
|
|
657
|
+
const testPasswordPatterns = [
|
|
658
|
+
/:password@/i, // user:password@ in connection strings
|
|
659
|
+
/:secret@/i, // user:secret@
|
|
660
|
+
/:test@/i, // user:test@
|
|
661
|
+
/:admin@/i, // user:admin@
|
|
662
|
+
/:root@/i, // user:root@
|
|
663
|
+
/:123456@/i, // user:123456@
|
|
664
|
+
/:postgres@/i, // postgres:postgres@
|
|
665
|
+
/:mysql@/i, // mysql:mysql@
|
|
666
|
+
/:redis@/i, // redis:redis@
|
|
667
|
+
];
|
|
668
|
+
return placeholderPatterns.some(pattern => pattern.test(value) || pattern.test(line)) || testPasswordPatterns.some(pattern => pattern.test(value));
|
|
669
|
+
}
|
|
670
|
+
// ============================================================================
|
|
671
|
+
// Security Context Detection
|
|
672
|
+
// ============================================================================
|
|
673
|
+
/**
|
|
674
|
+
* Check if line/path indicates a public endpoint (health, webhook, cron)
|
|
675
|
+
* These don't need authentication
|
|
676
|
+
*/
|
|
677
|
+
function isPublicEndpoint(lineContent, filePath) {
|
|
678
|
+
// Health check patterns
|
|
679
|
+
const healthCheckPatterns = [
|
|
680
|
+
/\/health\/?["'`]?/i,
|
|
681
|
+
/\/healthz\/?["'`]?/i,
|
|
682
|
+
/\/ready\/?["'`]?/i,
|
|
683
|
+
/\/readyz\/?["'`]?/i,
|
|
684
|
+
/\/live\/?["'`]?/i,
|
|
685
|
+
/\/livez\/?["'`]?/i,
|
|
686
|
+
/\/ping\/?["'`]?/i,
|
|
687
|
+
/\/status\/?["'`]?/i,
|
|
688
|
+
/\/api\/health/i,
|
|
689
|
+
/\/api\/status/i,
|
|
690
|
+
/\/_health/i,
|
|
691
|
+
];
|
|
692
|
+
// Webhook patterns
|
|
693
|
+
const webhookPatterns = [
|
|
694
|
+
/\/webhook/i,
|
|
695
|
+
/\/webhooks\//i,
|
|
696
|
+
/\/callback/i,
|
|
697
|
+
/\/stripe\/webhook/i,
|
|
698
|
+
/\/github\/webhook/i,
|
|
699
|
+
/\/clerk\/webhook/i,
|
|
700
|
+
];
|
|
701
|
+
// Cron/scheduled job patterns
|
|
702
|
+
const cronPatterns = [
|
|
703
|
+
/\/cron\//i,
|
|
704
|
+
/\/scheduled\//i,
|
|
705
|
+
/\/tasks?\//i,
|
|
706
|
+
/\/jobs?\//i,
|
|
707
|
+
];
|
|
708
|
+
// Check line content
|
|
709
|
+
const allPatterns = [...healthCheckPatterns, ...webhookPatterns, ...cronPatterns];
|
|
710
|
+
if (allPatterns.some(pattern => pattern.test(lineContent))) {
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
713
|
+
// Check file path
|
|
714
|
+
if (filePath.includes('/health') ||
|
|
715
|
+
filePath.includes('/webhook') ||
|
|
716
|
+
filePath.includes('/cron') ||
|
|
717
|
+
filePath.includes('/scheduled')) {
|
|
718
|
+
return true;
|
|
719
|
+
}
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Check if webhook has signature verification nearby
|
|
724
|
+
*/
|
|
725
|
+
function hasWebhookSignatureVerification(lines, lineIndex, windowSize = 15) {
|
|
726
|
+
const signaturePatterns = [
|
|
727
|
+
/verifySignature/i,
|
|
728
|
+
/validateSignature/i,
|
|
729
|
+
/checkSignature/i,
|
|
730
|
+
/signature.*verify/i,
|
|
731
|
+
/verify.*signature/i,
|
|
732
|
+
/hmac/i,
|
|
733
|
+
/x-hub-signature/i,
|
|
734
|
+
/stripe-signature/i,
|
|
735
|
+
/svix-signature/i,
|
|
736
|
+
/webhook.*secret/i,
|
|
737
|
+
/constructEvent/i, // Stripe webhook verification
|
|
738
|
+
/Webhook\.verify/i, // Generic webhook verify
|
|
739
|
+
];
|
|
740
|
+
const start = Math.max(0, lineIndex - windowSize);
|
|
741
|
+
const end = Math.min(lines.length, lineIndex + windowSize);
|
|
742
|
+
for (let i = start; i < end; i++) {
|
|
743
|
+
if (signaturePatterns.some(pattern => pattern.test(lines[i]))) {
|
|
744
|
+
return true;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
return false;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Check if there's an auth check nearby (bidirectional search)
|
|
751
|
+
*/
|
|
752
|
+
function hasAuthCheckNearby(lines, lineIndex, windowSize = 20) {
|
|
753
|
+
const authPatterns = [
|
|
754
|
+
/authorization/i,
|
|
755
|
+
/bearer\s+token/i,
|
|
756
|
+
/req\.user/i,
|
|
757
|
+
/request\.user/i,
|
|
758
|
+
/\.user\s*[=!]/,
|
|
759
|
+
/isAuthenticated/i,
|
|
760
|
+
/requireAuth/i,
|
|
761
|
+
/ensureAuth/i,
|
|
762
|
+
/checkAuth/i,
|
|
763
|
+
/verifyToken/i,
|
|
764
|
+
/validateToken/i,
|
|
765
|
+
/checkPermission/i,
|
|
766
|
+
/getServerSession/i,
|
|
767
|
+
/middleware.*auth/i,
|
|
768
|
+
/session\.user/i,
|
|
769
|
+
/currentUser/i,
|
|
770
|
+
/getSession\(/i,
|
|
771
|
+
/useSession\(/i,
|
|
772
|
+
/auth\(\)/i, // Next-Auth auth()
|
|
773
|
+
/withAuth/i,
|
|
774
|
+
/protected/i,
|
|
775
|
+
/verifySignature/i, // Webhook signature
|
|
776
|
+
/checkApiKey/i,
|
|
777
|
+
/validateApiKey/i,
|
|
778
|
+
/requireRole/i,
|
|
779
|
+
/hasRole/i,
|
|
780
|
+
/isAdmin/i,
|
|
781
|
+
];
|
|
782
|
+
// Search bidirectionally
|
|
783
|
+
const start = Math.max(0, lineIndex - windowSize);
|
|
784
|
+
const end = Math.min(lines.length, lineIndex + windowSize);
|
|
785
|
+
for (let i = start; i < end; i++) {
|
|
786
|
+
if (authPatterns.some(pattern => pattern.test(lines[i]))) {
|
|
787
|
+
return true;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
return false;
|
|
791
|
+
}
|
|
792
|
+
// ============================================================================
|
|
793
|
+
// BYOK (Bring Your Own Key) Context Detection
|
|
794
|
+
// ============================================================================
|
|
795
|
+
/**
|
|
796
|
+
* Check if this appears to be a BYOK (user-provided key) context
|
|
797
|
+
* BYOK is a feature, not a vulnerability, unless improperly handled
|
|
798
|
+
*/
|
|
799
|
+
function isBYOKContext(lineContent, filePath) {
|
|
800
|
+
// Common BYOK patterns
|
|
801
|
+
const byokPatterns = [
|
|
802
|
+
/user.*api.*key/i,
|
|
803
|
+
/customer.*key/i,
|
|
804
|
+
/your.*api.*key/i,
|
|
805
|
+
/provide.*key/i,
|
|
806
|
+
/enter.*key/i,
|
|
807
|
+
/input.*key/i,
|
|
808
|
+
/form.*key/i,
|
|
809
|
+
/settings.*key/i,
|
|
810
|
+
/config.*key.*user/i,
|
|
811
|
+
/BYOK/i,
|
|
812
|
+
/bring.*your.*own/i,
|
|
813
|
+
];
|
|
814
|
+
// Form/input contexts
|
|
815
|
+
const inputPatterns = [
|
|
816
|
+
/input.*type/i,
|
|
817
|
+
/onChange/i,
|
|
818
|
+
/onSubmit/i,
|
|
819
|
+
/handleSubmit/i,
|
|
820
|
+
/useState.*key/i,
|
|
821
|
+
/form.*data/i,
|
|
822
|
+
];
|
|
823
|
+
// Settings/config UI patterns
|
|
824
|
+
const settingsPatterns = [
|
|
825
|
+
/\/settings\//i,
|
|
826
|
+
/\/config\//i,
|
|
827
|
+
/\/preferences\//i,
|
|
828
|
+
/\/profile\//i,
|
|
829
|
+
];
|
|
830
|
+
// Check line content
|
|
831
|
+
if (byokPatterns.some(p => p.test(lineContent)) ||
|
|
832
|
+
inputPatterns.some(p => p.test(lineContent))) {
|
|
833
|
+
return true;
|
|
834
|
+
}
|
|
835
|
+
// Check file path
|
|
836
|
+
if (settingsPatterns.some(p => p.test(filePath))) {
|
|
837
|
+
// In settings files, look for user input context
|
|
838
|
+
if (inputPatterns.some(p => p.test(lineContent))) {
|
|
839
|
+
return true;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return false;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Check if key is being stored/handled properly (not exposed)
|
|
846
|
+
*/
|
|
847
|
+
function isKeyProperlyHandled(lineContent, lines, lineIndex) {
|
|
848
|
+
// Proper handling patterns (encryption, secure storage, etc.)
|
|
849
|
+
const properHandlingPatterns = [
|
|
850
|
+
/encrypt/i,
|
|
851
|
+
/hash/i,
|
|
852
|
+
/secure.*storage/i,
|
|
853
|
+
/keychain/i,
|
|
854
|
+
/vault/i,
|
|
855
|
+
/secretsManager/i,
|
|
856
|
+
/kms/i,
|
|
857
|
+
/\.env/i,
|
|
858
|
+
];
|
|
859
|
+
// Check current line
|
|
860
|
+
if (properHandlingPatterns.some(p => p.test(lineContent))) {
|
|
861
|
+
return true;
|
|
862
|
+
}
|
|
863
|
+
// Check nearby lines (5 lines before and after)
|
|
864
|
+
const start = Math.max(0, lineIndex - 5);
|
|
865
|
+
const end = Math.min(lines.length, lineIndex + 5);
|
|
866
|
+
for (let i = start; i < end; i++) {
|
|
867
|
+
if (properHandlingPatterns.some(p => p.test(lines[i]))) {
|
|
868
|
+
return true;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
return false;
|
|
872
|
+
}
|
|
873
|
+
// ============================================================================
|
|
874
|
+
// Service Role Key Context
|
|
875
|
+
// ============================================================================
|
|
876
|
+
/**
|
|
877
|
+
* Check if this is a service role key usage that's acceptable
|
|
878
|
+
* Server-only + env var = acceptable
|
|
879
|
+
* Client exposure = critical
|
|
880
|
+
*/
|
|
881
|
+
function getServiceRoleKeyContext(lineContent, filePath) {
|
|
882
|
+
const isServer = isServerOnlyFile(filePath);
|
|
883
|
+
const usesEnvVar = isEnvVarReference(lineContent);
|
|
884
|
+
const isClientFile = isClientBundledFile(filePath);
|
|
885
|
+
const isNextPublic = isNextPublicEnvVar(lineContent);
|
|
886
|
+
// NEXT_PUBLIC_ service role key = always critical (client exposure)
|
|
887
|
+
if (isNextPublic) {
|
|
888
|
+
return 'client_exposure';
|
|
889
|
+
}
|
|
890
|
+
// Server-only file using env var = safe
|
|
891
|
+
if (isServer && usesEnvVar) {
|
|
892
|
+
return 'safe_server';
|
|
893
|
+
}
|
|
894
|
+
// Client-bundled file = exposure risk
|
|
895
|
+
if (isClientFile) {
|
|
896
|
+
return 'client_exposure';
|
|
897
|
+
}
|
|
898
|
+
// Hardcoded or ambiguous = needs review
|
|
899
|
+
return 'needs_review';
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Check if file is a configuration file
|
|
903
|
+
*/
|
|
904
|
+
function isConfigFile(filePath) {
|
|
905
|
+
const configPatterns = [
|
|
906
|
+
/config\.(ts|js|json|yaml|yml)$/i,
|
|
907
|
+
/settings\.(ts|js|json)$/i,
|
|
908
|
+
/constants\.(ts|js)$/i,
|
|
909
|
+
/\.config\.(ts|js|mjs|cjs)$/i,
|
|
910
|
+
/\.env/i,
|
|
911
|
+
/tsconfig\.json$/i,
|
|
912
|
+
/package\.json$/i,
|
|
913
|
+
/jest\.config/i,
|
|
914
|
+
/vitest\.config/i,
|
|
915
|
+
/eslint/i,
|
|
916
|
+
/prettier/i,
|
|
917
|
+
];
|
|
918
|
+
return configPatterns.some(p => p.test(filePath));
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Build file-specific context for a single file
|
|
922
|
+
* Used by Layer 2 detectors for context-aware detection
|
|
923
|
+
*/
|
|
924
|
+
function buildFileContext(filePath) {
|
|
925
|
+
return {
|
|
926
|
+
isServerOnly: isServerOnlyFile(filePath),
|
|
927
|
+
isClientBundled: isClientBundledFile(filePath),
|
|
928
|
+
isTestFile: isTestOrMockFile(filePath),
|
|
929
|
+
isConfigFile: isConfigFile(filePath),
|
|
930
|
+
isToolingDir: isToolingDirectory(filePath),
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
//# sourceMappingURL=file-classifier.js.map
|