@oculum/scanner 1.0.9 → 1.0.11
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/baseline/diff.d.ts +32 -0
- package/dist/baseline/diff.d.ts.map +1 -0
- package/dist/baseline/diff.js +119 -0
- package/dist/baseline/diff.js.map +1 -0
- package/dist/baseline/index.d.ts +9 -0
- package/dist/baseline/index.d.ts.map +1 -0
- package/dist/baseline/index.js +19 -0
- package/dist/baseline/index.js.map +1 -0
- package/dist/baseline/manager.d.ts +67 -0
- package/dist/baseline/manager.d.ts.map +1 -0
- package/dist/baseline/manager.js +180 -0
- package/dist/baseline/manager.js.map +1 -0
- package/dist/baseline/types.d.ts +91 -0
- package/dist/baseline/types.d.ts.map +1 -0
- package/dist/baseline/types.js +12 -0
- package/dist/baseline/types.js.map +1 -0
- package/dist/formatters/cli-terminal.d.ts +38 -0
- package/dist/formatters/cli-terminal.d.ts.map +1 -1
- package/dist/formatters/cli-terminal.js +365 -42
- package/dist/formatters/cli-terminal.js.map +1 -1
- 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 +75 -11
- package/dist/formatters/github-comment.js.map +1 -1
- package/dist/formatters/index.d.ts +1 -1
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +4 -1
- package/dist/formatters/index.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -16
- package/dist/index.js.map +1 -1
- package/dist/layer1/config-audit.d.ts.map +1 -1
- package/dist/layer1/config-audit.js +20 -3
- package/dist/layer1/config-audit.js.map +1 -1
- package/dist/layer1/config-mcp-audit.d.ts +20 -0
- package/dist/layer1/config-mcp-audit.d.ts.map +1 -0
- package/dist/layer1/config-mcp-audit.js +239 -0
- package/dist/layer1/config-mcp-audit.js.map +1 -0
- package/dist/layer1/index.d.ts +1 -0
- package/dist/layer1/index.d.ts.map +1 -1
- package/dist/layer1/index.js +9 -1
- package/dist/layer1/index.js.map +1 -1
- package/dist/layer2/ai-agent-tools.d.ts.map +1 -1
- package/dist/layer2/ai-agent-tools.js +303 -0
- package/dist/layer2/ai-agent-tools.js.map +1 -1
- package/dist/layer2/ai-endpoint-protection.d.ts.map +1 -1
- package/dist/layer2/ai-endpoint-protection.js +17 -3
- package/dist/layer2/ai-endpoint-protection.js.map +1 -1
- package/dist/layer2/ai-execution-sinks.d.ts.map +1 -1
- package/dist/layer2/ai-execution-sinks.js +462 -12
- package/dist/layer2/ai-execution-sinks.js.map +1 -1
- package/dist/layer2/ai-fingerprinting.d.ts.map +1 -1
- package/dist/layer2/ai-fingerprinting.js +3 -0
- package/dist/layer2/ai-fingerprinting.js.map +1 -1
- package/dist/layer2/ai-mcp-security.d.ts +17 -0
- package/dist/layer2/ai-mcp-security.d.ts.map +1 -0
- package/dist/layer2/ai-mcp-security.js +679 -0
- package/dist/layer2/ai-mcp-security.js.map +1 -0
- package/dist/layer2/ai-package-hallucination.d.ts +19 -0
- package/dist/layer2/ai-package-hallucination.d.ts.map +1 -0
- package/dist/layer2/ai-package-hallucination.js +696 -0
- package/dist/layer2/ai-package-hallucination.js.map +1 -0
- package/dist/layer2/ai-prompt-hygiene.d.ts.map +1 -1
- package/dist/layer2/ai-prompt-hygiene.js +495 -9
- package/dist/layer2/ai-prompt-hygiene.js.map +1 -1
- package/dist/layer2/ai-rag-safety.d.ts.map +1 -1
- package/dist/layer2/ai-rag-safety.js +372 -1
- package/dist/layer2/ai-rag-safety.js.map +1 -1
- package/dist/layer2/auth-antipatterns.d.ts.map +1 -1
- package/dist/layer2/auth-antipatterns.js +4 -0
- package/dist/layer2/auth-antipatterns.js.map +1 -1
- package/dist/layer2/byok-patterns.d.ts.map +1 -1
- package/dist/layer2/byok-patterns.js +3 -0
- package/dist/layer2/byok-patterns.js.map +1 -1
- package/dist/layer2/dangerous-functions/child-process.d.ts +16 -0
- package/dist/layer2/dangerous-functions/child-process.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/child-process.js +74 -0
- package/dist/layer2/dangerous-functions/child-process.js.map +1 -0
- package/dist/layer2/dangerous-functions/dom-xss.d.ts +29 -0
- package/dist/layer2/dangerous-functions/dom-xss.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/dom-xss.js +179 -0
- package/dist/layer2/dangerous-functions/dom-xss.js.map +1 -0
- package/dist/layer2/dangerous-functions/index.d.ts +13 -0
- package/dist/layer2/dangerous-functions/index.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/index.js +621 -0
- package/dist/layer2/dangerous-functions/index.js.map +1 -0
- package/dist/layer2/dangerous-functions/json-parse.d.ts +31 -0
- package/dist/layer2/dangerous-functions/json-parse.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/json-parse.js +319 -0
- package/dist/layer2/dangerous-functions/json-parse.js.map +1 -0
- package/dist/layer2/dangerous-functions/math-random.d.ts +61 -0
- package/dist/layer2/dangerous-functions/math-random.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/math-random.js +459 -0
- package/dist/layer2/dangerous-functions/math-random.js.map +1 -0
- package/dist/layer2/dangerous-functions/patterns.d.ts +21 -0
- package/dist/layer2/dangerous-functions/patterns.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/patterns.js +161 -0
- package/dist/layer2/dangerous-functions/patterns.js.map +1 -0
- package/dist/layer2/dangerous-functions/request-validation.d.ts +13 -0
- package/dist/layer2/dangerous-functions/request-validation.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/request-validation.js +119 -0
- package/dist/layer2/dangerous-functions/request-validation.js.map +1 -0
- package/dist/layer2/dangerous-functions/utils/control-flow.d.ts +23 -0
- package/dist/layer2/dangerous-functions/utils/control-flow.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/utils/control-flow.js +149 -0
- package/dist/layer2/dangerous-functions/utils/control-flow.js.map +1 -0
- package/dist/layer2/dangerous-functions/utils/helpers.d.ts +31 -0
- package/dist/layer2/dangerous-functions/utils/helpers.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/utils/helpers.js +124 -0
- package/dist/layer2/dangerous-functions/utils/helpers.js.map +1 -0
- package/dist/layer2/dangerous-functions/utils/index.d.ts +9 -0
- package/dist/layer2/dangerous-functions/utils/index.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/utils/index.js +23 -0
- package/dist/layer2/dangerous-functions/utils/index.js.map +1 -0
- package/dist/layer2/dangerous-functions/utils/schema-validation.d.ts +22 -0
- package/dist/layer2/dangerous-functions/utils/schema-validation.d.ts.map +1 -0
- package/dist/layer2/dangerous-functions/utils/schema-validation.js +89 -0
- package/dist/layer2/dangerous-functions/utils/schema-validation.js.map +1 -0
- package/dist/layer2/data-exposure.d.ts.map +1 -1
- package/dist/layer2/data-exposure.js +3 -0
- package/dist/layer2/data-exposure.js.map +1 -1
- package/dist/layer2/framework-checks.d.ts.map +1 -1
- package/dist/layer2/framework-checks.js +3 -0
- package/dist/layer2/framework-checks.js.map +1 -1
- package/dist/layer2/index.d.ts +3 -0
- package/dist/layer2/index.d.ts.map +1 -1
- package/dist/layer2/index.js +61 -2
- package/dist/layer2/index.js.map +1 -1
- package/dist/layer2/logic-gates.d.ts.map +1 -1
- package/dist/layer2/logic-gates.js +4 -0
- package/dist/layer2/logic-gates.js.map +1 -1
- package/dist/layer2/model-supply-chain.d.ts +20 -0
- package/dist/layer2/model-supply-chain.d.ts.map +1 -0
- package/dist/layer2/model-supply-chain.js +376 -0
- package/dist/layer2/model-supply-chain.js.map +1 -0
- package/dist/layer2/risky-imports.d.ts.map +1 -1
- package/dist/layer2/risky-imports.js +4 -0
- package/dist/layer2/risky-imports.js.map +1 -1
- package/dist/layer2/variables.d.ts.map +1 -1
- package/dist/layer2/variables.js +4 -0
- package/dist/layer2/variables.js.map +1 -1
- package/dist/layer3/anthropic/auto-dismiss.d.ts +24 -0
- package/dist/layer3/anthropic/auto-dismiss.d.ts.map +1 -0
- package/dist/layer3/anthropic/auto-dismiss.js +188 -0
- package/dist/layer3/anthropic/auto-dismiss.js.map +1 -0
- package/dist/layer3/anthropic/clients.d.ts +44 -0
- package/dist/layer3/anthropic/clients.d.ts.map +1 -0
- package/dist/layer3/anthropic/clients.js +81 -0
- package/dist/layer3/anthropic/clients.js.map +1 -0
- package/dist/layer3/anthropic/index.d.ts +41 -0
- package/dist/layer3/anthropic/index.d.ts.map +1 -0
- package/dist/layer3/anthropic/index.js +141 -0
- package/dist/layer3/anthropic/index.js.map +1 -0
- package/dist/layer3/anthropic/prompts/index.d.ts +8 -0
- package/dist/layer3/anthropic/prompts/index.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/index.js +14 -0
- package/dist/layer3/anthropic/prompts/index.js.map +1 -0
- package/dist/layer3/anthropic/prompts/semantic-analysis.d.ts +15 -0
- package/dist/layer3/anthropic/prompts/semantic-analysis.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/semantic-analysis.js +169 -0
- package/dist/layer3/anthropic/prompts/semantic-analysis.js.map +1 -0
- package/dist/layer3/anthropic/prompts/validation.d.ts +12 -0
- package/dist/layer3/anthropic/prompts/validation.d.ts.map +1 -0
- package/dist/layer3/anthropic/prompts/validation.js +421 -0
- package/dist/layer3/anthropic/prompts/validation.js.map +1 -0
- package/dist/layer3/anthropic/providers/anthropic.d.ts +21 -0
- package/dist/layer3/anthropic/providers/anthropic.d.ts.map +1 -0
- package/dist/layer3/anthropic/providers/anthropic.js +266 -0
- package/dist/layer3/anthropic/providers/anthropic.js.map +1 -0
- package/dist/layer3/anthropic/providers/index.d.ts +8 -0
- package/dist/layer3/anthropic/providers/index.d.ts.map +1 -0
- package/dist/layer3/anthropic/providers/index.js +15 -0
- package/dist/layer3/anthropic/providers/index.js.map +1 -0
- package/dist/layer3/anthropic/providers/openai.d.ts +18 -0
- package/dist/layer3/anthropic/providers/openai.d.ts.map +1 -0
- package/dist/layer3/anthropic/providers/openai.js +340 -0
- package/dist/layer3/anthropic/providers/openai.js.map +1 -0
- package/dist/layer3/anthropic/request-builder.d.ts +20 -0
- package/dist/layer3/anthropic/request-builder.d.ts.map +1 -0
- package/dist/layer3/anthropic/request-builder.js +134 -0
- package/dist/layer3/anthropic/request-builder.js.map +1 -0
- package/dist/layer3/anthropic/types.d.ts +88 -0
- package/dist/layer3/anthropic/types.d.ts.map +1 -0
- package/dist/layer3/anthropic/types.js +38 -0
- package/dist/layer3/anthropic/types.js.map +1 -0
- package/dist/layer3/anthropic/utils/index.d.ts +9 -0
- package/dist/layer3/anthropic/utils/index.d.ts.map +1 -0
- package/dist/layer3/anthropic/utils/index.js +24 -0
- package/dist/layer3/anthropic/utils/index.js.map +1 -0
- package/dist/layer3/anthropic/utils/path-helpers.d.ts +21 -0
- package/dist/layer3/anthropic/utils/path-helpers.d.ts.map +1 -0
- package/dist/layer3/anthropic/utils/path-helpers.js +69 -0
- package/dist/layer3/anthropic/utils/path-helpers.js.map +1 -0
- package/dist/layer3/anthropic/utils/response-parser.d.ts +40 -0
- package/dist/layer3/anthropic/utils/response-parser.d.ts.map +1 -0
- package/dist/layer3/anthropic/utils/response-parser.js +285 -0
- package/dist/layer3/anthropic/utils/response-parser.js.map +1 -0
- package/dist/layer3/anthropic/utils/retry.d.ts +15 -0
- package/dist/layer3/anthropic/utils/retry.d.ts.map +1 -0
- package/dist/layer3/anthropic/utils/retry.js +62 -0
- package/dist/layer3/anthropic/utils/retry.js.map +1 -0
- package/dist/layer3/index.d.ts +1 -0
- package/dist/layer3/index.d.ts.map +1 -1
- package/dist/layer3/index.js +16 -6
- package/dist/layer3/index.js.map +1 -1
- package/dist/layer3/osv-check.d.ts +75 -0
- package/dist/layer3/osv-check.d.ts.map +1 -0
- package/dist/layer3/osv-check.js +308 -0
- package/dist/layer3/osv-check.js.map +1 -0
- package/dist/rules/framework-fixes.d.ts +48 -0
- package/dist/rules/framework-fixes.d.ts.map +1 -0
- package/dist/rules/framework-fixes.js +439 -0
- package/dist/rules/framework-fixes.js.map +1 -0
- package/dist/rules/index.d.ts +8 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +18 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/metadata.d.ts +43 -0
- package/dist/rules/metadata.d.ts.map +1 -0
- package/dist/rules/metadata.js +734 -0
- package/dist/rules/metadata.js.map +1 -0
- package/dist/suppression/config-loader.d.ts +74 -0
- package/dist/suppression/config-loader.d.ts.map +1 -0
- package/dist/suppression/config-loader.js +424 -0
- package/dist/suppression/config-loader.js.map +1 -0
- package/dist/suppression/hash.d.ts +48 -0
- package/dist/suppression/hash.d.ts.map +1 -0
- package/dist/suppression/hash.js +88 -0
- package/dist/suppression/hash.js.map +1 -0
- package/dist/suppression/index.d.ts +11 -0
- package/dist/suppression/index.d.ts.map +1 -0
- package/dist/suppression/index.js +39 -0
- package/dist/suppression/index.js.map +1 -0
- package/dist/suppression/inline-parser.d.ts +39 -0
- package/dist/suppression/inline-parser.d.ts.map +1 -0
- package/dist/suppression/inline-parser.js +218 -0
- package/dist/suppression/inline-parser.js.map +1 -0
- package/dist/suppression/manager.d.ts +94 -0
- package/dist/suppression/manager.d.ts.map +1 -0
- package/dist/suppression/manager.js +292 -0
- package/dist/suppression/manager.js.map +1 -0
- package/dist/suppression/types.d.ts +151 -0
- package/dist/suppression/types.d.ts.map +1 -0
- package/dist/suppression/types.js +28 -0
- package/dist/suppression/types.js.map +1 -0
- package/dist/tiers.d.ts +1 -1
- package/dist/tiers.d.ts.map +1 -1
- package/dist/tiers.js +27 -0
- package/dist/tiers.js.map +1 -1
- package/dist/types.d.ts +62 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/context-helpers.d.ts +4 -0
- package/dist/utils/context-helpers.d.ts.map +1 -1
- package/dist/utils/context-helpers.js +13 -9
- package/dist/utils/context-helpers.js.map +1 -1
- package/package.json +4 -2
- package/src/__tests__/benchmark/fixtures/layer1/mcp-config-audit.json +31 -0
- package/src/__tests__/benchmark/fixtures/layer2/ai-execution-sinks.ts +1489 -82
- package/src/__tests__/benchmark/fixtures/layer2/ai-mcp-security.ts +495 -0
- package/src/__tests__/benchmark/fixtures/layer2/ai-package-hallucination.ts +255 -0
- package/src/__tests__/benchmark/fixtures/layer2/ai-prompt-hygiene.ts +300 -1
- package/src/__tests__/benchmark/fixtures/layer2/ai-rag-safety.ts +139 -0
- package/src/__tests__/benchmark/fixtures/layer2/byok-patterns.ts +7 -0
- package/src/__tests__/benchmark/fixtures/layer2/data-exposure.ts +63 -0
- package/src/__tests__/benchmark/fixtures/layer2/excessive-agency.ts +221 -0
- package/src/__tests__/benchmark/fixtures/layer2/index.ts +18 -0
- package/src/__tests__/benchmark/fixtures/layer2/model-supply-chain.ts +204 -0
- package/src/__tests__/benchmark/fixtures/layer2/phase1-enhancements.ts +157 -0
- package/src/__tests__/snapshots/__snapshots__/anthropic-validation-refactor.test.ts.snap +758 -0
- package/src/__tests__/snapshots/__snapshots__/dangerous-functions-refactor.test.ts.snap +503 -0
- package/src/__tests__/snapshots/anthropic-validation-refactor.test.ts +321 -0
- package/src/__tests__/snapshots/dangerous-functions-refactor.test.ts +439 -0
- package/src/baseline/__tests__/diff.test.ts +261 -0
- package/src/baseline/__tests__/manager.test.ts +225 -0
- package/src/baseline/diff.ts +135 -0
- package/src/baseline/index.ts +29 -0
- package/src/baseline/manager.ts +230 -0
- package/src/baseline/types.ts +97 -0
- package/src/formatters/cli-terminal.ts +444 -41
- package/src/formatters/github-comment.ts +79 -11
- package/src/formatters/index.ts +4 -0
- package/src/index.ts +197 -14
- package/src/layer1/config-audit.ts +24 -3
- package/src/layer1/config-mcp-audit.ts +276 -0
- package/src/layer1/index.ts +16 -6
- package/src/layer2/ai-agent-tools.ts +336 -0
- package/src/layer2/ai-endpoint-protection.ts +16 -3
- package/src/layer2/ai-execution-sinks.ts +516 -12
- package/src/layer2/ai-fingerprinting.ts +5 -1
- package/src/layer2/ai-mcp-security.ts +730 -0
- package/src/layer2/ai-package-hallucination.ts +791 -0
- package/src/layer2/ai-prompt-hygiene.ts +547 -9
- package/src/layer2/ai-rag-safety.ts +382 -3
- package/src/layer2/auth-antipatterns.ts +5 -0
- package/src/layer2/byok-patterns.ts +5 -1
- package/src/layer2/dangerous-functions/child-process.ts +98 -0
- package/src/layer2/dangerous-functions/dom-xss.ts +220 -0
- package/src/layer2/dangerous-functions/index.ts +949 -0
- package/src/layer2/dangerous-functions/json-parse.ts +385 -0
- package/src/layer2/dangerous-functions/math-random.ts +537 -0
- package/src/layer2/dangerous-functions/patterns.ts +174 -0
- package/src/layer2/dangerous-functions/request-validation.ts +145 -0
- package/src/layer2/dangerous-functions/utils/control-flow.ts +162 -0
- package/src/layer2/dangerous-functions/utils/helpers.ts +170 -0
- package/src/layer2/dangerous-functions/utils/index.ts +25 -0
- package/src/layer2/dangerous-functions/utils/schema-validation.ts +91 -0
- package/src/layer2/data-exposure.ts +5 -1
- package/src/layer2/framework-checks.ts +5 -0
- package/src/layer2/index.ts +63 -1
- package/src/layer2/logic-gates.ts +5 -0
- package/src/layer2/model-supply-chain.ts +456 -0
- package/src/layer2/risky-imports.ts +5 -0
- package/src/layer2/variables.ts +5 -0
- package/src/layer3/__tests__/osv-check.test.ts +384 -0
- package/src/layer3/anthropic/auto-dismiss.ts +212 -0
- package/src/layer3/anthropic/clients.ts +84 -0
- package/src/layer3/anthropic/index.ts +170 -0
- package/src/layer3/anthropic/prompts/index.ts +14 -0
- package/src/layer3/anthropic/prompts/semantic-analysis.ts +173 -0
- package/src/layer3/anthropic/prompts/validation.ts +419 -0
- package/src/layer3/anthropic/providers/anthropic.ts +310 -0
- package/src/layer3/anthropic/providers/index.ts +8 -0
- package/src/layer3/anthropic/providers/openai.ts +384 -0
- package/src/layer3/anthropic/request-builder.ts +150 -0
- package/src/layer3/anthropic/types.ts +148 -0
- package/src/layer3/anthropic/utils/index.ts +26 -0
- package/src/layer3/anthropic/utils/path-helpers.ts +68 -0
- package/src/layer3/anthropic/utils/response-parser.ts +322 -0
- package/src/layer3/anthropic/utils/retry.ts +75 -0
- package/src/layer3/index.ts +18 -5
- package/src/layer3/osv-check.ts +420 -0
- package/src/rules/__tests__/framework-fixes.test.ts +689 -0
- package/src/rules/__tests__/metadata.test.ts +218 -0
- package/src/rules/framework-fixes.ts +470 -0
- package/src/rules/index.ts +21 -0
- package/src/rules/metadata.ts +831 -0
- package/src/suppression/__tests__/config-loader.test.ts +382 -0
- package/src/suppression/__tests__/hash.test.ts +166 -0
- package/src/suppression/__tests__/inline-parser.test.ts +212 -0
- package/src/suppression/__tests__/manager.test.ts +415 -0
- package/src/suppression/config-loader.ts +462 -0
- package/src/suppression/hash.ts +95 -0
- package/src/suppression/index.ts +51 -0
- package/src/suppression/inline-parser.ts +273 -0
- package/src/suppression/manager.ts +379 -0
- package/src/suppression/types.ts +174 -0
- package/src/tiers.ts +36 -0
- package/src/types.ts +90 -0
- package/src/utils/context-helpers.ts +13 -9
- package/dist/layer2/dangerous-functions.d.ts +0 -7
- package/dist/layer2/dangerous-functions.d.ts.map +0 -1
- package/dist/layer2/dangerous-functions.js +0 -1701
- package/dist/layer2/dangerous-functions.js.map +0 -1
- package/dist/layer3/anthropic.d.ts +0 -87
- package/dist/layer3/anthropic.d.ts.map +0 -1
- package/dist/layer3/anthropic.js +0 -1948
- package/dist/layer3/anthropic.js.map +0 -1
- package/dist/layer3/openai.d.ts +0 -25
- package/dist/layer3/openai.d.ts.map +0 -1
- package/dist/layer3/openai.js +0 -238
- package/dist/layer3/openai.js.map +0 -1
- package/src/layer2/dangerous-functions.ts +0 -1940
- package/src/layer3/anthropic.ts +0 -2257
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Auto-dismiss stats tracking should correctly count auto-dismissed findings 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"dismissed": Array [
|
|
6
|
+
Object {
|
|
7
|
+
"finding": Object {
|
|
8
|
+
"category": "dangerous_function",
|
|
9
|
+
"confidence": "high",
|
|
10
|
+
"description": "Test description",
|
|
11
|
+
"filePath": "src/__tests__/test.ts",
|
|
12
|
+
"id": "test-finding-1",
|
|
13
|
+
"layer": 2,
|
|
14
|
+
"lineContent": "const x = 1;",
|
|
15
|
+
"lineNumber": 10,
|
|
16
|
+
"severity": "high",
|
|
17
|
+
"suggestedFix": "Fix it",
|
|
18
|
+
"title": "Test Finding",
|
|
19
|
+
},
|
|
20
|
+
"reason": "Finding in test/mock file",
|
|
21
|
+
"rule": "test_file",
|
|
22
|
+
},
|
|
23
|
+
Object {
|
|
24
|
+
"finding": Object {
|
|
25
|
+
"category": "dangerous_function",
|
|
26
|
+
"confidence": "high",
|
|
27
|
+
"description": "Test description",
|
|
28
|
+
"filePath": "src/__tests__/another.test.ts",
|
|
29
|
+
"id": "test-finding-1",
|
|
30
|
+
"layer": 2,
|
|
31
|
+
"lineContent": "const x = 1;",
|
|
32
|
+
"lineNumber": 10,
|
|
33
|
+
"severity": "high",
|
|
34
|
+
"suggestedFix": "Fix it",
|
|
35
|
+
"title": "Test Finding",
|
|
36
|
+
},
|
|
37
|
+
"reason": "Finding in test/mock file",
|
|
38
|
+
"rule": "test_file",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
"toValidate": Array [
|
|
42
|
+
Object {
|
|
43
|
+
"category": "dangerous_function",
|
|
44
|
+
"confidence": "high",
|
|
45
|
+
"description": "Test description",
|
|
46
|
+
"filePath": "src/real-code.ts",
|
|
47
|
+
"id": "test-finding-1",
|
|
48
|
+
"layer": 2,
|
|
49
|
+
"lineContent": "const x = 1;",
|
|
50
|
+
"lineNumber": 10,
|
|
51
|
+
"severity": "high",
|
|
52
|
+
"suggestedFix": "Fix it",
|
|
53
|
+
"title": "Test Finding",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules CSS classes auto-dismiss should NOT auto-dismiss high entropy strings without CSS indicators 1`] = `
|
|
60
|
+
Object {
|
|
61
|
+
"dismissed": Array [],
|
|
62
|
+
"toValidate": Array [
|
|
63
|
+
Object {
|
|
64
|
+
"category": "high_entropy_string",
|
|
65
|
+
"confidence": "high",
|
|
66
|
+
"description": "Test description",
|
|
67
|
+
"filePath": "src/handler.ts",
|
|
68
|
+
"id": "test-finding-1",
|
|
69
|
+
"layer": 2,
|
|
70
|
+
"lineContent": "const token = \\"aB3dE5fG7hI9jK1lM3nO5pQ7rS9tU1vW3xY5z\\";",
|
|
71
|
+
"lineNumber": 10,
|
|
72
|
+
"severity": "high",
|
|
73
|
+
"suggestedFix": "Fix it",
|
|
74
|
+
"title": "Test Finding",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules CSS classes auto-dismiss should auto-dismiss Tailwind classes flagged as high entropy 1`] = `
|
|
81
|
+
Object {
|
|
82
|
+
"dismissed": Array [
|
|
83
|
+
Object {
|
|
84
|
+
"finding": Object {
|
|
85
|
+
"category": "high_entropy_string",
|
|
86
|
+
"confidence": "high",
|
|
87
|
+
"description": "Test description",
|
|
88
|
+
"filePath": "src/handler.ts",
|
|
89
|
+
"id": "test-finding-1",
|
|
90
|
+
"layer": 2,
|
|
91
|
+
"lineContent": "className=\\"flex items-center justify-between px-4 py-2 text-sm\\"",
|
|
92
|
+
"lineNumber": 10,
|
|
93
|
+
"severity": "high",
|
|
94
|
+
"suggestedFix": "Fix it",
|
|
95
|
+
"title": "Test Finding",
|
|
96
|
+
},
|
|
97
|
+
"reason": "CSS/Tailwind classes (not a secret)",
|
|
98
|
+
"rule": "css_classes",
|
|
99
|
+
},
|
|
100
|
+
Object {
|
|
101
|
+
"finding": Object {
|
|
102
|
+
"category": "high_entropy_string",
|
|
103
|
+
"confidence": "high",
|
|
104
|
+
"description": "Test description",
|
|
105
|
+
"filePath": "src/handler.ts",
|
|
106
|
+
"id": "test-finding-1",
|
|
107
|
+
"layer": 2,
|
|
108
|
+
"lineContent": "class=\\"bg-gray-100 rounded-lg shadow-md hover:bg-gray-200\\"",
|
|
109
|
+
"lineNumber": 10,
|
|
110
|
+
"severity": "high",
|
|
111
|
+
"suggestedFix": "Fix it",
|
|
112
|
+
"title": "Test Finding",
|
|
113
|
+
},
|
|
114
|
+
"reason": "CSS/Tailwind classes (not a secret)",
|
|
115
|
+
"rule": "css_classes",
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
"toValidate": Array [],
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Comment line auto-dismiss should NOT auto-dismiss ai_pattern findings in comments 1`] = `
|
|
123
|
+
Object {
|
|
124
|
+
"dismissed": Array [],
|
|
125
|
+
"toValidate": Array [
|
|
126
|
+
Object {
|
|
127
|
+
"category": "ai_pattern",
|
|
128
|
+
"confidence": "high",
|
|
129
|
+
"description": "Test description",
|
|
130
|
+
"filePath": "src/handler.ts",
|
|
131
|
+
"id": "test-finding-1",
|
|
132
|
+
"layer": 2,
|
|
133
|
+
"lineContent": "// AI-generated code pattern",
|
|
134
|
+
"lineNumber": 10,
|
|
135
|
+
"severity": "high",
|
|
136
|
+
"suggestedFix": "Fix it",
|
|
137
|
+
"title": "Test Finding",
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
|
|
143
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Comment line auto-dismiss should auto-dismiss findings in comment lines 1`] = `
|
|
144
|
+
Object {
|
|
145
|
+
"dismissed": Array [
|
|
146
|
+
Object {
|
|
147
|
+
"finding": Object {
|
|
148
|
+
"category": "hardcoded_secret",
|
|
149
|
+
"confidence": "high",
|
|
150
|
+
"description": "Test description",
|
|
151
|
+
"filePath": "src/handler.ts",
|
|
152
|
+
"id": "test-finding-1",
|
|
153
|
+
"layer": 2,
|
|
154
|
+
"lineContent": "// TODO: Replace with env var: API_KEY=sk-1234",
|
|
155
|
+
"lineNumber": 10,
|
|
156
|
+
"severity": "high",
|
|
157
|
+
"suggestedFix": "Fix it",
|
|
158
|
+
"title": "Test Finding",
|
|
159
|
+
},
|
|
160
|
+
"reason": "Code comment (not executable)",
|
|
161
|
+
"rule": "comment_line",
|
|
162
|
+
},
|
|
163
|
+
Object {
|
|
164
|
+
"finding": Object {
|
|
165
|
+
"category": "dangerous_function",
|
|
166
|
+
"confidence": "high",
|
|
167
|
+
"description": "Test description",
|
|
168
|
+
"filePath": "src/handler.ts",
|
|
169
|
+
"id": "test-finding-1",
|
|
170
|
+
"layer": 2,
|
|
171
|
+
"lineContent": "/* eval(userCode) would be dangerous */",
|
|
172
|
+
"lineNumber": 10,
|
|
173
|
+
"severity": "high",
|
|
174
|
+
"suggestedFix": "Fix it",
|
|
175
|
+
"title": "Test Finding",
|
|
176
|
+
},
|
|
177
|
+
"reason": "Code comment (not executable)",
|
|
178
|
+
"rule": "comment_line",
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
"toValidate": Array [],
|
|
182
|
+
}
|
|
183
|
+
`;
|
|
184
|
+
|
|
185
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Documentation file auto-dismiss should auto-dismiss findings in documentation files 1`] = `
|
|
186
|
+
Object {
|
|
187
|
+
"dismissed": Array [
|
|
188
|
+
Object {
|
|
189
|
+
"finding": Object {
|
|
190
|
+
"category": "dangerous_function",
|
|
191
|
+
"confidence": "high",
|
|
192
|
+
"description": "Test description",
|
|
193
|
+
"filePath": "docs/api.md",
|
|
194
|
+
"id": "test-finding-1",
|
|
195
|
+
"layer": 2,
|
|
196
|
+
"lineContent": "const x = 1;",
|
|
197
|
+
"lineNumber": 10,
|
|
198
|
+
"severity": "high",
|
|
199
|
+
"suggestedFix": "Fix it",
|
|
200
|
+
"title": "Test Finding",
|
|
201
|
+
},
|
|
202
|
+
"reason": "Finding in documentation file",
|
|
203
|
+
"rule": "documentation_file",
|
|
204
|
+
},
|
|
205
|
+
Object {
|
|
206
|
+
"finding": Object {
|
|
207
|
+
"category": "dangerous_function",
|
|
208
|
+
"confidence": "high",
|
|
209
|
+
"description": "Test description",
|
|
210
|
+
"filePath": "README.md",
|
|
211
|
+
"id": "test-finding-1",
|
|
212
|
+
"layer": 2,
|
|
213
|
+
"lineContent": "const x = 1;",
|
|
214
|
+
"lineNumber": 10,
|
|
215
|
+
"severity": "high",
|
|
216
|
+
"suggestedFix": "Fix it",
|
|
217
|
+
"title": "Test Finding",
|
|
218
|
+
},
|
|
219
|
+
"reason": "Finding in example/demo file",
|
|
220
|
+
"rule": "example_file",
|
|
221
|
+
},
|
|
222
|
+
Object {
|
|
223
|
+
"finding": Object {
|
|
224
|
+
"category": "dangerous_function",
|
|
225
|
+
"confidence": "high",
|
|
226
|
+
"description": "Test description",
|
|
227
|
+
"filePath": "CHANGELOG.txt",
|
|
228
|
+
"id": "test-finding-1",
|
|
229
|
+
"layer": 2,
|
|
230
|
+
"lineContent": "const x = 1;",
|
|
231
|
+
"lineNumber": 10,
|
|
232
|
+
"severity": "high",
|
|
233
|
+
"suggestedFix": "Fix it",
|
|
234
|
+
"title": "Test Finding",
|
|
235
|
+
},
|
|
236
|
+
"reason": "Finding in documentation file",
|
|
237
|
+
"rule": "documentation_file",
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
"toValidate": Array [],
|
|
241
|
+
}
|
|
242
|
+
`;
|
|
243
|
+
|
|
244
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Environment variable reference auto-dismiss should NOT auto-dismiss actual hardcoded secrets 1`] = `
|
|
245
|
+
Object {
|
|
246
|
+
"dismissed": Array [],
|
|
247
|
+
"toValidate": Array [
|
|
248
|
+
Object {
|
|
249
|
+
"category": "hardcoded_secret",
|
|
250
|
+
"confidence": "high",
|
|
251
|
+
"description": "Test description",
|
|
252
|
+
"filePath": "src/handler.ts",
|
|
253
|
+
"id": "test-finding-1",
|
|
254
|
+
"layer": 2,
|
|
255
|
+
"lineContent": "const apiKey = \\"sk-1234567890abcdef\\";",
|
|
256
|
+
"lineNumber": 10,
|
|
257
|
+
"severity": "high",
|
|
258
|
+
"suggestedFix": "Fix it",
|
|
259
|
+
"title": "Test Finding",
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
}
|
|
263
|
+
`;
|
|
264
|
+
|
|
265
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Environment variable reference auto-dismiss should auto-dismiss env var references flagged as secrets 1`] = `
|
|
266
|
+
Object {
|
|
267
|
+
"dismissed": Array [
|
|
268
|
+
Object {
|
|
269
|
+
"finding": Object {
|
|
270
|
+
"category": "hardcoded_secret",
|
|
271
|
+
"confidence": "high",
|
|
272
|
+
"description": "Test description",
|
|
273
|
+
"filePath": "src/handler.ts",
|
|
274
|
+
"id": "test-finding-1",
|
|
275
|
+
"layer": 2,
|
|
276
|
+
"lineContent": "const apiKey = process.env.API_KEY;",
|
|
277
|
+
"lineNumber": 10,
|
|
278
|
+
"severity": "high",
|
|
279
|
+
"suggestedFix": "Fix it",
|
|
280
|
+
"title": "Test Finding",
|
|
281
|
+
},
|
|
282
|
+
"reason": "Uses environment variable (not hardcoded)",
|
|
283
|
+
"rule": "env_var_reference",
|
|
284
|
+
},
|
|
285
|
+
Object {
|
|
286
|
+
"finding": Object {
|
|
287
|
+
"category": "high_entropy_string",
|
|
288
|
+
"confidence": "high",
|
|
289
|
+
"description": "Test description",
|
|
290
|
+
"filePath": "src/handler.ts",
|
|
291
|
+
"id": "test-finding-1",
|
|
292
|
+
"layer": 2,
|
|
293
|
+
"lineContent": "const secret = process.env.SECRET_KEY;",
|
|
294
|
+
"lineNumber": 10,
|
|
295
|
+
"severity": "high",
|
|
296
|
+
"suggestedFix": "Fix it",
|
|
297
|
+
"title": "Test Finding",
|
|
298
|
+
},
|
|
299
|
+
"reason": "Uses environment variable (not hardcoded)",
|
|
300
|
+
"rule": "env_var_reference",
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
"toValidate": Array [],
|
|
304
|
+
}
|
|
305
|
+
`;
|
|
306
|
+
|
|
307
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Example file auto-dismiss should auto-dismiss findings in example files 1`] = `
|
|
308
|
+
Object {
|
|
309
|
+
"dismissed": Array [
|
|
310
|
+
Object {
|
|
311
|
+
"finding": Object {
|
|
312
|
+
"category": "dangerous_function",
|
|
313
|
+
"confidence": "high",
|
|
314
|
+
"description": "Test description",
|
|
315
|
+
"filePath": "src/examples/demo.ts",
|
|
316
|
+
"id": "test-finding-1",
|
|
317
|
+
"layer": 2,
|
|
318
|
+
"lineContent": "const x = 1;",
|
|
319
|
+
"lineNumber": 10,
|
|
320
|
+
"severity": "high",
|
|
321
|
+
"suggestedFix": "Fix it",
|
|
322
|
+
"title": "Test Finding",
|
|
323
|
+
},
|
|
324
|
+
"reason": "Finding in example/demo file",
|
|
325
|
+
"rule": "example_file",
|
|
326
|
+
},
|
|
327
|
+
],
|
|
328
|
+
"toValidate": Array [
|
|
329
|
+
Object {
|
|
330
|
+
"category": "dangerous_function",
|
|
331
|
+
"confidence": "high",
|
|
332
|
+
"description": "Test description",
|
|
333
|
+
"filePath": "examples/basic-usage.ts",
|
|
334
|
+
"id": "test-finding-1",
|
|
335
|
+
"layer": 2,
|
|
336
|
+
"lineContent": "const x = 1;",
|
|
337
|
+
"lineNumber": 10,
|
|
338
|
+
"severity": "high",
|
|
339
|
+
"suggestedFix": "Fix it",
|
|
340
|
+
"title": "Test Finding",
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
}
|
|
344
|
+
`;
|
|
345
|
+
|
|
346
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Generic message auto-dismiss should auto-dismiss generic success/error messages 1`] = `
|
|
347
|
+
Object {
|
|
348
|
+
"dismissed": Array [
|
|
349
|
+
Object {
|
|
350
|
+
"finding": Object {
|
|
351
|
+
"category": "ai_pattern",
|
|
352
|
+
"confidence": "high",
|
|
353
|
+
"description": "Test description",
|
|
354
|
+
"filePath": "src/handler.ts",
|
|
355
|
+
"id": "test-finding-1",
|
|
356
|
+
"layer": 2,
|
|
357
|
+
"lineContent": "console.log(\\"success\\");",
|
|
358
|
+
"lineNumber": 10,
|
|
359
|
+
"severity": "high",
|
|
360
|
+
"suggestedFix": "Fix it",
|
|
361
|
+
"title": "Test Finding",
|
|
362
|
+
},
|
|
363
|
+
"reason": "Generic UI message (not security-relevant)",
|
|
364
|
+
"rule": "generic_message",
|
|
365
|
+
},
|
|
366
|
+
Object {
|
|
367
|
+
"finding": Object {
|
|
368
|
+
"category": "ai_pattern",
|
|
369
|
+
"confidence": "high",
|
|
370
|
+
"description": "Test description",
|
|
371
|
+
"filePath": "src/handler.ts",
|
|
372
|
+
"id": "test-finding-1",
|
|
373
|
+
"layer": 2,
|
|
374
|
+
"lineContent": "throw new Error(\\"something went wrong\\");",
|
|
375
|
+
"lineNumber": 10,
|
|
376
|
+
"severity": "high",
|
|
377
|
+
"suggestedFix": "Fix it",
|
|
378
|
+
"title": "Test Finding",
|
|
379
|
+
},
|
|
380
|
+
"reason": "Generic UI message (not security-relevant)",
|
|
381
|
+
"rule": "generic_message",
|
|
382
|
+
},
|
|
383
|
+
],
|
|
384
|
+
"toValidate": Array [],
|
|
385
|
+
}
|
|
386
|
+
`;
|
|
387
|
+
|
|
388
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Health check endpoint auto-dismiss should NOT auto-dismiss other missing_auth findings 1`] = `
|
|
389
|
+
Object {
|
|
390
|
+
"dismissed": Array [],
|
|
391
|
+
"toValidate": Array [
|
|
392
|
+
Object {
|
|
393
|
+
"category": "missing_auth",
|
|
394
|
+
"confidence": "high",
|
|
395
|
+
"description": "Test description",
|
|
396
|
+
"filePath": "src/api/users.ts",
|
|
397
|
+
"id": "test-finding-1",
|
|
398
|
+
"layer": 2,
|
|
399
|
+
"lineContent": "app.post(\\"/api/users\\", createUser)",
|
|
400
|
+
"lineNumber": 10,
|
|
401
|
+
"severity": "high",
|
|
402
|
+
"suggestedFix": "Fix it",
|
|
403
|
+
"title": "Test Finding",
|
|
404
|
+
},
|
|
405
|
+
],
|
|
406
|
+
}
|
|
407
|
+
`;
|
|
408
|
+
|
|
409
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Health check endpoint auto-dismiss should auto-dismiss health check missing_auth findings 1`] = `
|
|
410
|
+
Object {
|
|
411
|
+
"dismissed": Array [
|
|
412
|
+
Object {
|
|
413
|
+
"finding": Object {
|
|
414
|
+
"category": "missing_auth",
|
|
415
|
+
"confidence": "high",
|
|
416
|
+
"description": "Test description",
|
|
417
|
+
"filePath": "src/api/health.ts",
|
|
418
|
+
"id": "test-finding-1",
|
|
419
|
+
"layer": 2,
|
|
420
|
+
"lineContent": "app.get(\\"/health\\", (req, res) => res.send(\\"ok\\"))",
|
|
421
|
+
"lineNumber": 10,
|
|
422
|
+
"severity": "high",
|
|
423
|
+
"suggestedFix": "Fix it",
|
|
424
|
+
"title": "Test Finding",
|
|
425
|
+
},
|
|
426
|
+
"reason": "Public health check endpoint (auth not required)",
|
|
427
|
+
"rule": "health_check_endpoint",
|
|
428
|
+
},
|
|
429
|
+
Object {
|
|
430
|
+
"finding": Object {
|
|
431
|
+
"category": "missing_auth",
|
|
432
|
+
"confidence": "high",
|
|
433
|
+
"description": "Test description",
|
|
434
|
+
"filePath": "src/routes/health.ts",
|
|
435
|
+
"id": "test-finding-1",
|
|
436
|
+
"layer": 2,
|
|
437
|
+
"lineContent": "router.get(\\"/api/healthcheck\\", handler)",
|
|
438
|
+
"lineNumber": 10,
|
|
439
|
+
"severity": "high",
|
|
440
|
+
"suggestedFix": "Fix it",
|
|
441
|
+
"title": "Test Finding",
|
|
442
|
+
},
|
|
443
|
+
"reason": "Public health check endpoint (auth not required)",
|
|
444
|
+
"rule": "health_check_endpoint",
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
"toValidate": Array [],
|
|
448
|
+
}
|
|
449
|
+
`;
|
|
450
|
+
|
|
451
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Info severity auto-dismiss (core tier only) should NOT auto-dismiss info severity for AI-assisted tier 1`] = `
|
|
452
|
+
Object {
|
|
453
|
+
"dismissed": Array [],
|
|
454
|
+
"toValidate": Array [
|
|
455
|
+
Object {
|
|
456
|
+
"category": "ai_pattern",
|
|
457
|
+
"confidence": "high",
|
|
458
|
+
"description": "Test description",
|
|
459
|
+
"filePath": "src/handler.ts",
|
|
460
|
+
"id": "test-finding-1",
|
|
461
|
+
"layer": 2,
|
|
462
|
+
"lineContent": "const x = 1;",
|
|
463
|
+
"lineNumber": 10,
|
|
464
|
+
"severity": "info",
|
|
465
|
+
"suggestedFix": "Fix it",
|
|
466
|
+
"title": "Test Finding",
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
}
|
|
470
|
+
`;
|
|
471
|
+
|
|
472
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Info severity auto-dismiss (core tier only) should auto-dismiss info severity for core tier findings 1`] = `
|
|
473
|
+
Object {
|
|
474
|
+
"dismissed": Array [
|
|
475
|
+
Object {
|
|
476
|
+
"finding": Object {
|
|
477
|
+
"category": "dangerous_function",
|
|
478
|
+
"confidence": "high",
|
|
479
|
+
"description": "Test description",
|
|
480
|
+
"filePath": "src/handler.ts",
|
|
481
|
+
"id": "test-finding-1",
|
|
482
|
+
"layer": 2,
|
|
483
|
+
"lineContent": "const x = 1;",
|
|
484
|
+
"lineNumber": 10,
|
|
485
|
+
"severity": "info",
|
|
486
|
+
"suggestedFix": "Fix it",
|
|
487
|
+
"title": "Test Finding",
|
|
488
|
+
},
|
|
489
|
+
"reason": "Already info severity for core detector (low priority)",
|
|
490
|
+
"rule": "info_severity_core_only",
|
|
491
|
+
},
|
|
492
|
+
Object {
|
|
493
|
+
"finding": Object {
|
|
494
|
+
"category": "hardcoded_secret",
|
|
495
|
+
"confidence": "high",
|
|
496
|
+
"description": "Test description",
|
|
497
|
+
"filePath": "src/handler.ts",
|
|
498
|
+
"id": "test-finding-1",
|
|
499
|
+
"layer": 1,
|
|
500
|
+
"lineContent": "const x = 1;",
|
|
501
|
+
"lineNumber": 10,
|
|
502
|
+
"severity": "info",
|
|
503
|
+
"suggestedFix": "Fix it",
|
|
504
|
+
"title": "Test Finding",
|
|
505
|
+
},
|
|
506
|
+
"reason": "Already info severity for core detector (low priority)",
|
|
507
|
+
"rule": "info_severity_core_only",
|
|
508
|
+
},
|
|
509
|
+
],
|
|
510
|
+
"toValidate": Array [],
|
|
511
|
+
}
|
|
512
|
+
`;
|
|
513
|
+
|
|
514
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Mixed findings should correctly filter mixed findings 1`] = `
|
|
515
|
+
Object {
|
|
516
|
+
"dismissed": Array [
|
|
517
|
+
Object {
|
|
518
|
+
"finding": Object {
|
|
519
|
+
"category": "dangerous_function",
|
|
520
|
+
"confidence": "high",
|
|
521
|
+
"description": "Test description",
|
|
522
|
+
"filePath": "src/__tests__/handler.test.ts",
|
|
523
|
+
"id": "1",
|
|
524
|
+
"layer": 2,
|
|
525
|
+
"lineContent": "const x = 1;",
|
|
526
|
+
"lineNumber": 10,
|
|
527
|
+
"severity": "high",
|
|
528
|
+
"suggestedFix": "Fix it",
|
|
529
|
+
"title": "Test Finding",
|
|
530
|
+
},
|
|
531
|
+
"reason": "Finding in test/mock file",
|
|
532
|
+
"rule": "test_file",
|
|
533
|
+
},
|
|
534
|
+
Object {
|
|
535
|
+
"finding": Object {
|
|
536
|
+
"category": "hardcoded_secret",
|
|
537
|
+
"confidence": "high",
|
|
538
|
+
"description": "Test description",
|
|
539
|
+
"filePath": "src/config.ts",
|
|
540
|
+
"id": "3",
|
|
541
|
+
"layer": 2,
|
|
542
|
+
"lineContent": "const key = process.env.SECRET;",
|
|
543
|
+
"lineNumber": 10,
|
|
544
|
+
"severity": "high",
|
|
545
|
+
"suggestedFix": "Fix it",
|
|
546
|
+
"title": "Test Finding",
|
|
547
|
+
},
|
|
548
|
+
"reason": "Uses environment variable (not hardcoded)",
|
|
549
|
+
"rule": "env_var_reference",
|
|
550
|
+
},
|
|
551
|
+
Object {
|
|
552
|
+
"finding": Object {
|
|
553
|
+
"category": "dangerous_function",
|
|
554
|
+
"confidence": "high",
|
|
555
|
+
"description": "Test description",
|
|
556
|
+
"filePath": "src/util.ts",
|
|
557
|
+
"id": "5",
|
|
558
|
+
"layer": 2,
|
|
559
|
+
"lineContent": "const x = 1;",
|
|
560
|
+
"lineNumber": 10,
|
|
561
|
+
"severity": "info",
|
|
562
|
+
"suggestedFix": "Fix it",
|
|
563
|
+
"title": "Test Finding",
|
|
564
|
+
},
|
|
565
|
+
"reason": "Already info severity for core detector (low priority)",
|
|
566
|
+
"rule": "info_severity_core_only",
|
|
567
|
+
},
|
|
568
|
+
],
|
|
569
|
+
"toValidate": Array [
|
|
570
|
+
Object {
|
|
571
|
+
"category": "dangerous_function",
|
|
572
|
+
"confidence": "high",
|
|
573
|
+
"description": "Test description",
|
|
574
|
+
"filePath": "src/api/handler.ts",
|
|
575
|
+
"id": "2",
|
|
576
|
+
"layer": 2,
|
|
577
|
+
"lineContent": "const x = 1;",
|
|
578
|
+
"lineNumber": 10,
|
|
579
|
+
"severity": "high",
|
|
580
|
+
"suggestedFix": "Fix it",
|
|
581
|
+
"title": "Test Finding",
|
|
582
|
+
},
|
|
583
|
+
Object {
|
|
584
|
+
"category": "hardcoded_secret",
|
|
585
|
+
"confidence": "high",
|
|
586
|
+
"description": "Test description",
|
|
587
|
+
"filePath": "src/config.ts",
|
|
588
|
+
"id": "4",
|
|
589
|
+
"layer": 2,
|
|
590
|
+
"lineContent": "const key = \\"actual-secret-value\\";",
|
|
591
|
+
"lineNumber": 10,
|
|
592
|
+
"severity": "high",
|
|
593
|
+
"suggestedFix": "Fix it",
|
|
594
|
+
"title": "Test Finding",
|
|
595
|
+
},
|
|
596
|
+
],
|
|
597
|
+
}
|
|
598
|
+
`;
|
|
599
|
+
|
|
600
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Scanner code auto-dismiss should auto-dismiss findings in scanner/fixture code 1`] = `
|
|
601
|
+
Object {
|
|
602
|
+
"dismissed": Array [
|
|
603
|
+
Object {
|
|
604
|
+
"finding": Object {
|
|
605
|
+
"category": "dangerous_function",
|
|
606
|
+
"confidence": "high",
|
|
607
|
+
"description": "Test description",
|
|
608
|
+
"filePath": "packages/scanner/src/layer1/patterns.ts",
|
|
609
|
+
"id": "test-finding-1",
|
|
610
|
+
"layer": 2,
|
|
611
|
+
"lineContent": "const x = 1;",
|
|
612
|
+
"lineNumber": 10,
|
|
613
|
+
"severity": "high",
|
|
614
|
+
"suggestedFix": "Fix it",
|
|
615
|
+
"title": "Test Finding",
|
|
616
|
+
},
|
|
617
|
+
"reason": "Finding in scanner/fixture code",
|
|
618
|
+
"rule": "scanner_code",
|
|
619
|
+
},
|
|
620
|
+
Object {
|
|
621
|
+
"finding": Object {
|
|
622
|
+
"category": "dangerous_function",
|
|
623
|
+
"confidence": "high",
|
|
624
|
+
"description": "Test description",
|
|
625
|
+
"filePath": "src/__tests__/fixtures/vulnerable.ts",
|
|
626
|
+
"id": "test-finding-1",
|
|
627
|
+
"layer": 2,
|
|
628
|
+
"lineContent": "const x = 1;",
|
|
629
|
+
"lineNumber": 10,
|
|
630
|
+
"severity": "high",
|
|
631
|
+
"suggestedFix": "Fix it",
|
|
632
|
+
"title": "Test Finding",
|
|
633
|
+
},
|
|
634
|
+
"reason": "Finding in test/mock file",
|
|
635
|
+
"rule": "test_file",
|
|
636
|
+
},
|
|
637
|
+
],
|
|
638
|
+
"toValidate": Array [],
|
|
639
|
+
}
|
|
640
|
+
`;
|
|
641
|
+
|
|
642
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Test file auto-dismiss should auto-dismiss findings in mock files 1`] = `
|
|
643
|
+
Object {
|
|
644
|
+
"dismissed": Array [],
|
|
645
|
+
"toValidate": Array [
|
|
646
|
+
Object {
|
|
647
|
+
"category": "dangerous_function",
|
|
648
|
+
"confidence": "high",
|
|
649
|
+
"description": "Test description",
|
|
650
|
+
"filePath": "src/__mocks__/api.ts",
|
|
651
|
+
"id": "test-finding-1",
|
|
652
|
+
"layer": 2,
|
|
653
|
+
"lineContent": "const x = 1;",
|
|
654
|
+
"lineNumber": 10,
|
|
655
|
+
"severity": "high",
|
|
656
|
+
"suggestedFix": "Fix it",
|
|
657
|
+
"title": "Test Finding",
|
|
658
|
+
},
|
|
659
|
+
Object {
|
|
660
|
+
"category": "dangerous_function",
|
|
661
|
+
"confidence": "high",
|
|
662
|
+
"description": "Test description",
|
|
663
|
+
"filePath": "mocks/handler.ts",
|
|
664
|
+
"id": "test-finding-1",
|
|
665
|
+
"layer": 2,
|
|
666
|
+
"lineContent": "const x = 1;",
|
|
667
|
+
"lineNumber": 10,
|
|
668
|
+
"severity": "high",
|
|
669
|
+
"suggestedFix": "Fix it",
|
|
670
|
+
"title": "Test Finding",
|
|
671
|
+
},
|
|
672
|
+
],
|
|
673
|
+
}
|
|
674
|
+
`;
|
|
675
|
+
|
|
676
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Test file auto-dismiss should auto-dismiss findings in test files 1`] = `
|
|
677
|
+
Object {
|
|
678
|
+
"dismissed": Array [
|
|
679
|
+
Object {
|
|
680
|
+
"finding": Object {
|
|
681
|
+
"category": "dangerous_function",
|
|
682
|
+
"confidence": "high",
|
|
683
|
+
"description": "Test description",
|
|
684
|
+
"filePath": "src/__tests__/handler.test.ts",
|
|
685
|
+
"id": "test-finding-1",
|
|
686
|
+
"layer": 2,
|
|
687
|
+
"lineContent": "const x = 1;",
|
|
688
|
+
"lineNumber": 10,
|
|
689
|
+
"severity": "high",
|
|
690
|
+
"suggestedFix": "Fix it",
|
|
691
|
+
"title": "Test Finding",
|
|
692
|
+
},
|
|
693
|
+
"reason": "Finding in test/mock file",
|
|
694
|
+
"rule": "test_file",
|
|
695
|
+
},
|
|
696
|
+
Object {
|
|
697
|
+
"finding": Object {
|
|
698
|
+
"category": "dangerous_function",
|
|
699
|
+
"confidence": "high",
|
|
700
|
+
"description": "Test description",
|
|
701
|
+
"filePath": "src/handler.spec.ts",
|
|
702
|
+
"id": "test-finding-1",
|
|
703
|
+
"layer": 2,
|
|
704
|
+
"lineContent": "const x = 1;",
|
|
705
|
+
"lineNumber": 10,
|
|
706
|
+
"severity": "high",
|
|
707
|
+
"suggestedFix": "Fix it",
|
|
708
|
+
"title": "Test Finding",
|
|
709
|
+
},
|
|
710
|
+
"reason": "Finding in test/mock file",
|
|
711
|
+
"rule": "test_file",
|
|
712
|
+
},
|
|
713
|
+
Object {
|
|
714
|
+
"finding": Object {
|
|
715
|
+
"category": "dangerous_function",
|
|
716
|
+
"confidence": "high",
|
|
717
|
+
"description": "Test description",
|
|
718
|
+
"filePath": "tests/integration/api.test.js",
|
|
719
|
+
"id": "test-finding-1",
|
|
720
|
+
"layer": 2,
|
|
721
|
+
"lineContent": "const x = 1;",
|
|
722
|
+
"lineNumber": 10,
|
|
723
|
+
"severity": "high",
|
|
724
|
+
"suggestedFix": "Fix it",
|
|
725
|
+
"title": "Test Finding",
|
|
726
|
+
},
|
|
727
|
+
"reason": "Finding in test/mock file",
|
|
728
|
+
"rule": "test_file",
|
|
729
|
+
},
|
|
730
|
+
],
|
|
731
|
+
"toValidate": Array [],
|
|
732
|
+
}
|
|
733
|
+
`;
|
|
734
|
+
|
|
735
|
+
exports[`Refactor Safety - anthropic.ts Auto-Dismiss Rules Type definition any auto-dismiss should auto-dismiss any type in .d.ts files 1`] = `
|
|
736
|
+
Object {
|
|
737
|
+
"dismissed": Array [
|
|
738
|
+
Object {
|
|
739
|
+
"finding": Object {
|
|
740
|
+
"category": "ai_pattern",
|
|
741
|
+
"confidence": "high",
|
|
742
|
+
"description": "Test description",
|
|
743
|
+
"filePath": "types/global.d.ts",
|
|
744
|
+
"id": "test-finding-1",
|
|
745
|
+
"layer": 2,
|
|
746
|
+
"lineContent": "const x = 1;",
|
|
747
|
+
"lineNumber": 10,
|
|
748
|
+
"severity": "high",
|
|
749
|
+
"suggestedFix": "Fix it",
|
|
750
|
+
"title": "TypeScript any usage",
|
|
751
|
+
},
|
|
752
|
+
"reason": "Type definition (not runtime code)",
|
|
753
|
+
"rule": "type_definition_any",
|
|
754
|
+
},
|
|
755
|
+
],
|
|
756
|
+
"toValidate": Array [],
|
|
757
|
+
}
|
|
758
|
+
`;
|