@xenos1996/usa 2.26.2 → 2.28.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-help.d.ts.map +1 -1
- package/dist/cli-help.js +2 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli-intent.d.ts +4 -0
- package/dist/cli-intent.d.ts.map +1 -0
- package/dist/cli-intent.js +108 -0
- package/dist/cli-intent.js.map +1 -0
- package/dist/cli-scan.d.ts +12 -0
- package/dist/cli-scan.d.ts.map +1 -0
- package/dist/cli-scan.js +142 -0
- package/dist/cli-scan.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/engine/audit-config.d.ts +66 -0
- package/dist/engine/audit-config.d.ts.map +1 -0
- package/dist/engine/audit-config.js +148 -0
- package/dist/engine/audit-config.js.map +1 -0
- package/dist/engine/audit-types.d.ts +44 -0
- package/dist/engine/audit-types.d.ts.map +1 -0
- package/dist/engine/audit-types.js +2 -0
- package/dist/engine/audit-types.js.map +1 -0
- package/dist/engine/audit-warnings.d.ts +56 -0
- package/dist/engine/audit-warnings.d.ts.map +1 -0
- package/dist/engine/audit-warnings.js +116 -0
- package/dist/engine/audit-warnings.js.map +1 -0
- package/dist/engine/audit.d.ts +14 -38
- package/dist/engine/audit.d.ts.map +1 -1
- package/dist/engine/audit.js +9 -500
- package/dist/engine/audit.js.map +1 -1
- package/dist/engine/evaluate-packs.d.ts +37 -0
- package/dist/engine/evaluate-packs.d.ts.map +1 -0
- package/dist/engine/evaluate-packs.js +144 -0
- package/dist/engine/evaluate-packs.js.map +1 -0
- package/dist/engine/evaluate.d.ts.map +1 -1
- package/dist/engine/evaluate.js +31 -8
- package/dist/engine/evaluate.js.map +1 -1
- package/dist/engine/invariants.d.ts +8 -0
- package/dist/engine/invariants.d.ts.map +1 -1
- package/dist/engine/invariants.js +11 -0
- package/dist/engine/invariants.js.map +1 -1
- package/dist/engine/pack-selection.d.ts +21 -0
- package/dist/engine/pack-selection.d.ts.map +1 -0
- package/dist/engine/pack-selection.js +63 -0
- package/dist/engine/pack-selection.js.map +1 -0
- package/dist/engine/report-build.d.ts +22 -0
- package/dist/engine/report-build.d.ts.map +1 -0
- package/dist/engine/report-build.js +67 -0
- package/dist/engine/report-build.js.map +1 -0
- package/dist/foundation/interview.d.ts.map +1 -1
- package/dist/foundation/interview.js +16 -5
- package/dist/foundation/interview.js.map +1 -1
- package/dist/intent/match.d.ts +38 -0
- package/dist/intent/match.d.ts.map +1 -0
- package/dist/intent/match.js +108 -0
- package/dist/intent/match.js.map +1 -0
- package/dist/intent/otm.d.ts +16 -0
- package/dist/intent/otm.d.ts.map +1 -0
- package/dist/intent/otm.js +144 -0
- package/dist/intent/otm.js.map +1 -0
- package/dist/intent/types.d.ts +111 -0
- package/dist/intent/types.d.ts.map +1 -0
- package/dist/intent/types.js +16 -0
- package/dist/intent/types.js.map +1 -0
- package/dist/scanner/adapters/codeql.d.ts +14 -0
- package/dist/scanner/adapters/codeql.d.ts.map +1 -0
- package/dist/scanner/adapters/codeql.js +134 -0
- package/dist/scanner/adapters/codeql.js.map +1 -0
- package/dist/scanner/adapters/dependency-cruiser.d.ts +3 -0
- package/dist/scanner/adapters/dependency-cruiser.d.ts.map +1 -0
- package/dist/scanner/adapters/dependency-cruiser.js +174 -0
- package/dist/scanner/adapters/dependency-cruiser.js.map +1 -0
- package/dist/scanner/adapters/ort.d.ts +12 -0
- package/dist/scanner/adapters/ort.d.ts.map +1 -0
- package/dist/scanner/adapters/ort.js +259 -0
- package/dist/scanner/adapters/ort.js.map +1 -0
- package/dist/scanner/adapters/scorecard.d.ts +7 -0
- package/dist/scanner/adapters/scorecard.d.ts.map +1 -0
- package/dist/scanner/adapters/scorecard.js +209 -0
- package/dist/scanner/adapters/scorecard.js.map +1 -0
- package/dist/scanner/adapters/semgrep.d.ts +3 -0
- package/dist/scanner/adapters/semgrep.d.ts.map +1 -0
- package/dist/scanner/adapters/semgrep.js +163 -0
- package/dist/scanner/adapters/semgrep.js.map +1 -0
- package/dist/scanner/adapters/trivy.d.ts +3 -0
- package/dist/scanner/adapters/trivy.d.ts.map +1 -0
- package/dist/scanner/adapters/trivy.js +163 -0
- package/dist/scanner/adapters/trivy.js.map +1 -0
- package/dist/scanner/config.d.ts +4 -0
- package/dist/scanner/config.d.ts.map +1 -0
- package/dist/scanner/config.js +15 -0
- package/dist/scanner/config.js.map +1 -0
- package/dist/scanner/identity.d.ts +17 -0
- package/dist/scanner/identity.d.ts.map +1 -0
- package/dist/scanner/identity.js +50 -0
- package/dist/scanner/identity.js.map +1 -0
- package/dist/scanner/normalize.d.ts +40 -0
- package/dist/scanner/normalize.d.ts.map +1 -0
- package/dist/scanner/normalize.js +85 -0
- package/dist/scanner/normalize.js.map +1 -0
- package/dist/scanner/registry.d.ts +19 -0
- package/dist/scanner/registry.d.ts.map +1 -0
- package/dist/scanner/registry.js +43 -0
- package/dist/scanner/registry.js.map +1 -0
- package/dist/scanner/run.d.ts +70 -0
- package/dist/scanner/run.d.ts.map +1 -0
- package/dist/scanner/run.js +419 -0
- package/dist/scanner/run.js.map +1 -0
- package/dist/scanner/sarif.d.ts +21 -0
- package/dist/scanner/sarif.d.ts.map +1 -0
- package/dist/scanner/sarif.js +156 -0
- package/dist/scanner/sarif.js.map +1 -0
- package/dist/scanner/types.d.ts +236 -0
- package/dist/scanner/types.d.ts.map +1 -0
- package/dist/scanner/types.js +11 -0
- package/dist/scanner/types.js.map +1 -0
- package/package.json +9 -8
- package/rules/core/code-quality.yaml +12 -2
- package/rules/core/provenance-attestation.yaml +5 -0
- package/rules/core/testing-assurance.yaml +19 -4
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodeQL — Tier 1, opt-in and heavyweight.
|
|
3
|
+
*
|
|
4
|
+
* Two-step by nature: `database create` then `database analyze`. Both are
|
|
5
|
+
* constructed here and parsed through the shared SARIF normaliser.
|
|
6
|
+
*
|
|
7
|
+
* `analyze` writes SARIF to a **file** (`--output=`) and logs to stdout, so the
|
|
8
|
+
* adapter declares the file as its artifact. Before the runner could read
|
|
9
|
+
* artifacts, this adapter parsed stdout and therefore parsed log lines: the
|
|
10
|
+
* SARIF never reached `parse`. That is a structural bug the fixture-based tests
|
|
11
|
+
* could not see, because they called `parse` directly.
|
|
12
|
+
*
|
|
13
|
+
* Verified end-to-end against CodeQL 2.27.3 on `fixtures/insecure-app`: two
|
|
14
|
+
* stages, one artifact, two findings. Three bugs only a run could find —
|
|
15
|
+
*
|
|
16
|
+
* 1. the query specifier is positional, so the default empty `packs` was passed
|
|
17
|
+
* as one empty specifier and the run died with `Invalid package
|
|
18
|
+
* specification:` and no SARIF;
|
|
19
|
+
* 2. `codeql --version` prints a sentence, so `[\d.]+` recorded `2.27.3.`;
|
|
20
|
+
* 3. (in the shared SARIF normaliser) CodeQL omits `result.level`, which made
|
|
21
|
+
* every finding INFO until the rule's `defaultConfiguration.level` was used.
|
|
22
|
+
*
|
|
23
|
+
* Security boundary, enforced and not aspirational: **the engine never runs a
|
|
24
|
+
* build command**. CodeQL's `--command` is arbitrary project code; the adapter
|
|
25
|
+
* will only emit it when the project config sets
|
|
26
|
+
* `allowBuildCommands: true`, which the runner refuses unless the audit opts in.
|
|
27
|
+
* Enforced twice, on purpose: once here, once in the tests.
|
|
28
|
+
*/
|
|
29
|
+
import { spawnSync } from 'node:child_process';
|
|
30
|
+
import { statSync } from 'node:fs';
|
|
31
|
+
import path from 'node:path';
|
|
32
|
+
import { evidenceFromSarif } from '../sarif.js';
|
|
33
|
+
/** Where `database analyze` writes its SARIF, relative to the scan workdir. */
|
|
34
|
+
export const CODEQL_SARIF = 'codeql-results.sarif';
|
|
35
|
+
export const codeqlAdapter = {
|
|
36
|
+
id: 'codeql',
|
|
37
|
+
name: 'CodeQL data-flow analysis (opt-in)',
|
|
38
|
+
needsNetwork: true,
|
|
39
|
+
defaultConfig() {
|
|
40
|
+
return { language: 'javascript-typescript', packs: '', allowBuildCommands: false };
|
|
41
|
+
},
|
|
42
|
+
probe() {
|
|
43
|
+
const executable = which('codeql');
|
|
44
|
+
if (!executable) {
|
|
45
|
+
return {
|
|
46
|
+
available: false,
|
|
47
|
+
version: '',
|
|
48
|
+
reason: 'codeql executable not found on PATH (download from github/codeql-action)',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return { available: true, version: versionOf(executable), executable };
|
|
52
|
+
},
|
|
53
|
+
buildCommand(target, config) {
|
|
54
|
+
const language = String(config.language ?? 'javascript-typescript');
|
|
55
|
+
if (config.allowBuildCommands) {
|
|
56
|
+
throw new Error('allowBuildCommands must be granted by the audit, not by an adapter: the runner refuses build steps by default');
|
|
57
|
+
}
|
|
58
|
+
const db = path.join(target.workdir, 'codeql-db');
|
|
59
|
+
return {
|
|
60
|
+
prepare: [
|
|
61
|
+
{
|
|
62
|
+
argv: [
|
|
63
|
+
'codeql',
|
|
64
|
+
'database',
|
|
65
|
+
'create',
|
|
66
|
+
db,
|
|
67
|
+
'--language',
|
|
68
|
+
language,
|
|
69
|
+
'--source-root',
|
|
70
|
+
target.path,
|
|
71
|
+
'--no-run-unnecessary-builds',
|
|
72
|
+
],
|
|
73
|
+
timeoutMs: 900_000,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
argv: codeqlAnalyzeCommand(db, String(config.packs ?? ''), path.join(target.workdir, CODEQL_SARIF)),
|
|
77
|
+
artifacts: [CODEQL_SARIF],
|
|
78
|
+
timeoutMs: 900_000,
|
|
79
|
+
network: true,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
parse(raw, context) {
|
|
83
|
+
return evidenceFromSarif(raw, {
|
|
84
|
+
tool: 'codeql',
|
|
85
|
+
kind: 'dataflow-finding',
|
|
86
|
+
adapterVersion: context.adapterVersion,
|
|
87
|
+
confidence: 1.0,
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* The analyze leg, exposed so tests and callers can build it without running create.
|
|
93
|
+
*
|
|
94
|
+
* `packs` is a *positional* argument, so an empty string is not "no packs" — it
|
|
95
|
+
* is one empty specifier, and CodeQL rejects the whole run with
|
|
96
|
+
* `Invalid package specification:` and writes no SARIF. Measured on 2.27.3: with
|
|
97
|
+
* no specifier at all, CodeQL runs the language's default (code-scanning) suite.
|
|
98
|
+
*/
|
|
99
|
+
export function codeqlAnalyzeCommand(db, packs, out) {
|
|
100
|
+
const specifier = packs.trim();
|
|
101
|
+
return [
|
|
102
|
+
'codeql',
|
|
103
|
+
'database',
|
|
104
|
+
'analyze',
|
|
105
|
+
db,
|
|
106
|
+
...(specifier ? [specifier] : []),
|
|
107
|
+
'--format=sarif-latest',
|
|
108
|
+
`--output=${out}`,
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
function which(binary) {
|
|
112
|
+
for (const dir of (process.env.PATH ?? '').split(path.delimiter)) {
|
|
113
|
+
if (!dir)
|
|
114
|
+
continue;
|
|
115
|
+
const candidate = path.join(dir, binary);
|
|
116
|
+
try {
|
|
117
|
+
if (statSync(candidate).isFile())
|
|
118
|
+
return candidate;
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
/* keep looking */
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
function versionOf(executable) {
|
|
127
|
+
const proc = spawnSync(executable, ['--version'], { encoding: 'utf8', timeout: 30_000 });
|
|
128
|
+
// `codeql --version` prints "CodeQL command-line toolchain release 2.27.3."
|
|
129
|
+
// A `[\d.]+` class captures the sentence's full stop, and the version is
|
|
130
|
+
// recorded as "2.27.3." in every manifest.
|
|
131
|
+
const match = /(\d+\.\d+\.\d+)/.exec(String(proc.stdout ?? ''));
|
|
132
|
+
return match?.[1] ?? 'unknown';
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=codeql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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S,CAAC,EAAE,CAAC;QACjE,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC;YACH,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE;gBAAE,OAAO,SAAS,CAAC;QACrD,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,SAAS,CAAC,UAAkB;IACnC,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACzF,4EAA4E;IAC5E,yEAAyE;IACzE,2CAA2C;IAC3C,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IAChE,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-cruiser.d.ts","sourceRoot":"","sources":["../../../src/scanner/adapters/dependency-cruiser.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAA0B,cAAc,EAAiB,MAAM,aAAa,CAAC;AAIzF,eAAO,MAAM,wBAAwB,EAAE,cA2EtC,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dependency-cruiser — Tier 1.
|
|
3
|
+
*
|
|
4
|
+
* The critical fact driving this adapter: `-T json` **exits 0 regardless of
|
|
5
|
+
* violations** (the CLI docs are explicit; only the err-family reporters exit
|
|
6
|
+
* with the count of error-severity violations). Reading the exit code here
|
|
7
|
+
* would make every architecture violation invisible. The verdict is parsed
|
|
8
|
+
* from the JSON, never from the process status.
|
|
9
|
+
*/
|
|
10
|
+
import { spawnSync } from 'node:child_process';
|
|
11
|
+
import { statSync } from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { buildEvidence } from '../identity.js';
|
|
14
|
+
import { DETERMINISTIC_CONFIDENCE, dig, tryParseJson } from '../normalize.js';
|
|
15
|
+
export const dependencyCruiserAdapter = {
|
|
16
|
+
id: 'dependency-cruiser',
|
|
17
|
+
name: 'Dependency graph and architecture rules (JS/TS)',
|
|
18
|
+
defaultConfig() {
|
|
19
|
+
return { args: ['src'], rules: '' };
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* `--config` is passed only when the project supplies a rules file. The
|
|
23
|
+
* alternative — always `--no-config` — would make this adapter a graph
|
|
24
|
+
* printer: a cruise with no rules produces zero violations, and "0
|
|
25
|
+
* violations" is exactly the unfalsifiable result this subsystem refuses to
|
|
26
|
+
* emit. Verified against depcruise 18.7.0: the JSON has no `rules` key, so
|
|
27
|
+
* whether rules ran is a *configuration* fact, not something to detect from
|
|
28
|
+
* the output.
|
|
29
|
+
*/
|
|
30
|
+
probe() {
|
|
31
|
+
for (const binary of ['depcruise', 'dependency-cruiser']) {
|
|
32
|
+
const executable = which(binary);
|
|
33
|
+
if (executable) {
|
|
34
|
+
return { available: true, version: versionOf(executable), executable };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
available: false,
|
|
39
|
+
version: '',
|
|
40
|
+
reason: 'depcruise executable not found on PATH (not installed in this environment)',
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
buildCommand(target, config) {
|
|
44
|
+
const args = config.args ?? ['src'];
|
|
45
|
+
// The rules file has to reach argv, not only the parser. A parser told that
|
|
46
|
+
// rules exist stops guarding an empty violation list (see `parse`), so a
|
|
47
|
+
// cruise that never loaded the rules would report `ok` with no rows — a
|
|
48
|
+
// silent pass on the one thing this adapter exists to detect.
|
|
49
|
+
const rules = String(config.rules ?? '');
|
|
50
|
+
return {
|
|
51
|
+
argv: [
|
|
52
|
+
'depcruise',
|
|
53
|
+
'--output-type',
|
|
54
|
+
'json',
|
|
55
|
+
...(rules ? ['--config', rules] : ['--no-config']),
|
|
56
|
+
...args,
|
|
57
|
+
],
|
|
58
|
+
timeoutMs: 120_000,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
parse(raw, context) {
|
|
62
|
+
const parsed = tryParseJson(raw);
|
|
63
|
+
if (!parsed.ok) {
|
|
64
|
+
return [unknown(context, `dependency-cruiser output was not valid JSON: ${parsed.error}`)];
|
|
65
|
+
}
|
|
66
|
+
const modules = dig(parsed.value, ['modules']);
|
|
67
|
+
if (!Array.isArray(modules)) {
|
|
68
|
+
return [
|
|
69
|
+
unknown(context, 'dependency-cruiser report carried no modules array (nothing scanned?)'),
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
const violations = dig(parsed.value, ['summary', 'violations']);
|
|
73
|
+
const list = Array.isArray(violations) ? violations : [];
|
|
74
|
+
// No rules configured means the cruise produced a graph, not a verdict —
|
|
75
|
+
// and "0 violations" would be indistinguishable from "no problems".
|
|
76
|
+
if (list.length === 0 && !String(context.config.rules ?? '')) {
|
|
77
|
+
return [
|
|
78
|
+
unknown(context, 'dependency-cruiser ran without a rules config — a graph, not a verdict'),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
return list.map((violation, index) => violationToEvidence(violation, index, context.adapterVersion));
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
/** One edge violation → one evidence row naming both endpoints. */
|
|
85
|
+
/**
|
|
86
|
+
* depcruise 18.7.0 emits `from`/`to` as plain strings ("a.js"); some versions
|
|
87
|
+
* and the `--output-type err` family use objects. Accept both rather than
|
|
88
|
+
* guessing, which is how the first version of this adapter produced `? → ?`.
|
|
89
|
+
*/
|
|
90
|
+
function endpoint(value) {
|
|
91
|
+
if (typeof value === 'string')
|
|
92
|
+
return value;
|
|
93
|
+
return String(dig(value, ['path']) ?? 'unknown');
|
|
94
|
+
}
|
|
95
|
+
function violationToEvidence(violation, index, adapterVersion) {
|
|
96
|
+
const from = endpoint(dig(violation, ['from']));
|
|
97
|
+
const to = endpoint(dig(violation, ['to']));
|
|
98
|
+
const ruleName = String(dig(violation, ['rule', 'name']) ?? dig(violation, ['rule', 'id']) ?? 'unnamed-rule');
|
|
99
|
+
const severityWord = String(dig(violation, ['rule', 'severity']) ?? 'warn');
|
|
100
|
+
return buildEvidence({
|
|
101
|
+
source: {
|
|
102
|
+
tool: 'dependency-cruiser',
|
|
103
|
+
kind: 'dependency-edge',
|
|
104
|
+
version: adapterVersion,
|
|
105
|
+
identifier: ruleName,
|
|
106
|
+
},
|
|
107
|
+
provenance: placeholder(),
|
|
108
|
+
claim: `${from} → ${to} breaks rule ${ruleName} (${severityWord})`,
|
|
109
|
+
severity: mapSeverity(severityWord),
|
|
110
|
+
confidence: DETERMINISTIC_CONFIDENCE,
|
|
111
|
+
status: 'FAIL',
|
|
112
|
+
location: { file: from },
|
|
113
|
+
rawReference: { jsonPath: `summary.violations[${index}]` },
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function mapSeverity(word) {
|
|
117
|
+
if (word === 'error')
|
|
118
|
+
return 'HIGH';
|
|
119
|
+
if (word === 'info')
|
|
120
|
+
return 'INFO';
|
|
121
|
+
return 'MEDIUM';
|
|
122
|
+
}
|
|
123
|
+
function unknown(context, reason) {
|
|
124
|
+
return {
|
|
125
|
+
id: `UNKNOWN-dependency-cruiser-${reason}`.replace(/[^A-Za-z0-9-]/g, '-').slice(0, 48),
|
|
126
|
+
source: {
|
|
127
|
+
tool: 'dependency-cruiser',
|
|
128
|
+
version: context.adapterVersion,
|
|
129
|
+
kind: 'check',
|
|
130
|
+
identifier: 'UNKNOWN',
|
|
131
|
+
},
|
|
132
|
+
provenance: placeholder(),
|
|
133
|
+
claim: reason,
|
|
134
|
+
severity: 'INFO',
|
|
135
|
+
severitySource: 'adapter-default',
|
|
136
|
+
confidence: DETERMINISTIC_CONFIDENCE,
|
|
137
|
+
status: 'UNKNOWN',
|
|
138
|
+
location: null,
|
|
139
|
+
rawReference: {},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function placeholder() {
|
|
143
|
+
return {
|
|
144
|
+
executionId: '',
|
|
145
|
+
command: [],
|
|
146
|
+
config: {},
|
|
147
|
+
repositoryRevision: '',
|
|
148
|
+
timestamp: '',
|
|
149
|
+
executable: '',
|
|
150
|
+
timeoutMs: 0,
|
|
151
|
+
elapsedMs: 0,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function which(binary) {
|
|
155
|
+
for (const dir of (process.env.PATH ?? '').split(path.delimiter)) {
|
|
156
|
+
if (!dir)
|
|
157
|
+
continue;
|
|
158
|
+
const candidate = path.join(dir, binary);
|
|
159
|
+
try {
|
|
160
|
+
if (statSync(candidate).isFile())
|
|
161
|
+
return candidate;
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
/* keep looking */
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
function versionOf(executable) {
|
|
170
|
+
const proc = spawnSync(executable, ['--version'], { encoding: 'utf8', timeout: 15_000 });
|
|
171
|
+
const match = /([\w.]+)/.exec(String(proc.stdout ?? proc.stderr ?? ''));
|
|
172
|
+
return match?.[1] ?? 'unknown';
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=dependency-cruiser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-cruiser.js","sourceRoot":"","sources":["../../../src/scanner/adapters/dependency-cruiser.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,aAAa,EA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E;gBAAE,OAAO,SAAS,CAAC;QACrD,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,SAAS,CAAC,UAAkB;IACnC,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACzF,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IACxE,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ScannerAdapter } from '../types.js';
|
|
2
|
+
/** The artifact `analyze` writes and `evaluate` reads. */
|
|
3
|
+
export declare const ORT_ANALYZER_RESULT = "analyzer-result.yml";
|
|
4
|
+
/** The artifact `evaluate -f JSON` writes — the one this adapter parses. */
|
|
5
|
+
export declare const ORT_EVALUATION_RESULT = "evaluation-result.json";
|
|
6
|
+
/**
|
|
7
|
+
* The ruleset ORT bundles. Reachable only with the leading slash (measured);
|
|
8
|
+
* `scanners.ort.rulesFile` replaces it with a project's own `.kts` script.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ORT_DEFAULT_RULES = "/rules/osadl.rules.kts";
|
|
11
|
+
export declare const ortAdapter: ScannerAdapter;
|
|
12
|
+
//# sourceMappingURL=ort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ort.d.ts","sourceRoot":"","sources":["../../../src/scanner/adapters/ort.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAA0B,cAAc,EAAE,MAAM,aAAa,CAAC;AAI1E,0DAA0D;AAC1D,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAE1D,eAAO,MAAM,UAAU,EAAE,cAkFxB,CAAC"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OSS Review Toolkit (ORT) — Tier 2.
|
|
3
|
+
*
|
|
4
|
+
* ORT is a staged pipeline: `analyze` → `scan` → `advise` → `evaluate` → `report`.
|
|
5
|
+
* The stage whose output is *evidence* is `evaluate`: policy rules applied to a
|
|
6
|
+
* resolved dependency graph, producing rule violations with a package, a
|
|
7
|
+
* version and a rule name.
|
|
8
|
+
*
|
|
9
|
+
* CLI and payload verified against ORT 97.0.0 (run from the project's container
|
|
10
|
+
* image, `ghcr.io/oss-review-toolkit/ort`):
|
|
11
|
+
*
|
|
12
|
+
* ort analyze --input-dir <dir> --output-dir <dir> # → analyzer-result.yml
|
|
13
|
+
* ort evaluate -i <analyzer-result.yml> -o <dir> -f JSON # → evaluation-result.json
|
|
14
|
+
*
|
|
15
|
+
* Four things measured here that the documentation does not say:
|
|
16
|
+
*
|
|
17
|
+
* 1. `evaluate` does not take `--input-dir`; the input is `-i/--ort-file` and
|
|
18
|
+
* it takes the result *file*.
|
|
19
|
+
* 2. `evaluate` refuses to run without a rules *script* ("No rules specified.").
|
|
20
|
+
* The ruleset ORT ships is a classpath resource, and `--rules-resource` needs
|
|
21
|
+
* a **leading slash** (`/rules/osadl.rules.kts`): the un-prefixed form
|
|
22
|
+
* resolves against the command's own jar and dies with a NullPointerException.
|
|
23
|
+
* 3. The violations are written to a **file**, not stdout — stdout carries
|
|
24
|
+
* progress logs. An adapter that parses stdout parses the wrong stream.
|
|
25
|
+
* 4. `evaluate` **exits 2** when it finds violations. That is a successful run
|
|
26
|
+
* that objects, so exit status is recorded and never interpreted.
|
|
27
|
+
*
|
|
28
|
+
* The payload is `{ evaluator: { violations: [ { rule, pkg, license,
|
|
29
|
+
* license_sources, severity, message, how_to_fix } ] } }` where `pkg` is a
|
|
30
|
+
* coordinate string (`NPM::lodash:4.17.21`) or `null` for a violation that is
|
|
31
|
+
* not attached to a package.
|
|
32
|
+
*/
|
|
33
|
+
import { spawnSync } from 'node:child_process';
|
|
34
|
+
import { statSync } from 'node:fs';
|
|
35
|
+
import path from 'node:path';
|
|
36
|
+
import { parse as parseYaml } from 'yaml';
|
|
37
|
+
import { buildEvidence } from '../identity.js';
|
|
38
|
+
import { DETERMINISTIC_CONFIDENCE, dig, tryParseJson } from '../normalize.js';
|
|
39
|
+
/** The artifact `analyze` writes and `evaluate` reads. */
|
|
40
|
+
export const ORT_ANALYZER_RESULT = 'analyzer-result.yml';
|
|
41
|
+
/** The artifact `evaluate -f JSON` writes — the one this adapter parses. */
|
|
42
|
+
export const ORT_EVALUATION_RESULT = 'evaluation-result.json';
|
|
43
|
+
/**
|
|
44
|
+
* The ruleset ORT bundles. Reachable only with the leading slash (measured);
|
|
45
|
+
* `scanners.ort.rulesFile` replaces it with a project's own `.kts` script.
|
|
46
|
+
*/
|
|
47
|
+
export const ORT_DEFAULT_RULES = '/rules/osadl.rules.kts';
|
|
48
|
+
export const ortAdapter = {
|
|
49
|
+
id: 'ort',
|
|
50
|
+
name: 'OSS Review Toolkit dependency policy evaluator',
|
|
51
|
+
// Only `analyze` reaches the network: it resolves the dependency graph from
|
|
52
|
+
// the package registry. `evaluate` reads a file.
|
|
53
|
+
needsNetwork: true,
|
|
54
|
+
networkConfigKey: 'scanners.ort.ortFile',
|
|
55
|
+
defaultConfig() {
|
|
56
|
+
return {
|
|
57
|
+
outputDir: '.ort-results',
|
|
58
|
+
ortFile: '',
|
|
59
|
+
rulesFile: '',
|
|
60
|
+
rulesResource: ORT_DEFAULT_RULES,
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
probe() {
|
|
64
|
+
const executable = which('ort');
|
|
65
|
+
if (!executable) {
|
|
66
|
+
return {
|
|
67
|
+
available: false,
|
|
68
|
+
version: '',
|
|
69
|
+
reason: 'ort executable not found on PATH (JVM package from oss-review-toolkit/ort; ' +
|
|
70
|
+
'the container image ghcr.io/oss-review-toolkit/ort is the verified runner)',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return { available: true, version: versionOf(executable), executable };
|
|
74
|
+
},
|
|
75
|
+
buildCommand(target, config) {
|
|
76
|
+
const outputDir = String(config.outputDir ?? '.ort-results');
|
|
77
|
+
// A pre-computed result file turns this into a single offline stage.
|
|
78
|
+
const ortFile = String(config.ortFile ?? '');
|
|
79
|
+
const rulesFile = String(config.rulesFile ?? '');
|
|
80
|
+
const rulesResource = String(config.rulesResource ?? ORT_DEFAULT_RULES);
|
|
81
|
+
const input = ortFile || path.posix.join(outputDir, ORT_ANALYZER_RESULT);
|
|
82
|
+
const rules = rulesFile ? ['-r', rulesFile] : [`--rules-resource=${rulesResource}`];
|
|
83
|
+
return {
|
|
84
|
+
argv: ['ort', 'evaluate', '-i', input, '-o', outputDir, '-f', 'JSON', ...rules],
|
|
85
|
+
prepare: ortFile
|
|
86
|
+
? []
|
|
87
|
+
: [
|
|
88
|
+
{
|
|
89
|
+
argv: ['ort', 'analyze', '--input-dir', target.workdir, '--output-dir', outputDir],
|
|
90
|
+
timeoutMs: 900_000,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
artifacts: [path.posix.join(outputDir, ORT_EVALUATION_RESULT)],
|
|
94
|
+
network: !ortFile,
|
|
95
|
+
timeoutMs: 600_000,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
parse(raw, context) {
|
|
99
|
+
// ORT writes YAML by default; `-f JSON` (what the adapter asks for) writes
|
|
100
|
+
// JSON. Accept both so a hand-converted artifact still parses.
|
|
101
|
+
let doc;
|
|
102
|
+
if (raw.trimStart().startsWith('{')) {
|
|
103
|
+
const parsed = tryParseJson(raw);
|
|
104
|
+
if (!parsed.ok)
|
|
105
|
+
return [unknown(context, `ORT output was not valid JSON: ${parsed.error}`)];
|
|
106
|
+
doc = parsed.value;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
try {
|
|
110
|
+
doc = parseYaml(raw);
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
return [unknown(context, `ORT output was not valid YAML: ${err.message}`)];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// ORT 97 nests the result under `evaluator`; older layouts put it at the
|
|
117
|
+
// top. Accept both, and say so when neither is present rather than
|
|
118
|
+
// reporting a clean scan.
|
|
119
|
+
const violations = dig(doc, ['evaluator', 'violations']) ?? dig(doc, ['violations']);
|
|
120
|
+
if (!Array.isArray(violations)) {
|
|
121
|
+
return [unknown(context, 'ORT evaluation carried no violations array (nothing evaluated?)')];
|
|
122
|
+
}
|
|
123
|
+
if (violations.length === 0)
|
|
124
|
+
return [cleanRun(doc, context)];
|
|
125
|
+
return violations.map((violation, index) => violationToEvidence(violation, index, context.adapterVersion));
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* A clean evaluation is a fact, and its absence is not.
|
|
130
|
+
*
|
|
131
|
+
* With no row, "the policy was applied and nothing violated it" and "the policy
|
|
132
|
+
* never ran" look identical to a rule consuming this evidence.
|
|
133
|
+
*/
|
|
134
|
+
function cleanRun(doc, context) {
|
|
135
|
+
const packages = dig(doc, ['analyzer', 'result', 'packages']);
|
|
136
|
+
const count = Array.isArray(packages) ? packages.length : null;
|
|
137
|
+
const ruleset = String(context.config.rulesFile || context.config.rulesResource || ORT_DEFAULT_RULES);
|
|
138
|
+
return buildEvidence({
|
|
139
|
+
source: {
|
|
140
|
+
tool: 'ort',
|
|
141
|
+
kind: 'policy-evaluation',
|
|
142
|
+
version: context.adapterVersion,
|
|
143
|
+
identifier: 'evaluation',
|
|
144
|
+
},
|
|
145
|
+
provenance: placeholder(),
|
|
146
|
+
claim: `ORT evaluated ${count === null ? 'an unrecorded number of' : count} package(s) ` +
|
|
147
|
+
`under ${ruleset}: no rule violations`,
|
|
148
|
+
severity: 'INFO',
|
|
149
|
+
severitySource: 'adapter-default',
|
|
150
|
+
confidence: DETERMINISTIC_CONFIDENCE,
|
|
151
|
+
status: 'PASS',
|
|
152
|
+
location: null,
|
|
153
|
+
rawReference: { jsonPath: 'evaluator.violations' },
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/** ORT's own severity words, mapped once here rather than inside the normaliser. */
|
|
157
|
+
function ortSeverity(word) {
|
|
158
|
+
switch (word.toUpperCase()) {
|
|
159
|
+
case 'ERROR':
|
|
160
|
+
return 'HIGH';
|
|
161
|
+
case 'WARNING':
|
|
162
|
+
return 'MEDIUM';
|
|
163
|
+
case 'HINT':
|
|
164
|
+
return 'INFO';
|
|
165
|
+
default:
|
|
166
|
+
return 'LOW';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/** A string field, trimmed; anything else is empty rather than "[object Object]". */
|
|
170
|
+
function text(value) {
|
|
171
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
172
|
+
}
|
|
173
|
+
function violationToEvidence(violation, index, adapterVersion) {
|
|
174
|
+
const rule = text(dig(violation, ['rule'])) || 'unknown rule';
|
|
175
|
+
// `pkg` is a coordinate string or null. Null is not "unknown package": it is
|
|
176
|
+
// a violation the ruleset attached to the result rather than to a package.
|
|
177
|
+
const pkg = text(dig(violation, ['pkg'])) || null;
|
|
178
|
+
const message = text(dig(violation, ['message']));
|
|
179
|
+
const howToFix = text(dig(violation, ['how_to_fix']));
|
|
180
|
+
const license = text(dig(violation, ['license']));
|
|
181
|
+
const severityWord = text(dig(violation, ['severity'])) || 'ERROR';
|
|
182
|
+
// A licence-policy violation is only actionable if the licence is in the
|
|
183
|
+
// claim: the rule name alone does not say which licence tripped it.
|
|
184
|
+
const about = license ? ` (license ${license})` : '';
|
|
185
|
+
const detail = message ? `: ${message}` : '';
|
|
186
|
+
return buildEvidence({
|
|
187
|
+
source: {
|
|
188
|
+
tool: 'ort',
|
|
189
|
+
kind: 'policy-violation',
|
|
190
|
+
version: adapterVersion,
|
|
191
|
+
identifier: rule,
|
|
192
|
+
},
|
|
193
|
+
provenance: placeholder(),
|
|
194
|
+
claim: `${pkg ?? 'the repository'} violates policy rule ${rule}${about}${detail}`,
|
|
195
|
+
severity: ortSeverity(severityWord),
|
|
196
|
+
confidence: DETERMINISTIC_CONFIDENCE,
|
|
197
|
+
status: 'FAIL',
|
|
198
|
+
location: null,
|
|
199
|
+
rawReference: {
|
|
200
|
+
jsonPath: `evaluator.violations[${index}]`,
|
|
201
|
+
...(howToFix ? { excerpt: howToFix } : {}),
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function unknown(context, reason) {
|
|
206
|
+
return {
|
|
207
|
+
id: `UNKNOWN-ort-${reason}`.replace(/[^A-Za-z0-9-]/g, '-').slice(0, 48),
|
|
208
|
+
source: { tool: 'ort', version: context.adapterVersion, kind: 'check', identifier: 'UNKNOWN' },
|
|
209
|
+
provenance: placeholder(),
|
|
210
|
+
claim: reason,
|
|
211
|
+
severity: 'INFO',
|
|
212
|
+
severitySource: 'adapter-default',
|
|
213
|
+
confidence: DETERMINISTIC_CONFIDENCE,
|
|
214
|
+
status: 'UNKNOWN',
|
|
215
|
+
location: null,
|
|
216
|
+
rawReference: {},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function placeholder() {
|
|
220
|
+
return {
|
|
221
|
+
executionId: '',
|
|
222
|
+
command: [],
|
|
223
|
+
config: {},
|
|
224
|
+
repositoryRevision: '',
|
|
225
|
+
timestamp: '',
|
|
226
|
+
executable: '',
|
|
227
|
+
timeoutMs: 0,
|
|
228
|
+
elapsedMs: 0,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function which(binary) {
|
|
232
|
+
for (const dir of (process.env.PATH ?? '').split(path.delimiter)) {
|
|
233
|
+
if (!dir)
|
|
234
|
+
continue;
|
|
235
|
+
const candidate = path.join(dir, binary);
|
|
236
|
+
try {
|
|
237
|
+
if (statSync(candidate).isFile())
|
|
238
|
+
return candidate;
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
/* keep looking */
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
function versionOf(executable) {
|
|
247
|
+
const proc = spawnSync(executable, ['--version'], { encoding: 'utf8', timeout: 60_000 });
|
|
248
|
+
// Measured: `ort --version` prints JVM warnings first, and one of them names a
|
|
249
|
+
// jar (`jna-5.19.1.jar`) — a loose regex on the whole output reports 5.19.1 as
|
|
250
|
+
// the ORT version. Only a line that *is* a version counts, and the real one is
|
|
251
|
+
// last.
|
|
252
|
+
const lines = String(proc.stdout ?? proc.stderr ?? '')
|
|
253
|
+
.split('\n')
|
|
254
|
+
.map((line) => line.trim())
|
|
255
|
+
.filter((line) => /^\d+\.\d+\.\d+/.test(line));
|
|
256
|
+
const last = lines.at(-1);
|
|
257
|
+
return last ? /^(\d+\.\d+\.\d+)/.exec(last)[1] : 'unknown';
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=ort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ort.js","sourceRoot":"","sources":["../../../src/scanner/adapters/ort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE9E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,mBAAmB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,UAAkB;IACnC,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACzF,+EAA+E;IAC/E,+EAA+E;IAC/E,+EAA+E;IAC/E,QAAQ;IACR,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;SACnD,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ScannerAdapter } from '../types.js';
|
|
2
|
+
/** The file-based checks that survive `--local` (verified against v5.6.0). */
|
|
3
|
+
export declare const LOCAL_CHECKS: string[];
|
|
4
|
+
export declare const scorecardAdapter: ScannerAdapter;
|
|
5
|
+
/** `git@github.com:org/repo.git` or `https://github.com/org/repo.git` → `org/repo`. */
|
|
6
|
+
export declare function deriveRepoSlug(targetPath: string): string;
|
|
7
|
+
//# sourceMappingURL=scorecard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scorecard.d.ts","sourceRoot":"","sources":["../../../src/scanner/adapters/scorecard.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAA0B,cAAc,EAAiB,MAAM,aAAa,CAAC;AAIzF,8EAA8E;AAC9E,eAAO,MAAM,YAAY,UAQxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,cA6D9B,CAAC;AAsFF,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CASzD"}
|