@dataparade/cli 0.0.8 → 0.0.10
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/README.md +10 -10
- package/dist/package.json +1 -1
- package/dist/src/ai-enrichment/lambda-init-error.d.ts +5 -0
- package/dist/src/ai-enrichment/lambda-init-error.js +38 -0
- package/dist/src/ai-enrichment/providers/platform-proxy-provider.d.ts +5 -0
- package/dist/src/ai-enrichment/providers/platform-proxy-provider.js +27 -1
- package/dist/src/analyzers/cpp/cpp-detection-config.d.ts +73 -0
- package/dist/src/analyzers/cpp/cpp-detection-config.js +137 -0
- package/dist/src/analyzers/cpp/dependency-manifests.d.ts +8 -0
- package/dist/src/analyzers/cpp/dependency-manifests.js +130 -0
- package/dist/src/analyzers/cpp/detector.d.ts +3 -0
- package/dist/src/analyzers/cpp/detector.js +21 -0
- package/dist/src/analyzers/cpp/index.d.ts +2 -0
- package/dist/src/analyzers/cpp/index.js +11 -0
- package/dist/src/analyzers/cpp/manifest-parsers.d.ts +13 -0
- package/dist/src/analyzers/cpp/manifest-parsers.js +104 -0
- package/dist/src/analyzers/cpp/parser.d.ts +35 -0
- package/dist/src/analyzers/cpp/parser.js +206 -0
- package/dist/src/analyzers/cpp/patterns.d.ts +3 -0
- package/dist/src/analyzers/cpp/patterns.js +37 -0
- package/dist/src/analyzers/csharp/csharp-detection-config.d.ts +100 -0
- package/dist/src/analyzers/csharp/csharp-detection-config.js +160 -0
- package/dist/src/analyzers/csharp/dependency-manifests.d.ts +13 -0
- package/dist/src/analyzers/csharp/dependency-manifests.js +184 -0
- package/dist/src/analyzers/csharp/detector.d.ts +3 -0
- package/dist/src/analyzers/csharp/detector.js +21 -0
- package/dist/src/analyzers/csharp/index.d.ts +2 -0
- package/dist/src/analyzers/csharp/index.js +11 -0
- package/dist/src/analyzers/csharp/manifest-parsers.d.ts +34 -0
- package/dist/src/analyzers/csharp/manifest-parsers.js +130 -0
- package/dist/src/analyzers/csharp/parser.d.ts +48 -0
- package/dist/src/analyzers/csharp/parser.js +277 -0
- package/dist/src/analyzers/csharp/patterns.d.ts +3 -0
- package/dist/src/analyzers/csharp/patterns.js +57 -0
- package/dist/src/analyzers/go/dependency-manifests.d.ts +10 -0
- package/dist/src/analyzers/go/dependency-manifests.js +117 -0
- package/dist/src/analyzers/go/detector.d.ts +3 -0
- package/dist/src/analyzers/go/detector.js +21 -0
- package/dist/src/analyzers/go/go-detection-config.d.ts +97 -0
- package/dist/src/analyzers/go/go-detection-config.js +164 -0
- package/dist/src/analyzers/go/index.d.ts +2 -0
- package/dist/src/analyzers/go/index.js +11 -0
- package/dist/src/analyzers/go/manifest-parsers.d.ts +20 -0
- package/dist/src/analyzers/go/manifest-parsers.js +104 -0
- package/dist/src/analyzers/go/parser.d.ts +40 -0
- package/dist/src/analyzers/go/parser.js +186 -0
- package/dist/src/analyzers/go/patterns.d.ts +3 -0
- package/dist/src/analyzers/go/patterns.js +50 -0
- package/dist/src/analyzers/jvm/dependency-manifests.d.ts +16 -0
- package/dist/src/analyzers/jvm/dependency-manifests.js +205 -0
- package/dist/src/analyzers/jvm/detector.d.ts +3 -0
- package/dist/src/analyzers/jvm/detector.js +21 -0
- package/dist/src/analyzers/jvm/index.d.ts +9 -0
- package/dist/src/analyzers/jvm/index.js +18 -0
- package/dist/src/analyzers/jvm/jvm-detection-config.d.ts +136 -0
- package/dist/src/analyzers/jvm/jvm-detection-config.js +195 -0
- package/dist/src/analyzers/jvm/manifest-parsers.d.ts +61 -0
- package/dist/src/analyzers/jvm/manifest-parsers.js +246 -0
- package/dist/src/analyzers/jvm/parser.d.ts +54 -0
- package/dist/src/analyzers/jvm/parser.js +419 -0
- package/dist/src/analyzers/jvm/patterns.d.ts +3 -0
- package/dist/src/analyzers/jvm/patterns.js +64 -0
- package/dist/src/analyzers/python/detector.js +1 -1
- package/dist/src/analyzers/python/parser.d.ts +1 -0
- package/dist/src/analyzers/python/parser.js +7 -0
- package/dist/src/analyzers/python/patterns.d.ts +1 -0
- package/dist/src/analyzers/python/patterns.js +22 -77
- package/dist/src/analyzers/python/python-detection-config.d.ts +18 -0
- package/dist/src/analyzers/python/python-detection-config.js +20 -0
- package/dist/src/analyzers/registry.js +15 -0
- package/dist/src/analyzers/shared/c-family-calls.d.ts +26 -0
- package/dist/src/analyzers/shared/c-family-calls.js +118 -0
- package/dist/src/analyzers/shared/strip-comments.d.ts +32 -0
- package/dist/src/analyzers/shared/strip-comments.js +167 -0
- package/dist/src/analyzers/typescript/detector.js +1 -1
- package/dist/src/analyzers/typescript/typescript-detection-config.d.ts +37 -0
- package/dist/src/analyzers/typescript/typescript-detection-config.js +48 -0
- package/dist/src/analyzers/typescript/typescript-detection.d.ts +1 -0
- package/dist/src/analyzers/typescript/typescript-detection.js +27 -29
- package/dist/src/cli.js +1 -1
- package/dist/src/config/file.js +5 -0
- package/dist/src/config/resolve.js +5 -0
- package/dist/src/core/pipeline/graph-mapping.js +3 -0
- package/dist/src/core/pipeline/structural-scan.js +154 -31
- package/dist/src/core/schema/scan-config.schema.d.ts +5 -0
- package/dist/src/core/schema/scan-config.schema.js +5 -0
- package/dist/src/core/schema/scan-result.schema.d.ts +5 -0
- package/dist/src/core/schema/scan-result.schema.js +5 -0
- package/dist/src/core/sectioning/discover-service-sections.js +27 -1
- package/dist/src/core/types/file.d.ts +1 -1
- package/dist/src/ingest/file-system.js +27 -0
- package/dist/src/patterns/config.d.ts +8 -0
- package/dist/src/patterns/config.js +136 -0
- package/dist/src/patterns/detectors/cpp.d.ts +8 -0
- package/dist/src/patterns/detectors/cpp.js +243 -0
- package/dist/src/patterns/detectors/csharp.d.ts +9 -0
- package/dist/src/patterns/detectors/csharp.js +385 -0
- package/dist/src/patterns/detectors/go.d.ts +9 -0
- package/dist/src/patterns/detectors/go.js +298 -0
- package/dist/src/patterns/detectors/helpers.d.ts +3 -0
- package/dist/src/patterns/detectors/helpers.js +5 -0
- package/dist/src/patterns/detectors/jvm.d.ts +15 -0
- package/dist/src/patterns/detectors/jvm.js +537 -0
- package/dist/src/patterns/detectors/python.d.ts +1 -0
- package/dist/src/patterns/detectors/python.js +92 -5
- package/dist/src/patterns/detectors/typescript.d.ts +2 -0
- package/dist/src/patterns/detectors/typescript.js +156 -4
- package/dist/src/patterns/engine.d.ts +18 -0
- package/dist/src/patterns/engine.js +30 -0
- package/dist/src/patterns/scan-exclusions.js +20 -0
- package/dist/tests/unit/ai-enrichment/lambda-init-error.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/lambda-init-error.spec.js +11 -0
- package/dist/tests/unit/ai-enrichment/platform-proxy-provider.spec.js +80 -0
- package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.js +66 -0
- package/dist/tests/unit/analyzers/cpp/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/cpp/parser.spec.js +80 -0
- package/dist/tests/unit/analyzers/cpp/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/cpp/patterns.spec.js +141 -0
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.js +75 -0
- package/dist/tests/unit/analyzers/csharp/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/csharp/parser.spec.js +118 -0
- package/dist/tests/unit/analyzers/csharp/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/csharp/patterns.spec.js +210 -0
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.js +96 -0
- package/dist/tests/unit/analyzers/go/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/go/parser.spec.js +110 -0
- package/dist/tests/unit/analyzers/go/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/go/patterns.spec.js +239 -0
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.js +179 -0
- package/dist/tests/unit/analyzers/jvm/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/jvm/parser.spec.js +195 -0
- package/dist/tests/unit/analyzers/jvm/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/jvm/patterns.spec.js +284 -0
- package/dist/tests/unit/analyzers/python/patterns.spec.js +169 -0
- package/dist/tests/unit/analyzers/typescript/detector.spec.js +188 -0
- package/dist/tests/unit/core/cpp-dotnet-scan.spec.d.ts +1 -0
- package/dist/tests/unit/core/cpp-dotnet-scan.spec.js +67 -0
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.d.ts +1 -0
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.js +46 -0
- package/dist/tests/unit/core/go-scan.spec.d.ts +1 -0
- package/dist/tests/unit/core/go-scan.spec.js +78 -0
- package/dist/tests/unit/core/graph-mapping.spec.js +75 -0
- package/dist/tests/unit/core/jvm-scan.spec.d.ts +1 -0
- package/dist/tests/unit/core/jvm-scan.spec.js +94 -0
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.js +56 -0
- package/dist/tests/unit/ingest/jvm-languages.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/jvm-languages.spec.js +47 -0
- package/package.json +1 -1
- package/patterns/cpp.md +176 -0
- package/patterns/cpp.patterns.yaml +314 -0
- package/patterns/csharp.md +211 -0
- package/patterns/csharp.patterns.yaml +375 -0
- package/patterns/go.md +211 -0
- package/patterns/go.patterns.yaml +429 -0
- package/patterns/jvm.md +160 -0
- package/patterns/jvm.patterns.yaml +884 -0
- package/patterns/python.patterns.yaml +177 -0
- package/patterns/third-party.patterns.yaml +5 -0
- package/patterns/typescript.patterns.yaml +222 -0
package/patterns/jvm.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# JVM Patterns — Java and Kotlin (CLI Scanner)
|
|
2
|
+
|
|
3
|
+
This document describes the JVM patterns implemented by the CLI codebase
|
|
4
|
+
scanner. One analyzer serves both Java and Kotlin.
|
|
5
|
+
|
|
6
|
+
The JVM analyzer emits `RawFinding[]` using the **shared pattern IDs** from
|
|
7
|
+
`core/types/detection.ts`:
|
|
8
|
+
|
|
9
|
+
- `express_route`
|
|
10
|
+
- `database_connection`
|
|
11
|
+
- `external_api_call`
|
|
12
|
+
- `auth_middleware`
|
|
13
|
+
- `config_file`
|
|
14
|
+
- `env_variable`
|
|
15
|
+
- `lambda_handler`
|
|
16
|
+
|
|
17
|
+
These pattern IDs align with the TypeScript/JavaScript, Python, Go, C++, and
|
|
18
|
+
C# analyzers so that the classifier and data-flow detector treat every
|
|
19
|
+
language consistently.
|
|
20
|
+
|
|
21
|
+
## Why one analyzer for two languages
|
|
22
|
+
|
|
23
|
+
Java and Kotlin are separate `FileLanguage` values (`java`, `kotlin`) mapped to
|
|
24
|
+
the same analyzer, the way TypeScript and JavaScript already are. They share
|
|
25
|
+
everything the rules key off:
|
|
26
|
+
|
|
27
|
+
- the same package namespace (`org.springframework.web.bind.annotation`)
|
|
28
|
+
- the same Maven/Gradle coordinate space (`org.postgresql:postgresql`)
|
|
29
|
+
- the same Spring and Jakarta annotation vocabulary
|
|
30
|
+
- the same JDBC URLs and drivers
|
|
31
|
+
|
|
32
|
+
They differ only in declaration grammar, which is confined to the parser, and
|
|
33
|
+
in a few framework-specific rules (Ktor, Exposed) that are gated by import
|
|
34
|
+
package like any other framework.
|
|
35
|
+
|
|
36
|
+
## Structure
|
|
37
|
+
|
|
38
|
+
- **YAML configuration** at `cli/patterns/jvm.patterns.yaml` defines pattern
|
|
39
|
+
IDs, import packages, Maven coordinates, annotations, call names, route
|
|
40
|
+
regexes, and confidences.
|
|
41
|
+
- **Config loader** (`cli/src/analyzers/jvm/jvm-detection-config.ts`) validates
|
|
42
|
+
the YAML and compiles its regexes.
|
|
43
|
+
- **Parser** (`cli/src/analyzers/jvm/parser.ts`) produces a source-file model:
|
|
44
|
+
package name, imports (with static/wildcard/alias flags), annotated types
|
|
45
|
+
(with supertypes), methods, and call sites.
|
|
46
|
+
- **Detectors** (`cli/src/patterns/detectors/jvm.ts`) run inside the shared
|
|
47
|
+
`matchPatterns()` engine.
|
|
48
|
+
- **Manifests** (`cli/src/analyzers/jvm/manifest-parsers.ts`) read Maven,
|
|
49
|
+
Gradle, version catalogs, and Spring datasource configuration.
|
|
50
|
+
|
|
51
|
+
## Two token spaces: imports vs. coordinates
|
|
52
|
+
|
|
53
|
+
Unlike Go — where a `go.mod` require line is the exact string that appears in
|
|
54
|
+
an `import` — the JVM has two unrelated vocabularies for the same library:
|
|
55
|
+
|
|
56
|
+
| | Token | Example |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| `importPackages` | what appears in an `import` | `org.springframework.data.jpa.repository` |
|
|
59
|
+
| `packageCoordinates` | Maven `groupId:artifactId` | `org.springframework.boot:spring-boot-starter-data-jpa` |
|
|
60
|
+
|
|
61
|
+
Rules therefore carry both. `importPackages` matches exactly or as a package
|
|
62
|
+
prefix, so one entry covers a whole subtree. `packageCoordinates` matches the
|
|
63
|
+
full coordinate, or by `groupId` prefix when the configured entry has no `:`.
|
|
64
|
+
|
|
65
|
+
Coordinate matching additionally **requires the candidate to contain a `:`**.
|
|
66
|
+
Without that guard, a configured groupId prefix such as `org.mongodb` would
|
|
67
|
+
also match the `com.mongodb…` import of a source file, and the same client
|
|
68
|
+
would be reported twice for one service.
|
|
69
|
+
|
|
70
|
+
## Route composition
|
|
71
|
+
|
|
72
|
+
Spring and Micronaut put a template on the class and a suffix on the method;
|
|
73
|
+
the detector joins them, exactly as the C# analyzer does for `[Route]` +
|
|
74
|
+
`[HttpGet]`:
|
|
75
|
+
|
|
76
|
+
```java
|
|
77
|
+
@RestController
|
|
78
|
+
@RequestMapping("/api/customers")
|
|
79
|
+
public class CustomersController {
|
|
80
|
+
@GetMapping("/{id}")
|
|
81
|
+
public Customer byId(@PathVariable Long id) { … } // GET /api/customers/{id}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Two JVM-specific wrinkles:
|
|
86
|
+
|
|
87
|
+
**Named annotation arguments.** A route template may be positional
|
|
88
|
+
(`@GetMapping("/x")`), named (`@RequestMapping(value = "/x")`), or an array
|
|
89
|
+
(`@RequestMapping({"/x", "/y"})`), and the HTTP verb may itself be an argument
|
|
90
|
+
(`method = RequestMethod.DELETE`). The detector reads `value`/`path` and
|
|
91
|
+
`method` by name, falling back to the first positional string. It deliberately
|
|
92
|
+
does **not** fall back to "any quoted string", which would read
|
|
93
|
+
`@RequestMapping(consumes = "application/json")` as a path.
|
|
94
|
+
|
|
95
|
+
**JAX-RS splits the verb from the path.** `@GET` carries no template; the
|
|
96
|
+
sub-path lives in a sibling `@Path("/{id}")` on the same method. Frameworks
|
|
97
|
+
declare a `pathAnnotations` list so the detector knows where to look when the
|
|
98
|
+
route annotation has no template of its own.
|
|
99
|
+
|
|
100
|
+
## JDBC URLs name the engine
|
|
101
|
+
|
|
102
|
+
JDBC is engine-agnostic at the API level. The concrete database appears only in
|
|
103
|
+
the URL sub-protocol, so without reading it every JDBC database collapses into
|
|
104
|
+
one generic SQL node:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
jdbc:postgresql://db.internal:5432/billing → databaseType: postgres
|
|
108
|
+
jdbc:acmedb://host/db → databaseType: sql (driver preserved)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
This is the JVM analogue of Go's `sql.Open` driver argument. The same table
|
|
112
|
+
also resolves the plain URI schemes Spring uses for non-relational stores
|
|
113
|
+
(`mongodb://`, `redis://`), because those arrive through the same code path.
|
|
114
|
+
|
|
115
|
+
**Only the driver token is ever recorded.** JDBC URLs and Spring datasource
|
|
116
|
+
properties routinely carry credentials; the value itself never reaches a
|
|
117
|
+
finding. There is a test asserting a fixture password does not survive.
|
|
118
|
+
|
|
119
|
+
## Spring configuration is a first-class source
|
|
120
|
+
|
|
121
|
+
`application.properties` / `application.yml` is frequently the only place a
|
|
122
|
+
Spring service names the databases it talks to — the analogue of .NET's
|
|
123
|
+
`appsettings.json` `ConnectionStrings`. The manifest scanner reads datasource
|
|
124
|
+
URIs out of both formats, including the multi-document YAML that Spring uses
|
|
125
|
+
for per-profile configuration.
|
|
126
|
+
|
|
127
|
+
## Build manifests
|
|
128
|
+
|
|
129
|
+
| Manifest | Parsed for |
|
|
130
|
+
| --- | --- |
|
|
131
|
+
| `pom.xml` | `<dependency>` and `<parent>` coordinates; `<scope>test</scope>` skipped |
|
|
132
|
+
| `build.gradle`, `build.gradle.kts` | Groovy and Kotlin DSL, string and map notation, `platform(…)` wrappers |
|
|
133
|
+
| `gradle/libs.versions.toml` | `[libraries]` `module` or `group`+`name` |
|
|
134
|
+
|
|
135
|
+
Test dependencies are excluded from Gradle by construction rather than by a
|
|
136
|
+
filter: the configurations that ship code are spelled `implementation`,
|
|
137
|
+
`runtimeOnly`, and so on, while test variants carry a capitalised infix
|
|
138
|
+
(`testImplementation`), so the `\b`-anchored lowercase names cannot match them.
|
|
139
|
+
|
|
140
|
+
## Section discovery
|
|
141
|
+
|
|
142
|
+
`pom.xml`, `build.gradle`, and `build.gradle.kts` are service-boundary markers.
|
|
143
|
+
Unlike `CMakeLists.txt` — deliberately excluded because C++ projects put one in
|
|
144
|
+
nearly every subdirectory — a JVM build file sits at a module root, and on the
|
|
145
|
+
JVM the module *is* the deployable unit.
|
|
146
|
+
|
|
147
|
+
`settings.gradle`/`settings.gradle.kts` is **not** a marker: it declares the
|
|
148
|
+
root of a multi-project build rather than a module of its own.
|
|
149
|
+
|
|
150
|
+
## Known limitations
|
|
151
|
+
|
|
152
|
+
- **Call arguments are read per line.** A call whose arguments wrap onto the
|
|
153
|
+
following line yields no URL, so an external API call spanning lines is
|
|
154
|
+
detected as a call but not attributed to a service. This is inherited from
|
|
155
|
+
the shared C-family call extractor and applies equally to Go, C++, and C#.
|
|
156
|
+
- **`bearer_token_header` is broad.** It fires on any file containing the
|
|
157
|
+
literal `"Authorization"` at 0.7 confidence — the same trade-off as the Go
|
|
158
|
+
and C++ equivalents.
|
|
159
|
+
- **gRPC service registration** is emitted as an `express_route` with method
|
|
160
|
+
`RPC`, matching the Go analyzer's treatment.
|