actions-warden 0.3.0 → 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/AGENTS.md +60 -12
- package/CONTRIBUTING.md +6 -2
- package/README.md +180 -58
- package/RELEASING.md +3 -2
- package/SECURITY.md +23 -8
- package/docs/AI-AGENTS.md +125 -29
- package/docs/CLI.md +346 -69
- package/docs/CONFIGURATION.md +34 -11
- package/docs/DEVELOPMENT.md +114 -18
- package/docs/GITHUB-ACTION.md +163 -29
- package/docs/JAVASCRIPT-API.md +177 -11
- package/docs/OUTPUTS.md +408 -40
- package/docs/README.md +1 -1
- package/examples/README.md +21 -0
- package/examples/baseline-adoption/README.md +79 -0
- package/examples/baseline-adoption/github-actions.yml +56 -0
- package/examples/baseline-adoption/policy.yml +7 -0
- package/examples/ci-violation-reporting/README.md +82 -0
- package/examples/ci-violation-reporting/github-actions.yml +55 -0
- package/examples/ci-violation-reporting/policy.yml +7 -0
- package/examples/ci-violation-reporting/violating-workflow.yml +17 -0
- package/examples/csv-reporting/README.md +50 -0
- package/examples/csv-reporting/github-actions.yml +59 -0
- package/examples/html-organization-report/README.md +35 -0
- package/examples/html-organization-report/github-actions.yml +61 -0
- package/examples/notifications/README.md +67 -0
- package/examples/notifications/github-actions.yml +163 -0
- package/examples/org-scan.yml +24 -5
- package/examples/sarif-code-scanning/README.md +42 -0
- package/examples/sarif-code-scanning/github-actions.yml +66 -0
- package/examples/upgrade-pr.yml +1 -1
- package/llms.txt +14 -5
- package/package.json +8 -4
- package/skills/actions-warden/SKILL.md +91 -39
- package/src/action.js +353 -187
- package/src/cli.js +416 -209
- package/src/commands/audit.js +17 -30
- package/src/commands/org-scan.js +452 -286
- package/src/commands/pin.js +9 -5
- package/src/commands/report.js +7 -2
- package/src/commands/upgrade.js +9 -5
- package/src/commands/verify.js +24 -4
- package/src/index.js +5 -1
- package/src/lib/action-summary.js +656 -0
- package/src/lib/annotations.js +4 -6
- package/src/lib/baseline.js +11 -1
- package/src/lib/config.js +10 -5
- package/src/lib/destination.js +98 -0
- package/src/lib/execution.js +5 -1
- package/src/lib/formats/csv.js +125 -0
- package/src/lib/formats/html.js +394 -0
- package/src/lib/formats/json.js +17 -0
- package/src/lib/formats/sarif.js +229 -0
- package/src/lib/formats/text.js +30 -0
- package/src/lib/formats/toon.js +50 -0
- package/src/lib/formatter.js +25 -192
- package/src/lib/github-org.js +208 -102
- package/src/lib/org-artifacts.js +211 -0
- package/src/lib/org-checkpoint.js +159 -35
- package/src/lib/org-progress.js +182 -4
- package/src/lib/org-report-comparison.js +505 -0
- package/src/lib/org-report-directory.js +251 -0
- package/src/lib/org-report.js +223 -0
- package/src/lib/org-run.js +305 -0
- package/src/lib/org-schema.js +89 -0
- package/src/lib/org-source-links.js +39 -0
- package/src/lib/parser.js +5 -0
- package/src/lib/path-equality.js +30 -0
- package/src/lib/paths.js +18 -1
- package/src/lib/redact.js +58 -7
- package/src/lib/resolver.js +66 -9
- package/src/lib/types.js +137 -0
- package/src/lib/writer.js +3 -0
- package/src/rules/pull-request-target-checkout.js +5 -0
- package/src/rules/unpinned-action.js +2 -3
- package/src/rules/workflow-structure.js +2 -4
- package/src/version.js +1 -1
- package/src/lib/agent-mode.js +0 -175
package/src/commands/audit.js
CHANGED
|
@@ -16,20 +16,11 @@ import { format, summarize, SEVERITY_ORDER } from '../lib/formatter.js';
|
|
|
16
16
|
import { parseIgnoreDirectives, isIgnored } from '../lib/ignore.js';
|
|
17
17
|
import { canonicalPath, occurrenceId, pinOccurrenceId } from '../lib/identity.js';
|
|
18
18
|
import { resolveTargets } from '../lib/targets.js';
|
|
19
|
-
import { assignBaselineFingerprints, loadBaseline } from '../lib/baseline.js';
|
|
19
|
+
import { assignBaselineFingerprints, emptyBaseline, loadBaseline } from '../lib/baseline.js';
|
|
20
20
|
import { DEFAULT_CONFIG, filterIgnoredPaths, loadConfig } from '../lib/config.js';
|
|
21
21
|
import { RULES } from '../rules/index.js';
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* @typedef {object} Finding
|
|
25
|
-
* @property {string} id - unique id (sha1 short)
|
|
26
|
-
* @property {string} ruleId
|
|
27
|
-
* @property {string} severity
|
|
28
|
-
* @property {string} file
|
|
29
|
-
* @property {number} line
|
|
30
|
-
* @property {Record<string, unknown>} fields
|
|
31
|
-
* @property {string} explain
|
|
32
|
-
*/
|
|
23
|
+
/** @typedef {import('../lib/types.js').Finding} Finding */
|
|
33
24
|
|
|
34
25
|
/**
|
|
35
26
|
* @param {object} opts
|
|
@@ -227,20 +218,12 @@ async function resolveBaselineData({ baseline, cwd }) {
|
|
|
227
218
|
: emptyBaseline();
|
|
228
219
|
}
|
|
229
220
|
|
|
230
|
-
function emptyBaseline() {
|
|
231
|
-
return { path: null, ids: new Set(), fingerprints: new Set() };
|
|
232
|
-
}
|
|
233
|
-
|
|
234
221
|
function stripExplain(f) {
|
|
235
222
|
const copy = { ...f };
|
|
236
223
|
delete copy.explain;
|
|
237
224
|
return copy;
|
|
238
225
|
}
|
|
239
226
|
|
|
240
|
-
/**
|
|
241
|
-
* @param {string[]|undefined} workflows
|
|
242
|
-
* @param {string} cwd
|
|
243
|
-
*/
|
|
244
227
|
/**
|
|
245
228
|
* @param {Finding[]} findings
|
|
246
229
|
* @param {string|undefined} min
|
|
@@ -255,15 +238,12 @@ function filterBySeverity(findings, min) {
|
|
|
255
238
|
));
|
|
256
239
|
}
|
|
257
240
|
|
|
258
|
-
function relPath(p, cwd) {
|
|
259
|
-
return canonicalPath(p, cwd);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
241
|
/**
|
|
263
242
|
* Render an audit result to the chosen format.
|
|
264
243
|
*
|
|
265
244
|
* @param {Awaited<ReturnType<typeof audit>>} result
|
|
266
|
-
* @param {{format: 'toon'|'json'|'text', explain?: boolean,
|
|
245
|
+
* @param {{format: 'toon'|'json'|'text'|'csv'|'sarif'|'html', explain?: boolean,
|
|
246
|
+
* cwd?: string}} opts
|
|
267
247
|
*/
|
|
268
248
|
export function renderAudit(result, opts) {
|
|
269
249
|
const cwd = opts.cwd ?? process.cwd();
|
|
@@ -272,14 +252,14 @@ export function renderAudit(result, opts) {
|
|
|
272
252
|
status: result.status,
|
|
273
253
|
json: {
|
|
274
254
|
schemaVersion: '1.0',
|
|
275
|
-
files: result.files.map(f =>
|
|
276
|
-
findings: result.findings.map(f => ({ ...f, file:
|
|
255
|
+
files: result.files.map(f => canonicalPath(f, cwd)),
|
|
256
|
+
findings: result.findings.map(f => ({ ...f, file: canonicalPath(f.file, cwd) })),
|
|
277
257
|
summary: result.summary,
|
|
278
258
|
baseline: {
|
|
279
259
|
...result.baseline,
|
|
280
|
-
path: result.baseline.path ?
|
|
260
|
+
path: result.baseline.path ? canonicalPath(result.baseline.path, cwd) : null,
|
|
281
261
|
},
|
|
282
|
-
configPath: result.configPath ?
|
|
262
|
+
configPath: result.configPath ? canonicalPath(result.configPath, cwd) : null,
|
|
283
263
|
status: result.status,
|
|
284
264
|
},
|
|
285
265
|
});
|
|
@@ -299,7 +279,7 @@ export function renderAudit(result, opts) {
|
|
|
299
279
|
}
|
|
300
280
|
}
|
|
301
281
|
for (const f of result.files) {
|
|
302
|
-
records.push({ label: 'SCAN', fields: { file:
|
|
282
|
+
records.push({ label: 'SCAN', fields: { file: canonicalPath(f, opts.cwd ?? process.cwd()) } });
|
|
303
283
|
}
|
|
304
284
|
for (const finding of result.findings) {
|
|
305
285
|
const fields = { id: finding.id, ...finding.fields, line: finding.line };
|
|
@@ -310,5 +290,12 @@ export function renderAudit(result, opts) {
|
|
|
310
290
|
records.push({ label: 'FINDING', fields });
|
|
311
291
|
}
|
|
312
292
|
records.push({ label: 'SUMMARY', fields: result.summary });
|
|
313
|
-
return format(opts.format, records, {
|
|
293
|
+
return format(opts.format, records, {
|
|
294
|
+
status: result.status,
|
|
295
|
+
title: 'Workflow security audit',
|
|
296
|
+
metadata: {
|
|
297
|
+
config: result.configPath ? canonicalPath(result.configPath, cwd) : 'built-in defaults',
|
|
298
|
+
baseline: result.baseline.path ? canonicalPath(result.baseline.path, cwd) : 'none',
|
|
299
|
+
},
|
|
300
|
+
});
|
|
314
301
|
}
|