@dataparade/cli 0.0.12 → 0.0.14
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/package.json +5 -8
- package/dist/src/ai-enrichment/candidate-selector.d.ts +4 -4
- package/dist/src/ai-enrichment/candidate-selector.js +37 -32
- package/dist/src/ai-enrichment/fallbacks.d.ts +2 -2
- package/dist/src/ai-enrichment/fallbacks.js +227 -83
- package/dist/src/ai-enrichment/merge-rules.d.ts +5 -3
- package/dist/src/ai-enrichment/merge-rules.js +225 -35
- package/dist/src/ai-enrichment/non-pii-signal-rules.js +2 -6
- package/dist/src/ai-enrichment/openai-proposals-response.schema.d.ts +1 -1
- package/dist/src/ai-enrichment/pii-signal-rules.js +2 -6
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.d.ts +2 -2
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.js +4 -4
- package/dist/src/ai-enrichment/property-priority.d.ts +5 -0
- package/dist/src/ai-enrichment/property-priority.js +23 -0
- package/dist/src/ai-enrichment/provider-prompt.d.ts +5 -5
- package/dist/src/ai-enrichment/provider-prompt.js +24 -15
- package/dist/src/ai-enrichment/provider-topology-rules.js +2 -6
- package/dist/src/ai-enrichment/providers/provider-contract.d.ts +6 -0
- package/dist/src/ai-enrichment/providers/provider-contract.js +62 -2
- package/dist/src/ai-enrichment/red-flags.d.ts +46 -0
- package/dist/src/ai-enrichment/red-flags.js +365 -0
- package/dist/src/ai-enrichment/sensitive-paths.d.ts +1 -1
- package/dist/src/ai-enrichment/sensitive-paths.js +3 -3
- package/dist/src/ai-enrichment/third-party-data-flow.js +3 -3
- package/dist/src/ai-enrichment/third-party-evidence.d.ts +3 -3
- package/dist/src/ai-enrichment/third-party-evidence.js +96 -93
- package/dist/src/ai-enrichment/third-party-subtype.js +2 -2
- package/dist/src/ai-enrichment/tools/index.d.ts +1 -1
- package/dist/src/ai-enrichment/types.d.ts +1 -1
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js +161 -143
- package/dist/src/config/file.d.ts +1 -1
- package/dist/src/config/file.js +21 -20
- package/dist/src/config/resolve.d.ts +1 -1
- package/dist/src/config/resolve.js +75 -69
- package/dist/src/core/pipeline/graph-mapping.d.ts +1 -6
- package/dist/src/core/pipeline/graph-mapping.js +3 -314
- package/dist/src/core/pipeline/orchestrator-result.d.ts +9 -6
- package/dist/src/core/pipeline/orchestrator.d.ts +2 -26
- package/dist/src/core/pipeline/orchestrator.js +4 -77
- package/dist/src/core/pipeline/scan-pipeline.d.ts +4 -3
- package/dist/src/core/pipeline/scan-pipeline.js +82 -128
- package/dist/src/core/schema/index.d.ts +2 -2
- package/dist/src/core/schema/index.js +4 -2
- package/dist/src/core/schema/scan-config.schema.d.ts +4 -3
- package/dist/src/core/schema/scan-config.schema.js +18 -17
- package/dist/src/core/schema/scan-result.schema.d.ts +2 -456
- package/dist/src/core/schema/scan-result.schema.js +12 -240
- package/dist/src/core/types/component.d.ts +1 -18
- package/dist/src/core/types/component.js +15 -0
- package/dist/src/core/types/config.d.ts +1 -64
- package/dist/src/core/types/config.js +15 -0
- package/dist/src/core/types/data-flow.d.ts +1 -24
- package/dist/src/core/types/data-flow.js +15 -0
- package/dist/src/core/types/detection.d.ts +1 -12
- package/dist/src/core/types/detection.js +15 -17
- package/dist/src/core/types/file.d.ts +1 -14
- package/dist/src/core/types/file.js +15 -0
- package/dist/src/core/types/index.d.ts +1 -7
- package/dist/src/core/types/index.js +1 -7
- package/dist/src/core/types/progress.d.ts +1 -9
- package/dist/src/core/types/progress.js +15 -0
- package/dist/src/core/types/result.d.ts +1 -140
- package/dist/src/core/types/result.js +15 -0
- package/dist/src/evals/run-model-matrix.js +2 -1
- package/dist/src/output/json.d.ts +11 -3
- package/dist/src/output/json.js +10 -5
- package/dist/src/platform-api/estimate-scan-footprint.js +9 -10
- package/dist/src/scanner-package-root.d.ts +2 -0
- package/dist/src/scanner-package-root.js +12 -0
- package/dist/tests/cli/cli.spec.js +18 -15
- package/dist/tests/unit/ai-enrichment/candidate-selector.spec.js +80 -49
- package/dist/tests/unit/ai-enrichment/fallbacks.spec.js +78 -0
- package/dist/tests/unit/ai-enrichment/merge-rules.spec.js +658 -166
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +78 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt.spec.js +80 -75
- package/dist/tests/unit/ai-enrichment/red-flags.spec.js +227 -0
- package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.js +2 -2
- package/dist/tests/unit/ai-enrichment/third-party-evidence.spec.js +38 -34
- package/dist/tests/unit/cli/scan-command-ai-flags.spec.js +5 -3
- package/dist/tests/unit/cli/scan-command-e2e-backend-lambda-orphan.spec.js +60 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-app-plus-terraform.spec.js +2 -2
- package/dist/tests/unit/cli/scan-command-e2e-occupied-section-hubs.spec.js +58 -0
- package/dist/tests/unit/cli/scan-command-e2e-ruby-basic.spec.js +46 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sentry-route-env.spec.js +2 -1
- package/dist/tests/unit/cli/scan-command-exit-code.spec.js +7 -5
- package/dist/tests/unit/cli/scan-quota-flow.spec.js +8 -0
- package/dist/tests/unit/core/cpp-dotnet-scan.spec.js +4 -3
- package/dist/tests/unit/core/go-scan.spec.js +7 -6
- package/dist/tests/unit/core/graph-mapping.spec.js +2 -1
- package/dist/tests/unit/core/invariant-tests-dedupe-determinism.spec.js +7 -6
- package/dist/tests/unit/core/jvm-scan.spec.js +6 -5
- package/dist/tests/unit/core/no-source-code-leakage.spec.js +2 -1
- package/dist/tests/unit/core/orchestrator.spec.js +21 -20
- package/dist/tests/unit/core/output-json.spec.js +3 -2
- package/dist/tests/unit/core/parsing-error-handling-nonfatal.spec.js +2 -1
- package/dist/tests/unit/core/scan-result-language-stats.spec.js +2 -1
- package/dist/tests/unit/core/terraform-json-overlay.spec.js +2 -1
- package/dist/tests/unit/publish-manifest.spec.js +3 -2
- package/package.json +5 -8
- package/dist/src/analyzers/cpp/cpp-detection-config.d.ts +0 -73
- package/dist/src/analyzers/cpp/cpp-detection-config.js +0 -137
- package/dist/src/analyzers/cpp/dependency-manifests.d.ts +0 -8
- package/dist/src/analyzers/cpp/dependency-manifests.js +0 -130
- package/dist/src/analyzers/cpp/detector.d.ts +0 -3
- package/dist/src/analyzers/cpp/detector.js +0 -21
- package/dist/src/analyzers/cpp/index.d.ts +0 -2
- package/dist/src/analyzers/cpp/index.js +0 -11
- package/dist/src/analyzers/cpp/manifest-parsers.d.ts +0 -13
- package/dist/src/analyzers/cpp/manifest-parsers.js +0 -104
- package/dist/src/analyzers/cpp/parser.d.ts +0 -35
- package/dist/src/analyzers/cpp/parser.js +0 -206
- package/dist/src/analyzers/cpp/patterns.d.ts +0 -3
- package/dist/src/analyzers/cpp/patterns.js +0 -37
- package/dist/src/analyzers/csharp/csharp-detection-config.d.ts +0 -100
- package/dist/src/analyzers/csharp/csharp-detection-config.js +0 -160
- package/dist/src/analyzers/csharp/dependency-manifests.d.ts +0 -13
- package/dist/src/analyzers/csharp/dependency-manifests.js +0 -184
- package/dist/src/analyzers/csharp/detector.d.ts +0 -3
- package/dist/src/analyzers/csharp/detector.js +0 -21
- package/dist/src/analyzers/csharp/index.d.ts +0 -2
- package/dist/src/analyzers/csharp/index.js +0 -11
- package/dist/src/analyzers/csharp/manifest-parsers.d.ts +0 -34
- package/dist/src/analyzers/csharp/manifest-parsers.js +0 -130
- package/dist/src/analyzers/csharp/parser.d.ts +0 -48
- package/dist/src/analyzers/csharp/parser.js +0 -277
- package/dist/src/analyzers/csharp/patterns.d.ts +0 -3
- package/dist/src/analyzers/csharp/patterns.js +0 -57
- package/dist/src/analyzers/go/dependency-manifests.d.ts +0 -10
- package/dist/src/analyzers/go/dependency-manifests.js +0 -117
- package/dist/src/analyzers/go/detector.d.ts +0 -3
- package/dist/src/analyzers/go/detector.js +0 -21
- package/dist/src/analyzers/go/go-detection-config.d.ts +0 -97
- package/dist/src/analyzers/go/go-detection-config.js +0 -164
- package/dist/src/analyzers/go/index.d.ts +0 -2
- package/dist/src/analyzers/go/index.js +0 -11
- package/dist/src/analyzers/go/manifest-parsers.d.ts +0 -20
- package/dist/src/analyzers/go/manifest-parsers.js +0 -104
- package/dist/src/analyzers/go/parser.d.ts +0 -40
- package/dist/src/analyzers/go/parser.js +0 -186
- package/dist/src/analyzers/go/patterns.d.ts +0 -3
- package/dist/src/analyzers/go/patterns.js +0 -50
- package/dist/src/analyzers/jvm/dependency-manifests.d.ts +0 -16
- package/dist/src/analyzers/jvm/dependency-manifests.js +0 -205
- package/dist/src/analyzers/jvm/detector.d.ts +0 -3
- package/dist/src/analyzers/jvm/detector.js +0 -21
- package/dist/src/analyzers/jvm/index.d.ts +0 -9
- package/dist/src/analyzers/jvm/index.js +0 -18
- package/dist/src/analyzers/jvm/jvm-detection-config.d.ts +0 -136
- package/dist/src/analyzers/jvm/jvm-detection-config.js +0 -195
- package/dist/src/analyzers/jvm/manifest-parsers.d.ts +0 -61
- package/dist/src/analyzers/jvm/manifest-parsers.js +0 -246
- package/dist/src/analyzers/jvm/parser.d.ts +0 -54
- package/dist/src/analyzers/jvm/parser.js +0 -419
- package/dist/src/analyzers/jvm/patterns.d.ts +0 -3
- package/dist/src/analyzers/jvm/patterns.js +0 -64
- package/dist/src/analyzers/php/dependency-manifests.d.ts +0 -10
- package/dist/src/analyzers/php/dependency-manifests.js +0 -117
- package/dist/src/analyzers/php/detector.d.ts +0 -3
- package/dist/src/analyzers/php/detector.js +0 -20
- package/dist/src/analyzers/php/index.d.ts +0 -2
- package/dist/src/analyzers/php/index.js +0 -11
- package/dist/src/analyzers/php/manifest-parsers.d.ts +0 -14
- package/dist/src/analyzers/php/manifest-parsers.js +0 -40
- package/dist/src/analyzers/php/parser.d.ts +0 -42
- package/dist/src/analyzers/php/parser.js +0 -297
- package/dist/src/analyzers/php/patterns.d.ts +0 -3
- package/dist/src/analyzers/php/patterns.js +0 -49
- package/dist/src/analyzers/php/php-detection-config.d.ts +0 -104
- package/dist/src/analyzers/php/php-detection-config.js +0 -192
- package/dist/src/analyzers/python/dependency-manifests.d.ts +0 -8
- package/dist/src/analyzers/python/dependency-manifests.js +0 -131
- package/dist/src/analyzers/python/detector.d.ts +0 -3
- package/dist/src/analyzers/python/detector.js +0 -22
- package/dist/src/analyzers/python/index.d.ts +0 -2
- package/dist/src/analyzers/python/index.js +0 -11
- package/dist/src/analyzers/python/manifest-parsers.d.ts +0 -3
- package/dist/src/analyzers/python/manifest-parsers.js +0 -134
- package/dist/src/analyzers/python/parser.d.ts +0 -27
- package/dist/src/analyzers/python/parser.js +0 -194
- package/dist/src/analyzers/python/patterns.d.ts +0 -8
- package/dist/src/analyzers/python/patterns.js +0 -51
- package/dist/src/analyzers/python/python-detection-config.d.ts +0 -93
- package/dist/src/analyzers/python/python-detection-config.js +0 -168
- package/dist/src/analyzers/registry.d.ts +0 -13
- package/dist/src/analyzers/registry.js +0 -78
- package/dist/src/analyzers/shared/c-family-calls.d.ts +0 -26
- package/dist/src/analyzers/shared/c-family-calls.js +0 -118
- package/dist/src/analyzers/shared/manifest-budgets.d.ts +0 -19
- package/dist/src/analyzers/shared/manifest-budgets.js +0 -21
- package/dist/src/analyzers/shared/manifest-fs.d.ts +0 -13
- package/dist/src/analyzers/shared/manifest-fs.js +0 -138
- package/dist/src/analyzers/shared/property-inference.d.ts +0 -8
- package/dist/src/analyzers/shared/property-inference.js +0 -165
- package/dist/src/analyzers/shared/strip-comments.d.ts +0 -32
- package/dist/src/analyzers/shared/strip-comments.js +0 -168
- package/dist/src/analyzers/terraform/detector.d.ts +0 -10
- package/dist/src/analyzers/terraform/detector.js +0 -198
- package/dist/src/analyzers/terraform/index.d.ts +0 -2
- package/dist/src/analyzers/terraform/index.js +0 -13
- package/dist/src/analyzers/terraform/parser.d.ts +0 -29
- package/dist/src/analyzers/terraform/parser.js +0 -202
- package/dist/src/analyzers/terraform/terraform-detection-config.d.ts +0 -48
- package/dist/src/analyzers/terraform/terraform-detection-config.js +0 -218
- package/dist/src/analyzers/terraform/terraform-exec.d.ts +0 -11
- package/dist/src/analyzers/terraform/terraform-exec.js +0 -35
- package/dist/src/analyzers/terraform/terraform-module-manifest.d.ts +0 -19
- package/dist/src/analyzers/terraform/terraform-module-manifest.js +0 -75
- package/dist/src/analyzers/terraform/terraform-show-json.d.ts +0 -15
- package/dist/src/analyzers/terraform/terraform-show-json.js +0 -188
- package/dist/src/analyzers/terraform/terraform-utility-resource.d.ts +0 -12
- package/dist/src/analyzers/terraform/terraform-utility-resource.js +0 -30
- package/dist/src/analyzers/types.d.ts +0 -5
- package/dist/src/analyzers/types.js +0 -2
- package/dist/src/analyzers/typescript/actor-detection.d.ts +0 -4
- package/dist/src/analyzers/typescript/actor-detection.js +0 -15
- package/dist/src/analyzers/typescript/dependency-manifests.d.ts +0 -9
- package/dist/src/analyzers/typescript/dependency-manifests.js +0 -131
- package/dist/src/analyzers/typescript/detector.d.ts +0 -3
- package/dist/src/analyzers/typescript/detector.js +0 -23
- package/dist/src/analyzers/typescript/index.d.ts +0 -2
- package/dist/src/analyzers/typescript/index.js +0 -11
- package/dist/src/analyzers/typescript/manifest-parsers.d.ts +0 -1
- package/dist/src/analyzers/typescript/manifest-parsers.js +0 -30
- package/dist/src/analyzers/typescript/parser.d.ts +0 -44
- package/dist/src/analyzers/typescript/parser.js +0 -287
- package/dist/src/analyzers/typescript/third-party-detection.d.ts +0 -4
- package/dist/src/analyzers/typescript/third-party-detection.js +0 -16
- package/dist/src/analyzers/typescript/typescript-detection-config.d.ts +0 -105
- package/dist/src/analyzers/typescript/typescript-detection-config.js +0 -219
- package/dist/src/analyzers/typescript/typescript-detection.d.ts +0 -11
- package/dist/src/analyzers/typescript/typescript-detection.js +0 -55
- package/dist/src/classifier/application-injection.d.ts +0 -12
- package/dist/src/classifier/application-injection.js +0 -335
- package/dist/src/classifier/classify.d.ts +0 -3
- package/dist/src/classifier/classify.js +0 -15
- package/dist/src/classifier/component-factory.d.ts +0 -3
- package/dist/src/classifier/component-factory.js +0 -488
- package/dist/src/classifier/config.d.ts +0 -38
- package/dist/src/classifier/config.js +0 -260
- package/dist/src/classifier/enhance-defaults.d.ts +0 -28
- package/dist/src/classifier/enhance-defaults.js +0 -369
- package/dist/src/classifier/enhance.d.ts +0 -13
- package/dist/src/classifier/enhance.js +0 -295
- package/dist/src/classifier/external-url-third-party.d.ts +0 -26
- package/dist/src/classifier/external-url-third-party.js +0 -195
- package/dist/src/classifier/grouping.js +0 -2
- package/dist/src/classifier/main-application-selection.d.ts +0 -41
- package/dist/src/classifier/main-application-selection.js +0 -222
- package/dist/src/classifier/naming.d.ts +0 -4
- package/dist/src/classifier/naming.js +0 -78
- package/dist/src/classifier/postprocessing.d.ts +0 -18
- package/dist/src/classifier/postprocessing.js +0 -565
- package/dist/src/classifier/sectioning.d.ts +0 -5
- package/dist/src/classifier/sectioning.js +0 -60
- package/dist/src/classifier/terraform-provider-hub.d.ts +0 -6
- package/dist/src/classifier/terraform-provider-hub.js +0 -38
- package/dist/src/config/actor-detection-config.d.ts +0 -21
- package/dist/src/config/actor-detection-config.js +0 -97
- package/dist/src/config/property-detection-config.d.ts +0 -27
- package/dist/src/config/property-detection-config.js +0 -355
- package/dist/src/config/third-party-detection-config.d.ts +0 -25
- package/dist/src/config/third-party-detection-config.js +0 -97
- package/dist/src/core/pipeline/classifier-phase.d.ts +0 -7
- package/dist/src/core/pipeline/classifier-phase.js +0 -78
- package/dist/src/core/pipeline/dataflow-phase.d.ts +0 -7
- package/dist/src/core/pipeline/dataflow-phase.js +0 -10
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.d.ts +0 -7
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.js +0 -74
- package/dist/src/core/pipeline/diagram-layout/constants.d.ts +0 -11
- package/dist/src/core/pipeline/diagram-layout/constants.js +0 -14
- package/dist/src/core/pipeline/diagram-layout/edge-handles.d.ts +0 -3
- package/dist/src/core/pipeline/diagram-layout/edge-handles.js +0 -26
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.d.ts +0 -3
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.js +0 -40
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.d.ts +0 -6
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.js +0 -53
- package/dist/src/core/pipeline/diagram-layout/section-helpers.d.ts +0 -30
- package/dist/src/core/pipeline/diagram-layout/section-helpers.js +0 -62
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.d.ts +0 -3
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.js +0 -109
- package/dist/src/core/pipeline/diagram-layout/types.d.ts +0 -2
- package/dist/src/core/pipeline/diagram-layout/types.js +0 -2
- package/dist/src/core/pipeline/infer-data-flow-protocol.d.ts +0 -7
- package/dist/src/core/pipeline/infer-data-flow-protocol.js +0 -39
- package/dist/src/core/pipeline/mixed-app-terraform-scan.d.ts +0 -13
- package/dist/src/core/pipeline/mixed-app-terraform-scan.js +0 -81
- package/dist/src/core/pipeline/resolve-path-under-scan-root.d.ts +0 -7
- package/dist/src/core/pipeline/resolve-path-under-scan-root.js +0 -55
- package/dist/src/core/pipeline/sorting.d.ts +0 -3
- package/dist/src/core/pipeline/sorting.js +0 -48
- package/dist/src/core/pipeline/stable-component-ids.d.ts +0 -15
- package/dist/src/core/pipeline/stable-component-ids.js +0 -68
- package/dist/src/core/pipeline/structural-scan.d.ts +0 -19
- package/dist/src/core/pipeline/structural-scan.js +0 -452
- package/dist/src/core/pipeline/terraform-flow-utils.d.ts +0 -6
- package/dist/src/core/pipeline/terraform-flow-utils.js +0 -32
- package/dist/src/core/pipeline/terraform-minimal-services.d.ts +0 -31
- package/dist/src/core/pipeline/terraform-minimal-services.js +0 -225
- package/dist/src/core/sectioning/discover-service-sections.d.ts +0 -80
- package/dist/src/core/sectioning/discover-service-sections.js +0 -497
- package/dist/src/core/sectioning/section-runtime.d.ts +0 -21
- package/dist/src/core/sectioning/section-runtime.js +0 -148
- package/dist/src/core/terraform/component-predicates.d.ts +0 -13
- package/dist/src/core/terraform/component-predicates.js +0 -71
- package/dist/src/data-flow/application-hub.d.ts +0 -7
- package/dist/src/data-flow/application-hub.js +0 -88
- package/dist/src/data-flow/dedupe.d.ts +0 -7
- package/dist/src/data-flow/dedupe.js +0 -92
- package/dist/src/data-flow/detect.d.ts +0 -16
- package/dist/src/data-flow/detect.js +0 -203
- package/dist/src/data-flow/detector.d.ts +0 -15
- package/dist/src/data-flow/detector.js +0 -18
- package/dist/src/data-flow/drop-cross-section-flows.d.ts +0 -8
- package/dist/src/data-flow/drop-cross-section-flows.js +0 -32
- package/dist/src/data-flow/ensure-actor-flow.d.ts +0 -16
- package/dist/src/data-flow/ensure-actor-flow.js +0 -101
- package/dist/src/data-flow/ensure-manifest-declared-flows.d.ts +0 -14
- package/dist/src/data-flow/ensure-manifest-declared-flows.js +0 -76
- package/dist/src/data-flow/ensure-section-api-flows.d.ts +0 -6
- package/dist/src/data-flow/ensure-section-api-flows.js +0 -57
- package/dist/src/data-flow/flow-builder.d.ts +0 -5
- package/dist/src/data-flow/flow-builder.js +0 -80
- package/dist/src/data-flow/import-graph.d.ts +0 -10
- package/dist/src/data-flow/import-graph.js +0 -147
- package/dist/src/data-flow/index.d.ts +0 -8
- package/dist/src/data-flow/index.js +0 -20
- package/dist/src/data-flow/internal-fetch.d.ts +0 -8
- package/dist/src/data-flow/internal-fetch.js +0 -209
- package/dist/src/data-flow/postprocess.d.ts +0 -9
- package/dist/src/data-flow/postprocess.js +0 -63
- package/dist/src/data-flow/rewire.d.ts +0 -10
- package/dist/src/data-flow/rewire.js +0 -93
- package/dist/src/data-flow/source-attribution.d.ts +0 -8
- package/dist/src/data-flow/source-attribution.js +0 -131
- package/dist/src/data-flow/source-resolution.d.ts +0 -13
- package/dist/src/data-flow/source-resolution.js +0 -61
- package/dist/src/data-flow/target-matching.d.ts +0 -21
- package/dist/src/data-flow/target-matching.js +0 -253
- package/dist/src/data-flow/terraform-flows.d.ts +0 -32
- package/dist/src/data-flow/terraform-flows.js +0 -170
- package/dist/src/ingest/file-system.d.ts +0 -17
- package/dist/src/ingest/file-system.js +0 -269
- package/dist/src/ingest/gitignore.d.ts +0 -12
- package/dist/src/ingest/gitignore.js +0 -127
- package/dist/src/ingest/sensitive-paths.d.ts +0 -2
- package/dist/src/ingest/sensitive-paths.js +0 -8
- package/dist/src/patterns/config.d.ts +0 -32
- package/dist/src/patterns/config.js +0 -286
- package/dist/src/patterns/detectors/cpp.d.ts +0 -8
- package/dist/src/patterns/detectors/cpp.js +0 -243
- package/dist/src/patterns/detectors/csharp.d.ts +0 -9
- package/dist/src/patterns/detectors/csharp.js +0 -385
- package/dist/src/patterns/detectors/go.d.ts +0 -9
- package/dist/src/patterns/detectors/go.js +0 -298
- package/dist/src/patterns/detectors/helpers.d.ts +0 -22
- package/dist/src/patterns/detectors/helpers.js +0 -73
- package/dist/src/patterns/detectors/jvm.d.ts +0 -15
- package/dist/src/patterns/detectors/jvm.js +0 -537
- package/dist/src/patterns/detectors/php.d.ts +0 -9
- package/dist/src/patterns/detectors/php.js +0 -466
- package/dist/src/patterns/detectors/python.d.ts +0 -9
- package/dist/src/patterns/detectors/python.js +0 -499
- package/dist/src/patterns/detectors/typescript.d.ts +0 -10
- package/dist/src/patterns/detectors/typescript.js +0 -480
- package/dist/src/patterns/engine.d.ts +0 -58
- package/dist/src/patterns/engine.js +0 -148
- package/dist/src/patterns/flow-source-patterns.d.ts +0 -6
- package/dist/src/patterns/flow-source-patterns.js +0 -39
- package/dist/src/patterns/frontend-frameworks.d.ts +0 -4
- package/dist/src/patterns/frontend-frameworks.js +0 -25
- package/dist/src/patterns/scan-exclusions.d.ts +0 -14
- package/dist/src/patterns/scan-exclusions.js +0 -96
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.d.ts +0 -2
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.js +0 -8
- package/dist/tests/fixtures/e2e-ts-sample/db.d.ts +0 -3
- package/dist/tests/fixtures/e2e-ts-sample/db.js +0 -7
- package/dist/tests/fixtures/e2e-ts-sample/external-api.d.ts +0 -1
- package/dist/tests/fixtures/e2e-ts-sample/external-api.js +0 -18
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.d.ts +0 -3
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.js +0 -7
- package/dist/tests/fixtures/e2e-ts-sample/server.d.ts +0 -14
- package/dist/tests/fixtures/e2e-ts-sample/server.js +0 -4
- package/dist/tests/fixtures/e2e-ts-sentry-route-env/server.js +0 -24
- package/dist/tests/fixtures/ingest-basic/src/index.d.ts +0 -1
- package/dist/tests/fixtures/ingest-basic/src/index.js +0 -6
- package/dist/tests/fixtures/mixed-language-basic/api.d.ts +0 -2
- package/dist/tests/fixtures/mixed-language-basic/api.js +0 -12
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.js +0 -6
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.js +0 -6
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.js +0 -7
- package/dist/tests/fixtures/typescript-basic/app/route.d.ts +0 -1
- package/dist/tests/fixtures/typescript-basic/app/route.js +0 -7
- package/dist/tests/fixtures/typescript-basic/db-client-import.d.ts +0 -2
- package/dist/tests/fixtures/typescript-basic/db-client-import.js +0 -8
- package/dist/tests/fixtures/typescript-basic/db.d.ts +0 -3
- package/dist/tests/fixtures/typescript-basic/db.js +0 -7
- package/dist/tests/fixtures/typescript-basic/external-api.d.ts +0 -1
- package/dist/tests/fixtures/typescript-basic/external-api.js +0 -18
- package/dist/tests/fixtures/typescript-basic/pg-client.d.ts +0 -3
- package/dist/tests/fixtures/typescript-basic/pg-client.js +0 -7
- package/dist/tests/fixtures/typescript-basic/server.d.ts +0 -14
- package/dist/tests/fixtures/typescript-basic/server.js +0 -4
- package/dist/tests/fixtures/typescript-dependency-manifests-basic/src/index.d.ts +0 -0
- package/dist/tests/fixtures/typescript-dependency-manifests-basic/src/index.js +0 -2
- package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.js +0 -66
- package/dist/tests/unit/analyzers/cpp/parser.spec.js +0 -80
- package/dist/tests/unit/analyzers/cpp/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/cpp/patterns.spec.js +0 -141
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.js +0 -75
- package/dist/tests/unit/analyzers/csharp/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/csharp/parser.spec.js +0 -118
- package/dist/tests/unit/analyzers/csharp/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/csharp/patterns.spec.js +0 -210
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.js +0 -96
- package/dist/tests/unit/analyzers/go/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/go/parser.spec.js +0 -110
- package/dist/tests/unit/analyzers/go/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/go/patterns.spec.js +0 -239
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.js +0 -179
- package/dist/tests/unit/analyzers/jvm/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/jvm/parser.spec.js +0 -195
- package/dist/tests/unit/analyzers/jvm/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/jvm/patterns.spec.js +0 -284
- package/dist/tests/unit/analyzers/php/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/php/dependency-manifests.spec.js +0 -54
- package/dist/tests/unit/analyzers/php/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/php/parser.spec.js +0 -128
- package/dist/tests/unit/analyzers/php/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/php/patterns.spec.js +0 -334
- package/dist/tests/unit/analyzers/python/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/python/parser.spec.js +0 -104
- package/dist/tests/unit/analyzers/python/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/python/patterns.spec.js +0 -458
- package/dist/tests/unit/analyzers/registry.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/registry.spec.js +0 -234
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.js +0 -87
- package/dist/tests/unit/analyzers/terraform/detector.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/detector.spec.js +0 -110
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.js +0 -53
- package/dist/tests/unit/analyzers/terraform/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/parser.spec.js +0 -56
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.js +0 -63
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.js +0 -19
- package/dist/tests/unit/analyzers/terraform-exec.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform-exec.spec.js +0 -27
- package/dist/tests/unit/analyzers/terraform-show-json.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform-show-json.spec.js +0 -77
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.js +0 -61
- package/dist/tests/unit/analyzers/typescript/detector.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/detector.spec.js +0 -413
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.js +0 -49
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.js +0 -27
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.js +0 -64
- package/dist/tests/unit/analyzers/typescript/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/parser.spec.js +0 -99
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.js +0 -24
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.js +0 -160
- package/dist/tests/unit/classifier/classify.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/classify.spec.js +0 -1521
- package/dist/tests/unit/classifier/enhance.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/enhance.spec.js +0 -400
- package/dist/tests/unit/classifier/external-url-third-party.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/external-url-third-party.spec.js +0 -83
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.js +0 -44
- package/dist/tests/unit/classifier/terraform-grouping.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/terraform-grouping.spec.js +0 -96
- package/dist/tests/unit/config/property-detection-config.spec.d.ts +0 -1
- package/dist/tests/unit/config/property-detection-config.spec.js +0 -38
- package/dist/tests/unit/core/classifier-phase-regressions.spec.d.ts +0 -1
- package/dist/tests/unit/core/classifier-phase-regressions.spec.js +0 -68
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.d.ts +0 -1
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.js +0 -46
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.d.ts +0 -1
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.js +0 -66
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.d.ts +0 -1
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.js +0 -132
- package/dist/tests/unit/core/discover-service-sections.spec.d.ts +0 -1
- package/dist/tests/unit/core/discover-service-sections.spec.js +0 -204
- package/dist/tests/unit/core/infer-data-flow-protocol.spec.d.ts +0 -1
- package/dist/tests/unit/core/infer-data-flow-protocol.spec.js +0 -37
- package/dist/tests/unit/core/manifest-package-hub.spec.d.ts +0 -1
- package/dist/tests/unit/core/manifest-package-hub.spec.js +0 -53
- package/dist/tests/unit/core/monorepo-package-sections.spec.d.ts +0 -1
- package/dist/tests/unit/core/monorepo-package-sections.spec.js +0 -121
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.d.ts +0 -1
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.js +0 -54
- package/dist/tests/unit/core/section-discovery-excludes.spec.d.ts +0 -1
- package/dist/tests/unit/core/section-discovery-excludes.spec.js +0 -49
- package/dist/tests/unit/core/section-runtime.spec.d.ts +0 -1
- package/dist/tests/unit/core/section-runtime.spec.js +0 -166
- package/dist/tests/unit/core/stable-component-ids.spec.d.ts +0 -1
- package/dist/tests/unit/core/stable-component-ids.spec.js +0 -112
- package/dist/tests/unit/core/structural-scan.spec.d.ts +0 -1
- package/dist/tests/unit/core/structural-scan.spec.js +0 -83
- package/dist/tests/unit/core/terraform-minimal-services.spec.d.ts +0 -1
- package/dist/tests/unit/core/terraform-minimal-services.spec.js +0 -378
- package/dist/tests/unit/data-flow/application-hub.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/application-hub.spec.js +0 -48
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.js +0 -95
- package/dist/tests/unit/data-flow/dedupe.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/dedupe.spec.js +0 -134
- package/dist/tests/unit/data-flow/detector.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/detector.spec.js +0 -1254
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.js +0 -132
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.js +0 -233
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.js +0 -125
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.js +0 -40
- package/dist/tests/unit/data-flow/postprocess.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/postprocess.spec.js +0 -78
- package/dist/tests/unit/data-flow/rewire.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/rewire.spec.js +0 -194
- package/dist/tests/unit/data-flow/terraform-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/terraform-flows.spec.js +0 -199
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.js +0 -56
- package/dist/tests/unit/ingest/env-exclusion.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/env-exclusion.spec.js +0 -43
- package/dist/tests/unit/ingest/file-system.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/file-system.spec.js +0 -180
- package/dist/tests/unit/ingest/gitignore.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/gitignore.spec.js +0 -30
- package/dist/tests/unit/ingest/jvm-languages.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/jvm-languages.spec.js +0 -47
- package/dist/tests/unit/ingest/php-languages.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/php-languages.spec.js +0 -40
- package/dist/tests/unit/patterns/scan-exclusions.spec.d.ts +0 -1
- package/dist/tests/unit/patterns/scan-exclusions.spec.js +0 -58
- package/patterns/README.md +0 -322
- package/patterns/actor.patterns.yaml +0 -51
- package/patterns/aws-terraform-catalog.snapshot.json +0 -1760
- package/patterns/aws-terraform-service-hints.generated.json +0 -1446
- package/patterns/azure-terraform-catalog.snapshot.json +0 -1195
- package/patterns/azure-terraform-service-hints.generated.json +0 -864
- package/patterns/classifier/actors.classifier.yaml +0 -17
- package/patterns/classifier/components.classifier.yaml +0 -110
- package/patterns/classifier/third-party.classifier.yaml +0 -169
- package/patterns/cpp.md +0 -176
- package/patterns/cpp.patterns.yaml +0 -314
- package/patterns/csharp.md +0 -211
- package/patterns/csharp.patterns.yaml +0 -375
- package/patterns/go.md +0 -211
- package/patterns/go.patterns.yaml +0 -429
- package/patterns/jvm.md +0 -160
- package/patterns/jvm.patterns.yaml +0 -884
- package/patterns/kubernetes-terraform-catalog.snapshot.json +0 -94
- package/patterns/kubernetes-terraform-service-hints.generated.json +0 -258
- package/patterns/non-pii-signals.rules.yaml +0 -84
- package/patterns/php.md +0 -74
- package/patterns/php.patterns.yaml +0 -311
- package/patterns/pii-signals.rules.yaml +0 -115
- package/patterns/property.patterns.yaml +0 -431
- package/patterns/provider-topology.rules.yaml +0 -765
- package/patterns/python.md +0 -211
- package/patterns/python.patterns.yaml +0 -337
- package/patterns/terraform.md +0 -37
- package/patterns/terraform.patterns.yaml +0 -495
- package/patterns/third-party.patterns.yaml +0 -182
- package/patterns/typescript.patterns.yaml +0 -361
- /package/dist/{src/classifier/grouping.d.ts → tests/unit/ai-enrichment/red-flags.spec.d.ts} +0 -0
- /package/dist/tests/{fixtures/e2e-ts-sentry-route-env/server.d.ts → unit/cli/scan-command-e2e-backend-lambda-orphan.spec.d.ts} +0 -0
- /package/dist/tests/unit/{analyzers/cpp/dependency-manifests.spec.d.ts → cli/scan-command-e2e-occupied-section-hubs.spec.d.ts} +0 -0
- /package/dist/tests/unit/{analyzers/cpp/parser.spec.d.ts → cli/scan-command-e2e-ruby-basic.spec.d.ts} +0 -0
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.clearTypeScriptPatternConfigCache = clearTypeScriptPatternConfigCache;
|
|
7
|
-
exports.loadTypeScriptPatternConfig = loadTypeScriptPatternConfig;
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const yaml_1 = __importDefault(require("yaml"));
|
|
11
|
-
const detection_1 = require("../../core/types/detection");
|
|
12
|
-
/** Default confidence when not specified in YAML. */
|
|
13
|
-
const DEFAULT_CONFIDENCE = 0.8;
|
|
14
|
-
function validatePatternId(rawValue, context) {
|
|
15
|
-
const id = String(rawValue);
|
|
16
|
-
if (!detection_1.PATTERN_IDS.includes(id)) {
|
|
17
|
-
throw new Error(`Invalid patternId '${rawValue}' in ${context}`);
|
|
18
|
-
}
|
|
19
|
-
return id;
|
|
20
|
-
}
|
|
21
|
-
function compileRegex(pattern, flags) {
|
|
22
|
-
try {
|
|
23
|
-
return new RegExp(pattern, flags ?? "");
|
|
24
|
-
}
|
|
25
|
-
catch (err) {
|
|
26
|
-
const message = err instanceof Error ? err.message : "Unknown regex compilation error";
|
|
27
|
-
throw new Error(`Invalid regex pattern '${pattern}': ${message}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function compileRegexList(patterns) {
|
|
31
|
-
if (!patterns || patterns.length === 0) {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
return patterns.map((p) => compileRegex(p));
|
|
35
|
-
}
|
|
36
|
-
function normalizeRawConfig(raw) {
|
|
37
|
-
const frameworks = raw.routes?.frameworks?.map((fw) => {
|
|
38
|
-
const patternId = validatePatternId(fw.patternId, `routes.frameworks entry '${fw.id}'`);
|
|
39
|
-
return {
|
|
40
|
-
id: fw.id,
|
|
41
|
-
patternId,
|
|
42
|
-
imports: fw.imports ?? [],
|
|
43
|
-
routeCallRegexes: compileRegexList(fw.routeCallRegexes),
|
|
44
|
-
controllerDecoratorRegexes: compileRegexList(fw.controllerDecoratorRegexes),
|
|
45
|
-
routeDecoratorRegexes: compileRegexList(fw.routeDecoratorRegexes),
|
|
46
|
-
routeRegexes: fw.routeRegexes?.map((entry) => ({
|
|
47
|
-
regex: compileRegex(entry.regex),
|
|
48
|
-
methodGroup: entry.methodGroup,
|
|
49
|
-
pathGroup: entry.pathGroup,
|
|
50
|
-
defaultMethod: entry.defaultMethod,
|
|
51
|
-
})) ?? [],
|
|
52
|
-
confidence: fw.confidence ?? DEFAULT_CONFIDENCE,
|
|
53
|
-
};
|
|
54
|
-
}) ?? [];
|
|
55
|
-
const dbClients = raw.db_clients?.map((c) => {
|
|
56
|
-
const patternId = validatePatternId(c.patternId, `db_clients entry '${c.id}'`);
|
|
57
|
-
return {
|
|
58
|
-
id: c.id,
|
|
59
|
-
patternId,
|
|
60
|
-
databaseType: c.databaseType,
|
|
61
|
-
importModules: c.importModules ?? [],
|
|
62
|
-
creationRegexes: compileRegexList(c.regexes),
|
|
63
|
-
confidence: c.confidence ?? DEFAULT_CONFIDENCE,
|
|
64
|
-
};
|
|
65
|
-
}) ?? [];
|
|
66
|
-
const authLibraries = raw.auth?.libraries?.map((lib) => {
|
|
67
|
-
const patternId = validatePatternId(lib.patternId, `auth.libraries entry '${lib.id}'`);
|
|
68
|
-
return {
|
|
69
|
-
id: lib.id,
|
|
70
|
-
patternId,
|
|
71
|
-
importFragments: lib.importFragments ?? [],
|
|
72
|
-
callRegexes: compileRegexList(lib.regexes),
|
|
73
|
-
contentRegexes: compileRegexList(lib.contentRegexes),
|
|
74
|
-
strategy: lib.strategy,
|
|
75
|
-
confidence: lib.confidence ?? DEFAULT_CONFIDENCE,
|
|
76
|
-
};
|
|
77
|
-
}) ?? [];
|
|
78
|
-
const serverlessHandlers = raw.serverless?.handlers?.map((handler) => {
|
|
79
|
-
const patternId = validatePatternId(handler.patternId, `serverless.handlers entry '${handler.id}'`);
|
|
80
|
-
return {
|
|
81
|
-
id: handler.id,
|
|
82
|
-
patternId,
|
|
83
|
-
importModules: handler.importModules ?? [],
|
|
84
|
-
handlerRegexes: compileRegexList(handler.handlerRegexes),
|
|
85
|
-
typeNames: handler.typeNames ?? [],
|
|
86
|
-
confidence: handler.confidence ?? DEFAULT_CONFIDENCE,
|
|
87
|
-
};
|
|
88
|
-
}) ?? [];
|
|
89
|
-
const externalHttpClients = raw.external_apis?.httpClients?.map((client) => {
|
|
90
|
-
const patternId = validatePatternId(client.patternId, `external_apis.httpClients entry '${client.id}'`);
|
|
91
|
-
return {
|
|
92
|
-
id: client.id,
|
|
93
|
-
patternId,
|
|
94
|
-
clientName: client.clientName,
|
|
95
|
-
importFragments: client.importFragments ?? [],
|
|
96
|
-
callRegexes: compileRegexList(client.regexes),
|
|
97
|
-
confidence: client.confidence ?? DEFAULT_CONFIDENCE,
|
|
98
|
-
};
|
|
99
|
-
}) ?? [];
|
|
100
|
-
const configLoaders = raw.config_loaders?.map((loader) => {
|
|
101
|
-
const patternId = validatePatternId(loader.patternId, `config_loaders entry '${loader.id}'`);
|
|
102
|
-
return {
|
|
103
|
-
id: loader.id,
|
|
104
|
-
patternId,
|
|
105
|
-
importFragments: loader.importFragments ?? [],
|
|
106
|
-
callRegexes: compileRegexList(loader.regexes),
|
|
107
|
-
name: loader.name ?? loader.id,
|
|
108
|
-
confidence: loader.confidence ?? DEFAULT_CONFIDENCE,
|
|
109
|
-
};
|
|
110
|
-
}) ?? [];
|
|
111
|
-
const configKeys = raw.config_keys?.keys?.map((k) => {
|
|
112
|
-
const patternId = validatePatternId(k.patternId, `config_keys.keys entry '${k.name}'`);
|
|
113
|
-
return {
|
|
114
|
-
name: k.name,
|
|
115
|
-
patternId,
|
|
116
|
-
confidence: k.confidence ?? DEFAULT_CONFIDENCE,
|
|
117
|
-
};
|
|
118
|
-
}) ?? [];
|
|
119
|
-
const importantKeys = raw.env_variables?.importantKeys?.slice() ?? [];
|
|
120
|
-
const h = raw.heuristics;
|
|
121
|
-
if (!h?.processEnv?.regex || !h?.sqlKeyword?.regex || !h?.nextRouteHandler?.regex || !h?.configKeyAccess?.regex) {
|
|
122
|
-
throw new Error("TypeScript pattern config requires heuristics.processEnv.regex, heuristics.sqlKeyword.regex, heuristics.nextRouteHandler.regex, and heuristics.configKeyAccess.regex in the YAML file.");
|
|
123
|
-
}
|
|
124
|
-
const processEnvRegex = compileRegex(h.processEnv.regex);
|
|
125
|
-
const sqlKeywordRegex = compileRegex(h.sqlKeyword.regex, "i");
|
|
126
|
-
const nextRouteHandlerRegex = compileRegex(h.nextRouteHandler.regex);
|
|
127
|
-
const configKeyAccessRegex = compileRegex(h.configKeyAccess.regex);
|
|
128
|
-
const sqlKeywordPatternId = h.sqlKeyword.patternId
|
|
129
|
-
? validatePatternId(h.sqlKeyword.patternId, "heuristics.sqlKeyword")
|
|
130
|
-
: "database_connection";
|
|
131
|
-
const heuristics = {
|
|
132
|
-
processEnv: {
|
|
133
|
-
regex: processEnvRegex,
|
|
134
|
-
confidence: h.processEnv.confidence ?? 0.95,
|
|
135
|
-
},
|
|
136
|
-
sqlKeyword: {
|
|
137
|
-
regex: sqlKeywordRegex,
|
|
138
|
-
patternId: sqlKeywordPatternId,
|
|
139
|
-
confidence: h.sqlKeyword.confidence ?? 0.6,
|
|
140
|
-
},
|
|
141
|
-
nextRouteHandler: {
|
|
142
|
-
regex: nextRouteHandlerRegex,
|
|
143
|
-
confidence: h.nextRouteHandler.confidence ?? 0.75,
|
|
144
|
-
},
|
|
145
|
-
configKeyAccess: { regex: configKeyAccessRegex },
|
|
146
|
-
};
|
|
147
|
-
return {
|
|
148
|
-
routes: {
|
|
149
|
-
frameworks,
|
|
150
|
-
},
|
|
151
|
-
dbClients,
|
|
152
|
-
auth: {
|
|
153
|
-
libraries: authLibraries,
|
|
154
|
-
},
|
|
155
|
-
serverless: {
|
|
156
|
-
handlers: serverlessHandlers,
|
|
157
|
-
},
|
|
158
|
-
externalApis: {
|
|
159
|
-
httpClients: externalHttpClients,
|
|
160
|
-
},
|
|
161
|
-
configLoaders,
|
|
162
|
-
heuristics,
|
|
163
|
-
envVariables: {
|
|
164
|
-
importantKeys,
|
|
165
|
-
},
|
|
166
|
-
configKeys: {
|
|
167
|
-
keys: configKeys,
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
let cachedConfig;
|
|
172
|
-
/** Clears the config cache (for tests). */
|
|
173
|
-
function clearTypeScriptPatternConfigCache() {
|
|
174
|
-
cachedConfig = undefined;
|
|
175
|
-
}
|
|
176
|
-
function getPatternsFilePath() {
|
|
177
|
-
// During tests, this module runs from src/analyzers/typescript.
|
|
178
|
-
// In the built package, it runs from dist/src/analyzers/typescript.
|
|
179
|
-
// We want the CLI package root that contains the `patterns/` directory.
|
|
180
|
-
const parts = __dirname.split(path_1.default.sep);
|
|
181
|
-
const distIndex = parts.lastIndexOf("dist");
|
|
182
|
-
let cliRoot;
|
|
183
|
-
if (distIndex !== -1) {
|
|
184
|
-
// e.g. /path/to/cli/dist/src/analyzers/typescript -> /path/to/cli
|
|
185
|
-
cliRoot = parts.slice(0, distIndex).join(path_1.default.sep);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
// e.g. /path/to/cli/src/analyzers/typescript -> /path/to/cli
|
|
189
|
-
cliRoot = path_1.default.resolve(__dirname, "../../..");
|
|
190
|
-
}
|
|
191
|
-
return path_1.default.join(cliRoot, "patterns", "typescript.patterns.yaml");
|
|
192
|
-
}
|
|
193
|
-
function loadTypeScriptPatternConfig() {
|
|
194
|
-
if (cachedConfig) {
|
|
195
|
-
return cachedConfig;
|
|
196
|
-
}
|
|
197
|
-
const patternsPath = getPatternsFilePath();
|
|
198
|
-
let raw;
|
|
199
|
-
try {
|
|
200
|
-
raw = fs_1.default.readFileSync(patternsPath, "utf8");
|
|
201
|
-
}
|
|
202
|
-
catch (err) {
|
|
203
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
204
|
-
throw new Error(`TypeScript pattern config is required but could not be read from '${patternsPath}': ${message}`);
|
|
205
|
-
}
|
|
206
|
-
const parsed = yaml_1.default.parse(raw);
|
|
207
|
-
if (!parsed || typeof parsed !== "object") {
|
|
208
|
-
throw new Error(`TypeScript pattern config at '${patternsPath}' did not parse to an object.`);
|
|
209
|
-
}
|
|
210
|
-
try {
|
|
211
|
-
const normalized = normalizeRawConfig(parsed);
|
|
212
|
-
cachedConfig = normalized;
|
|
213
|
-
return normalized;
|
|
214
|
-
}
|
|
215
|
-
catch (err) {
|
|
216
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
217
|
-
throw new Error(`Invalid TypeScript pattern config at '${patternsPath}': ${message}`);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { FileInfo } from "../../core/types/file";
|
|
2
|
-
import type { RawFinding } from "../../core/types/detection";
|
|
3
|
-
import type { ParserResult } from "./parser";
|
|
4
|
-
type TsPatternDetector = (file: FileInfo, model: ParserResult) => RawFinding[];
|
|
5
|
-
export declare const detectRoutePatterns: TsPatternDetector;
|
|
6
|
-
export declare const detectDatabaseConnections: TsPatternDetector;
|
|
7
|
-
export declare const detectExternalApiCalls: TsPatternDetector;
|
|
8
|
-
export declare const detectAuthMiddleware: TsPatternDetector;
|
|
9
|
-
export declare const detectConfigAndEnvUsage: TsPatternDetector;
|
|
10
|
-
export declare const detectServerlessHandlers: TsPatternDetector;
|
|
11
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectServerlessHandlers = exports.detectConfigAndEnvUsage = exports.detectAuthMiddleware = exports.detectExternalApiCalls = exports.detectDatabaseConnections = exports.detectRoutePatterns = void 0;
|
|
4
|
-
const strip_comments_1 = require("../shared/strip-comments");
|
|
5
|
-
const engine_1 = require("../../patterns/engine");
|
|
6
|
-
function toImportLikes(model) {
|
|
7
|
-
return model.imports.map((imp) => ({
|
|
8
|
-
module: imp.moduleSpecifier,
|
|
9
|
-
names: imp.importedNames,
|
|
10
|
-
}));
|
|
11
|
-
}
|
|
12
|
-
function buildPatternContext(file, model) {
|
|
13
|
-
return {
|
|
14
|
-
language: model.language,
|
|
15
|
-
file,
|
|
16
|
-
imports: toImportLikes(model),
|
|
17
|
-
normalizedPath: model.normalizedPath,
|
|
18
|
-
strippedContent: (0, strip_comments_1.stripCommentsPreservingLayout)(file.content ?? "", {
|
|
19
|
-
backtickStrings: true,
|
|
20
|
-
}),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
const detectRoutePatterns = (file, model) => {
|
|
24
|
-
const allFindings = (0, engine_1.matchPatterns)(buildPatternContext(file, model));
|
|
25
|
-
return allFindings.filter((f) => f.pattern === "express_route");
|
|
26
|
-
};
|
|
27
|
-
exports.detectRoutePatterns = detectRoutePatterns;
|
|
28
|
-
const detectDatabaseConnections = (file, model) => {
|
|
29
|
-
const allFindings = (0, engine_1.matchPatterns)(buildPatternContext(file, model));
|
|
30
|
-
return allFindings.filter((f) => f.pattern === "database_connection");
|
|
31
|
-
};
|
|
32
|
-
exports.detectDatabaseConnections = detectDatabaseConnections;
|
|
33
|
-
const detectExternalApiCalls = (file, model) => {
|
|
34
|
-
const allFindings = (0, engine_1.matchPatterns)({
|
|
35
|
-
...buildPatternContext(file, model),
|
|
36
|
-
includeThirdPartyHttpLinePatterns: true,
|
|
37
|
-
});
|
|
38
|
-
return allFindings.filter((f) => f.pattern === "external_api_call");
|
|
39
|
-
};
|
|
40
|
-
exports.detectExternalApiCalls = detectExternalApiCalls;
|
|
41
|
-
const detectAuthMiddleware = (file, model) => {
|
|
42
|
-
const allFindings = (0, engine_1.matchPatterns)(buildPatternContext(file, model));
|
|
43
|
-
return allFindings.filter((f) => f.pattern === "auth_middleware");
|
|
44
|
-
};
|
|
45
|
-
exports.detectAuthMiddleware = detectAuthMiddleware;
|
|
46
|
-
const detectConfigAndEnvUsage = (file, model) => {
|
|
47
|
-
const allFindings = (0, engine_1.matchPatterns)(buildPatternContext(file, model));
|
|
48
|
-
return allFindings.filter((f) => f.pattern === "env_variable" || f.pattern === "config_file");
|
|
49
|
-
};
|
|
50
|
-
exports.detectConfigAndEnvUsage = detectConfigAndEnvUsage;
|
|
51
|
-
const detectServerlessHandlers = (file, model) => {
|
|
52
|
-
const allFindings = (0, engine_1.matchPatterns)(buildPatternContext(file, model));
|
|
53
|
-
return allFindings.filter((f) => f.pattern === "lambda_handler");
|
|
54
|
-
};
|
|
55
|
-
exports.detectServerlessHandlers = detectServerlessHandlers;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { DetectedComponent } from "../core/types/component";
|
|
2
|
-
import type { ServiceSection } from "../core/sectioning/discover-service-sections";
|
|
3
|
-
/** Synthetic main app created when no code hub exists (e.g. IaC-only scan). */
|
|
4
|
-
export declare const INJECTED_PROJECT_PLACEHOLDER_SOURCE_CONTEXT: "injected_project_placeholder";
|
|
5
|
-
export declare function injectApplicationAssetsPerSectionIfMissing(components: DetectedComponent[], sections: ServiceSection[], opts?: {
|
|
6
|
-
projectName?: string;
|
|
7
|
-
}): DetectedComponent[];
|
|
8
|
-
export declare function injectApplicationAssetIfMissing(components: DetectedComponent[], opts?: {
|
|
9
|
-
projectName?: string;
|
|
10
|
-
}): DetectedComponent[];
|
|
11
|
-
export declare function injectActorIfMissing(components: DetectedComponent[]): DetectedComponent[];
|
|
12
|
-
export declare function synthesizeSectionApiNodes(components: DetectedComponent[]): DetectedComponent[];
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INJECTED_PROJECT_PLACEHOLDER_SOURCE_CONTEXT = void 0;
|
|
4
|
-
exports.injectApplicationAssetsPerSectionIfMissing = injectApplicationAssetsPerSectionIfMissing;
|
|
5
|
-
exports.injectApplicationAssetIfMissing = injectApplicationAssetIfMissing;
|
|
6
|
-
exports.injectActorIfMissing = injectActorIfMissing;
|
|
7
|
-
exports.synthesizeSectionApiNodes = synthesizeSectionApiNodes;
|
|
8
|
-
const property_detection_config_1 = require("../config/property-detection-config");
|
|
9
|
-
const main_application_selection_1 = require("./main-application-selection");
|
|
10
|
-
const section_runtime_1 = require("../core/sectioning/section-runtime");
|
|
11
|
-
const sectioning_1 = require("./sectioning");
|
|
12
|
-
const postprocessing_1 = require("./postprocessing");
|
|
13
|
-
/** Synthetic main app created when no code hub exists (e.g. IaC-only scan). */
|
|
14
|
-
exports.INJECTED_PROJECT_PLACEHOLDER_SOURCE_CONTEXT = "injected_project_placeholder";
|
|
15
|
-
function isLikelyUserEntrypoint(mainApp) {
|
|
16
|
-
const subType = mainApp.subType;
|
|
17
|
-
if (subType === "application")
|
|
18
|
-
return true;
|
|
19
|
-
const framework = mainApp.properties?.framework;
|
|
20
|
-
const frameworks = [];
|
|
21
|
-
if (typeof framework === "string")
|
|
22
|
-
frameworks.push(framework);
|
|
23
|
-
if (Array.isArray(framework)) {
|
|
24
|
-
for (const v of framework) {
|
|
25
|
-
if (typeof v === "string")
|
|
26
|
-
frameworks.push(v);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return frameworks.some((f) => {
|
|
30
|
-
const lower = f.toLowerCase();
|
|
31
|
-
if (main_application_selection_1.PREFERRED_WEB_APP_FRAMEWORKS.has(lower))
|
|
32
|
-
return true;
|
|
33
|
-
return Array.from(main_application_selection_1.PREFERRED_WEB_APP_FRAMEWORKS).some((fw) => lower.includes(fw));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function isLikelyBackendEntrypoint(mainApp) {
|
|
37
|
-
const framework = mainApp.properties?.framework;
|
|
38
|
-
const frameworks = [];
|
|
39
|
-
if (typeof framework === "string")
|
|
40
|
-
frameworks.push(framework);
|
|
41
|
-
if (Array.isArray(framework)) {
|
|
42
|
-
for (const v of framework) {
|
|
43
|
-
if (typeof v === "string")
|
|
44
|
-
frameworks.push(v);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const backendHints = new Set([
|
|
48
|
-
"express",
|
|
49
|
-
"nest",
|
|
50
|
-
"fastapi",
|
|
51
|
-
"flask",
|
|
52
|
-
"django",
|
|
53
|
-
"drf",
|
|
54
|
-
"starlette",
|
|
55
|
-
"bottle",
|
|
56
|
-
"serverless",
|
|
57
|
-
]);
|
|
58
|
-
if (frameworks.some((f) => {
|
|
59
|
-
const lower = f.toLowerCase();
|
|
60
|
-
return (backendHints.has(lower) ||
|
|
61
|
-
lower.includes("backend") ||
|
|
62
|
-
lower.includes("api"));
|
|
63
|
-
})) {
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
const sectionId = (0, sectioning_1.getSectionIdFromProperties)(mainApp.properties).toLowerCase();
|
|
67
|
-
return sectionId.includes("backend") || sectionId.endsWith("-api");
|
|
68
|
-
}
|
|
69
|
-
function getInjectedUserActorSubtype(mainApp) {
|
|
70
|
-
return isLikelyBackendEntrypoint(mainApp) ? "api_consumer" : "customer";
|
|
71
|
-
}
|
|
72
|
-
function getNextComponentId(components) {
|
|
73
|
-
let maxNumericId = 0;
|
|
74
|
-
for (const component of components) {
|
|
75
|
-
const match = /^cmp_(\d+)$/.exec(component.id);
|
|
76
|
-
if (match) {
|
|
77
|
-
const num = Number.parseInt(match[1], 10);
|
|
78
|
-
if (!Number.isNaN(num) && num > maxNumericId) {
|
|
79
|
-
maxNumericId = num;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
const next = maxNumericId + 1;
|
|
84
|
-
return `cmp_${next}`;
|
|
85
|
-
}
|
|
86
|
-
function isSingleRouteApiAsset(component) {
|
|
87
|
-
if (component.type !== "asset" || component.subType !== "api") {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
const name = (component.name || "").trim();
|
|
91
|
-
if (!name)
|
|
92
|
-
return false;
|
|
93
|
-
const lower = name.toLowerCase();
|
|
94
|
-
if (lower === "route handler") {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
if (lower.startsWith("nest_controller")) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
if (/^(get|post|put|delete|patch|options|head)\s+/.test(lower)) {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
function chooseMainAppSubType(mainAppSubtypes) {
|
|
106
|
-
if (mainAppSubtypes.has("application"))
|
|
107
|
-
return "application";
|
|
108
|
-
if (mainAppSubtypes.has("service"))
|
|
109
|
-
return "service";
|
|
110
|
-
if (mainAppSubtypes.has("api"))
|
|
111
|
-
return "api";
|
|
112
|
-
const first = mainAppSubtypes.values().next();
|
|
113
|
-
return first.done ? "service" : first.value;
|
|
114
|
-
}
|
|
115
|
-
function injectApplicationAssetsPerSectionIfMissing(components, sections, opts) {
|
|
116
|
-
if (!components || components.length === 0)
|
|
117
|
-
return [];
|
|
118
|
-
if (!sections || sections.length === 0)
|
|
119
|
-
return components;
|
|
120
|
-
const { mainAppSubtypes } = (0, property_detection_config_1.loadPropertyDetectionConfig)().enhance;
|
|
121
|
-
const chosenSubType = chooseMainAppSubType(mainAppSubtypes);
|
|
122
|
-
const hasCandidateInSection = new Map();
|
|
123
|
-
for (const c of components) {
|
|
124
|
-
if (c.type !== "asset" || c.subType === undefined)
|
|
125
|
-
continue;
|
|
126
|
-
if (!mainAppSubtypes.has(c.subType))
|
|
127
|
-
continue;
|
|
128
|
-
if ((0, main_application_selection_1.isExcludedFromMainApplicationHub)(c))
|
|
129
|
-
continue;
|
|
130
|
-
const sid = (0, sectioning_1.getSectionIdFromProperties)(c.properties);
|
|
131
|
-
hasCandidateInSection.set(sid, true);
|
|
132
|
-
}
|
|
133
|
-
const synthetic = [];
|
|
134
|
-
const hasPrimaryMonorepo = sections.some((s) => s.isPrimaryMonorepoPackage === true);
|
|
135
|
-
const eligibleSections = sections.filter((s) => {
|
|
136
|
-
if (s.role !== "service")
|
|
137
|
-
return false;
|
|
138
|
-
if (hasPrimaryMonorepo)
|
|
139
|
-
return s.isPrimaryMonorepoPackage === true;
|
|
140
|
-
return true;
|
|
141
|
-
});
|
|
142
|
-
for (const section of eligibleSections) {
|
|
143
|
-
const sid = section.id;
|
|
144
|
-
if (!(0, section_runtime_1.sectionQualifiesForSyntheticApplication)(section, components))
|
|
145
|
-
continue;
|
|
146
|
-
if (hasCandidateInSection.get(sid) === true)
|
|
147
|
-
continue;
|
|
148
|
-
const name = section.label.trim() || sid;
|
|
149
|
-
synthetic.push({
|
|
150
|
-
id: getNextComponentId([...components, ...synthetic]),
|
|
151
|
-
name,
|
|
152
|
-
type: "asset",
|
|
153
|
-
subType: chosenSubType,
|
|
154
|
-
confidence: 1,
|
|
155
|
-
detectedFrom: [],
|
|
156
|
-
sourceLocations: [],
|
|
157
|
-
properties: {
|
|
158
|
-
section_id: sid,
|
|
159
|
-
section_label: section.label,
|
|
160
|
-
section_role: section.role,
|
|
161
|
-
...(section.packageName
|
|
162
|
-
? { package_name: section.packageName }
|
|
163
|
-
: {}),
|
|
164
|
-
...(section.isPrimaryMonorepoPackage === true
|
|
165
|
-
? { is_primary_monorepo_package: true }
|
|
166
|
-
: {}),
|
|
167
|
-
sourceContext: exports.INJECTED_PROJECT_PLACEHOLDER_SOURCE_CONTEXT,
|
|
168
|
-
},
|
|
169
|
-
description: undefined,
|
|
170
|
-
dataFlowIds: undefined,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
return synthetic.length > 0 ? [...components, ...synthetic] : components;
|
|
174
|
-
}
|
|
175
|
-
function injectApplicationAssetIfMissing(components, opts) {
|
|
176
|
-
if (!components || components.length === 0) {
|
|
177
|
-
return [];
|
|
178
|
-
}
|
|
179
|
-
const appIndex = (0, main_application_selection_1.pickMainApplicationAssetIndex)(components);
|
|
180
|
-
if (appIndex !== -1) {
|
|
181
|
-
const cloned = [...components];
|
|
182
|
-
const app = cloned[appIndex];
|
|
183
|
-
if (app.name === "Route Handler" ||
|
|
184
|
-
app.name === "route handler") {
|
|
185
|
-
const projectName = (opts?.projectName && opts.projectName.trim()) || "Application";
|
|
186
|
-
cloned[appIndex] = {
|
|
187
|
-
...app,
|
|
188
|
-
name: projectName,
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
return cloned;
|
|
192
|
-
}
|
|
193
|
-
const name = (opts?.projectName && opts.projectName.trim()) || "Application";
|
|
194
|
-
const { mainAppSubtypes } = (0, property_detection_config_1.loadPropertyDetectionConfig)().enhance;
|
|
195
|
-
let chosenSubType;
|
|
196
|
-
if (mainAppSubtypes.has("application")) {
|
|
197
|
-
chosenSubType = "application";
|
|
198
|
-
}
|
|
199
|
-
else if (mainAppSubtypes.has("service")) {
|
|
200
|
-
chosenSubType = "service";
|
|
201
|
-
}
|
|
202
|
-
else if (mainAppSubtypes.has("api")) {
|
|
203
|
-
chosenSubType = "api";
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
const first = mainAppSubtypes.values().next();
|
|
207
|
-
chosenSubType = first.value;
|
|
208
|
-
}
|
|
209
|
-
const defaultSectionId = (0, sectioning_1.pickDefaultSectionId)(components);
|
|
210
|
-
const defaultSectionRole = (0, sectioning_1.pickSectionRoleForSectionId)(components, defaultSectionId);
|
|
211
|
-
const synthetic = {
|
|
212
|
-
id: getNextComponentId(components),
|
|
213
|
-
name,
|
|
214
|
-
type: "asset",
|
|
215
|
-
subType: chosenSubType,
|
|
216
|
-
confidence: 1,
|
|
217
|
-
detectedFrom: [],
|
|
218
|
-
sourceLocations: [],
|
|
219
|
-
properties: {
|
|
220
|
-
section_id: defaultSectionId,
|
|
221
|
-
section_role: defaultSectionRole,
|
|
222
|
-
sourceContext: exports.INJECTED_PROJECT_PLACEHOLDER_SOURCE_CONTEXT,
|
|
223
|
-
},
|
|
224
|
-
};
|
|
225
|
-
return [...components, synthetic];
|
|
226
|
-
}
|
|
227
|
-
function injectActorIfMissing(components) {
|
|
228
|
-
if (!components || components.length === 0) {
|
|
229
|
-
return [];
|
|
230
|
-
}
|
|
231
|
-
const actorsBySection = new Set(components
|
|
232
|
-
.filter((c) => c.type === "actor")
|
|
233
|
-
.map((c) => (0, sectioning_1.getSectionIdFromProperties)(c.properties)));
|
|
234
|
-
const mainApps = components.filter((c) => c.type === "asset" &&
|
|
235
|
-
(c.properties?.isMainApplication === true ||
|
|
236
|
-
c.properties?.isMainApplication === "true"));
|
|
237
|
-
const synthetic = [];
|
|
238
|
-
for (const mainApp of mainApps) {
|
|
239
|
-
if (!isLikelyUserEntrypoint(mainApp))
|
|
240
|
-
continue;
|
|
241
|
-
if (!(0, section_runtime_1.shouldInjectUserActorForMainApp)(mainApp, components))
|
|
242
|
-
continue;
|
|
243
|
-
const mainAppSectionId = (0, sectioning_1.getSectionIdFromProperties)(mainApp.properties);
|
|
244
|
-
const fallbackSectionId = (0, sectioning_1.pickDefaultSectionId)(components);
|
|
245
|
-
const sectionId = mainAppSectionId !== "<unsectioned>"
|
|
246
|
-
? mainAppSectionId
|
|
247
|
-
: fallbackSectionId;
|
|
248
|
-
if (actorsBySection.has(sectionId))
|
|
249
|
-
continue;
|
|
250
|
-
actorsBySection.add(sectionId);
|
|
251
|
-
const sectionRole = (0, sectioning_1.pickSectionRoleForSectionId)(components, sectionId);
|
|
252
|
-
synthetic.push({
|
|
253
|
-
id: getNextComponentId([...components, ...synthetic]),
|
|
254
|
-
name: "User",
|
|
255
|
-
type: "actor",
|
|
256
|
-
subType: getInjectedUserActorSubtype(mainApp),
|
|
257
|
-
confidence: 0.5,
|
|
258
|
-
detectedFrom: [],
|
|
259
|
-
sourceLocations: [],
|
|
260
|
-
properties: {
|
|
261
|
-
sourceContext: "injected_default",
|
|
262
|
-
section_id: sectionId,
|
|
263
|
-
section_role: sectionRole,
|
|
264
|
-
},
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
return synthetic.length > 0 ? [...components, ...synthetic] : components;
|
|
268
|
-
}
|
|
269
|
-
function synthesizeSectionApiNodes(components) {
|
|
270
|
-
if (!components?.length)
|
|
271
|
-
return [];
|
|
272
|
-
const bySection = new Map();
|
|
273
|
-
for (const component of components) {
|
|
274
|
-
const sectionId = (0, sectioning_1.getSectionIdFromProperties)(component.properties);
|
|
275
|
-
const list = bySection.get(sectionId);
|
|
276
|
-
if (list)
|
|
277
|
-
list.push(component);
|
|
278
|
-
else
|
|
279
|
-
bySection.set(sectionId, [component]);
|
|
280
|
-
}
|
|
281
|
-
const synthetic = [];
|
|
282
|
-
for (const [sectionId, sectionComponents] of bySection.entries()) {
|
|
283
|
-
const routeEvidenceRefs = [];
|
|
284
|
-
let hasNonManifestRouteEvidence = false;
|
|
285
|
-
for (const c of sectionComponents) {
|
|
286
|
-
for (const ref of c.detectedFrom) {
|
|
287
|
-
if (ref.pattern === "express_route") {
|
|
288
|
-
routeEvidenceRefs.push(ref);
|
|
289
|
-
const fp = ref.sourceLocation?.filePath?.replace(/\\/g, "/");
|
|
290
|
-
if (fp && !fp.endsWith("package.json")) {
|
|
291
|
-
hasNonManifestRouteEvidence = true;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
if (routeEvidenceRefs.length === 0 || !hasNonManifestRouteEvidence)
|
|
297
|
-
continue;
|
|
298
|
-
routeEvidenceRefs.sort(postprocessing_1.compareDetectedFromRefs);
|
|
299
|
-
const existingApi = sectionComponents.find((c) => {
|
|
300
|
-
if (c.type !== "asset" || c.subType !== "api")
|
|
301
|
-
return false;
|
|
302
|
-
const isMainApp = c.properties?.isMainApplication === true ||
|
|
303
|
-
c.properties?.isMainApplication === "true";
|
|
304
|
-
const hasRouteEvidence = c.detectedFrom.some((ref) => ref.pattern === "express_route");
|
|
305
|
-
if (hasRouteEvidence && !isMainApp)
|
|
306
|
-
return true;
|
|
307
|
-
return (c.properties?.isSectionApiNode === true ||
|
|
308
|
-
c.properties?.isSectionApiNode === "true");
|
|
309
|
-
});
|
|
310
|
-
if (existingApi)
|
|
311
|
-
continue;
|
|
312
|
-
const sectionLabel = (0, sectioning_1.getSectionLabelFromProperties)(sectionComponents[0]?.properties) ?? sectionId;
|
|
313
|
-
const sourceLocations = (0, postprocessing_1.dedupeSourceLocations)(routeEvidenceRefs
|
|
314
|
-
.map((ref) => ref.sourceLocation)
|
|
315
|
-
.filter((loc) => loc !== undefined)).sort(postprocessing_1.compareSourceLocations);
|
|
316
|
-
synthetic.push({
|
|
317
|
-
id: getNextComponentId([...components, ...synthetic]),
|
|
318
|
-
name: "API",
|
|
319
|
-
type: "asset",
|
|
320
|
-
subType: "api",
|
|
321
|
-
confidence: 1,
|
|
322
|
-
detectedFrom: routeEvidenceRefs,
|
|
323
|
-
sourceLocations,
|
|
324
|
-
properties: {
|
|
325
|
-
section_id: sectionId,
|
|
326
|
-
section_label: sectionLabel,
|
|
327
|
-
section_role: (0, sectioning_1.pickSectionRoleForSectionId)(components, sectionId),
|
|
328
|
-
isSectionApiNode: true,
|
|
329
|
-
},
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
if (synthetic.length === 0)
|
|
333
|
-
return components;
|
|
334
|
-
return [...components, ...synthetic];
|
|
335
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { classifyRawFindings } from "./component-factory";
|
|
2
|
-
export { dedupeComponents, mergeDatabaseAssetsByType, compactAuthServiceComponents, mergeGlobalIdentityProviderThirdParties, } from "./postprocessing";
|
|
3
|
-
export { injectApplicationAssetsPerSectionIfMissing, injectApplicationAssetIfMissing, injectActorIfMissing, synthesizeSectionApiNodes, } from "./application-injection";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.synthesizeSectionApiNodes = exports.injectActorIfMissing = exports.injectApplicationAssetIfMissing = exports.injectApplicationAssetsPerSectionIfMissing = exports.mergeGlobalIdentityProviderThirdParties = exports.compactAuthServiceComponents = exports.mergeDatabaseAssetsByType = exports.dedupeComponents = exports.classifyRawFindings = void 0;
|
|
4
|
-
var component_factory_1 = require("./component-factory");
|
|
5
|
-
Object.defineProperty(exports, "classifyRawFindings", { enumerable: true, get: function () { return component_factory_1.classifyRawFindings; } });
|
|
6
|
-
var postprocessing_1 = require("./postprocessing");
|
|
7
|
-
Object.defineProperty(exports, "dedupeComponents", { enumerable: true, get: function () { return postprocessing_1.dedupeComponents; } });
|
|
8
|
-
Object.defineProperty(exports, "mergeDatabaseAssetsByType", { enumerable: true, get: function () { return postprocessing_1.mergeDatabaseAssetsByType; } });
|
|
9
|
-
Object.defineProperty(exports, "compactAuthServiceComponents", { enumerable: true, get: function () { return postprocessing_1.compactAuthServiceComponents; } });
|
|
10
|
-
Object.defineProperty(exports, "mergeGlobalIdentityProviderThirdParties", { enumerable: true, get: function () { return postprocessing_1.mergeGlobalIdentityProviderThirdParties; } });
|
|
11
|
-
var application_injection_1 = require("./application-injection");
|
|
12
|
-
Object.defineProperty(exports, "injectApplicationAssetsPerSectionIfMissing", { enumerable: true, get: function () { return application_injection_1.injectApplicationAssetsPerSectionIfMissing; } });
|
|
13
|
-
Object.defineProperty(exports, "injectApplicationAssetIfMissing", { enumerable: true, get: function () { return application_injection_1.injectApplicationAssetIfMissing; } });
|
|
14
|
-
Object.defineProperty(exports, "injectActorIfMissing", { enumerable: true, get: function () { return application_injection_1.injectActorIfMissing; } });
|
|
15
|
-
Object.defineProperty(exports, "synthesizeSectionApiNodes", { enumerable: true, get: function () { return application_injection_1.synthesizeSectionApiNodes; } });
|