@heossi/qnsi 0.5.6 → 0.6.0
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/cli/commands/crypto-scan.d.ts +13 -0
- package/dist/cli/commands/crypto-scan.d.ts.map +1 -0
- package/dist/cli/commands/crypto-scan.js +247 -0
- package/dist/cli/commands/crypto-scan.js.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/code-scan/canonical.d.ts +25 -0
- package/dist/code-scan/canonical.d.ts.map +1 -0
- package/dist/code-scan/canonical.js +80 -0
- package/dist/code-scan/canonical.js.map +1 -0
- package/dist/code-scan/index.d.ts +6 -0
- package/dist/code-scan/index.d.ts.map +1 -0
- package/dist/code-scan/index.js +5 -0
- package/dist/code-scan/index.js.map +1 -0
- package/dist/code-scan/rules/artifacts.d.ts +7 -0
- package/dist/code-scan/rules/artifacts.d.ts.map +1 -0
- package/dist/code-scan/rules/artifacts.js +83 -0
- package/dist/code-scan/rules/artifacts.js.map +1 -0
- package/dist/code-scan/rules/c.d.ts +6 -0
- package/dist/code-scan/rules/c.d.ts.map +1 -0
- package/dist/code-scan/rules/c.js +77 -0
- package/dist/code-scan/rules/c.js.map +1 -0
- package/dist/code-scan/rules/csharp.d.ts +6 -0
- package/dist/code-scan/rules/csharp.d.ts.map +1 -0
- package/dist/code-scan/rules/csharp.js +67 -0
- package/dist/code-scan/rules/csharp.js.map +1 -0
- package/dist/code-scan/rules/go.d.ts +8 -0
- package/dist/code-scan/rules/go.d.ts.map +1 -0
- package/dist/code-scan/rules/go.js +93 -0
- package/dist/code-scan/rules/go.js.map +1 -0
- package/dist/code-scan/rules/index.d.ts +8 -0
- package/dist/code-scan/rules/index.d.ts.map +1 -0
- package/dist/code-scan/rules/index.js +24 -0
- package/dist/code-scan/rules/index.js.map +1 -0
- package/dist/code-scan/rules/java.d.ts +8 -0
- package/dist/code-scan/rules/java.d.ts.map +1 -0
- package/dist/code-scan/rules/java.js +160 -0
- package/dist/code-scan/rules/java.js.map +1 -0
- package/dist/code-scan/rules/javascript.d.ts +7 -0
- package/dist/code-scan/rules/javascript.d.ts.map +1 -0
- package/dist/code-scan/rules/javascript.js +179 -0
- package/dist/code-scan/rules/javascript.js.map +1 -0
- package/dist/code-scan/rules/python.d.ts +6 -0
- package/dist/code-scan/rules/python.d.ts.map +1 -0
- package/dist/code-scan/rules/python.js +133 -0
- package/dist/code-scan/rules/python.js.map +1 -0
- package/dist/code-scan/rules/rust.d.ts +8 -0
- package/dist/code-scan/rules/rust.d.ts.map +1 -0
- package/dist/code-scan/rules/rust.js +86 -0
- package/dist/code-scan/rules/rust.js.map +1 -0
- package/dist/code-scan/scanner.d.ts +18 -0
- package/dist/code-scan/scanner.d.ts.map +1 -0
- package/dist/code-scan/scanner.js +254 -0
- package/dist/code-scan/scanner.js.map +1 -0
- package/dist/code-scan/strip.d.ts +25 -0
- package/dist/code-scan/strip.d.ts.map +1 -0
- package/dist/code-scan/strip.js +150 -0
- package/dist/code-scan/strip.js.map +1 -0
- package/dist/code-scan/types.d.ts +76 -0
- package/dist/code-scan/types.d.ts.map +1 -0
- package/dist/code-scan/types.js +9 -0
- package/dist/code-scan/types.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kms.d.ts +59 -0
- package/dist/kms.d.ts.map +1 -1
- package/dist/kms.js +41 -0
- package/dist/kms.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `qnsi crypto scan` — source-code cryptography scanning.
|
|
3
|
+
*
|
|
4
|
+
* Runs the @heossi/qnsi/code-scan engine locally (parse-only, zero network in
|
|
5
|
+
* scan mode) and prints findings as a table, JSON, or a CycloneDX 1.5 CBOM.
|
|
6
|
+
* With --upload, submits a findings-only report (never source code) to
|
|
7
|
+
* POST /proxy/crypto/v1/code-scan-reports using the same HMAC agent protocol
|
|
8
|
+
* as the qnsp host agent. Design: docs/design/code-crypto-scanner.md.
|
|
9
|
+
*/
|
|
10
|
+
import type { Command } from "commander";
|
|
11
|
+
import type { CliConfig } from "../config.js";
|
|
12
|
+
export declare function registerCryptoScanCommands(program: Command, config: CliConfig): void;
|
|
13
|
+
//# sourceMappingURL=crypto-scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-scan.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/crypto-scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA4L9C,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CA2FpF"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `qnsi crypto scan` — source-code cryptography scanning.
|
|
3
|
+
*
|
|
4
|
+
* Runs the @heossi/qnsi/code-scan engine locally (parse-only, zero network in
|
|
5
|
+
* scan mode) and prints findings as a table, JSON, or a CycloneDX 1.5 CBOM.
|
|
6
|
+
* With --upload, submits a findings-only report (never source code) to
|
|
7
|
+
* POST /proxy/crypto/v1/code-scan-reports using the same HMAC agent protocol
|
|
8
|
+
* as the qnsp host agent. Design: docs/design/code-crypto-scanner.md.
|
|
9
|
+
*/
|
|
10
|
+
import { createHash, createHmac, randomBytes } from "node:crypto";
|
|
11
|
+
import { writeFile } from "node:fs/promises";
|
|
12
|
+
import { basename, resolve } from "node:path";
|
|
13
|
+
import cliPackage from "../../../package.json" with { type: "json" };
|
|
14
|
+
import { RULE_SET_VERSION, scanDirectory } from "../../code-scan/index.js";
|
|
15
|
+
import { EXIT_CODES } from "../config.js";
|
|
16
|
+
import { printError, printJson, printSuccess, printTable } from "../utils/output.js";
|
|
17
|
+
const UPLOAD_TIMEOUT_MS = 30_000;
|
|
18
|
+
/** Server-side cap on findings per report (route schema). */
|
|
19
|
+
const MAX_UPLOAD_FINDINGS = 10_000;
|
|
20
|
+
/**
|
|
21
|
+
* Derive the HMAC key from the agent bootstrap secret: SHA-256 over the
|
|
22
|
+
* DECODED bytes of the hex secret. Matches agent-auth.ts / qnsp-agent.
|
|
23
|
+
*/
|
|
24
|
+
function deriveHmacKey(secret) {
|
|
25
|
+
return createHash("sha256").update(Buffer.from(secret, "hex")).digest();
|
|
26
|
+
}
|
|
27
|
+
function signReport(agentId, secret, rawBody) {
|
|
28
|
+
const timestamp = new Date().toISOString();
|
|
29
|
+
const nonce = randomBytes(16).toString("hex");
|
|
30
|
+
const bodyHash = createHash("sha256").update(rawBody).digest("hex");
|
|
31
|
+
const signature = createHmac("sha256", deriveHmacKey(secret))
|
|
32
|
+
.update(`${timestamp}.${nonce}.${bodyHash}`)
|
|
33
|
+
.digest("hex");
|
|
34
|
+
return {
|
|
35
|
+
"x-agent-id": agentId,
|
|
36
|
+
"x-agent-timestamp": timestamp,
|
|
37
|
+
"x-agent-nonce": nonce,
|
|
38
|
+
"x-agent-body-hash": bodyHash,
|
|
39
|
+
"x-agent-signature": signature,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Wire shape for one finding — matches codeScanReportSchema exactly. The
|
|
44
|
+
* engine's `classification` field is intentionally NOT sent: the server
|
|
45
|
+
* derives isPqc/isHybrid from the canonical algorithm id and the strict
|
|
46
|
+
* schema rejects unknown keys.
|
|
47
|
+
*/
|
|
48
|
+
function toWireFinding(finding) {
|
|
49
|
+
return {
|
|
50
|
+
path: finding.path,
|
|
51
|
+
line: finding.line,
|
|
52
|
+
language: finding.language,
|
|
53
|
+
library: finding.library,
|
|
54
|
+
ruleId: finding.ruleId,
|
|
55
|
+
algorithm: finding.algorithm,
|
|
56
|
+
category: finding.category,
|
|
57
|
+
confidence: finding.confidence,
|
|
58
|
+
lineHash: finding.lineHash,
|
|
59
|
+
...(finding.keySize !== undefined ? { keySize: finding.keySize } : {}),
|
|
60
|
+
...(finding.testContext !== undefined ? { testContext: finding.testContext } : {}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Minimal CycloneDX 1.5 CBOM built locally from scan findings. */
|
|
64
|
+
function buildLocalCbom(summary, scannedPath) {
|
|
65
|
+
const byAlgorithm = new Map();
|
|
66
|
+
for (const finding of summary.findings) {
|
|
67
|
+
const entry = byAlgorithm.get(finding.algorithm);
|
|
68
|
+
if (entry) {
|
|
69
|
+
entry.count += 1;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
byAlgorithm.set(finding.algorithm, {
|
|
73
|
+
count: 1,
|
|
74
|
+
classification: finding.classification,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
bomFormat: "CycloneDX",
|
|
80
|
+
specVersion: "1.5",
|
|
81
|
+
metadata: {
|
|
82
|
+
timestamp: new Date().toISOString(),
|
|
83
|
+
tools: [{ name: "qnsi crypto scan", version: cliPackage.version }],
|
|
84
|
+
component: { type: "application", name: scannedPath },
|
|
85
|
+
},
|
|
86
|
+
components: Array.from(byAlgorithm.entries()).map(([algorithm, info]) => ({
|
|
87
|
+
type: "crypto-asset",
|
|
88
|
+
name: algorithm,
|
|
89
|
+
postureClass: info.classification,
|
|
90
|
+
occurrences: info.count,
|
|
91
|
+
cryptoProperties: { assetType: "algorithm" },
|
|
92
|
+
})),
|
|
93
|
+
summary: {
|
|
94
|
+
filesScanned: summary.filesScanned,
|
|
95
|
+
filesSkipped: summary.filesSkipped,
|
|
96
|
+
totalFindings: summary.findings.length,
|
|
97
|
+
classical: summary.findings.filter((f) => f.classification === "classical").length,
|
|
98
|
+
pqc: summary.findings.filter((f) => f.classification === "pqc").length,
|
|
99
|
+
hybrid: summary.findings.filter((f) => f.classification === "hybrid").length,
|
|
100
|
+
truncated: summary.truncated,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
async function uploadReport(config, options, summary, scannedPath) {
|
|
105
|
+
const agentId = options.agentId ?? process.env["QNSI_AGENT_ID"];
|
|
106
|
+
const agentSecret = options.agentSecret ?? process.env["QNSI_AGENT_SECRET"];
|
|
107
|
+
const tenantId = config.tenantId;
|
|
108
|
+
const edgeGatewayUrl = config.edgeGatewayUrl;
|
|
109
|
+
if (!agentId || !agentSecret) {
|
|
110
|
+
printError("--upload requires agent credentials (--agent-id/--agent-secret or QNSI_AGENT_ID/QNSI_AGENT_SECRET). Register a scanner agent under Crypto Posture → Agents.");
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (!tenantId) {
|
|
114
|
+
printError("--upload requires QNSI_TENANT_ID");
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
if (!edgeGatewayUrl) {
|
|
118
|
+
printError("--upload requires QNSI_EDGE_GATEWAY_URL");
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (!options.repoId) {
|
|
122
|
+
printError("--upload requires --repo-id (stable identifier used to dedupe rescans)");
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
if (summary.findings.length > MAX_UPLOAD_FINDINGS) {
|
|
126
|
+
printError(`Scan produced ${summary.findings.length} findings; the ingest cap is ${MAX_UPLOAD_FINDINGS}. Narrow the scan with --exclude.`);
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
const report = {
|
|
130
|
+
agentId,
|
|
131
|
+
repo: {
|
|
132
|
+
id: options.repoId,
|
|
133
|
+
name: options.repoName ?? basename(scannedPath),
|
|
134
|
+
...(options.ref ? { ref: options.ref } : {}),
|
|
135
|
+
...(options.commit ? { commitSha: options.commit } : {}),
|
|
136
|
+
},
|
|
137
|
+
scannedAt: new Date().toISOString(),
|
|
138
|
+
scannerVersion: cliPackage.version,
|
|
139
|
+
ruleSetVersion: RULE_SET_VERSION,
|
|
140
|
+
findings: summary.findings.map(toWireFinding),
|
|
141
|
+
};
|
|
142
|
+
const rawBody = Buffer.from(JSON.stringify(report), "utf8");
|
|
143
|
+
const url = `${edgeGatewayUrl.replace(/\/$/, "")}/proxy/crypto/v1/code-scan-reports`;
|
|
144
|
+
const response = await fetch(url, {
|
|
145
|
+
method: "POST",
|
|
146
|
+
headers: {
|
|
147
|
+
"content-type": "application/json",
|
|
148
|
+
"x-qnsp-tenant": tenantId,
|
|
149
|
+
...signReport(agentId, agentSecret, rawBody),
|
|
150
|
+
},
|
|
151
|
+
body: rawBody,
|
|
152
|
+
signal: AbortSignal.timeout(UPLOAD_TIMEOUT_MS),
|
|
153
|
+
});
|
|
154
|
+
if (response.status !== 202) {
|
|
155
|
+
const errorText = await response.text();
|
|
156
|
+
printError(`Upload failed: ${response.status} ${errorText}`);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
const accepted = (await response.json());
|
|
160
|
+
printSuccess(`Uploaded ${accepted.findingCount ?? summary.findings.length} findings (bodyHash ${accepted.bodyHash ?? "n/a"}). They enter the CBOM on the next discovery run of the code_repo source.`);
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
export function registerCryptoScanCommands(program, config) {
|
|
164
|
+
const crypto = program
|
|
165
|
+
.command("crypto")
|
|
166
|
+
.description("Cryptographic inventory commands (source-code scanning)");
|
|
167
|
+
crypto
|
|
168
|
+
.command("scan [directory]")
|
|
169
|
+
.description("Scan source code for classical/PQC cryptography usage (local, parse-only; code never leaves this machine)")
|
|
170
|
+
.option("--format <format>", "Output format: table | json | cbom", "table")
|
|
171
|
+
.option("--output <file>", "Write output to a file instead of stdout")
|
|
172
|
+
.option("--exclude <dirs>", "Comma-separated extra directory names to skip")
|
|
173
|
+
.option("--max-findings <n>", "Stop after N findings (reported as truncated)")
|
|
174
|
+
.option("--upload", "Upload findings to the QNSI crypto inventory (requires agent credentials)")
|
|
175
|
+
.option("--repo-id <id>", "Stable repository id for upload dedup (required with --upload)")
|
|
176
|
+
.option("--repo-name <name>", "Repository display name (default: directory basename)")
|
|
177
|
+
.option("--ref <ref>", "Git ref being scanned (upload metadata)")
|
|
178
|
+
.option("--commit <sha>", "Git commit SHA being scanned (upload metadata)")
|
|
179
|
+
.option("--agent-id <id>", "Scanner agent id (or QNSI_AGENT_ID)")
|
|
180
|
+
.option("--agent-secret <secret>", "Scanner agent secret (or QNSI_AGENT_SECRET)")
|
|
181
|
+
.action(async (directory, options) => {
|
|
182
|
+
const scannedPath = resolve(directory ?? ".");
|
|
183
|
+
let summary;
|
|
184
|
+
try {
|
|
185
|
+
summary = await scanDirectory({
|
|
186
|
+
rootDir: scannedPath,
|
|
187
|
+
...(options.exclude
|
|
188
|
+
? { excludeDirs: options.exclude.split(",").map((d) => d.trim()) }
|
|
189
|
+
: {}),
|
|
190
|
+
...(options.maxFindings ? { maxFindings: Number.parseInt(options.maxFindings, 10) } : {}),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
printError(`Scan failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
195
|
+
process.exit(EXIT_CODES.GENERAL_ERROR);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (summary.truncated) {
|
|
199
|
+
printError(`Warning: finding cap reached — results are TRUNCATED (${summary.findings.length} findings).`);
|
|
200
|
+
}
|
|
201
|
+
const format = options.format ?? "table";
|
|
202
|
+
if (format === "cbom") {
|
|
203
|
+
const cbom = buildLocalCbom(summary, scannedPath);
|
|
204
|
+
if (options.output) {
|
|
205
|
+
await writeFile(options.output, `${JSON.stringify(cbom, null, "\t")}\n`, "utf8");
|
|
206
|
+
printSuccess(`CBOM written to ${options.output}`);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
printJson(cbom);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else if (format === "json") {
|
|
213
|
+
const payload = {
|
|
214
|
+
scannedPath,
|
|
215
|
+
filesScanned: summary.filesScanned,
|
|
216
|
+
filesSkipped: summary.filesSkipped,
|
|
217
|
+
truncated: summary.truncated,
|
|
218
|
+
findings: summary.findings,
|
|
219
|
+
};
|
|
220
|
+
if (options.output) {
|
|
221
|
+
await writeFile(options.output, `${JSON.stringify(payload, null, "\t")}\n`, "utf8");
|
|
222
|
+
printSuccess(`Findings written to ${options.output}`);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
printJson(payload);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
printTable(summary.findings.map((f) => ({
|
|
230
|
+
path: `${f.path}:${f.line}`,
|
|
231
|
+
algorithm: f.algorithm,
|
|
232
|
+
class: f.classification,
|
|
233
|
+
confidence: f.confidence,
|
|
234
|
+
rule: f.ruleId,
|
|
235
|
+
})));
|
|
236
|
+
printSuccess(`${summary.findings.length} findings in ${summary.filesScanned} files (${summary.filesSkipped} skipped)`);
|
|
237
|
+
}
|
|
238
|
+
if (options.upload) {
|
|
239
|
+
const ok = await uploadReport(config, options, summary, scannedPath);
|
|
240
|
+
if (!ok) {
|
|
241
|
+
process.exit(EXIT_CODES.INVALID_ARGUMENTS);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=crypto-scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-scan.js","sourceRoot":"","sources":["../../../src/cli/commands/crypto-scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAI9C,OAAO,UAAU,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE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C,CAAC;gBAC3C,OAAO;YACR,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { registerAuditCommands } from "./commands/audit.js";
|
|
|
6
6
|
import { registerAuthCommands } from "./commands/auth.js";
|
|
7
7
|
import { registerBillingCommands } from "./commands/billing.js";
|
|
8
8
|
import { registerCryptoPolicyCommands } from "./commands/crypto-policy.js";
|
|
9
|
+
import { registerCryptoScanCommands } from "./commands/crypto-scan.js";
|
|
9
10
|
import { registerKmsCommands } from "./commands/kms.js";
|
|
10
11
|
import { registerObservabilityCommands } from "./commands/observability.js";
|
|
11
12
|
import { registerSearchCommands } from "./commands/search.js";
|
|
@@ -62,6 +63,7 @@ registerStorageCommands(program, config);
|
|
|
62
63
|
registerSearchCommands(program, config);
|
|
63
64
|
registerTenantCommands(program, config);
|
|
64
65
|
registerCryptoPolicyCommands(program, config);
|
|
66
|
+
registerCryptoScanCommands(program, config);
|
|
65
67
|
registerBillingCommands(program, config);
|
|
66
68
|
registerAccessControlCommands(program, config);
|
|
67
69
|
registerObservabilityCommands(program, config);
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,UAAU,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,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M,CAAC,CAAC;AACvC,uBAAuB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACzC,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACxC,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACxC,4BAA4B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC9C,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC5C,uBAAuB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACzC,6BAA6B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC/C,6BAA6B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC/C,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAE1C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical algorithm ids — MUST stay aligned with the keys consumed by
|
|
3
|
+
* crypto-inventory-service's PqcReadinessAssessor (ALGORITHM_BASE_URGENCY /
|
|
4
|
+
* RECOMMENDED_REPLACEMENT) and isPqcAlgorithm(). An id the assessor does not
|
|
5
|
+
* know falls back to migration urgency "high", which is fail-safe.
|
|
6
|
+
*/
|
|
7
|
+
/** rsa + optional size → "rsa-2048" | "rsa-unknown". */
|
|
8
|
+
export declare function canonicalRsa(keySize: number | null): string;
|
|
9
|
+
/**
|
|
10
|
+
* Curve name → canonical "ecdsa-p256"-style id. `usage` distinguishes
|
|
11
|
+
* signing (ecdsa) from key agreement (ecdh); default is ecdsa.
|
|
12
|
+
*/
|
|
13
|
+
export declare function canonicalEcCurve(curve: string, usage?: "ecdsa" | "ecdh"): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Normalize an algorithm token the way the assessor does (lowercase,
|
|
16
|
+
* underscores → dashes).
|
|
17
|
+
*/
|
|
18
|
+
export declare function normalizeAlgorithmId(algorithm: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Search adjacent lines for a key-size literal near a size-parameterized
|
|
21
|
+
* finding (e.g. `modulusLength: 2048` on the line after `generateKeyPair`).
|
|
22
|
+
* Window is deliberately small to avoid picking up unrelated numbers.
|
|
23
|
+
*/
|
|
24
|
+
export declare function findKeySizeNear(lines: readonly string[], lineIndex: number): number | null;
|
|
25
|
+
//# sourceMappingURL=canonical.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../../src/code-scan/canonical.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAK3D;AAqBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,OAAO,GAAG,MAAgB,GAAG,MAAM,GAAG,IAAI,CAMhG;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyB1F"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical algorithm ids — MUST stay aligned with the keys consumed by
|
|
3
|
+
* crypto-inventory-service's PqcReadinessAssessor (ALGORITHM_BASE_URGENCY /
|
|
4
|
+
* RECOMMENDED_REPLACEMENT) and isPqcAlgorithm(). An id the assessor does not
|
|
5
|
+
* know falls back to migration urgency "high", which is fail-safe.
|
|
6
|
+
*/
|
|
7
|
+
const RSA_SIZES = new Set([1024, 2048, 3072, 4096]);
|
|
8
|
+
/** rsa + optional size → "rsa-2048" | "rsa-unknown". */
|
|
9
|
+
export function canonicalRsa(keySize) {
|
|
10
|
+
if (keySize !== null && RSA_SIZES.has(keySize)) {
|
|
11
|
+
return `rsa-${keySize}`;
|
|
12
|
+
}
|
|
13
|
+
return "rsa-unknown";
|
|
14
|
+
}
|
|
15
|
+
const CURVE_MAP = {
|
|
16
|
+
// NIST P-curves under their many aliases
|
|
17
|
+
"p-192": "p192",
|
|
18
|
+
p192: "p192",
|
|
19
|
+
prime192v1: "p192",
|
|
20
|
+
secp192r1: "p192",
|
|
21
|
+
"p-256": "p256",
|
|
22
|
+
p256: "p256",
|
|
23
|
+
prime256v1: "p256",
|
|
24
|
+
secp256r1: "p256",
|
|
25
|
+
secp256k1: "p256",
|
|
26
|
+
"p-384": "p384",
|
|
27
|
+
p384: "p384",
|
|
28
|
+
secp384r1: "p384",
|
|
29
|
+
"p-521": "p521",
|
|
30
|
+
p521: "p521",
|
|
31
|
+
secp521r1: "p521",
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Curve name → canonical "ecdsa-p256"-style id. `usage` distinguishes
|
|
35
|
+
* signing (ecdsa) from key agreement (ecdh); default is ecdsa.
|
|
36
|
+
*/
|
|
37
|
+
export function canonicalEcCurve(curve, usage = "ecdsa") {
|
|
38
|
+
const suffix = CURVE_MAP[curve.toLowerCase()];
|
|
39
|
+
if (!suffix) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return `${usage}-${suffix}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Normalize an algorithm token the way the assessor does (lowercase,
|
|
46
|
+
* underscores → dashes).
|
|
47
|
+
*/
|
|
48
|
+
export function normalizeAlgorithmId(algorithm) {
|
|
49
|
+
return algorithm.toLowerCase().replace(/_/g, "-");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Search adjacent lines for a key-size literal near a size-parameterized
|
|
53
|
+
* finding (e.g. `modulusLength: 2048` on the line after `generateKeyPair`).
|
|
54
|
+
* Window is deliberately small to avoid picking up unrelated numbers.
|
|
55
|
+
*/
|
|
56
|
+
export function findKeySizeNear(lines, lineIndex) {
|
|
57
|
+
const SIZE_PATTERN = /(?:modulusLength|keySize|key_size|keysize|bits|size|modulus_length)\s*[:=(]\s*(\d{3,5})/i;
|
|
58
|
+
const INLINE_PATTERN = /\b(1024|2048|3072|4096)\b/;
|
|
59
|
+
const start = lineIndex;
|
|
60
|
+
const end = Math.min(lines.length - 1, lineIndex + 4);
|
|
61
|
+
for (let i = start; i <= end; i++) {
|
|
62
|
+
const line = lines[i] ?? "";
|
|
63
|
+
const named = SIZE_PATTERN.exec(line);
|
|
64
|
+
if (named?.[1]) {
|
|
65
|
+
const parsed = Number.parseInt(named[1], 10);
|
|
66
|
+
if (Number.isFinite(parsed)) {
|
|
67
|
+
return parsed;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Inline literal only counts on the firing line itself, e.g. RSA.generate(2048)
|
|
71
|
+
if (i === start) {
|
|
72
|
+
const inline = INLINE_PATTERN.exec(line);
|
|
73
|
+
if (inline?.[1]) {
|
|
74
|
+
return Number.parseInt(inline[1], 10);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=canonical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.js","sourceRoot":"","sources":["../../src/code-scan/canonical.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEpD,wDAAwD;AACxD,MAAM,UAAU,YAAY,CAAC,OAAsB;IAClD,IAAI,OAAO,KAAK,IAAI,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QAChD,OAAO,OAAO,OAAO,EAAE,CAAC;IACzB,CAAC;IACD,OAAO,aAAa,CAAC;AACtB,CAAC;AAED,MAAM,SAAS,GAA2B;IACzC,y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AAI,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAChB,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC7C,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC7B,OAAO,MAAM,CAAC;YACf,CAAC;QACF,CAAC;QACD,gFAAgF;QAChF,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;YACjB,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjB,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { canonicalEcCurve, canonicalRsa, findKeySizeNear, normalizeAlgorithmId, } from "./canonical.js";
|
|
2
|
+
export { ALL_RULES, RULE_SET_VERSION } from "./rules/index.js";
|
|
3
|
+
export { detectLanguage, hashLine, isTestPath, scanDirectory, scanFileContent } from "./scanner.js";
|
|
4
|
+
export { stripComments } from "./strip.js";
|
|
5
|
+
export type { CodeCryptoFinding, Confidence, CryptoDetectionRule, FindingCategory, FindingClassification, Language, ScanOptions, ScanSummary, } from "./types.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/code-scan/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,oBAAoB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EACX,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,QAAQ,EACR,WAAW,EACX,WAAW,GACX,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { canonicalEcCurve, canonicalRsa, findKeySizeNear, normalizeAlgorithmId, } from "./canonical.js";
|
|
2
|
+
export { ALL_RULES, RULE_SET_VERSION } from "./rules/index.js";
|
|
3
|
+
export { detectLanguage, hashLine, isTestPath, scanDirectory, scanFileContent } from "./scanner.js";
|
|
4
|
+
export { stripComments } from "./strip.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/code-scan/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,oBAAoB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Language-independent artifact rules: PEM headers, JWK fields, TLS config
|
|
3
|
+
* cipher strings. These fire in "config" files and any source language.
|
|
4
|
+
*/
|
|
5
|
+
import type { CryptoDetectionRule } from "../types.js";
|
|
6
|
+
export declare const artifactRules: readonly CryptoDetectionRule[];
|
|
7
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../src/code-scan/rules/artifacts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,aAAa,CAAC;AAgBjE,eAAO,MAAM,aAAa,EAAE,SAAS,mBAAmB,EAyDvD,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Language-independent artifact rules: PEM headers, JWK fields, TLS config
|
|
3
|
+
* cipher strings. These fire in "config" files and any source language.
|
|
4
|
+
*/
|
|
5
|
+
const ALL = [
|
|
6
|
+
"javascript",
|
|
7
|
+
"typescript",
|
|
8
|
+
"python",
|
|
9
|
+
"java",
|
|
10
|
+
"kotlin",
|
|
11
|
+
"go",
|
|
12
|
+
"c",
|
|
13
|
+
"cpp",
|
|
14
|
+
"csharp",
|
|
15
|
+
"rust",
|
|
16
|
+
"config",
|
|
17
|
+
];
|
|
18
|
+
export const artifactRules = [
|
|
19
|
+
{
|
|
20
|
+
id: "artifact-pem-classical-key-header",
|
|
21
|
+
languages: ALL,
|
|
22
|
+
pattern: /-----BEGIN (RSA|EC|DSA) PRIVATE KEY-----/,
|
|
23
|
+
algorithm: (match) => {
|
|
24
|
+
const kind = match[1] ?? "";
|
|
25
|
+
if (kind === "RSA")
|
|
26
|
+
return "rsa-unknown";
|
|
27
|
+
if (kind === "EC")
|
|
28
|
+
return "ecdsa-unknown";
|
|
29
|
+
return "dsa-unknown";
|
|
30
|
+
},
|
|
31
|
+
category: "artifact",
|
|
32
|
+
classification: "classical",
|
|
33
|
+
confidence: "high",
|
|
34
|
+
library: "PEM",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "artifact-jwk-classical-kty",
|
|
38
|
+
languages: ALL,
|
|
39
|
+
pattern: /"kty"\s*:\s*"(RSA|EC|OKP)"/,
|
|
40
|
+
algorithm: (match) => {
|
|
41
|
+
const kty = match[1] ?? "";
|
|
42
|
+
if (kty === "RSA")
|
|
43
|
+
return "rsa-unknown";
|
|
44
|
+
if (kty === "EC")
|
|
45
|
+
return "ecdsa-unknown";
|
|
46
|
+
return "ed25519";
|
|
47
|
+
},
|
|
48
|
+
category: "artifact",
|
|
49
|
+
classification: "classical",
|
|
50
|
+
confidence: "medium",
|
|
51
|
+
library: "JWK",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "artifact-config-hybrid-tls-group",
|
|
55
|
+
languages: ALL,
|
|
56
|
+
pattern: /\b(X25519MLKEM768|X25519Kyber768Draft00|SecP256r1MLKEM768)\b/,
|
|
57
|
+
algorithm: (match) => (match[1] ?? "").toLowerCase(),
|
|
58
|
+
category: "protocol",
|
|
59
|
+
classification: "hybrid",
|
|
60
|
+
confidence: "high",
|
|
61
|
+
library: "TLS config",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "artifact-cargo-classical-dep",
|
|
65
|
+
languages: ["config"],
|
|
66
|
+
pattern: /^\s*(rsa|p256|p384|k256|ed25519-dalek|md5|sha1)\s*=\s*["{]/,
|
|
67
|
+
algorithm: (match) => {
|
|
68
|
+
const crate = match[1] ?? "";
|
|
69
|
+
if (crate === "rsa")
|
|
70
|
+
return "rsa-unknown";
|
|
71
|
+
if (crate === "ed25519-dalek")
|
|
72
|
+
return "ed25519";
|
|
73
|
+
if (crate === "md5" || crate === "sha1")
|
|
74
|
+
return crate;
|
|
75
|
+
return `ecdsa-${crate === "p384" ? "p384" : "p256"}`;
|
|
76
|
+
},
|
|
77
|
+
category: "artifact",
|
|
78
|
+
classification: "classical",
|
|
79
|
+
confidence: "medium",
|
|
80
|
+
library: "Cargo.toml",
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +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
|
+
const LANGS = ["c", "cpp"];
|
|
5
|
+
export const cRules = [
|
|
6
|
+
{
|
|
7
|
+
id: "c-openssl-rsa",
|
|
8
|
+
languages: LANGS,
|
|
9
|
+
pattern: /\b(RSA_generate_key(?:_ex)?|EVP_PKEY_RSA|EVP_RSA_gen)\b/,
|
|
10
|
+
algorithm: "rsa-unknown",
|
|
11
|
+
category: "asymmetric",
|
|
12
|
+
classification: "classical",
|
|
13
|
+
confidence: "high",
|
|
14
|
+
library: "OpenSSL",
|
|
15
|
+
wantsKeySize: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "c-openssl-ec",
|
|
19
|
+
languages: LANGS,
|
|
20
|
+
pattern: /\b(EC_KEY_new(?:_by_curve_name)?|EVP_PKEY_EC|NID_(?:X9_62_prime256v1|secp384r1|secp521r1))\b/,
|
|
21
|
+
algorithm: (match) => {
|
|
22
|
+
const token = match[1] ?? "";
|
|
23
|
+
if (token.includes("prime256v1"))
|
|
24
|
+
return "ecdsa-p256";
|
|
25
|
+
if (token.includes("secp384r1"))
|
|
26
|
+
return "ecdsa-p384";
|
|
27
|
+
if (token.includes("secp521r1"))
|
|
28
|
+
return "ecdsa-p521";
|
|
29
|
+
return "ecdsa-unknown";
|
|
30
|
+
},
|
|
31
|
+
category: "asymmetric",
|
|
32
|
+
classification: "classical",
|
|
33
|
+
confidence: "high",
|
|
34
|
+
library: "OpenSSL",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "c-openssl-weak-digest",
|
|
38
|
+
languages: LANGS,
|
|
39
|
+
pattern: /\bEVP_(md5|sha1)\s*\(\s*\)|\b(MD5|SHA1)_(?:Init|Update|Final)\b/,
|
|
40
|
+
algorithm: (match) => ((match[1] ?? match[2] ?? "").toLowerCase() === "md5" ? "md5" : "sha1"),
|
|
41
|
+
category: "hash",
|
|
42
|
+
classification: "classical",
|
|
43
|
+
confidence: "high",
|
|
44
|
+
library: "OpenSSL",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "c-openssl-weak-cipher",
|
|
48
|
+
languages: LANGS,
|
|
49
|
+
pattern: /\bEVP_(des_ede3[a-z0-9_]*|des_[a-z0-9_]+|rc4[a-z0-9_]*)\s*\(/,
|
|
50
|
+
algorithm: (match) => {
|
|
51
|
+
const name = (match[1] ?? "").toLowerCase();
|
|
52
|
+
if (name.startsWith("des_ede3"))
|
|
53
|
+
return "3des";
|
|
54
|
+
if (name.startsWith("des"))
|
|
55
|
+
return "des";
|
|
56
|
+
return "rc4";
|
|
57
|
+
},
|
|
58
|
+
category: "symmetric",
|
|
59
|
+
classification: "classical",
|
|
60
|
+
confidence: "high",
|
|
61
|
+
library: "OpenSSL",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "c-pqc-liboqs",
|
|
65
|
+
languages: LANGS,
|
|
66
|
+
pattern: /\bOQS_(?:KEM|SIG)_(?:new\s*\(\s*)?(?:OQS_(?:KEM|SIG)_alg_)?([a-z0-9_]+)/i,
|
|
67
|
+
algorithm: (match) => {
|
|
68
|
+
const name = (match[1] ?? "").toLowerCase().replace(/_/g, "-");
|
|
69
|
+
return name.length > 2 ? name : null;
|
|
70
|
+
},
|
|
71
|
+
category: "asymmetric",
|
|
72
|
+
classification: "pqc",
|
|
73
|
+
confidence: "medium",
|
|
74
|
+
library: "liboqs",
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
//# sourceMappingURL=c.js.map
|