@owasp-aghast/aghast 0.8.3 → 0.9.0-rc.1
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/config/pricing.json +39 -9
- package/dist/build-config.d.ts.map +1 -1
- package/dist/build-config.js +101 -2
- package/dist/build-config.js.map +1 -1
- package/dist/check-library.d.ts +25 -0
- package/dist/check-library.d.ts.map +1 -1
- package/dist/check-library.js +172 -1
- package/dist/check-library.js.map +1 -1
- package/dist/ci-metadata.d.ts +42 -0
- package/dist/ci-metadata.d.ts.map +1 -0
- package/dist/ci-metadata.js +131 -0
- package/dist/ci-metadata.js.map +1 -0
- package/dist/claude-code-provider.d.ts +7 -0
- package/dist/claude-code-provider.d.ts.map +1 -1
- package/dist/claude-code-provider.js +65 -1
- package/dist/claude-code-provider.js.map +1 -1
- package/dist/cli.js +4 -1
- package/dist/cli.js.map +1 -1
- package/dist/concurrency.d.ts +18 -0
- package/dist/concurrency.d.ts.map +1 -0
- package/dist/concurrency.js +39 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/cost-tracker.d.ts +45 -0
- package/dist/cost-tracker.d.ts.map +1 -0
- package/dist/cost-tracker.js +56 -0
- package/dist/cost-tracker.js.map +1 -0
- package/dist/discoveries/glob-discovery.d.ts +21 -0
- package/dist/discoveries/glob-discovery.d.ts.map +1 -0
- package/dist/discoveries/glob-discovery.js +215 -0
- package/dist/discoveries/glob-discovery.js.map +1 -0
- package/dist/discoveries/script-discovery.d.ts +117 -0
- package/dist/discoveries/script-discovery.d.ts.map +1 -0
- package/dist/discoveries/script-discovery.js +593 -0
- package/dist/discoveries/script-discovery.js.map +1 -0
- package/dist/docs-url.d.ts +14 -0
- package/dist/docs-url.d.ts.map +1 -0
- package/dist/docs-url.js +17 -0
- package/dist/docs-url.js.map +1 -0
- package/dist/error-codes.d.ts +12 -1
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +16 -2
- package/dist/error-codes.js.map +1 -1
- package/dist/formatters/csv-formatter.d.ts +45 -0
- package/dist/formatters/csv-formatter.d.ts.map +1 -0
- package/dist/formatters/csv-formatter.js +176 -0
- package/dist/formatters/csv-formatter.js.map +1 -0
- package/dist/formatters/html-formatter.d.ts +39 -0
- package/dist/formatters/html-formatter.d.ts.map +1 -0
- package/dist/formatters/html-formatter.js +432 -0
- package/dist/formatters/html-formatter.js.map +1 -0
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +6 -0
- package/dist/formatters/index.js.map +1 -1
- package/dist/formatters/markdown-formatter.d.ts +61 -0
- package/dist/formatters/markdown-formatter.d.ts.map +1 -0
- package/dist/formatters/markdown-formatter.js +557 -0
- package/dist/formatters/markdown-formatter.js.map +1 -0
- package/dist/formatters/sarif-formatter.d.ts +7 -0
- package/dist/formatters/sarif-formatter.d.ts.map +1 -1
- package/dist/formatters/sarif-formatter.js +80 -0
- package/dist/formatters/sarif-formatter.js.map +1 -1
- package/dist/formatters/types.d.ts +24 -0
- package/dist/formatters/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +365 -10
- package/dist/index.js.map +1 -1
- package/dist/issue-file-writer.d.ts +21 -0
- package/dist/issue-file-writer.d.ts.map +1 -0
- package/dist/issue-file-writer.js +307 -0
- package/dist/issue-file-writer.js.map +1 -0
- package/dist/judge.d.ts +62 -0
- package/dist/judge.d.ts.map +1 -0
- package/dist/judge.js +305 -0
- package/dist/judge.js.map +1 -0
- package/dist/mock-agent-provider.d.ts +3 -0
- package/dist/mock-agent-provider.d.ts.map +1 -1
- package/dist/mock-agent-provider.js +13 -0
- package/dist/mock-agent-provider.js.map +1 -1
- package/dist/new-check.d.ts.map +1 -1
- package/dist/new-check.js +334 -22
- package/dist/new-check.js.map +1 -1
- package/dist/opencode-provider.d.ts.map +1 -1
- package/dist/opencode-provider.js +33 -0
- package/dist/opencode-provider.js.map +1 -1
- package/dist/repo-scan.d.ts +80 -0
- package/dist/repo-scan.d.ts.map +1 -0
- package/dist/repo-scan.js +250 -0
- package/dist/repo-scan.js.map +1 -0
- package/dist/result-handlers/pr-comment-handler.d.ts +136 -0
- package/dist/result-handlers/pr-comment-handler.d.ts.map +1 -0
- package/dist/result-handlers/pr-comment-handler.js +381 -0
- package/dist/result-handlers/pr-comment-handler.js.map +1 -0
- package/dist/retry.d.ts +128 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +261 -0
- package/dist/retry.js.map +1 -0
- package/dist/runtime-config.d.ts.map +1 -1
- package/dist/runtime-config.js +62 -0
- package/dist/runtime-config.js.map +1 -1
- package/dist/scan-runner.d.ts +31 -22
- package/dist/scan-runner.d.ts.map +1 -1
- package/dist/scan-runner.js +145 -100
- package/dist/scan-runner.js.map +1 -1
- package/dist/semgrep-runner.js +6 -4
- package/dist/semgrep-runner.js.map +1 -1
- package/dist/stats.d.ts.map +1 -1
- package/dist/stats.js +4 -1
- package/dist/stats.js.map +1 -1
- package/dist/types.d.ts +149 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -17,6 +17,26 @@ export function mapSeverityToLevel(severity) {
|
|
|
17
17
|
return 'note';
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Maps a judge verdict to a SARIF result kind.
|
|
22
|
+
*
|
|
23
|
+
* `false_positive` maps to `pass` rather than the more obvious `false`, because
|
|
24
|
+
* `false` is not a member of the SARIF 2.1.0 `kind` enum — the spec allows only
|
|
25
|
+
* `notApplicable`, `pass`, `fail`, `review`, `open` and `informational`, and a
|
|
26
|
+
* validating consumer rejects the whole document otherwise.
|
|
27
|
+
*
|
|
28
|
+
* `pass` is also what this formatter already emits for false positives found by
|
|
29
|
+
* false-positive-validation checks (see `buildValidationResults`), so both paths
|
|
30
|
+
* now describe a dismissed finding the same way: `kind: "pass"` plus a
|
|
31
|
+
* suppression carrying the rationale.
|
|
32
|
+
*/
|
|
33
|
+
function mapVerdictToKind(verdict) {
|
|
34
|
+
switch (verdict) {
|
|
35
|
+
case 'true_positive': return 'open';
|
|
36
|
+
case 'false_positive': return 'pass';
|
|
37
|
+
case 'uncertain': return 'review';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
20
40
|
export class SarifFormatter {
|
|
21
41
|
id = 'sarif';
|
|
22
42
|
fileExtension = '.sarif';
|
|
@@ -29,6 +49,7 @@ export class SarifFormatter {
|
|
|
29
49
|
if (results.validations) {
|
|
30
50
|
sarifResults.push(...this.buildValidationResults(results.validations));
|
|
31
51
|
}
|
|
52
|
+
const invocations = this.buildInvocations(results);
|
|
32
53
|
const sarif = {
|
|
33
54
|
$schema: 'https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json',
|
|
34
55
|
version: '2.1.0',
|
|
@@ -41,12 +62,36 @@ export class SarifFormatter {
|
|
|
41
62
|
rules,
|
|
42
63
|
},
|
|
43
64
|
},
|
|
65
|
+
...(invocations ? { invocations } : {}),
|
|
44
66
|
results: sarifResults,
|
|
45
67
|
},
|
|
46
68
|
],
|
|
47
69
|
};
|
|
48
70
|
return JSON.stringify(sarif, null, 2);
|
|
49
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Map CI/CD metadata (spec E.4) to a single SARIF invocation entry. The
|
|
74
|
+
* `properties` bag is the conventional location for non-standard run
|
|
75
|
+
* context in SARIF; we use stable, namespaced keys (`aghast.<field>`) so
|
|
76
|
+
* downstream consumers can rely on the shape.
|
|
77
|
+
*/
|
|
78
|
+
buildInvocations(results) {
|
|
79
|
+
const ci = results.metadata?.ciMetadata;
|
|
80
|
+
if (!ci)
|
|
81
|
+
return undefined;
|
|
82
|
+
const properties = {};
|
|
83
|
+
if (ci.jobUrl)
|
|
84
|
+
properties['aghast.ciJobUrl'] = ci.jobUrl;
|
|
85
|
+
if (ci.branch)
|
|
86
|
+
properties['aghast.ciBranch'] = ci.branch;
|
|
87
|
+
if (ci.pipelineSource)
|
|
88
|
+
properties['aghast.ciPipelineSource'] = ci.pipelineSource;
|
|
89
|
+
if (ci.jobStartedAt)
|
|
90
|
+
properties['aghast.ciJobStartedAt'] = ci.jobStartedAt;
|
|
91
|
+
if (Object.keys(properties).length === 0)
|
|
92
|
+
return undefined;
|
|
93
|
+
return [{ executionSuccessful: true, properties }];
|
|
94
|
+
}
|
|
50
95
|
buildRules(results) {
|
|
51
96
|
const seen = new Map();
|
|
52
97
|
for (const check of results.checks) {
|
|
@@ -85,6 +130,41 @@ export class SarifFormatter {
|
|
|
85
130
|
if (issue.dataFlow && issue.dataFlow.length > 0) {
|
|
86
131
|
result.codeFlows = [this.buildCodeFlow(issue.dataFlow)];
|
|
87
132
|
}
|
|
133
|
+
// Judge verdict → SARIF kind and properties
|
|
134
|
+
if (issue.judge) {
|
|
135
|
+
result.kind = mapVerdictToKind(issue.judge.verdict);
|
|
136
|
+
result.properties = {
|
|
137
|
+
...(result.properties ?? {}),
|
|
138
|
+
judge: {
|
|
139
|
+
verdict: issue.judge.verdict,
|
|
140
|
+
confidence: issue.judge.confidence,
|
|
141
|
+
rationale: issue.judge.rationale,
|
|
142
|
+
model: issue.judge.model,
|
|
143
|
+
provider: issue.judge.provider,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
if (issue.judge.verdict === 'false_positive') {
|
|
147
|
+
// Match how false-positive-validation dismissals are already
|
|
148
|
+
// represented: a suppression carries the reason, so a consumer that
|
|
149
|
+
// only understands standard SARIF still learns why the finding was
|
|
150
|
+
// dismissed without reading our `properties` bag.
|
|
151
|
+
result.suppressions = [
|
|
152
|
+
...(result.suppressions ?? []),
|
|
153
|
+
{ kind: 'external', justification: issue.judge.rationale },
|
|
154
|
+
];
|
|
155
|
+
// `level` is meaningless alongside `kind: "pass"` per SARIF 2.1.0, and
|
|
156
|
+
// `buildValidationResults` omits it for the same reason. Leaving a
|
|
157
|
+
// severity-derived level here would tell a consumer the finding is
|
|
158
|
+
// both dismissed and an error.
|
|
159
|
+
delete result.level;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (issue.flagSource) {
|
|
163
|
+
result.properties = {
|
|
164
|
+
...(result.properties ?? {}),
|
|
165
|
+
flagSource: issue.flagSource,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
88
168
|
return result;
|
|
89
169
|
});
|
|
90
170
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sarif-formatter.js","sourceRoot":"","sources":["../../src/formatters/sarif-formatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,kDAAkD;AAClD,MAAM,UAAU,kBAAkB,CAAC,QAA4B;IAC7D,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM;YACT,OAAO,OAAO,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,SAAS,CAAC;QACnB,KAAK,KAAK,CAAC;QACX,KAAK,eAAe,CAAC;QACrB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"sarif-formatter.js","sourceRoot":"","sources":["../../src/formatters/sarif-formatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,kDAAkD;AAClD,MAAM,UAAU,kBAAkB,CAAC,QAA4B;IAC7D,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM;YACT,OAAO,OAAO,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,SAAS,CAAC;QACnB,KAAK,KAAK,CAAC;QACX,KAAK,eAAe,CAAC;QACrB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAmCD;;;;;;;;;;;;GAYG;AACH,SAAS,gBAAgB,CAAC,OAAgC;IACxD,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,eAAe,CAAC,CAAC,OAAO,MAAM,CAAC;QACpC,KAAK,gBAAgB,CAAC,CAAC,OAAO,MAAM,CAAC;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uEAAuE;YACvE,OAAO;gBACL,MAAM,EAAE,CAAC,CAAC,OAAO;gBACjB,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,IAAI,uCAAuC,EAAE;gBAC9E,SAAS,EAAE;oBACT;wBACE,gBAAgB,EAAE;4BAChB,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;4BACxC,MAAM;yBACP;qBACF;iBACF;gBACD,YAAY,EAAE;oBACZ;wBACE,IAAI,EAAE,UAAU;wBAChB,aAAa,EAAE,CAAC,CAAC,SAAS;qBAC3B;iBACF;aACoB,CAAC;QAC1B,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,aAAa,CAAC,KAAqB;QACzC,OAAO;YACL,WAAW,EAAE;gBACX;oBACE,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBAC9B,QAAQ,EAAE;4BACR,gBAAgB,EAAE;gCAChB,gBAAgB,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE;gCACpC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE;6BACvC;4BACD,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE;yBAC9B;qBACF,CAAC,CAAC;iBACJ;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -6,6 +6,30 @@ import type { ScanResults } from '../types.js';
|
|
|
6
6
|
export interface OutputFormatter {
|
|
7
7
|
readonly id: string;
|
|
8
8
|
readonly fileExtension: string;
|
|
9
|
+
/**
|
|
10
|
+
* Renders `results` to the formatter's output string.
|
|
11
|
+
*
|
|
12
|
+
* **Escaping contract.** `ScanResults` carries AI-authored free text —
|
|
13
|
+
* `SecurityIssue.description`, `.recommendation`, and `judge.rationale` — that
|
|
14
|
+
* is derived from the LLM's analysis of the *scanned* repository and can
|
|
15
|
+
* therefore contain attacker-crafted content. Any formatter that renders these
|
|
16
|
+
* fields into a surface where such content could break structure or become
|
|
17
|
+
* active MUST neutralise them for that surface before emitting:
|
|
18
|
+
* - HTML → `escapeHtml` (entity-encode; see `html-formatter.ts`)
|
|
19
|
+
* - Markdown → `description`/`.recommendation` are rendered as their own
|
|
20
|
+
* Markdown block, so they need the block-safe `escapeMarkdownText`
|
|
21
|
+
* (backslash-escape, newlines preserved). `judge.rationale` is always
|
|
22
|
+
* rendered inline after a fixed bullet prefix on a single line, so the
|
|
23
|
+
* narrower `escapeInlineText` (backslash-escape + collapse newlines to
|
|
24
|
+
* spaces) is sufficient — see `markdown-formatter.ts`.
|
|
25
|
+
* - CSV → `escapeCsvField` (formula-injection guard + RFC-4180 quoting)
|
|
26
|
+
*
|
|
27
|
+
* Structured, non-rendered formats (JSON, SARIF) carry the raw text verbatim —
|
|
28
|
+
* their serialisers already prevent structural breakout — so escaping there
|
|
29
|
+
* would corrupt the payload and is intentionally omitted. Do NOT pre-sanitise
|
|
30
|
+
* these fields centrally: the required transform differs per surface, and
|
|
31
|
+
* mangling the shared `ScanResults` would corrupt the structured formats.
|
|
32
|
+
*/
|
|
9
33
|
format(results: ScanResults): string;
|
|
10
34
|
}
|
|
11
35
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/formatters/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/formatters/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC;CACtC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,9 @@
|
|
|
3
3
|
* Usage: aghast scan <repository-path> --config-dir <path> [options]
|
|
4
4
|
*/
|
|
5
5
|
import 'dotenv/config';
|
|
6
|
+
export declare function parseRepoSlug(slug: string | undefined): {
|
|
7
|
+
owner: string;
|
|
8
|
+
repo: string;
|
|
9
|
+
} | undefined;
|
|
6
10
|
export declare function runScan(args: string[]): Promise<void>;
|
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,eAAe,CAAC;AAqjBvB,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAQnG;AAgED,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwkB3D"}
|