@dataparade/cli 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +5 -8
- package/dist/src/ai-enrichment/candidate-selector.d.ts +1 -1
- package/dist/src/ai-enrichment/fallbacks.d.ts +2 -2
- package/dist/src/ai-enrichment/fallbacks.js +97 -80
- package/dist/src/ai-enrichment/merge-rules.d.ts +2 -0
- package/dist/src/ai-enrichment/merge-rules.js +116 -4
- 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 +1 -1
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.js +1 -1
- package/dist/src/ai-enrichment/provider-prompt.d.ts +1 -1
- package/dist/src/ai-enrichment/provider-prompt.js +4 -0
- 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/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-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.js +6 -5
- package/dist/src/config/file.d.ts +1 -1
- package/dist/src/config/file.js +21 -19
- package/dist/src/config/resolve.d.ts +1 -1
- package/dist/src/config/resolve.js +75 -68
- 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 +1 -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 +2 -1
- package/dist/src/core/pipeline/scan-pipeline.js +39 -97
- 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 +5 -3
- package/dist/src/core/schema/scan-config.schema.js +18 -16
- package/dist/src/core/schema/scan-result.schema.d.ts +2 -455
- package/dist/src/core/schema/scan-result.schema.js +12 -239
- 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/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/merge-rules.spec.js +246 -0
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +78 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt.spec.js +2 -0
- package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.js +2 -2
- package/dist/tests/unit/cli/scan-command-ai-flags.spec.js +5 -3
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-app-plus-terraform.spec.js +2 -2
- 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/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/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 -75
- 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 -167
- 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.d.ts +0 -1
- 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 -12
- package/dist/src/classifier/postprocessing.js +0 -510
- 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 -427
- 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 -494
- 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 -266
- 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 -30
- package/dist/src/patterns/config.js +0 -255
- 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/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 -141
- 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/unit/analyzers/cpp/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.js +0 -66
- package/dist/tests/unit/analyzers/cpp/parser.spec.d.ts +0 -1
- 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/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 -1453
- 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/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/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 -172
- package/patterns/typescript.patterns.yaml +0 -361
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.parseJvmSourceFile = parseJvmSourceFile;
|
|
37
|
-
const nodePath = __importStar(require("path"));
|
|
38
|
-
const c_family_calls_1 = require("../shared/c-family-calls");
|
|
39
|
-
const strip_comments_1 = require("../shared/strip-comments");
|
|
40
|
-
const PACKAGE_REGEX = /^package\s+([A-Za-z_][\w.]*)/;
|
|
41
|
-
// The `*` lives in the character class rather than as an optional suffix: a
|
|
42
|
-
// greedy `[\w.]*` would otherwise swallow the dot before `.*` could match it.
|
|
43
|
-
const IMPORT_REGEX = /^import\s+(static\s+)?([A-Za-z_][\w.*]*)\s*(?:as\s+([A-Za-z_]\w*))?\s*;?/;
|
|
44
|
-
const JAVA_TYPE_MODIFIERS = "public|private|protected|abstract|final|static|sealed|non-sealed|strictfp";
|
|
45
|
-
const JAVA_TYPE_REGEX = new RegExp(`^(?:(?:${JAVA_TYPE_MODIFIERS})\\s+)*(class|interface|enum|record|@interface)\\s+([A-Za-z_]\\w*)`);
|
|
46
|
-
const KOTLIN_TYPE_MODIFIERS = "public|private|protected|internal|open|abstract|final|sealed|data|inner|value|inline|annotation|companion|expect|actual";
|
|
47
|
-
const KOTLIN_TYPE_REGEX = new RegExp(`^(?:(?:${KOTLIN_TYPE_MODIFIERS})\\s+)*(class|interface|object|enum\\s+class|annotation\\s+class)\\s+([A-Za-z_]\\w*)`);
|
|
48
|
-
const KOTLIN_FUNCTION_REGEX = /^(?:(?:public|private|protected|internal|open|override|abstract|final|inline|suspend|operator|infix|tailrec|external|expect|actual)\s+)*fun\s+(?:<[^>]*>\s*)?(?:[A-Za-z_][\w.<>,\s?]*\.)?([A-Za-z_]\w*)\s*\(/;
|
|
49
|
-
const JAVA_METHOD_REGEX = /^(?:(?:public|private|protected|static|final|abstract|synchronized|native|strictfp|default)\s+)*(?:<[^>]*>\s*)?[A-Za-z_][\w.<>,\[\]?\s]*\s+([A-Za-z_]\w*)\s*\(/;
|
|
50
|
-
/**
|
|
51
|
-
* First tokens that make a line look like a Java method declaration when it is
|
|
52
|
-
* actually a statement (`return foo(...)`, `throw new X(...)`).
|
|
53
|
-
*/
|
|
54
|
-
const JAVA_STATEMENT_STARTERS = new Set([
|
|
55
|
-
"return",
|
|
56
|
-
"throw",
|
|
57
|
-
"new",
|
|
58
|
-
"if",
|
|
59
|
-
"for",
|
|
60
|
-
"while",
|
|
61
|
-
"switch",
|
|
62
|
-
"catch",
|
|
63
|
-
"do",
|
|
64
|
-
"else",
|
|
65
|
-
"case",
|
|
66
|
-
"assert",
|
|
67
|
-
"synchronized",
|
|
68
|
-
"import",
|
|
69
|
-
"package",
|
|
70
|
-
"yield",
|
|
71
|
-
]);
|
|
72
|
-
function normalizePath(p) {
|
|
73
|
-
if (!p)
|
|
74
|
-
return "";
|
|
75
|
-
const normalized = p.split("\\").join("/");
|
|
76
|
-
return normalizedPathIsRelativeToCwd(normalized)
|
|
77
|
-
? normalized
|
|
78
|
-
: normalized.replace(nodePath.resolve(), "").replace(/^\/+/, "");
|
|
79
|
-
}
|
|
80
|
-
function normalizedPathIsRelativeToCwd(p) {
|
|
81
|
-
return !p.startsWith("/") && !p.match(/^[A-Za-z]:\//);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Consume one `@Annotation(...)` from the start of `text`, following the
|
|
85
|
-
* argument list across lines when it does not close on the current one —
|
|
86
|
-
* Spring routinely wraps `@RequestMapping(value = ..., method = ...)`.
|
|
87
|
-
*
|
|
88
|
-
* Returns the annotation, the remainder of the line it ended on, and that
|
|
89
|
-
* line's index.
|
|
90
|
-
*/
|
|
91
|
-
function consumeAnnotation(lines, lineIndex, text) {
|
|
92
|
-
const nameMatch = text.match(/^@\s*(?:([A-Za-z_]\w*)\s*:\s*)?([A-Za-z_][\w.]*)/);
|
|
93
|
-
if (!nameMatch)
|
|
94
|
-
return null;
|
|
95
|
-
// Kotlin use-site targets (`@field:Autowired`) are dropped; the annotation
|
|
96
|
-
// identity is what rules match on.
|
|
97
|
-
const qualified = nameMatch[2];
|
|
98
|
-
const name = qualified.includes(".")
|
|
99
|
-
? (qualified.split(".").pop() ?? qualified)
|
|
100
|
-
: qualified;
|
|
101
|
-
let rest = text.slice(nameMatch[0].length);
|
|
102
|
-
let endIndex = lineIndex;
|
|
103
|
-
let argumentsSnippet = "";
|
|
104
|
-
if (rest.trimStart().startsWith("(")) {
|
|
105
|
-
rest = rest.trimStart();
|
|
106
|
-
let depth = 0;
|
|
107
|
-
let inString = false;
|
|
108
|
-
let quote = "";
|
|
109
|
-
let collected = "";
|
|
110
|
-
let consumed = false;
|
|
111
|
-
while (endIndex < lines.length && !consumed) {
|
|
112
|
-
const source = endIndex === lineIndex ? rest : (lines[endIndex] ?? "");
|
|
113
|
-
let cursor = 0;
|
|
114
|
-
for (; cursor < source.length; cursor += 1) {
|
|
115
|
-
const char = source[cursor];
|
|
116
|
-
if (inString) {
|
|
117
|
-
if (char === "\\") {
|
|
118
|
-
cursor += 1;
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
if (char === quote)
|
|
122
|
-
inString = false;
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
if (char === '"' || char === "'") {
|
|
126
|
-
inString = true;
|
|
127
|
-
quote = char;
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
if (char === "(") {
|
|
131
|
-
depth += 1;
|
|
132
|
-
}
|
|
133
|
-
else if (char === ")") {
|
|
134
|
-
depth -= 1;
|
|
135
|
-
if (depth === 0) {
|
|
136
|
-
consumed = true;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (consumed) {
|
|
142
|
-
collected += source.slice(0, cursor);
|
|
143
|
-
rest = source.slice(cursor + 1).trim();
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
collected += `${source} `;
|
|
147
|
-
endIndex += 1;
|
|
148
|
-
rest = "";
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// Unbalanced parentheses: treat the annotation as argument-less rather
|
|
152
|
-
// than swallowing the rest of the file.
|
|
153
|
-
if (!consumed)
|
|
154
|
-
return null;
|
|
155
|
-
argumentsSnippet = collected.replace(/^\s*\(/, "").trim();
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
rest = rest.trim();
|
|
159
|
-
}
|
|
160
|
-
return {
|
|
161
|
-
annotation: {
|
|
162
|
-
name,
|
|
163
|
-
argumentsSnippet,
|
|
164
|
-
raw: argumentsSnippet ? `${name}(${argumentsSnippet})` : name,
|
|
165
|
-
},
|
|
166
|
-
rest,
|
|
167
|
-
endIndex,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
/** Supertypes from a Java `extends A implements B, C` header. */
|
|
171
|
-
function javaBaseTypes(header) {
|
|
172
|
-
const bases = [];
|
|
173
|
-
const extendsMatch = header.match(/\bextends\s+([^{]+?)(?=\bimplements\b|\{|$)/);
|
|
174
|
-
if (extendsMatch)
|
|
175
|
-
bases.push(...splitTypeList(extendsMatch[1]));
|
|
176
|
-
const implementsMatch = header.match(/\bimplements\s+([^{]+?)(?=\{|$)/);
|
|
177
|
-
if (implementsMatch)
|
|
178
|
-
bases.push(...splitTypeList(implementsMatch[1]));
|
|
179
|
-
return bases;
|
|
180
|
-
}
|
|
181
|
-
/** Supertypes from a Kotlin `class X(...) : A(), B` header. */
|
|
182
|
-
function kotlinBaseTypes(header) {
|
|
183
|
-
// Skip the primary constructor's parameter list so its types are not read
|
|
184
|
-
// as supertypes.
|
|
185
|
-
let depth = 0;
|
|
186
|
-
let colonIndex = -1;
|
|
187
|
-
for (let i = 0; i < header.length; i += 1) {
|
|
188
|
-
const char = header[i];
|
|
189
|
-
if (char === "(" || char === "<")
|
|
190
|
-
depth += 1;
|
|
191
|
-
else if (char === ")" || char === ">")
|
|
192
|
-
depth -= 1;
|
|
193
|
-
else if (char === ":" && depth === 0) {
|
|
194
|
-
colonIndex = i;
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
else if (char === "{" && depth === 0)
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
if (colonIndex === -1)
|
|
201
|
-
return [];
|
|
202
|
-
const tail = header.slice(colonIndex + 1).replace(/\{.*$/, "");
|
|
203
|
-
return splitTypeList(tail);
|
|
204
|
-
}
|
|
205
|
-
/** Split a comma-separated type list, ignoring commas inside generics/args. */
|
|
206
|
-
function splitTypeList(raw) {
|
|
207
|
-
const parts = [];
|
|
208
|
-
let depth = 0;
|
|
209
|
-
let current = "";
|
|
210
|
-
for (const char of raw) {
|
|
211
|
-
if (char === "<" || char === "(")
|
|
212
|
-
depth += 1;
|
|
213
|
-
else if (char === ">" || char === ")")
|
|
214
|
-
depth -= 1;
|
|
215
|
-
if (char === "," && depth === 0) {
|
|
216
|
-
parts.push(current);
|
|
217
|
-
current = "";
|
|
218
|
-
continue;
|
|
219
|
-
}
|
|
220
|
-
current += char;
|
|
221
|
-
}
|
|
222
|
-
parts.push(current);
|
|
223
|
-
return parts
|
|
224
|
-
// Keep the bare type name: `Foo<Bar>()` and `Foo<Bar>` both yield `Foo`.
|
|
225
|
-
.map((part) => part.trim().replace(/[<(].*$/, "").trim())
|
|
226
|
-
.filter((part) => Boolean(part) && /^[A-Za-z_][\w.]*$/.test(part));
|
|
227
|
-
}
|
|
228
|
-
function emptyModel(file, normalizedPath, isKotlin, warnings) {
|
|
229
|
-
return {
|
|
230
|
-
file,
|
|
231
|
-
normalizedPath,
|
|
232
|
-
strippedContent: "",
|
|
233
|
-
isKotlin,
|
|
234
|
-
imports: [],
|
|
235
|
-
types: [],
|
|
236
|
-
methods: [],
|
|
237
|
-
calls: [],
|
|
238
|
-
warnings,
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function parseJvmSourceFile(file) {
|
|
242
|
-
const warnings = [];
|
|
243
|
-
const normalizedPath = normalizePath(file.path);
|
|
244
|
-
const isKotlin = file.language === "kotlin";
|
|
245
|
-
if (file.language !== "java" && file.language !== "kotlin") {
|
|
246
|
-
warnings.push(`Unsupported language '${file.language}' for JVM parser in file '${file.path}'.`);
|
|
247
|
-
return emptyModel(file, normalizedPath, isKotlin, warnings);
|
|
248
|
-
}
|
|
249
|
-
const content = file.content ?? "";
|
|
250
|
-
if (content.includes("\u0000")) {
|
|
251
|
-
warnings.push(`File '${file.path}' appears unreadable (contains null bytes); parser will continue with best-effort analysis.`);
|
|
252
|
-
}
|
|
253
|
-
const strippedContent = (0, strip_comments_1.stripCommentsPreservingLayout)(content, {
|
|
254
|
-
tripleQuotedStrings: true,
|
|
255
|
-
nestedBlockComments: isKotlin,
|
|
256
|
-
});
|
|
257
|
-
const lines = strippedContent.split(/\r?\n/);
|
|
258
|
-
const imports = [];
|
|
259
|
-
const types = [];
|
|
260
|
-
const methods = [];
|
|
261
|
-
let packageName;
|
|
262
|
-
let currentType;
|
|
263
|
-
let pendingAnnotations = [];
|
|
264
|
-
const toLocation = (startLine, endLine) => ({
|
|
265
|
-
filePath: file.path,
|
|
266
|
-
startLine,
|
|
267
|
-
endLine,
|
|
268
|
-
});
|
|
269
|
-
const typeRegex = isKotlin ? KOTLIN_TYPE_REGEX : JAVA_TYPE_REGEX;
|
|
270
|
-
for (let i = 0; i < lines.length; i += 1) {
|
|
271
|
-
let text = (lines[i] ?? "").trim();
|
|
272
|
-
// The line an annotation's arguments finished on; declarations on that
|
|
273
|
-
// same line still belong to `i`'s pending annotations.
|
|
274
|
-
let declarationLineIndex = i;
|
|
275
|
-
if (!text)
|
|
276
|
-
continue;
|
|
277
|
-
// Annotations may sit on their own line, wrap across several, or share a
|
|
278
|
-
// line with the member they decorate.
|
|
279
|
-
while (text.startsWith("@")) {
|
|
280
|
-
const consumed = consumeAnnotation(lines, declarationLineIndex, text);
|
|
281
|
-
if (!consumed)
|
|
282
|
-
break;
|
|
283
|
-
pendingAnnotations.push(consumed.annotation);
|
|
284
|
-
text = consumed.rest;
|
|
285
|
-
declarationLineIndex = consumed.endIndex;
|
|
286
|
-
i = consumed.endIndex;
|
|
287
|
-
}
|
|
288
|
-
if (!text)
|
|
289
|
-
continue;
|
|
290
|
-
const lineNumber = declarationLineIndex + 1;
|
|
291
|
-
if (!packageName) {
|
|
292
|
-
const packageMatch = text.match(PACKAGE_REGEX);
|
|
293
|
-
if (packageMatch) {
|
|
294
|
-
packageName = packageMatch[1];
|
|
295
|
-
pendingAnnotations = [];
|
|
296
|
-
continue;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
const importMatch = text.match(IMPORT_REGEX);
|
|
300
|
-
if (importMatch) {
|
|
301
|
-
const raw = importMatch[2];
|
|
302
|
-
const isWildcard = raw.endsWith("*");
|
|
303
|
-
imports.push({
|
|
304
|
-
qualifiedName: raw.replace(/\.?\*$/, ""),
|
|
305
|
-
alias: importMatch[3],
|
|
306
|
-
isStatic: Boolean(importMatch[1]),
|
|
307
|
-
isWildcard,
|
|
308
|
-
location: toLocation(lineNumber, lineNumber),
|
|
309
|
-
});
|
|
310
|
-
pendingAnnotations = [];
|
|
311
|
-
continue;
|
|
312
|
-
}
|
|
313
|
-
const typeMatch = text.match(typeRegex);
|
|
314
|
-
if (typeMatch) {
|
|
315
|
-
const name = typeMatch[2];
|
|
316
|
-
currentType = name;
|
|
317
|
-
types.push({
|
|
318
|
-
name,
|
|
319
|
-
kind: normalizeTypeKind(typeMatch[1]),
|
|
320
|
-
baseTypes: isKotlin ? kotlinBaseTypes(text) : javaBaseTypes(text),
|
|
321
|
-
annotations: pendingAnnotations,
|
|
322
|
-
location: toLocation(lineNumber, lineNumber),
|
|
323
|
-
});
|
|
324
|
-
pendingAnnotations = [];
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
const methodMatch = isKotlin
|
|
328
|
-
? text.match(KOTLIN_FUNCTION_REGEX)
|
|
329
|
-
: matchJavaMethod(text);
|
|
330
|
-
if (methodMatch) {
|
|
331
|
-
methods.push({
|
|
332
|
-
name: methodMatch[1],
|
|
333
|
-
annotations: pendingAnnotations,
|
|
334
|
-
declaringType: currentType,
|
|
335
|
-
location: toLocation(lineNumber, findMemberEndLine(lines, declarationLineIndex)),
|
|
336
|
-
});
|
|
337
|
-
pendingAnnotations = [];
|
|
338
|
-
continue;
|
|
339
|
-
}
|
|
340
|
-
pendingAnnotations = [];
|
|
341
|
-
}
|
|
342
|
-
const calls = (0, c_family_calls_1.extractCFamilyCalls)(lines, { filePath: file.path });
|
|
343
|
-
return {
|
|
344
|
-
file,
|
|
345
|
-
normalizedPath,
|
|
346
|
-
strippedContent,
|
|
347
|
-
isKotlin,
|
|
348
|
-
packageName,
|
|
349
|
-
imports,
|
|
350
|
-
types,
|
|
351
|
-
methods,
|
|
352
|
-
calls,
|
|
353
|
-
warnings,
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Java method declarations have no leading keyword of their own — a
|
|
358
|
-
* package-private `void handle()` is just a type followed by a name — so
|
|
359
|
-
* statements that share that shape are rejected explicitly.
|
|
360
|
-
*/
|
|
361
|
-
function matchJavaMethod(text) {
|
|
362
|
-
const firstToken = text.match(/^([A-Za-z_]\w*)/)?.[1];
|
|
363
|
-
if (firstToken && JAVA_STATEMENT_STARTERS.has(firstToken))
|
|
364
|
-
return null;
|
|
365
|
-
const match = text.match(JAVA_METHOD_REGEX);
|
|
366
|
-
if (!match)
|
|
367
|
-
return null;
|
|
368
|
-
// An assignment is a field initializer, not a declaration:
|
|
369
|
-
// `private final Foo foo = new Foo(...)`.
|
|
370
|
-
const beforeParen = text.slice(0, text.indexOf("("));
|
|
371
|
-
if (beforeParen.includes("="))
|
|
372
|
-
return null;
|
|
373
|
-
return match;
|
|
374
|
-
}
|
|
375
|
-
function normalizeTypeKind(raw) {
|
|
376
|
-
const normalized = raw.replace(/\s+/g, " ").trim();
|
|
377
|
-
if (normalized === "interface")
|
|
378
|
-
return "interface";
|
|
379
|
-
if (normalized === "@interface" || normalized === "annotation class") {
|
|
380
|
-
return "annotation";
|
|
381
|
-
}
|
|
382
|
-
if (normalized === "enum" || normalized === "enum class")
|
|
383
|
-
return "enum";
|
|
384
|
-
if (normalized === "record")
|
|
385
|
-
return "record";
|
|
386
|
-
if (normalized === "object")
|
|
387
|
-
return "object";
|
|
388
|
-
return "class";
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Walk braces forward from a declaration to find its closing line. Abstract
|
|
392
|
-
* and interface methods, and Kotlin expression bodies, end on their own line.
|
|
393
|
-
*/
|
|
394
|
-
function findMemberEndLine(lines, startIndex) {
|
|
395
|
-
const startLine = lines[startIndex] ?? "";
|
|
396
|
-
const trimmed = startLine.trimEnd();
|
|
397
|
-
if (trimmed.endsWith(";"))
|
|
398
|
-
return startIndex + 1;
|
|
399
|
-
if (/=\s*[^=]*$/.test(trimmed) && !trimmed.endsWith("{")) {
|
|
400
|
-
return startIndex + 1;
|
|
401
|
-
}
|
|
402
|
-
let depth = 0;
|
|
403
|
-
let seenOpening = false;
|
|
404
|
-
for (let i = startIndex; i < lines.length; i += 1) {
|
|
405
|
-
const line = lines[i] ?? "";
|
|
406
|
-
for (const char of line) {
|
|
407
|
-
if (char === "{") {
|
|
408
|
-
depth += 1;
|
|
409
|
-
seenOpening = true;
|
|
410
|
-
}
|
|
411
|
-
else if (char === "}") {
|
|
412
|
-
depth -= 1;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
if (seenOpening && depth <= 0)
|
|
416
|
-
return i + 1;
|
|
417
|
-
}
|
|
418
|
-
return startIndex + 1;
|
|
419
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectJvmPatternsFromModel = detectJvmPatternsFromModel;
|
|
4
|
-
const engine_1 = require("../../patterns/engine");
|
|
5
|
-
/**
|
|
6
|
-
* Represent a JVM import as a language-agnostic import.
|
|
7
|
-
*
|
|
8
|
-
* The shared third-party catalog matches lowercase fragments (`stripe`,
|
|
9
|
-
* `sendgrid`) while JVM fully-qualified names mix cases
|
|
10
|
-
* (`com.stripe.StripeClient`), so the lowercased forms are carried alongside
|
|
11
|
-
* the segments.
|
|
12
|
-
*/
|
|
13
|
-
function importsForEngine(model) {
|
|
14
|
-
return model.imports.map((entry) => {
|
|
15
|
-
const qualifiedName = entry.qualifiedName;
|
|
16
|
-
const segments = qualifiedName.split(".").filter(Boolean);
|
|
17
|
-
const names = Array.from(new Set([
|
|
18
|
-
qualifiedName,
|
|
19
|
-
qualifiedName.toLowerCase(),
|
|
20
|
-
...segments,
|
|
21
|
-
...segments.map((segment) => segment.toLowerCase()),
|
|
22
|
-
...(entry.alias ? [entry.alias] : []),
|
|
23
|
-
])).filter(Boolean);
|
|
24
|
-
return { module: qualifiedName, names };
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Annotations are carried as decorator strings, both with and without their
|
|
29
|
-
* argument list: `GetMapping("/{id}")` and `GetMapping`.
|
|
30
|
-
*/
|
|
31
|
-
function annotationsAsDecorators(annotations) {
|
|
32
|
-
const decorators = new Set();
|
|
33
|
-
for (const annotation of annotations) {
|
|
34
|
-
decorators.add(annotation.raw);
|
|
35
|
-
decorators.add(annotation.name);
|
|
36
|
-
}
|
|
37
|
-
return Array.from(decorators);
|
|
38
|
-
}
|
|
39
|
-
function detectJvmPatternsFromModel(model) {
|
|
40
|
-
return (0, engine_1.matchPatterns)({
|
|
41
|
-
language: model.file.language,
|
|
42
|
-
file: model.file,
|
|
43
|
-
normalizedPath: model.normalizedPath,
|
|
44
|
-
strippedContent: model.strippedContent,
|
|
45
|
-
imports: importsForEngine(model),
|
|
46
|
-
functions: model.methods.map((method) => ({
|
|
47
|
-
name: method.name,
|
|
48
|
-
decorators: annotationsAsDecorators(method.annotations),
|
|
49
|
-
location: method.location,
|
|
50
|
-
})),
|
|
51
|
-
types: model.types.map((type) => ({
|
|
52
|
-
name: type.name,
|
|
53
|
-
kind: type.kind,
|
|
54
|
-
baseTypes: type.baseTypes,
|
|
55
|
-
decorators: annotationsAsDecorators(type.annotations),
|
|
56
|
-
location: type.location,
|
|
57
|
-
})),
|
|
58
|
-
moduleLevelCalls: model.calls.map((call) => ({
|
|
59
|
-
callee: call.callee,
|
|
60
|
-
argumentsSnippet: call.argumentsSnippet,
|
|
61
|
-
location: call.location,
|
|
62
|
-
})),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { RawFinding } from "../../core/types/detection";
|
|
2
|
-
import { type ManifestScanBudgetOptions } from "../shared/manifest-budgets";
|
|
3
|
-
export interface PythonManifestPackages {
|
|
4
|
-
manifestRelativePath: string;
|
|
5
|
-
packages: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare function parsePythonDependencyManifests(rootPath: string, opts?: ManifestScanBudgetOptions): Promise<PythonManifestPackages[]>;
|
|
8
|
-
export declare function detectPythonPatternsFromDependencyManifests(rootPath: string, opts?: ManifestScanBudgetOptions): Promise<RawFinding[]>;
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.parsePythonDependencyManifests = parsePythonDependencyManifests;
|
|
40
|
-
exports.detectPythonPatternsFromDependencyManifests = detectPythonPatternsFromDependencyManifests;
|
|
41
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
42
|
-
const path = __importStar(require("path"));
|
|
43
|
-
const engine_1 = require("../../patterns/engine");
|
|
44
|
-
const manifest_budgets_1 = require("../shared/manifest-budgets");
|
|
45
|
-
const manifest_fs_1 = require("../shared/manifest-fs");
|
|
46
|
-
const manifest_parsers_1 = require("./manifest-parsers");
|
|
47
|
-
function toPosixPath(p) {
|
|
48
|
-
return p.split(path.sep).join("/");
|
|
49
|
-
}
|
|
50
|
-
function createManifestFileInfo(manifestRelativePath) {
|
|
51
|
-
return {
|
|
52
|
-
path: manifestRelativePath,
|
|
53
|
-
name: path.basename(manifestRelativePath),
|
|
54
|
-
content: "",
|
|
55
|
-
language: "python",
|
|
56
|
-
size: 0,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
async function parsePythonDependencyManifests(rootPath, opts) {
|
|
60
|
-
const rootDir = path.resolve(rootPath);
|
|
61
|
-
const manifests = [];
|
|
62
|
-
const state = (0, manifest_budgets_1.budgetStateFromOptions)(opts);
|
|
63
|
-
await (0, manifest_fs_1.walkForManifests)(rootDir, manifests, {
|
|
64
|
-
rootDir,
|
|
65
|
-
state,
|
|
66
|
-
excludePaths: opts?.excludePaths,
|
|
67
|
-
isManifestFile: (_entry, entryPath) => {
|
|
68
|
-
const name = path.basename(entryPath);
|
|
69
|
-
const lower = name.toLowerCase();
|
|
70
|
-
const isRequirements = lower.startsWith("requirements") && lower.endsWith(".txt");
|
|
71
|
-
const isPyproject = lower === "pyproject.toml";
|
|
72
|
-
const isPipfile = name === "Pipfile";
|
|
73
|
-
return isRequirements || isPyproject || isPipfile;
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
const byManifest = [];
|
|
77
|
-
let bytesRead = 0;
|
|
78
|
-
const maxBytes = state.maxTotalManifestReadBytes;
|
|
79
|
-
for (const manifestAbsPath of manifests) {
|
|
80
|
-
if (bytesRead >= maxBytes)
|
|
81
|
-
break;
|
|
82
|
-
const lower = path.basename(manifestAbsPath).toLowerCase();
|
|
83
|
-
const manifestRelativePath = toPosixPath(path.relative(rootDir, manifestAbsPath));
|
|
84
|
-
let raw;
|
|
85
|
-
try {
|
|
86
|
-
raw = await promises_1.default.readFile(manifestAbsPath, "utf8");
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
bytesRead += raw.length;
|
|
92
|
-
let packages = [];
|
|
93
|
-
if (lower.startsWith("requirements") && lower.endsWith(".txt")) {
|
|
94
|
-
packages = (0, manifest_parsers_1.extractPackagesFromRequirementsTxt)(raw);
|
|
95
|
-
}
|
|
96
|
-
else if (lower === "pyproject.toml") {
|
|
97
|
-
packages = (0, manifest_parsers_1.extractPackagesFromPyprojectToml)(raw);
|
|
98
|
-
}
|
|
99
|
-
else if (path.basename(manifestAbsPath).toLowerCase() === "pipfile") {
|
|
100
|
-
packages = (0, manifest_parsers_1.extractPackagesFromPipfile)(raw);
|
|
101
|
-
}
|
|
102
|
-
// Skip empty manifests to avoid generating empty matchPatterns runs.
|
|
103
|
-
if (packages.length === 0)
|
|
104
|
-
continue;
|
|
105
|
-
byManifest.push({
|
|
106
|
-
manifestRelativePath,
|
|
107
|
-
packages: Array.from(new Set(packages)),
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
return byManifest;
|
|
111
|
-
}
|
|
112
|
-
async function detectPythonPatternsFromDependencyManifests(rootPath, opts) {
|
|
113
|
-
const manifestPackages = await parsePythonDependencyManifests(rootPath, opts);
|
|
114
|
-
if (manifestPackages.length === 0)
|
|
115
|
-
return [];
|
|
116
|
-
const findings = [];
|
|
117
|
-
for (const manifest of manifestPackages) {
|
|
118
|
-
const manifestFile = createManifestFileInfo(manifest.manifestRelativePath);
|
|
119
|
-
const imports = manifest.packages.map((p) => ({
|
|
120
|
-
module: p,
|
|
121
|
-
names: [p],
|
|
122
|
-
}));
|
|
123
|
-
findings.push(...(0, engine_1.matchPatterns)({
|
|
124
|
-
language: "python",
|
|
125
|
-
file: manifestFile,
|
|
126
|
-
normalizedPath: manifestFile.path,
|
|
127
|
-
imports,
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
return findings;
|
|
131
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectPythonPatterns = detectPythonPatterns;
|
|
4
|
-
const parser_1 = require("./parser");
|
|
5
|
-
const property_inference_1 = require("../shared/property-inference");
|
|
6
|
-
const patterns_1 = require("./patterns");
|
|
7
|
-
function detectPythonPatterns(file) {
|
|
8
|
-
const moduleModel = (0, parser_1.parsePythonModule)(file);
|
|
9
|
-
if (moduleModel.file.language !== "python") {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
const findings = [];
|
|
13
|
-
findings.push(...(0, patterns_1.detectPythonRoutePatterns)(moduleModel), ...(0, patterns_1.detectPythonDatabaseConnections)(moduleModel), ...(0, patterns_1.detectPythonExternalApiCalls)(moduleModel), ...(0, patterns_1.detectPythonAuthPatterns)(moduleModel), ...(0, patterns_1.detectPythonConfigAndEnvUsage)(moduleModel), ...(0, patterns_1.detectPythonServerlessHandlers)(moduleModel));
|
|
14
|
-
// Merge pattern-matched component properties (from YAML) into each finding.
|
|
15
|
-
for (const finding of findings) {
|
|
16
|
-
const detected = (0, property_inference_1.getPropertiesFromFinding)(finding, file.content);
|
|
17
|
-
if (Object.keys(detected).length > 0) {
|
|
18
|
-
finding.properties = { ...(finding.properties ?? {}), ...detected };
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return findings;
|
|
22
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPythonAnalyzer = createPythonAnalyzer;
|
|
4
|
-
const detector_1 = require("./detector");
|
|
5
|
-
function createPythonAnalyzer() {
|
|
6
|
-
return {
|
|
7
|
-
detect(file) {
|
|
8
|
-
return (0, detector_1.detectPythonPatterns)(file);
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
}
|