@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.
Files changed (164) hide show
  1. package/README.md +10 -10
  2. package/dist/package.json +1 -1
  3. package/dist/src/ai-enrichment/lambda-init-error.d.ts +5 -0
  4. package/dist/src/ai-enrichment/lambda-init-error.js +38 -0
  5. package/dist/src/ai-enrichment/providers/platform-proxy-provider.d.ts +5 -0
  6. package/dist/src/ai-enrichment/providers/platform-proxy-provider.js +27 -1
  7. package/dist/src/analyzers/cpp/cpp-detection-config.d.ts +73 -0
  8. package/dist/src/analyzers/cpp/cpp-detection-config.js +137 -0
  9. package/dist/src/analyzers/cpp/dependency-manifests.d.ts +8 -0
  10. package/dist/src/analyzers/cpp/dependency-manifests.js +130 -0
  11. package/dist/src/analyzers/cpp/detector.d.ts +3 -0
  12. package/dist/src/analyzers/cpp/detector.js +21 -0
  13. package/dist/src/analyzers/cpp/index.d.ts +2 -0
  14. package/dist/src/analyzers/cpp/index.js +11 -0
  15. package/dist/src/analyzers/cpp/manifest-parsers.d.ts +13 -0
  16. package/dist/src/analyzers/cpp/manifest-parsers.js +104 -0
  17. package/dist/src/analyzers/cpp/parser.d.ts +35 -0
  18. package/dist/src/analyzers/cpp/parser.js +206 -0
  19. package/dist/src/analyzers/cpp/patterns.d.ts +3 -0
  20. package/dist/src/analyzers/cpp/patterns.js +37 -0
  21. package/dist/src/analyzers/csharp/csharp-detection-config.d.ts +100 -0
  22. package/dist/src/analyzers/csharp/csharp-detection-config.js +160 -0
  23. package/dist/src/analyzers/csharp/dependency-manifests.d.ts +13 -0
  24. package/dist/src/analyzers/csharp/dependency-manifests.js +184 -0
  25. package/dist/src/analyzers/csharp/detector.d.ts +3 -0
  26. package/dist/src/analyzers/csharp/detector.js +21 -0
  27. package/dist/src/analyzers/csharp/index.d.ts +2 -0
  28. package/dist/src/analyzers/csharp/index.js +11 -0
  29. package/dist/src/analyzers/csharp/manifest-parsers.d.ts +34 -0
  30. package/dist/src/analyzers/csharp/manifest-parsers.js +130 -0
  31. package/dist/src/analyzers/csharp/parser.d.ts +48 -0
  32. package/dist/src/analyzers/csharp/parser.js +277 -0
  33. package/dist/src/analyzers/csharp/patterns.d.ts +3 -0
  34. package/dist/src/analyzers/csharp/patterns.js +57 -0
  35. package/dist/src/analyzers/go/dependency-manifests.d.ts +10 -0
  36. package/dist/src/analyzers/go/dependency-manifests.js +117 -0
  37. package/dist/src/analyzers/go/detector.d.ts +3 -0
  38. package/dist/src/analyzers/go/detector.js +21 -0
  39. package/dist/src/analyzers/go/go-detection-config.d.ts +97 -0
  40. package/dist/src/analyzers/go/go-detection-config.js +164 -0
  41. package/dist/src/analyzers/go/index.d.ts +2 -0
  42. package/dist/src/analyzers/go/index.js +11 -0
  43. package/dist/src/analyzers/go/manifest-parsers.d.ts +20 -0
  44. package/dist/src/analyzers/go/manifest-parsers.js +104 -0
  45. package/dist/src/analyzers/go/parser.d.ts +40 -0
  46. package/dist/src/analyzers/go/parser.js +186 -0
  47. package/dist/src/analyzers/go/patterns.d.ts +3 -0
  48. package/dist/src/analyzers/go/patterns.js +50 -0
  49. package/dist/src/analyzers/jvm/dependency-manifests.d.ts +16 -0
  50. package/dist/src/analyzers/jvm/dependency-manifests.js +205 -0
  51. package/dist/src/analyzers/jvm/detector.d.ts +3 -0
  52. package/dist/src/analyzers/jvm/detector.js +21 -0
  53. package/dist/src/analyzers/jvm/index.d.ts +9 -0
  54. package/dist/src/analyzers/jvm/index.js +18 -0
  55. package/dist/src/analyzers/jvm/jvm-detection-config.d.ts +136 -0
  56. package/dist/src/analyzers/jvm/jvm-detection-config.js +195 -0
  57. package/dist/src/analyzers/jvm/manifest-parsers.d.ts +61 -0
  58. package/dist/src/analyzers/jvm/manifest-parsers.js +246 -0
  59. package/dist/src/analyzers/jvm/parser.d.ts +54 -0
  60. package/dist/src/analyzers/jvm/parser.js +419 -0
  61. package/dist/src/analyzers/jvm/patterns.d.ts +3 -0
  62. package/dist/src/analyzers/jvm/patterns.js +64 -0
  63. package/dist/src/analyzers/python/detector.js +1 -1
  64. package/dist/src/analyzers/python/parser.d.ts +1 -0
  65. package/dist/src/analyzers/python/parser.js +7 -0
  66. package/dist/src/analyzers/python/patterns.d.ts +1 -0
  67. package/dist/src/analyzers/python/patterns.js +22 -77
  68. package/dist/src/analyzers/python/python-detection-config.d.ts +18 -0
  69. package/dist/src/analyzers/python/python-detection-config.js +20 -0
  70. package/dist/src/analyzers/registry.js +15 -0
  71. package/dist/src/analyzers/shared/c-family-calls.d.ts +26 -0
  72. package/dist/src/analyzers/shared/c-family-calls.js +118 -0
  73. package/dist/src/analyzers/shared/strip-comments.d.ts +32 -0
  74. package/dist/src/analyzers/shared/strip-comments.js +167 -0
  75. package/dist/src/analyzers/typescript/detector.js +1 -1
  76. package/dist/src/analyzers/typescript/typescript-detection-config.d.ts +37 -0
  77. package/dist/src/analyzers/typescript/typescript-detection-config.js +48 -0
  78. package/dist/src/analyzers/typescript/typescript-detection.d.ts +1 -0
  79. package/dist/src/analyzers/typescript/typescript-detection.js +27 -29
  80. package/dist/src/cli.js +1 -1
  81. package/dist/src/config/file.js +5 -0
  82. package/dist/src/config/resolve.js +5 -0
  83. package/dist/src/core/pipeline/graph-mapping.js +3 -0
  84. package/dist/src/core/pipeline/structural-scan.js +154 -31
  85. package/dist/src/core/schema/scan-config.schema.d.ts +5 -0
  86. package/dist/src/core/schema/scan-config.schema.js +5 -0
  87. package/dist/src/core/schema/scan-result.schema.d.ts +5 -0
  88. package/dist/src/core/schema/scan-result.schema.js +5 -0
  89. package/dist/src/core/sectioning/discover-service-sections.js +27 -1
  90. package/dist/src/core/types/file.d.ts +1 -1
  91. package/dist/src/ingest/file-system.js +27 -0
  92. package/dist/src/patterns/config.d.ts +8 -0
  93. package/dist/src/patterns/config.js +136 -0
  94. package/dist/src/patterns/detectors/cpp.d.ts +8 -0
  95. package/dist/src/patterns/detectors/cpp.js +243 -0
  96. package/dist/src/patterns/detectors/csharp.d.ts +9 -0
  97. package/dist/src/patterns/detectors/csharp.js +385 -0
  98. package/dist/src/patterns/detectors/go.d.ts +9 -0
  99. package/dist/src/patterns/detectors/go.js +298 -0
  100. package/dist/src/patterns/detectors/helpers.d.ts +3 -0
  101. package/dist/src/patterns/detectors/helpers.js +5 -0
  102. package/dist/src/patterns/detectors/jvm.d.ts +15 -0
  103. package/dist/src/patterns/detectors/jvm.js +537 -0
  104. package/dist/src/patterns/detectors/python.d.ts +1 -0
  105. package/dist/src/patterns/detectors/python.js +92 -5
  106. package/dist/src/patterns/detectors/typescript.d.ts +2 -0
  107. package/dist/src/patterns/detectors/typescript.js +156 -4
  108. package/dist/src/patterns/engine.d.ts +18 -0
  109. package/dist/src/patterns/engine.js +30 -0
  110. package/dist/src/patterns/scan-exclusions.js +20 -0
  111. package/dist/tests/unit/ai-enrichment/lambda-init-error.spec.d.ts +1 -0
  112. package/dist/tests/unit/ai-enrichment/lambda-init-error.spec.js +11 -0
  113. package/dist/tests/unit/ai-enrichment/platform-proxy-provider.spec.js +80 -0
  114. package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.d.ts +1 -0
  115. package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.js +66 -0
  116. package/dist/tests/unit/analyzers/cpp/parser.spec.d.ts +1 -0
  117. package/dist/tests/unit/analyzers/cpp/parser.spec.js +80 -0
  118. package/dist/tests/unit/analyzers/cpp/patterns.spec.d.ts +1 -0
  119. package/dist/tests/unit/analyzers/cpp/patterns.spec.js +141 -0
  120. package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.d.ts +1 -0
  121. package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.js +75 -0
  122. package/dist/tests/unit/analyzers/csharp/parser.spec.d.ts +1 -0
  123. package/dist/tests/unit/analyzers/csharp/parser.spec.js +118 -0
  124. package/dist/tests/unit/analyzers/csharp/patterns.spec.d.ts +1 -0
  125. package/dist/tests/unit/analyzers/csharp/patterns.spec.js +210 -0
  126. package/dist/tests/unit/analyzers/go/dependency-manifests.spec.d.ts +1 -0
  127. package/dist/tests/unit/analyzers/go/dependency-manifests.spec.js +96 -0
  128. package/dist/tests/unit/analyzers/go/parser.spec.d.ts +1 -0
  129. package/dist/tests/unit/analyzers/go/parser.spec.js +110 -0
  130. package/dist/tests/unit/analyzers/go/patterns.spec.d.ts +1 -0
  131. package/dist/tests/unit/analyzers/go/patterns.spec.js +239 -0
  132. package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.d.ts +1 -0
  133. package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.js +179 -0
  134. package/dist/tests/unit/analyzers/jvm/parser.spec.d.ts +1 -0
  135. package/dist/tests/unit/analyzers/jvm/parser.spec.js +195 -0
  136. package/dist/tests/unit/analyzers/jvm/patterns.spec.d.ts +1 -0
  137. package/dist/tests/unit/analyzers/jvm/patterns.spec.js +284 -0
  138. package/dist/tests/unit/analyzers/python/patterns.spec.js +169 -0
  139. package/dist/tests/unit/analyzers/typescript/detector.spec.js +188 -0
  140. package/dist/tests/unit/core/cpp-dotnet-scan.spec.d.ts +1 -0
  141. package/dist/tests/unit/core/cpp-dotnet-scan.spec.js +67 -0
  142. package/dist/tests/unit/core/cpp-dotnet-sections.spec.d.ts +1 -0
  143. package/dist/tests/unit/core/cpp-dotnet-sections.spec.js +46 -0
  144. package/dist/tests/unit/core/go-scan.spec.d.ts +1 -0
  145. package/dist/tests/unit/core/go-scan.spec.js +78 -0
  146. package/dist/tests/unit/core/graph-mapping.spec.js +75 -0
  147. package/dist/tests/unit/core/jvm-scan.spec.d.ts +1 -0
  148. package/dist/tests/unit/core/jvm-scan.spec.js +94 -0
  149. package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.d.ts +1 -0
  150. package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.js +56 -0
  151. package/dist/tests/unit/ingest/jvm-languages.spec.d.ts +1 -0
  152. package/dist/tests/unit/ingest/jvm-languages.spec.js +47 -0
  153. package/package.json +1 -1
  154. package/patterns/cpp.md +176 -0
  155. package/patterns/cpp.patterns.yaml +314 -0
  156. package/patterns/csharp.md +211 -0
  157. package/patterns/csharp.patterns.yaml +375 -0
  158. package/patterns/go.md +211 -0
  159. package/patterns/go.patterns.yaml +429 -0
  160. package/patterns/jvm.md +160 -0
  161. package/patterns/jvm.patterns.yaml +884 -0
  162. package/patterns/python.patterns.yaml +177 -0
  163. package/patterns/third-party.patterns.yaml +5 -0
  164. package/patterns/typescript.patterns.yaml +222 -0
