@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,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Finding Hash Computation
|
|
4
|
+
* Creates stable, reproducible hashes for identifying specific findings
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.normalizePathForHash = normalizePathForHash;
|
|
8
|
+
exports.normalizeContentForHash = normalizeContentForHash;
|
|
9
|
+
exports.computeFindingHash = computeFindingHash;
|
|
10
|
+
exports.computeHashFromComponents = computeHashFromComponents;
|
|
11
|
+
exports.isValidHash = isValidHash;
|
|
12
|
+
exports.formatHashForDisplay = formatHashForDisplay;
|
|
13
|
+
const crypto_1 = require("crypto");
|
|
14
|
+
/**
|
|
15
|
+
* Normalize a file path for hashing
|
|
16
|
+
* - Removes leading ./ or /
|
|
17
|
+
* - Converts backslashes to forward slashes
|
|
18
|
+
* - Lowercases (for case-insensitive matching)
|
|
19
|
+
*/
|
|
20
|
+
function normalizePathForHash(filePath) {
|
|
21
|
+
return filePath
|
|
22
|
+
.replace(/^\.\//, '') // Remove leading ./
|
|
23
|
+
.replace(/^\//, '') // Remove leading /
|
|
24
|
+
.replace(/\\/g, '/') // Normalize backslashes
|
|
25
|
+
.toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Normalize line content for hashing
|
|
29
|
+
* - Trims whitespace
|
|
30
|
+
* - Collapses multiple whitespace to single space
|
|
31
|
+
* - Removes common noise (line numbers, etc.)
|
|
32
|
+
*/
|
|
33
|
+
function normalizeContentForHash(content) {
|
|
34
|
+
return content
|
|
35
|
+
.trim()
|
|
36
|
+
.replace(/\s+/g, ' ') // Collapse whitespace
|
|
37
|
+
.replace(/^\d+:\s*/, ''); // Remove line number prefix if present
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Compute a stable hash for a vulnerability finding
|
|
41
|
+
*
|
|
42
|
+
* Hash = SHA256(normalizedPath:normalizedContent:category).slice(0,16)
|
|
43
|
+
*
|
|
44
|
+
* This creates a 16-character hex hash that:
|
|
45
|
+
* - Stays stable across whitespace changes
|
|
46
|
+
* - Changes when the actual code changes
|
|
47
|
+
* - Changes when the finding category changes
|
|
48
|
+
* - Is unique enough for practical use
|
|
49
|
+
*
|
|
50
|
+
* @param finding - The vulnerability to hash
|
|
51
|
+
* @returns A 16-character hex hash string
|
|
52
|
+
*/
|
|
53
|
+
function computeFindingHash(finding) {
|
|
54
|
+
const normalizedPath = normalizePathForHash(finding.filePath);
|
|
55
|
+
const normalizedContent = normalizeContentForHash(finding.lineContent);
|
|
56
|
+
const category = finding.category;
|
|
57
|
+
const input = `${normalizedPath}:${normalizedContent}:${category}`;
|
|
58
|
+
const hash = (0, crypto_1.createHash)('sha256').update(input).digest('hex');
|
|
59
|
+
// Return first 16 characters (64 bits of entropy - sufficient for uniqueness)
|
|
60
|
+
return hash.slice(0, 16);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Compute hash from raw components (for testing or manual construction)
|
|
64
|
+
*/
|
|
65
|
+
function computeHashFromComponents(filePath, lineContent, category) {
|
|
66
|
+
const normalizedPath = normalizePathForHash(filePath);
|
|
67
|
+
const normalizedContent = normalizeContentForHash(lineContent);
|
|
68
|
+
const input = `${normalizedPath}:${normalizedContent}:${category}`;
|
|
69
|
+
const hash = (0, crypto_1.createHash)('sha256').update(input).digest('hex');
|
|
70
|
+
return hash.slice(0, 16);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate a hash format
|
|
74
|
+
* Must be 16 hexadecimal characters
|
|
75
|
+
*/
|
|
76
|
+
function isValidHash(hash) {
|
|
77
|
+
return /^[0-9a-f]{16}$/i.test(hash);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Format a hash for display (with truncation indicator)
|
|
81
|
+
*/
|
|
82
|
+
function formatHashForDisplay(hash) {
|
|
83
|
+
if (hash.length <= 16) {
|
|
84
|
+
return hash;
|
|
85
|
+
}
|
|
86
|
+
return `${hash.slice(0, 12)}...`;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/suppression/hash.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAWH,oDAMC;AAQD,0DAKC;AAgBD,gDAUC;AAKD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,iBAAiB,GAAG,uBAAuB,CAAC,WAAW,CAAC,CAAA;IAE9D,MAAM,KAAK,GAAG,GAAG,cAAc,IAAI,iBAAiB,IAAI,QAAQ,EAAE,CAAA;IAClE,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAE7D,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAC1B,CAAC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,IAAY;IACtC,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACrC,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QACtB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAA;AAClC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suppression System
|
|
3
|
+
* Allows users to suppress findings via config files and inline comments
|
|
4
|
+
*/
|
|
5
|
+
export { SuppressionManager, type SuppressionManagerOptions } from './manager';
|
|
6
|
+
export type { SuppressionConfig, RuleSuppression, FindingSuppression, InlineSuppression, SuppressionMatch, SuppressedVulnerability, SuppressionResult, } from './types';
|
|
7
|
+
export { SUPPRESSION_CONFIG_FILES, DEFAULT_SUPPRESSION_CONFIG } from './types';
|
|
8
|
+
export { computeFindingHash, computeHashFromComponents, normalizePathForHash, normalizeContentForHash, isValidHash, formatHashForDisplay, } from './hash';
|
|
9
|
+
export { loadSuppressionConfig, loadConfigFromPath, findConfigFile, writeSuppressionConfig, addFindingSuppression, removeFindingSuppression, addRuleSuppression, listSuppressions, isExpired, type ConfigLoadResult, } from './config-loader';
|
|
10
|
+
export { parseInlineSuppressions, isLineSuppressed, extractSuppressionReasons, generateSuppressionComment, } from './inline-parser';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/suppression/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,WAAW,CAAA;AAG9E,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAG9E,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,EACX,oBAAoB,GACrB,MAAM,QAAQ,CAAA;AAGf,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Suppression System
|
|
4
|
+
* Allows users to suppress findings via config files and inline comments
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.generateSuppressionComment = exports.extractSuppressionReasons = exports.isLineSuppressed = exports.parseInlineSuppressions = exports.isExpired = exports.listSuppressions = exports.addRuleSuppression = exports.removeFindingSuppression = exports.addFindingSuppression = exports.writeSuppressionConfig = exports.findConfigFile = exports.loadConfigFromPath = exports.loadSuppressionConfig = exports.formatHashForDisplay = exports.isValidHash = exports.normalizeContentForHash = exports.normalizePathForHash = exports.computeHashFromComponents = exports.computeFindingHash = exports.DEFAULT_SUPPRESSION_CONFIG = exports.SUPPRESSION_CONFIG_FILES = exports.SuppressionManager = void 0;
|
|
8
|
+
// Main exports
|
|
9
|
+
var manager_1 = require("./manager");
|
|
10
|
+
Object.defineProperty(exports, "SuppressionManager", { enumerable: true, get: function () { return manager_1.SuppressionManager; } });
|
|
11
|
+
var types_1 = require("./types");
|
|
12
|
+
Object.defineProperty(exports, "SUPPRESSION_CONFIG_FILES", { enumerable: true, get: function () { return types_1.SUPPRESSION_CONFIG_FILES; } });
|
|
13
|
+
Object.defineProperty(exports, "DEFAULT_SUPPRESSION_CONFIG", { enumerable: true, get: function () { return types_1.DEFAULT_SUPPRESSION_CONFIG; } });
|
|
14
|
+
// Hash utilities
|
|
15
|
+
var hash_1 = require("./hash");
|
|
16
|
+
Object.defineProperty(exports, "computeFindingHash", { enumerable: true, get: function () { return hash_1.computeFindingHash; } });
|
|
17
|
+
Object.defineProperty(exports, "computeHashFromComponents", { enumerable: true, get: function () { return hash_1.computeHashFromComponents; } });
|
|
18
|
+
Object.defineProperty(exports, "normalizePathForHash", { enumerable: true, get: function () { return hash_1.normalizePathForHash; } });
|
|
19
|
+
Object.defineProperty(exports, "normalizeContentForHash", { enumerable: true, get: function () { return hash_1.normalizeContentForHash; } });
|
|
20
|
+
Object.defineProperty(exports, "isValidHash", { enumerable: true, get: function () { return hash_1.isValidHash; } });
|
|
21
|
+
Object.defineProperty(exports, "formatHashForDisplay", { enumerable: true, get: function () { return hash_1.formatHashForDisplay; } });
|
|
22
|
+
// Config utilities
|
|
23
|
+
var config_loader_1 = require("./config-loader");
|
|
24
|
+
Object.defineProperty(exports, "loadSuppressionConfig", { enumerable: true, get: function () { return config_loader_1.loadSuppressionConfig; } });
|
|
25
|
+
Object.defineProperty(exports, "loadConfigFromPath", { enumerable: true, get: function () { return config_loader_1.loadConfigFromPath; } });
|
|
26
|
+
Object.defineProperty(exports, "findConfigFile", { enumerable: true, get: function () { return config_loader_1.findConfigFile; } });
|
|
27
|
+
Object.defineProperty(exports, "writeSuppressionConfig", { enumerable: true, get: function () { return config_loader_1.writeSuppressionConfig; } });
|
|
28
|
+
Object.defineProperty(exports, "addFindingSuppression", { enumerable: true, get: function () { return config_loader_1.addFindingSuppression; } });
|
|
29
|
+
Object.defineProperty(exports, "removeFindingSuppression", { enumerable: true, get: function () { return config_loader_1.removeFindingSuppression; } });
|
|
30
|
+
Object.defineProperty(exports, "addRuleSuppression", { enumerable: true, get: function () { return config_loader_1.addRuleSuppression; } });
|
|
31
|
+
Object.defineProperty(exports, "listSuppressions", { enumerable: true, get: function () { return config_loader_1.listSuppressions; } });
|
|
32
|
+
Object.defineProperty(exports, "isExpired", { enumerable: true, get: function () { return config_loader_1.isExpired; } });
|
|
33
|
+
// Inline comment utilities
|
|
34
|
+
var inline_parser_1 = require("./inline-parser");
|
|
35
|
+
Object.defineProperty(exports, "parseInlineSuppressions", { enumerable: true, get: function () { return inline_parser_1.parseInlineSuppressions; } });
|
|
36
|
+
Object.defineProperty(exports, "isLineSuppressed", { enumerable: true, get: function () { return inline_parser_1.isLineSuppressed; } });
|
|
37
|
+
Object.defineProperty(exports, "extractSuppressionReasons", { enumerable: true, get: function () { return inline_parser_1.extractSuppressionReasons; } });
|
|
38
|
+
Object.defineProperty(exports, "generateSuppressionComment", { enumerable: true, get: function () { return inline_parser_1.generateSuppressionComment; } });
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/suppression/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,eAAe;AACf,qCAA8E;AAArE,6GAAA,kBAAkB,OAAA;AAY3B,iCAA8E;AAArE,iHAAA,wBAAwB,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAE7D,iBAAiB;AACjB,+BAOe;AANb,0GAAA,kBAAkB,OAAA;AAClB,iHAAA,yBAAyB,OAAA;AACzB,4GAAA,oBAAoB,OAAA;AACpB,+GAAA,uBAAuB,OAAA;AACvB,mGAAA,WAAW,OAAA;AACX,4GAAA,oBAAoB,OAAA;AAGtB,mBAAmB;AACnB,iDAWwB;AAVtB,sHAAA,qBAAqB,OAAA;AACrB,mHAAA,kBAAkB,OAAA;AAClB,+GAAA,cAAc,OAAA;AACd,uHAAA,sBAAsB,OAAA;AACtB,sHAAA,qBAAqB,OAAA;AACrB,yHAAA,wBAAwB,OAAA;AACxB,mHAAA,kBAAkB,OAAA;AAClB,iHAAA,gBAAgB,OAAA;AAChB,0GAAA,SAAS,OAAA;AAIX,2BAA2B;AAC3B,iDAKwB;AAJtB,wHAAA,uBAAuB,OAAA;AACvB,iHAAA,gBAAgB,OAAA;AAChB,0HAAA,yBAAyB,OAAA;AACzB,2HAAA,0BAA0B,OAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline Suppression Comment Parser
|
|
3
|
+
* Parses oculum-ignore comments from source code
|
|
4
|
+
*/
|
|
5
|
+
import type { InlineSuppression } from './types';
|
|
6
|
+
import type { VulnerabilityCategory } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Parse all inline suppressions from file content
|
|
9
|
+
*
|
|
10
|
+
* Returns a map of line numbers to their effective suppressions.
|
|
11
|
+
* A line can be suppressed by:
|
|
12
|
+
* 1. A same-line comment (oculum-ignore)
|
|
13
|
+
* 2. A next-line comment on the previous line (oculum-ignore-next-line)
|
|
14
|
+
* 3. Being within a block suppression (oculum-ignore-block ... oculum-ignore-block-end)
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseInlineSuppressions(content: string): Map<number, InlineSuppression>;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a specific line is suppressed
|
|
19
|
+
*/
|
|
20
|
+
export declare function isLineSuppressed(suppressions: Map<number, InlineSuppression>, lineNumber: number, category?: VulnerabilityCategory): InlineSuppression | null;
|
|
21
|
+
/**
|
|
22
|
+
* Extract all unique suppression reasons from a file
|
|
23
|
+
* Useful for auditing suppressed findings
|
|
24
|
+
*/
|
|
25
|
+
export declare function extractSuppressionReasons(content: string): Array<{
|
|
26
|
+
reason: string;
|
|
27
|
+
ruleId?: VulnerabilityCategory;
|
|
28
|
+
lineNumber: number;
|
|
29
|
+
type: InlineSuppression['type'];
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Generate a suppression comment for a given line
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateSuppressionComment(reason: string, options?: {
|
|
35
|
+
type?: 'next-line' | 'same-line';
|
|
36
|
+
ruleId?: VulnerabilityCategory;
|
|
37
|
+
commentStyle?: '//' | '#' | '--';
|
|
38
|
+
}): string;
|
|
39
|
+
//# sourceMappingURL=inline-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-parser.d.ts","sourceRoot":"","sources":["../../src/suppression/inline-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAkHrD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CA+DvF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAC5C,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,iBAAiB,GAAG,IAAI,CAa1B;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;IAChE,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,qBAAqB,CAAA;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;CAChC,CAAC,CAyBD;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACP,IAAI,CAAC,EAAE,WAAW,GAAG,WAAW,CAAA;IAChC,MAAM,CAAC,EAAE,qBAAqB,CAAA;IAC9B,YAAY,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,IAAI,CAAA;CAC5B,GACL,MAAM,CAUR"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Inline Suppression Comment Parser
|
|
4
|
+
* Parses oculum-ignore comments from source code
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.parseInlineSuppressions = parseInlineSuppressions;
|
|
8
|
+
exports.isLineSuppressed = isLineSuppressed;
|
|
9
|
+
exports.extractSuppressionReasons = extractSuppressionReasons;
|
|
10
|
+
exports.generateSuppressionComment = generateSuppressionComment;
|
|
11
|
+
/**
|
|
12
|
+
* Valid suppression comment patterns:
|
|
13
|
+
*
|
|
14
|
+
* Single-line suppressions:
|
|
15
|
+
* // oculum-ignore-next-line: reason here
|
|
16
|
+
* // oculum-ignore-next-line [rule-id]: reason here
|
|
17
|
+
* code // oculum-ignore: reason here
|
|
18
|
+
* code // oculum-ignore [rule-id]: reason here
|
|
19
|
+
*
|
|
20
|
+
* Block suppressions:
|
|
21
|
+
* /* oculum-ignore-block: reason here * /
|
|
22
|
+
* ... code ...
|
|
23
|
+
* /* oculum-ignore-block-end * /
|
|
24
|
+
*
|
|
25
|
+
* Also supports:
|
|
26
|
+
* # oculum-ignore-next-line: reason (Python, Ruby, YAML, etc.)
|
|
27
|
+
* -- oculum-ignore-next-line: reason (SQL)
|
|
28
|
+
*/
|
|
29
|
+
// Regex patterns for parsing comments
|
|
30
|
+
const PATTERNS = {
|
|
31
|
+
// // oculum-ignore-next-line: reason
|
|
32
|
+
// // oculum-ignore-next-line [rule-id]: reason
|
|
33
|
+
nextLine: /(?:\/\/|#|--)\s*oculum-ignore-next-line(?:\s*\[([^\]]+)\])?\s*:\s*(.+)/i,
|
|
34
|
+
// code // oculum-ignore: reason
|
|
35
|
+
// code // oculum-ignore [rule-id]: reason
|
|
36
|
+
sameLine: /(?:\/\/|#|--)\s*oculum-ignore(?:\s*\[([^\]]+)\])?\s*:\s*(.+)/i,
|
|
37
|
+
// /* oculum-ignore-block: reason */
|
|
38
|
+
// /* oculum-ignore-block [rule-id]: reason */
|
|
39
|
+
blockStart: /\/\*\s*oculum-ignore-block(?:\s*\[([^\]]+)\])?\s*:\s*([^*]+)\*\//i,
|
|
40
|
+
// /* oculum-ignore-block-end */
|
|
41
|
+
blockEnd: /\/\*\s*oculum-ignore-block-end\s*\*\//i,
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Parse a single line for suppression comments
|
|
45
|
+
*/
|
|
46
|
+
function parseLineForSuppression(line, lineNumber) {
|
|
47
|
+
// Check for next-line suppression (must be the only thing on the line, aside from whitespace)
|
|
48
|
+
const trimmed = line.trim();
|
|
49
|
+
// Next-line pattern (comment at start of line)
|
|
50
|
+
if (trimmed.startsWith('//') ||
|
|
51
|
+
trimmed.startsWith('#') ||
|
|
52
|
+
trimmed.startsWith('--')) {
|
|
53
|
+
const nextLineMatch = trimmed.match(PATTERNS.nextLine);
|
|
54
|
+
if (nextLineMatch) {
|
|
55
|
+
return {
|
|
56
|
+
lineNumber,
|
|
57
|
+
type: 'next-line',
|
|
58
|
+
ruleId: nextLineMatch[1],
|
|
59
|
+
reason: nextLineMatch[2].trim(),
|
|
60
|
+
commentText: trimmed,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Same-line pattern (comment at end of line with code before)
|
|
65
|
+
// Only check if there's actual code before the comment
|
|
66
|
+
const sameLineMatch = line.match(PATTERNS.sameLine);
|
|
67
|
+
if (sameLineMatch) {
|
|
68
|
+
// Find where the comment starts
|
|
69
|
+
const commentIndex = line.search(/(?:\/\/|#|--)\s*oculum-ignore/i);
|
|
70
|
+
const beforeComment = line.substring(0, commentIndex).trim();
|
|
71
|
+
// Only treat as same-line if there's code before the comment
|
|
72
|
+
// (not just whitespace or if it's at the start)
|
|
73
|
+
if (beforeComment.length > 0) {
|
|
74
|
+
return {
|
|
75
|
+
lineNumber,
|
|
76
|
+
type: 'same-line',
|
|
77
|
+
ruleId: sameLineMatch[1],
|
|
78
|
+
reason: sameLineMatch[2].trim(),
|
|
79
|
+
commentText: line.substring(commentIndex).trim(),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Block start pattern
|
|
84
|
+
const blockStartMatch = line.match(PATTERNS.blockStart);
|
|
85
|
+
if (blockStartMatch) {
|
|
86
|
+
return {
|
|
87
|
+
lineNumber,
|
|
88
|
+
type: 'block-start',
|
|
89
|
+
ruleId: blockStartMatch[1],
|
|
90
|
+
reason: blockStartMatch[2].trim(),
|
|
91
|
+
commentText: blockStartMatch[0],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// Block end pattern
|
|
95
|
+
const blockEndMatch = line.match(PATTERNS.blockEnd);
|
|
96
|
+
if (blockEndMatch) {
|
|
97
|
+
return {
|
|
98
|
+
lineNumber,
|
|
99
|
+
type: 'block-end',
|
|
100
|
+
reason: '', // Block end has no reason
|
|
101
|
+
commentText: blockEndMatch[0],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Parse all inline suppressions from file content
|
|
108
|
+
*
|
|
109
|
+
* Returns a map of line numbers to their effective suppressions.
|
|
110
|
+
* A line can be suppressed by:
|
|
111
|
+
* 1. A same-line comment (oculum-ignore)
|
|
112
|
+
* 2. A next-line comment on the previous line (oculum-ignore-next-line)
|
|
113
|
+
* 3. Being within a block suppression (oculum-ignore-block ... oculum-ignore-block-end)
|
|
114
|
+
*/
|
|
115
|
+
function parseInlineSuppressions(content) {
|
|
116
|
+
const lines = content.split('\n');
|
|
117
|
+
const suppressions = new Map();
|
|
118
|
+
// Track block suppression state
|
|
119
|
+
let currentBlock = null;
|
|
120
|
+
for (let i = 0; i < lines.length; i++) {
|
|
121
|
+
const lineNumber = i + 1; // 1-indexed
|
|
122
|
+
const line = lines[i];
|
|
123
|
+
const suppression = parseLineForSuppression(line, lineNumber);
|
|
124
|
+
if (suppression) {
|
|
125
|
+
switch (suppression.type) {
|
|
126
|
+
case 'next-line':
|
|
127
|
+
// Apply to the next line
|
|
128
|
+
if (i + 1 < lines.length) {
|
|
129
|
+
suppressions.set(lineNumber + 1, {
|
|
130
|
+
...suppression,
|
|
131
|
+
lineNumber: lineNumber + 1,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case 'same-line':
|
|
136
|
+
// Apply to this line
|
|
137
|
+
suppressions.set(lineNumber, suppression);
|
|
138
|
+
break;
|
|
139
|
+
case 'block-start':
|
|
140
|
+
// Start tracking block suppression
|
|
141
|
+
currentBlock = {
|
|
142
|
+
startLine: lineNumber,
|
|
143
|
+
reason: suppression.reason,
|
|
144
|
+
ruleId: suppression.ruleId,
|
|
145
|
+
};
|
|
146
|
+
break;
|
|
147
|
+
case 'block-end':
|
|
148
|
+
// End block suppression
|
|
149
|
+
currentBlock = null;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// If we're in a block suppression, add suppression for this line
|
|
154
|
+
// (unless it's the block start/end line itself)
|
|
155
|
+
if (currentBlock && suppression?.type !== 'block-start' && suppression?.type !== 'block-end') {
|
|
156
|
+
// Don't override explicit same-line suppressions
|
|
157
|
+
if (!suppressions.has(lineNumber)) {
|
|
158
|
+
suppressions.set(lineNumber, {
|
|
159
|
+
lineNumber,
|
|
160
|
+
type: 'block-start', // Mark as from block
|
|
161
|
+
reason: currentBlock.reason,
|
|
162
|
+
ruleId: currentBlock.ruleId,
|
|
163
|
+
commentText: `Block suppression from line ${currentBlock.startLine}`,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return suppressions;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Check if a specific line is suppressed
|
|
172
|
+
*/
|
|
173
|
+
function isLineSuppressed(suppressions, lineNumber, category) {
|
|
174
|
+
const suppression = suppressions.get(lineNumber);
|
|
175
|
+
if (!suppression) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
// If suppression specifies a rule and category doesn't match, not suppressed
|
|
179
|
+
if (suppression.ruleId && category && suppression.ruleId !== category) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
return suppression;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Extract all unique suppression reasons from a file
|
|
186
|
+
* Useful for auditing suppressed findings
|
|
187
|
+
*/
|
|
188
|
+
function extractSuppressionReasons(content) {
|
|
189
|
+
const suppressions = parseInlineSuppressions(content);
|
|
190
|
+
const seen = new Set();
|
|
191
|
+
const results = [];
|
|
192
|
+
for (const [lineNumber, suppression] of suppressions) {
|
|
193
|
+
// Only include unique comment sources (not duplicates from block propagation)
|
|
194
|
+
const key = `${suppression.commentText}`;
|
|
195
|
+
if (!seen.has(key) && suppression.type !== 'block-end') {
|
|
196
|
+
seen.add(key);
|
|
197
|
+
results.push({
|
|
198
|
+
reason: suppression.reason,
|
|
199
|
+
ruleId: suppression.ruleId,
|
|
200
|
+
lineNumber,
|
|
201
|
+
type: suppression.type,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return results;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Generate a suppression comment for a given line
|
|
209
|
+
*/
|
|
210
|
+
function generateSuppressionComment(reason, options = {}) {
|
|
211
|
+
const { type = 'next-line', ruleId, commentStyle = '//' } = options;
|
|
212
|
+
const ruleSpec = ruleId ? ` [${ruleId}]` : '';
|
|
213
|
+
if (type === 'next-line') {
|
|
214
|
+
return `${commentStyle} oculum-ignore-next-line${ruleSpec}: ${reason}`;
|
|
215
|
+
}
|
|
216
|
+
return `${commentStyle} oculum-ignore${ruleSpec}: ${reason}`;
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=inline-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-parser.js","sourceRoot":"","sources":["../../src/suppression/inline-parser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA8HH,0DA+DC;AAKD,4CAiBC;AAMD,8DA8BC;AAKD,gEAiBC;AAxQD;;;;;;;;;;;;;;;;;GAiBG;AAEH,sCAAsC;AACtC,MAAM,QAAQ,GAAG;IACf,qCAAqC;IACrC,+CAA+C;IAC/C,QAAQ,EAAE,yEAAyE;IAEnF,gCAAgC;IAChC,0CAA0C;IAC1C,QAAQ,EAAE,+DAA+D;IAEzE,oCAAoC;IACpC,8CAA8C;IAC9C,UAAU,EAAE,mEAAmE;IAE/E,gCAAgC;IAChC,QAAQ,EAAE,wCAAwC;CACnD,CAAA;AAED;;GAEG;AACH,SAAS,uBAAuB,CAC9B,IAAY,EACZ,UAAkB;IAElB,8FAA8F;IAC9F,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAE3B,+CAA+C;IAC/C,IACE,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;QACxB,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QACvB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EACxB,CAAC;QACD,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACtD,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO;gBACL,UAAU;gBACV,IAAI,EAAE,WAAW;gBACjB,MAAM,E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,OAAO,CAAC,CAAA;IACrD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,MAAM,OAAO,GAKR,EAAE,CAAA;IAEP,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,YAAY,EAAE,CAAC;QACrD,8EAA8E;QAC9E,MAAM,GAAG,GAAG,GAAG,WAAW,CAAC,WAAW,EAAE,CAAA;QACxC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACb,OAAO,CAAC,IAAI,CAAC;gBACX,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,UAAU;gBACV,IAAI,EAAE,WAAW,CAAC,IAAI;aACvB,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CACxC,MAAc,EACd,UAII,EAAE;IAEN,MAAM,EAAE,IAAI,GAAG,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IAEnE,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAE7C,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACzB,OAAO,GAAG,YAAY,2BAA2B,QAAQ,KAAK,MAAM,EAAE,CAAA;IACxE,CAAC;IAED,OAAO,GAAG,YAAY,iBAAiB,QAAQ,KAAK,MAAM,EAAE,CAAA;AAC9D,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suppression Manager
|
|
3
|
+
* Central class for managing all suppression logic
|
|
4
|
+
*/
|
|
5
|
+
import type { Vulnerability, ScanFile } from '../types';
|
|
6
|
+
import type { SuppressionConfig, SuppressionMatch, SuppressionResult, RuleSuppression, FindingSuppression } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Options for SuppressionManager
|
|
9
|
+
*/
|
|
10
|
+
export interface SuppressionManagerOptions {
|
|
11
|
+
/** Path to the project root (for finding config files) */
|
|
12
|
+
projectPath: string;
|
|
13
|
+
/** Optional pre-loaded config (skips file loading) */
|
|
14
|
+
config?: SuppressionConfig;
|
|
15
|
+
/** Whether to include expired suppressions (for auditing) */
|
|
16
|
+
includeExpired?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* SuppressionManager handles all suppression logic
|
|
20
|
+
*
|
|
21
|
+
* Priority order for suppressions:
|
|
22
|
+
* 1. Inline comment suppressions (highest priority)
|
|
23
|
+
* 2. Config file finding suppressions (by hash)
|
|
24
|
+
* 3. Config file rule suppressions (by category)
|
|
25
|
+
*/
|
|
26
|
+
export declare class SuppressionManager {
|
|
27
|
+
private config;
|
|
28
|
+
private configPath;
|
|
29
|
+
private configErrors;
|
|
30
|
+
private includeExpired;
|
|
31
|
+
private projectPath;
|
|
32
|
+
private inlineSuppressionCache;
|
|
33
|
+
constructor(options: SuppressionManagerOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Get configuration errors (if any)
|
|
36
|
+
*/
|
|
37
|
+
getConfigErrors(): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Get the path to the config file (if found)
|
|
40
|
+
*/
|
|
41
|
+
getConfigPath(): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Check if a file path should be ignored entirely
|
|
44
|
+
*/
|
|
45
|
+
isPathIgnored(filePath: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Parse inline suppressions for a file
|
|
48
|
+
*/
|
|
49
|
+
private getInlineSuppressions;
|
|
50
|
+
/**
|
|
51
|
+
* Check if a finding is suppressed
|
|
52
|
+
*
|
|
53
|
+
* Priority:
|
|
54
|
+
* 1. Inline comment (highest)
|
|
55
|
+
* 2. Config finding suppression (by hash)
|
|
56
|
+
* 3. Config rule suppression (by category)
|
|
57
|
+
*/
|
|
58
|
+
isFindingSuppressed(finding: Vulnerability, fileContent?: string): SuppressionMatch;
|
|
59
|
+
/**
|
|
60
|
+
* Apply suppressions to a list of findings
|
|
61
|
+
*/
|
|
62
|
+
applySuppressions(findings: Vulnerability[], files: ScanFile[]): SuppressionResult;
|
|
63
|
+
/**
|
|
64
|
+
* Get all suppressions from config
|
|
65
|
+
*/
|
|
66
|
+
getAllSuppressions(): {
|
|
67
|
+
rules: RuleSuppression[];
|
|
68
|
+
findings: FindingSuppression[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Get ignore patterns from config
|
|
72
|
+
*/
|
|
73
|
+
getIgnorePatterns(): string[];
|
|
74
|
+
/**
|
|
75
|
+
* Check if suppression system is active (has any suppressions)
|
|
76
|
+
*/
|
|
77
|
+
hasSuppressions(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Get summary of suppression configuration
|
|
80
|
+
*/
|
|
81
|
+
getSummary(): {
|
|
82
|
+
configPath: string | undefined;
|
|
83
|
+
ruleCount: number;
|
|
84
|
+
findingCount: number;
|
|
85
|
+
ignorePatternCount: number;
|
|
86
|
+
hasErrors: boolean;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Clear the inline suppression cache
|
|
90
|
+
* (useful if files have been modified)
|
|
91
|
+
*/
|
|
92
|
+
clearCache(): void;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/suppression/manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAGjB,eAAe,EACf,kBAAkB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