@@ -0,0 +1,47 @@
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
+ const promises_1 = __importDefault(require("fs/promises"));
7
+ const os_1 = __importDefault(require("os"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const file_system_1 = require("../../../src/ingest/file-system");
10
+ describe("ingest/file-system - Java and Kotlin language mapping", () => {
11
+ let root;
12
+ beforeAll(async () => {
13
+ root = await promises_1.default.mkdtemp(path_1.default.join(os_1.default.tmpdir(), "dp-ingest-jvm-"));
14
+ const files = {
15
+ "Application.java": "class Application {}",
16
+ "Routes.kt": "fun routes() {}",
17
+ "build.gradle.kts": "plugins { }",
18
+ "notes.md": "# notes",
19
+ };
20
+ for (const [name, content] of Object.entries(files)) {
21
+ await promises_1.default.writeFile(path_1.default.join(root, name), content, "utf8");
22
+ }
23
+ // Maven and Gradle build output is excluded by default.
24
+ await promises_1.default.mkdir(path_1.default.join(root, "target", "classes"), { recursive: true });
25
+ await promises_1.default.writeFile(path_1.default.join(root, "target", "classes", "Generated.java"), "class Generated {}", "utf8");
26
+ await promises_1.default.mkdir(path_1.default.join(root, ".gradle"), { recursive: true });
27
+ await promises_1.default.writeFile(path_1.default.join(root, ".gradle", "Cached.kt"), "fun cached() {}", "utf8");
28
+ });
29
+ afterAll(async () => {
30
+ await promises_1.default.rm(root, { recursive: true, force: true });
31
+ });
32
+ it("maps .java to java and .kt/.kts to kotlin", async () => {
33
+ const files = await (0, file_system_1.ingestFileSystem)(root);
34
+ const byName = new Map(files.map((file) => [file.name, file.language]));
35
+ expect(byName.get("Application.java")).toBe("java");
36
+ expect(byName.get("Routes.kt")).toBe("kotlin");
37
+ expect(byName.get("build.gradle.kts")).toBe("kotlin");
38
+ expect(byName.has("notes.md")).toBe(false);
39
+ });
40
+ it("excludes Maven and Gradle build output", async () => {
41
+ const files = await (0, file_system_1.ingestFileSystem)(root);
42
+ const names = files.map((file) => file.name);
43
+ // `target/` is excluded by name; `.gradle/` as a hidden directory.
44
+ expect(names).not.toContain("Generated.java");
45
+ expect(names).not.toContain("Cached.kt");
46
+ });
47
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataparade/cli",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "dataPARADE CLI — scan codebases for privacy and security data flows",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -0,0 +1,176 @@
1
+ # C++ Patterns (CLI Scanner)
2
+
3
+ This document describes the C++ patterns implemented by the CLI codebase
4
+ scanner.
5
+
6
+ The C++ 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
+
16
+ These pattern IDs align with the TypeScript/JavaScript, Python, and C#
17
+ analyzers so that the classifier and data-flow detector treat every language
18
+ consistently.
19
+
20
+ ## Structure
21
+
22
+ - **YAML configuration** at `cli/patterns/cpp.patterns.yaml` defines pattern
23
+ IDs, headers, package names, call names, route regexes, and confidences.
24
+ - **Config loader** (`cli/src/analyzers/cpp/cpp-detection-config.ts`) validates
25
+ the YAML and compiles its regexes.
26
+ - **Parser** (`cli/src/analyzers/cpp/parser.ts`) produces a lightweight
27
+ translation-unit model: includes, functions, types, namespaces, and call
28
+ sites.
29
+ - **Detectors** (`cli/src/patterns/detectors/cpp.ts`) run inside the shared
30
+ `matchPatterns()` engine.
31
+
32
+ ### Comment handling
33
+
34
+ C++ sources are pre-processed by `stripCommentsPreservingLayout()`
35
+ (`cli/src/analyzers/shared/strip-comments.ts`) before any line-based rule runs.
36
+ Comments are replaced with spaces so line numbers stay accurate, and string
37
+ literals are preserved — a URL like `"https://api.example.com"` must not be
38
+ truncated at its `//`. Commented-out routes therefore produce no findings.
39
+
40
+ ### Header matching
41
+
42
+ `includeHeaders` values are matched against `#include` paths:
43
+
44
+ - A value **without** a `/` must match a whole path segment. `hiredis` matches
45
+ `<hiredis/hiredis.h>`; `sql.h` does **not** match `<mysql/mysql.h>`.
46
+ - A value **with** a `/` is matched as a substring, e.g. `curl/curl.h`.
47
+
48
+ ---
49
+
50
+ ## Route / Handler Detection (`express_route`)
51
+
52
+ Route detection is regex-driven per framework and gated on the framework's
53
+ headers. Each rule declares a `regex` plus optional `methodGroup` /
54
+ `pathGroup` / `defaultMethod`.
55
+
56
+ | Framework | Detected form |
57
+ | --- | --- |
58
+ | Crow | `CROW_ROUTE(app, "/users")`, `CROW_BP_ROUTE(...)` |
59
+ | cpp-httplib | `svr.Get("/health", ...)`, `svr.Post(...)` |
60
+ | Drogon | `registerHandler("/users", ...)`, `ADD_METHOD_TO(...)`, `METHOD_ADD(...)` |
61
+ | Pistache | `Routes::Get(router, "/users", ...)` |
62
+ | oatpp | `ENDPOINT("GET", "/users", name)` |
63
+
64
+ **Example:**
65
+
66
+ ```cpp
67
+ #include <crow.h>
68
+
69
+ int main() {
70
+ crow::SimpleApp app;
71
+ CROW_ROUTE(app, "/customers")([]() { return crow::response(200); });
72
+ app.port(8080).run();
73
+ }
74
+ ```
75
+
76
+ **Emitted finding:**
77
+
78
+ - `pattern`: `express_route`
79
+ - `name`: `"<METHOD> <path>"` when the framework encodes a method, otherwise
80
+ `"<FRAMEWORK>_ROUTE <path>"`
81
+ - `properties`: `framework`, `httpMethods`, `path`
82
+
83
+ ---
84
+
85
+ ## Database Connections (`database_connection`)
86
+
87
+ Detected from a header include, a package-manifest entry, or a call site.
88
+
89
+ | Client | `databaseType` | Signals |
90
+ | --- | --- | --- |
91
+ | libpq | `postgres` | `<libpq-fe.h>`, `PQconnectdb` |
92
+ | libpqxx | `postgres` | `<pqxx/pqxx>`, `pqxx::connection` |
93
+ | SQLite3 | `sqlite` | `<sqlite3.h>`, `sqlite3_open` |
94
+ | MySQL Connector/C++ | `mysql` | `<mysql/mysql.h>`, `mysql_real_connect` |
95
+ | mongocxx | `mongodb` | `<mongocxx/client.hpp>`, `mongocxx::client` |
96
+ | hiredis | `redis` | `<hiredis/hiredis.h>`, `redisConnect` |
97
+ | redis-plus-plus | `redis` | `<sw/redis++/redis++.h>` |
98
+ | SOCI | `sql` | `<soci/soci.h>`, `soci::session` |
99
+ | nanodbc | `sql` | `<nanodbc/nanodbc.h>` |
100
+ | DataStax C++ driver | `cassandra` | `<cassandra.h>`, `cass_session_connect` |
101
+
102
+ **Emitted properties:** `client`, `databaseType`.
103
+
104
+ ---
105
+
106
+ ## External API Calls (`external_api_call`)
107
+
108
+ Matched on call sites whose callee is a configured `callNames` entry or starts
109
+ with a configured `callNamePrefixes` entry, gated on the client's headers. When
110
+ the call arguments contain a literal URL, the service name is resolved from the
111
+ third-party catalog (`third-party.patterns.yaml`).
112
+
113
+ | Client | Signals |
114
+ | --- | --- |
115
+ | libcurl | `<curl/curl.h>`, `curl_easy_setopt(..., CURLOPT_URL, "https://...")` |
116
+ | cpr | `<cpr/cpr.h>`, any `cpr::` call |
117
+ | cpp-httplib client | `httplib::Client("https://...")` |
118
+ | POCO | `Poco::Net::HTTPSClientSession`, `Poco::URI` |
119
+ | Boost.Beast | `<boost/beast/http.hpp>` |
120
+
121
+ **Example:**
122
+
123
+ ```cpp
124
+ #include <curl/curl.h>
125
+
126
+ CURL* curl = curl_easy_init();
127
+ curl_easy_setopt(curl, CURLOPT_URL, "https://api.stripe.com/v1/charges");
128
+ ```
129
+
130
+ → `external_api_call` with `properties.serviceName = "stripe"`.
131
+
132
+ ---
133
+
134
+ ## Auth (`auth_middleware`)
135
+
136
+ - **jwt-cpp** — `<jwt-cpp/jwt.h>` or `jwt::decode` / `jwt::verify` /
137
+ `jwt::create`; emits `properties.strategy = "jwt"`.
138
+ - **Bearer token headers** — a literal `"Authorization"` header or a
139
+ `Authorization: Bearer` construction; lower confidence (`0.7`), emits
140
+ `properties.strategy = "bearer_token"`.
141
+
142
+ ---
143
+
144
+ ## Config and Environment (`config_file`, `env_variable`)
145
+
146
+ - `env_variable`: `getenv("KEY")` / `std::getenv("KEY")`; the key is captured
147
+ into `properties.key`.
148
+ - `config_file`: files named `config`, `configuration`, or `settings` with a
149
+ C++ extension (`.h`, `.hpp`, `.hxx`, `.cpp`, `.cc`, `.cxx`).
150
+
151
+ ---
152
+
153
+ ## Dependency Manifests
154
+
155
+ `cli/src/analyzers/cpp/dependency-manifests.ts` walks the repository for:
156
+
157
+ - `vcpkg.json` — `dependencies` (string and object forms)
158
+ - `conanfile.txt` — `[requires]` / `[tool_requires]`
159
+ - `conanfile.py` — `requires = "..."`, `self.requires("...")`
160
+ - `CMakeLists.txt` — `find_package()`, `FetchContent_Declare()`, `CPMAddPackage()`
161
+
162
+ Versions are stripped (`fmt/10.2.1` → `fmt`). Package names feed the shared
163
+ third-party service catalog and the `packageNames` field of the database and
164
+ auth rules, so a `libpqxx` dependency is reported as a Postgres client even
165
+ when no source file was scanned.
166
+
167
+ Manifest walking is bounded by the shared budgets in
168
+ `cli/src/analyzers/shared/manifest-budgets.ts`.
169
+
170
+ ---
171
+
172
+ ## File Types
173
+
174
+ The ingest layer maps `.cpp`, `.cc`, `.cxx`, `.c++`, `.hpp`, `.hh`, `.hxx`,
175
+ `.ipp`, `.inl`, and `.h` to the `cpp` language. `cmake-build-debug/` and
176
+ `cmake-build-release/` are excluded by default.
@@ -0,0 +1,314 @@
1
+ # C++ pattern config. All entries share: patternId, optional confidence (default 0.8).
2
+ #
3
+ # Header gating (`includeHeaders`) works on `#include` paths: a value without a
4
+ # "/" matches a whole path segment (`hiredis` matches <hiredis/hiredis.h> but
5
+ # `sql.h` does not match <mysql/mysql.h>); a value with a "/" is matched as a
6
+ # substring (`curl/curl.h`).
7
+
8
+ db_clients:
9
+ - id: libpq
10
+ packageNames:
11
+ - libpq
12
+ patternId: database_connection
13
+ databaseType: postgres
14
+ includeHeaders:
15
+ - libpq-fe.h
16
+ callNames:
17
+ - PQconnectdb
18
+ - PQconnectdbParams
19
+ - PQsetdbLogin
20
+ confidence: 0.9
21
+
22
+ - id: libpqxx
23
+ packageNames:
24
+ - libpqxx
25
+ patternId: database_connection
26
+ databaseType: postgres
27
+ includeHeaders:
28
+ - pqxx/pqxx
29
+ - pqxx
30
+ callNames:
31
+ - pqxx::connection
32
+ - pqxx::lazyconnection
33
+ confidence: 0.9
34
+
35
+ - id: sqlite3
36
+ packageNames:
37
+ - sqlite3
38
+ - sqlite
39
+ patternId: database_connection
40
+ databaseType: sqlite
41
+ includeHeaders:
42
+ - sqlite3.h
43
+ - sqlite3ext.h
44
+ callNames:
45
+ - sqlite3_open
46
+ - sqlite3_open_v2
47
+ - sqlite3_open16
48
+ confidence: 0.9
49
+
50
+ - id: mysql_connector_cpp
51
+ packageNames:
52
+ - libmysql
53
+ - mysql-connector-cpp
54
+ - mysql
55
+ patternId: database_connection
56
+ databaseType: mysql
57
+ includeHeaders:
58
+ - mysql.h
59
+ - mysql/mysql.h
60
+ - mysql_driver.h
61
+ - mysqlx/xdevapi.h
62
+ callNames:
63
+ - mysql_real_connect
64
+ - get_mysql_driver_instance
65
+ - mysqlx::Session
66
+ - sql::mysql::get_mysql_driver_instance
67
+ confidence: 0.9
68
+
69
+ - id: mongocxx
70
+ packageNames:
71
+ - mongo-cxx-driver
72
+ - mongocxx
73
+ patternId: database_connection
74
+ databaseType: mongodb
75
+ includeHeaders:
76
+ - mongocxx/client.hpp
77
+ - mongocxx/uri.hpp
78
+ - mongocxx/instance.hpp
79
+ callNames:
80
+ - mongocxx::client
81
+ - mongocxx::uri
82
+ - mongocxx::pool
83
+ confidence: 0.9
84
+
85
+ - id: hiredis
86
+ packageNames:
87
+ - hiredis
88
+ patternId: database_connection
89
+ databaseType: redis
90
+ includeHeaders:
91
+ - hiredis
92
+ - hiredis.h
93
+ callNames:
94
+ - redisConnect
95
+ - redisConnectWithTimeout
96
+ - redisConnectUnix
97
+ confidence: 0.9
98
+
99
+ - id: redis_plus_plus
100
+ packageNames:
101
+ - redis-plus-plus
102
+ patternId: database_connection
103
+ databaseType: redis
104
+ includeHeaders:
105
+ - sw/redis++/redis++.h
106
+ callNames:
107
+ - sw::redis::Redis
108
+ - sw::redis::RedisCluster
109
+ confidence: 0.85
110
+
111
+ - id: soci
112
+ packageNames:
113
+ - soci
114
+ patternId: database_connection
115
+ databaseType: sql
116
+ includeHeaders:
117
+ - soci/soci.h
118
+ - soci
119
+ callNames:
120
+ - soci::session
121
+ confidence: 0.85
122
+
123
+ - id: nanodbc
124
+ packageNames:
125
+ - nanodbc
126
+ patternId: database_connection
127
+ databaseType: sql
128
+ includeHeaders:
129
+ - nanodbc/nanodbc.h
130
+ - nanodbc.h
131
+ callNames:
132
+ - nanodbc::connection
133
+ confidence: 0.85
134
+
135
+ - id: cassandra_cpp
136
+ packageNames:
137
+ - cassandra-cpp-driver
138
+ patternId: database_connection
139
+ databaseType: cassandra
140
+ includeHeaders:
141
+ - cassandra.h
142
+ callNames:
143
+ - cass_cluster_new
144
+ - cass_session_connect
145
+ confidence: 0.85
146
+
147
+ - id: odbc_mssql
148
+ patternId: database_connection
149
+ databaseType: mssql
150
+ includeHeaders:
151
+ - sql.h
152
+ - sqlext.h
153
+ - odbcss.h
154
+ - sqltypes.h
155
+ callNames:
156
+ - SQLConnect
157
+ - SQLDriverConnect
158
+ - SQLAllocHandle
159
+ confidence: 0.85
160
+
161
+ auth:
162
+ libraries:
163
+ - id: jwt_cpp
164
+ packageNames:
165
+ - jwt-cpp
166
+ patternId: auth_middleware
167
+ includeHeaders:
168
+ - jwt-cpp/jwt.h
169
+ - jwt-cpp/traits/kazuho-picojson/defaults.h
170
+ callNames:
171
+ - jwt::decode
172
+ - jwt::verify
173
+ - jwt::create
174
+ strategy: jwt
175
+ confidence: 0.85
176
+
177
+ - id: bearer_token_header
178
+ patternId: auth_middleware
179
+ contentRegexes:
180
+ - 'Authorization["'']?\s*,?\s*["'']?\s*Bearer'
181
+ - '"Authorization"'
182
+ strategy: bearer_token
183
+ confidence: 0.7
184
+
185
+ routes:
186
+ frameworks:
187
+ - id: crow
188
+ patternId: express_route
189
+ includeHeaders:
190
+ - crow.h
191
+ - crow_all.h
192
+ - crow/app.h
193
+ confidence: 0.9
194
+ routeRegexes:
195
+ - regex: 'CROW_(?:BP_)?ROUTE\s*\(\s*[A-Za-z_][A-Za-z0-9_]*\s*,\s*"([^"]+)"'
196
+ pathGroup: 1
197
+
198
+ - id: cpp_httplib
199
+ patternId: express_route
200
+ includeHeaders:
201
+ - httplib.h
202
+ confidence: 0.9
203
+ routeRegexes:
204
+ - regex: '\b[A-Za-z_][A-Za-z0-9_]*\.(Get|Post|Put|Delete|Patch|Options)\s*\(\s*R?"([^"]+)"\s*,'
205
+ methodGroup: 1
206
+ pathGroup: 2
207
+
208
+ - id: drogon
209
+ patternId: express_route
210
+ includeHeaders:
211
+ - drogon/drogon.h
212
+ - drogon/HttpController.h
213
+ - drogon/HttpSimpleController.h
214
+ confidence: 0.9
215
+ routeRegexes:
216
+ - regex: 'registerHandler\s*\(\s*"([^"]+)"'
217
+ pathGroup: 1
218
+ - regex: '(?:ADD_METHOD_TO|METHOD_ADD|ADD_METHOD_VIA_REGEX)\s*\(\s*[^,]+,\s*"([^"]+)"'
219
+ pathGroup: 1
220
+
221
+ - id: pistache
222
+ patternId: express_route
223
+ includeHeaders:
224
+ - pistache/router.h
225
+ - pistache/endpoint.h
226
+ confidence: 0.9
227
+ routeRegexes:
228
+ - regex: 'Routes::(Get|Post|Put|Delete|Patch|Options)\s*\(\s*[A-Za-z_][A-Za-z0-9_]*\s*,\s*"([^"]+)"'
229
+ methodGroup: 1
230
+ pathGroup: 2
231
+
232
+ - id: oatpp
233
+ patternId: express_route
234
+ includeHeaders:
235
+ - oatpp/core/macro/codegen.hpp
236
+ - oatpp/web/server/api/ApiController.hpp
237
+ - oatpp/codegen/ApiController_define.hpp
238
+ confidence: 0.9
239
+ routeRegexes:
240
+ - regex: 'ENDPOINT\s*\(\s*"([A-Za-z]+)"\s*,\s*"([^"]+)"'
241
+ methodGroup: 1
242
+ pathGroup: 2
243
+
244
+ env_config:
245
+ envVariable:
246
+ patternId: env_variable
247
+ regex: '\b(?:std::)?getenv\s*\(\s*"([^"]+)"'
248
+ confidence: 0.85
249
+
250
+ configFile:
251
+ patternId: config_file
252
+ fileNameRegex: '(^|/)(config|configuration|settings)\.(h|hpp|hxx|cpp|cc|cxx)$'
253
+ name: cpp_config
254
+ confidence: 0.75
255
+
256
+ external_apis:
257
+ httpClients:
258
+ - id: libcurl
259
+ patternId: external_api_call
260
+ clientName: libcurl
261
+ includeHeaders:
262
+ - curl/curl.h
263
+ - curl/easy.h
264
+ # `curl_easy_init` takes no arguments, so only the option setter can
265
+ # carry a URL worth attributing to a service.
266
+ callNames:
267
+ - curl_easy_setopt
268
+ urlRegex: '"(https?:\/\/[^\s"]+)"'
269
+ confidence: 0.85
270
+
271
+ - id: cpr
272
+ patternId: external_api_call
273
+ clientName: cpr
274
+ includeHeaders:
275
+ - cpr/cpr.h
276
+ callNamePrefixes:
277
+ - "cpr::"
278
+ urlRegex: '"(https?:\/\/[^\s"]+)"'
279
+ confidence: 0.85
280
+
281
+ - id: cpp_httplib_client
282
+ patternId: external_api_call
283
+ clientName: httplib
284
+ includeHeaders:
285
+ - httplib.h
286
+ callNames:
287
+ - httplib::Client
288
+ - httplib::SSLClient
289
+ urlRegex: '"(https?:\/\/[^\s"]+)"'
290
+ confidence: 0.85
291
+
292
+ - id: poco_http
293
+ patternId: external_api_call
294
+ clientName: poco
295
+ includeHeaders:
296
+ - Poco/Net/HTTPSClientSession.h
297
+ - Poco/Net/HTTPClientSession.h
298
+ callNames:
299
+ - Poco::Net::HTTPSClientSession
300
+ - Poco::Net::HTTPClientSession
301
+ - Poco::URI
302
+ urlRegex: '"(https?:\/\/[^\s"]+)"'
303
+ confidence: 0.85
304
+
305
+ - id: boost_beast
306
+ patternId: external_api_call
307
+ clientName: boost_beast
308
+ includeHeaders:
309
+ - boost/beast/http.hpp
310
+ - boost/beast/core.hpp
311
+ callNames:
312
+ - resolver.resolve
313
+ urlRegex: '"(https?:\/\/[^\s"]+)"'
314
+ confidence: 0.75