awguard 1.5.0 → 1.7.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/Dockerfile +15 -0
  3. package/README.md +230 -10
  4. package/action.yml +7 -3
  5. package/docs/assets/terminal-demo.svg +19 -0
  6. package/docs/comparison.md +168 -0
  7. package/docs/launch-plan.md +35 -17
  8. package/docs/market-analysis.md +3 -1
  9. package/docs/marketplace-listing.md +59 -0
  10. package/docs/npm-publishing.md +68 -0
  11. package/docs/release-checklist.md +71 -0
  12. package/docs/report-gallery.md +166 -0
  13. package/docs/roadmap.md +41 -7
  14. package/docs/rule-authoring.md +99 -0
  15. package/docs/schemas.md +16 -0
  16. package/docs/setup-recipes.md +199 -0
  17. package/docs/site/index.html +280 -0
  18. package/examples/.gitlab-ci.yml +6 -0
  19. package/examples/.vscode/tasks.json +33 -0
  20. package/examples/README.md +11 -0
  21. package/examples/awguard.config.example.json +14 -0
  22. package/examples/corpus/.cursor/rules/autonomy.mdc +3 -0
  23. package/examples/corpus/.github/prompts/auto-fix.prompt.md +3 -0
  24. package/examples/corpus/.github/workflows/agentic-pr-review.yml +20 -0
  25. package/examples/corpus/.github/workflows/pull-request-target-head.yml +13 -0
  26. package/examples/corpus/.mcp.json +15 -0
  27. package/examples/corpus/AGENTS.md +5 -0
  28. package/examples/corpus/README.md +23 -0
  29. package/examples/dashboard/README.md +55 -0
  30. package/examples/dashboard/index.html +313 -0
  31. package/examples/dashboard/sample-history.json +53 -0
  32. package/examples/lab/README.md +33 -0
  33. package/examples/lab/fixed/.github/workflows/ai-triage.yml +20 -0
  34. package/examples/lab/fixed/.mcp.json +12 -0
  35. package/examples/lab/fixed/AGENTS.md +5 -0
  36. package/examples/lab/unsafe/.github/workflows/ai-triage.yml +16 -0
  37. package/examples/lab/unsafe/.mcp.json +11 -0
  38. package/examples/lab/unsafe/AGENTS.md +4 -0
  39. package/examples/pr-comment-bot.yml +43 -0
  40. package/examples/pre-commit-config.yaml +8 -0
  41. package/examples/pull-request-target.yml +1 -1
  42. package/examples/safe-agent.yml +1 -1
  43. package/examples/unsafe-agent.yml +1 -1
  44. package/examples/vscode-extension/README.md +49 -0
  45. package/examples/vscode-extension/assets/problems-panel.svg +23 -0
  46. package/examples/vscode-extension/package.json +68 -0
  47. package/examples/vscode-extension/src/extension.js +116 -0
  48. package/package.json +3 -1
  49. package/schemas/awguard.badge.schema.json +25 -0
  50. package/schemas/awguard.baseline.schema.json +40 -0
  51. package/schemas/awguard.comparison.schema.json +146 -0
  52. package/schemas/awguard.config.schema.json +167 -0
  53. package/schemas/awguard.inventory.schema.json +124 -0
  54. package/schemas/awguard.report.schema.json +121 -0
  55. package/src/autofix.js +201 -0
  56. package/src/badges.js +63 -0
  57. package/src/baseline.js +77 -0
  58. package/src/cli.js +281 -5
  59. package/src/compare.js +166 -0
  60. package/src/config.js +58 -2
  61. package/src/demo.js +90 -0
  62. package/src/doctor.js +189 -0
  63. package/src/explain.js +147 -0
  64. package/src/graph.js +6 -1
  65. package/src/init.js +84 -0
  66. package/src/inventory.js +11 -0
  67. package/src/migration.js +10 -0
  68. package/src/policy-packs.js +99 -0
  69. package/src/policy-wizard.js +165 -0
  70. package/src/presets.js +2 -1
  71. package/src/remediation.js +92 -1
  72. package/src/reporters.js +92 -5
  73. package/src/scanner.js +295 -10
  74. package/src/score.js +3 -0
  75. package/src/templates.js +132 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 1.7.0 - 2026-05-30
6
+
7
+ - Add `awguard doctor` for setup, config, scan target, schema, and GitHub Actions summary checks.
8
+ - Add `awguard explain AWG###` for rule-level explanations and remediation guidance.
9
+ - Add `awguard badges` to print copyable README badge snippets.
10
+ - Add `awguard demo` for an offline unsafe-to-fixed vulnerable lab walkthrough.
11
+ - Add `awguard templates` for GitHub Actions, code scanning, GitLab CI, pre-commit, and VS Code snippets.
12
+ - Add `awguard policy-pack` for OSS, strict, and enterprise policy starter configs.
13
+ - Add `scan.include` and `scan.exclude` config globs for narrowing discovered scan files.
14
+ - Add `AWG016`, `AWG017`, and `AWG018` for checkout credentials, unsafe agent writeback, and MCP input injection.
15
+ - Improve SARIF metadata with stable AWGuard fingerprints, categories, snippets, and columns.
16
+ - Move the JavaScript GitHub Action runtime and bundled workflow templates to Node 24-ready actions.
17
+ - Add machine-readable remediation codes to JSON and SARIF findings.
18
+ - Add scan guardrails for maximum discovered files and maximum scanned file size.
19
+ - Add end-to-end golden tests for unsafe/fixed labs, compare, inventory, and score outputs.
20
+ - Add `awguard baseline-review` with explicit `--prune` support for stale baselines.
21
+ - Add `awguard policy-wizard` for reviewed policy allowlist starter configs.
22
+ - Add a safe PR comment workflow example and Docker image publishing workflow.
23
+ - Add `schemas/awguard.config.schema.json` for editor validation of AWGuard config files.
24
+ - Add schemas for JSON scan reports, inventories, comparisons, baselines, and badge endpoints.
25
+ - Add compare report surface diffs and `--compare ... --format json`.
26
+ - Add automatic GitHub Actions job summaries with scan metrics and top findings.
27
+ - Add expanded comparison, setup recipe, report gallery, rule authoring, release checklist, and npm trusted publishing docs.
28
+ - Add a trusted publishing GitHub Actions workflow for tokenless npm releases.
29
+ - Add a real-world pattern corpus for unsafe agent workflow, prompt, instruction, Cursor rule, and MCP examples.
30
+ - Add VS Code task, problem matcher, and extension proof-of-concept assets.
31
+ - Add a local dashboard proof of concept for AWI score and finding trends.
32
+ - Add opt-in `--fix` for narrow workflow hardening edits and improve `--fix-dry-run` with an autofix plan.
33
+ - Add `AWG019` for offline MCP package reputation policy using trusted package scopes.
34
+
35
+ ## 1.6.0
36
+
37
+ - Add `awguard init` to print starter GitHub Action, strict config, baseline, report, and badge setup snippets.
38
+ - Add `--format inventory-json` for machine-readable agentic surface inventories.
39
+ - Add `--compare previous.json current.json` for introduced/resolved finding and file drift reports.
40
+ - Add policy allowlists with `AWG015` for unapproved files, MCP servers, packages, or commands.
41
+ - Add Docker, GitLab CI, pre-commit, VS Code task, Marketplace, comparison, demo, and vulnerable lab assets.
42
+
3
43
  ## 1.5.0
4
44
 
5
45
  - Add `--format inventory` to map agentic repository surfaces by workflows, agent context files, and MCP configs.
package/Dockerfile ADDED
@@ -0,0 +1,15 @@
1
+ FROM node:24-alpine
2
+
3
+ LABEL org.opencontainers.image.title="Agentic Workflow Guard"
4
+ LABEL org.opencontainers.image.description="Scan GitHub Actions workflows, agent instructions, and MCP configs for agentic workflow risk."
5
+ LABEL org.opencontainers.image.source="https://github.com/Mughal-Baig/agentic-workflow-guard"
6
+ LABEL org.opencontainers.image.licenses="MIT"
7
+
8
+ WORKDIR /app
9
+ COPY package.json README.md LICENSE action.yml ./
10
+ COPY bin ./bin
11
+ COPY src ./src
12
+ RUN chmod +x /app/bin/awguard.js && ln -s /app/bin/awguard.js /usr/local/bin/awguard
13
+
14
+ WORKDIR /repo
15
+ ENTRYPOINT ["node", "/app/bin/awguard.js"]
package/README.md CHANGED
@@ -5,8 +5,11 @@
5
5
  [![GitHub release](https://img.shields.io/github/v/release/Mughal-Baig/agentic-workflow-guard)](https://github.com/Mughal-Baig/agentic-workflow-guard/releases)
6
6
  [![npm](https://img.shields.io/npm/v/awguard)](https://www.npmjs.com/package/awguard)
7
7
  [![AWI risk](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Mughal-Baig/agentic-workflow-guard/main/docs/awguard-badge.json)](docs/awguard-badge.json)
8
+ [![Project site](https://img.shields.io/badge/site-live-0f766e)](https://mughal-baig.github.io/agentic-workflow-guard/)
8
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
9
10
 
11
+ ![Agentic Workflow Guard terminal demo](docs/assets/terminal-demo.svg)
12
+
10
13
  `agentic-workflow-guard` is a small, zero-dependency scanner for GitHub Actions workflows, persistent agent instruction files, and MCP configs used by AI coding agents, LLMs, or automated review bots.
11
14
 
12
15
  It looks for a new class of CI/CD risk: untrusted issue, pull request, comment, or branch text flowing into an AI agent prompt, then into write-capable tools, secrets, shell scripts, persistent instructions that weaken review boundaries, or MCP servers that expand agent authority.
@@ -42,6 +45,26 @@ Install from npm:
42
45
  npx awguard .
43
46
  ```
44
47
 
48
+ Generate a starter config, GitHub Action, baseline command, and badge snippet:
49
+
50
+ ```bash
51
+ npx awguard init
52
+ ```
53
+
54
+ Check your local setup, config discovery, scan target, and GitHub Actions summary support:
55
+
56
+ ```bash
57
+ npx awguard doctor
58
+ ```
59
+
60
+ Explain a rule, print README badge snippets, or run the built-in vulnerable lab demo:
61
+
62
+ ```bash
63
+ npx awguard explain AWG001
64
+ npx awguard badges --repo OWNER/REPO --site https://OWNER.github.io/REPO/
65
+ npx awguard demo
66
+ ```
67
+
45
68
  ## Use In GitHub Actions
46
69
 
47
70
  After you upload this repository to GitHub, users can add:
@@ -60,7 +83,7 @@ jobs:
60
83
  scan-agent-workflows:
61
84
  runs-on: ubuntu-latest
62
85
  steps:
63
- - uses: actions/checkout@v4
86
+ - uses: actions/checkout@v6
64
87
  - uses: Mughal-Baig/agentic-workflow-guard@v0
65
88
  with:
66
89
  config: awguard.config.json
@@ -68,6 +91,8 @@ jobs:
68
91
  fail-on: high
69
92
  ```
70
93
 
94
+ When AWGuard runs inside GitHub Actions it also writes a job summary with scanned file count, finding count, highest severity, top findings, and follow-up commands.
95
+
71
96
  To adopt the scanner without breaking CI on old findings, commit a baseline file and use:
72
97
 
73
98
  ```yaml
@@ -98,7 +123,7 @@ jobs:
98
123
  scan:
99
124
  runs-on: ubuntu-latest
100
125
  steps:
101
- - uses: actions/checkout@v4
126
+ - uses: actions/checkout@v6
102
127
  - uses: Mughal-Baig/agentic-workflow-guard@v0
103
128
  with:
104
129
  format: sarif
@@ -113,25 +138,46 @@ jobs:
113
138
  ## CLI
114
139
 
115
140
  ```bash
116
- awguard [path] [--config file] [--preset name] [--format text|json|markdown|github|sarif|graph|html|migration|score|badge|inventory] [--output file] [--baseline file] [--write-baseline file] [--fix-dry-run] [--fail-on none|low|medium|high|critical]
141
+ awguard [path] [--config file] [--preset name] [--format text|json|markdown|github|sarif|graph|html|migration|score|badge|inventory|inventory-json] [--output file] [--baseline file] [--write-baseline file] [--fix-dry-run] [--fix] [--fail-on none|low|medium|high|critical]
142
+ awguard init
143
+ awguard doctor [path] [--config file] [--preset name]
144
+ awguard explain [AWG###]
145
+ awguard badges [--repo OWNER/REPO] [--branch main] [--badge-file docs/awguard-badge.json] [--site URL]
146
+ awguard demo
147
+ awguard templates [all|github|code-scanning|gitlab|pre-commit|vscode]
148
+ awguard policy-pack [oss|strict|enterprise]
149
+ awguard policy-wizard [path] [--dry-run] [--format markdown|json] [--output awguard.config.json]
150
+ awguard baseline-review [path] --baseline awguard.baseline.json [--format text|json] [--prune]
151
+ awguard --compare previous.json current.json
117
152
  ```
118
153
 
119
154
  Examples:
120
155
 
121
156
  ```bash
157
+ node ./bin/awguard.js doctor
158
+ node ./bin/awguard.js explain AWG013
159
+ node ./bin/awguard.js badges --repo Mughal-Baig/agentic-workflow-guard --site https://mughal-baig.github.io/agentic-workflow-guard/
160
+ node ./bin/awguard.js demo
161
+ node ./bin/awguard.js templates github
162
+ node ./bin/awguard.js policy-pack strict
163
+ node ./bin/awguard.js policy-wizard . --dry-run
164
+ node ./bin/awguard.js baseline-review . --baseline awguard.baseline.json
122
165
  node ./bin/awguard.js examples/unsafe-agent.yml
123
166
  node ./bin/awguard.js . --config awguard.config.json
124
167
  node ./bin/awguard.js . --preset strict --format graph
125
168
  node ./bin/awguard.js . --format html --output awguard-report.html
126
169
  node ./bin/awguard.js . --format migration --output awguard-migration.md
127
170
  node ./bin/awguard.js . --format inventory
171
+ node ./bin/awguard.js . --format inventory-json --output awguard-inventory.json
128
172
  node ./bin/awguard.js . --format score
129
173
  node ./bin/awguard.js . --format badge --output awguard-badge.json
130
174
  node ./bin/awguard.js . --fix-dry-run
175
+ node ./bin/awguard.js . --fix
131
176
  node ./bin/awguard.js . --format markdown --fail-on medium
132
177
  node ./bin/awguard.js . --format sarif --output awguard.sarif --fail-on none
133
178
  node ./bin/awguard.js . --write-baseline awguard.baseline.json
134
179
  node ./bin/awguard.js . --baseline awguard.baseline.json --fail-on high
180
+ node ./bin/awguard.js --compare old-awguard.json new-awguard.json
135
181
  node ./bin/awguard.js . --format github --fail-on high
136
182
  ```
137
183
 
@@ -153,12 +199,29 @@ node ./bin/awguard.js . --baseline awguard.baseline.json --fail-on high
153
199
 
154
200
  The baseline stores stable finding fingerprints, not secrets or workflow contents.
155
201
 
202
+ Review and prune stale baseline entries:
203
+
204
+ ```bash
205
+ node ./bin/awguard.js baseline-review . --baseline awguard.baseline.json
206
+ node ./bin/awguard.js baseline-review . --baseline awguard.baseline.json --format json
207
+ node ./bin/awguard.js baseline-review . --baseline awguard.baseline.json --prune
208
+ ```
209
+
210
+ `baseline-review` never rewrites the baseline unless `--prune` is present.
211
+
156
212
  ## Configuration
157
213
 
158
214
  Agentic Workflow Guard automatically loads `awguard.config.json` or `.awguard.json` from the scan root. You can also pass `--config`.
159
215
 
160
216
  ```json
161
217
  {
218
+ "$schema": "https://raw.githubusercontent.com/Mughal-Baig/agentic-workflow-guard/main/schemas/awguard.config.schema.json",
219
+ "scan": {
220
+ "include": [".github/workflows/*", "AGENTS.md", ".mcp.json"],
221
+ "exclude": ["node_modules/*", "dist/*", "build/*"],
222
+ "maxFiles": 250,
223
+ "maxFileBytes": 262144
224
+ },
162
225
  "rules": {
163
226
  "AWG010": "off",
164
227
  "AWG008": "low",
@@ -175,6 +238,67 @@ Agentic Workflow Guard automatically loads `awguard.config.json` or `.awguard.js
175
238
 
176
239
  Rule values can be `"off"`, `"low"`, `"medium"`, `"high"`, or `"critical"`.
177
240
  See `examples/awguard.config.example.json` for a complete template.
241
+ The config schema is published at `schemas/awguard.config.schema.json` for editor completion and validation.
242
+ `scan.maxFiles` and `scan.maxFileBytes` are optional guardrails for very large repositories; leave them out if you do not want hard limits.
243
+
244
+ Generate starter policy packs:
245
+
246
+ ```bash
247
+ node ./bin/awguard.js policy-pack oss
248
+ node ./bin/awguard.js policy-pack strict
249
+ node ./bin/awguard.js policy-pack enterprise
250
+ ```
251
+
252
+ Generate a starter policy from the current repository surfaces:
253
+
254
+ ```bash
255
+ node ./bin/awguard.js policy-wizard . --dry-run
256
+ node ./bin/awguard.js policy-wizard . --format json --output awguard.config.json
257
+ ```
258
+
259
+ Review the generated allowlists before committing them. The wizard preserves existing config fields when you pass `--config`.
260
+
261
+ Generate CI and editor templates:
262
+
263
+ ```bash
264
+ node ./bin/awguard.js templates all
265
+ node ./bin/awguard.js templates code-scanning
266
+ node ./bin/awguard.js templates pre-commit
267
+ ```
268
+
269
+ PR comment bot starter:
270
+
271
+ - Copy `examples/pr-comment-bot.yml` to `.github/workflows/awguard-pr-comment.yml`.
272
+ - It uses `pull_request`, `contents: read`, and `pull-requests: write`.
273
+ - It only posts comments for same-repository pull requests; forked pull requests still get the scan job without exposing secrets or privileged `pull_request_target` behavior.
274
+
275
+ Docker usage:
276
+
277
+ ```bash
278
+ docker run --rm -v "$PWD:/repo" ghcr.io/mughal-baig/agentic-workflow-guard:latest . --preset strict
279
+ ```
280
+
281
+ GitHub Actions Docker job:
282
+
283
+ ```yaml
284
+ jobs:
285
+ awguard:
286
+ runs-on: ubuntu-latest
287
+ steps:
288
+ - uses: actions/checkout@v6
289
+ - run: docker run --rm -v "$PWD:/repo" ghcr.io/mughal-baig/agentic-workflow-guard:latest . --preset strict --fail-on high
290
+ ```
291
+
292
+ GitLab CI container job:
293
+
294
+ ```yaml
295
+ awguard:
296
+ image:
297
+ name: ghcr.io/mughal-baig/agentic-workflow-guard:latest
298
+ entrypoint: [""]
299
+ script:
300
+ - awguard . --preset strict --fail-on high
301
+ ```
178
302
 
179
303
  Built-in presets:
180
304
 
@@ -240,6 +364,12 @@ Then add a badge to your README:
240
364
  [![AWI risk](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/OWNER/REPO/main/docs/awguard-badge.json)](docs/awguard-badge.json)
241
365
  ```
242
366
 
367
+ Or print all common badge snippets:
368
+
369
+ ```bash
370
+ node ./bin/awguard.js badges --repo OWNER/REPO
371
+ ```
372
+
243
373
  The score starts at 100 and subtracts risk for critical, high, medium, and low findings. This makes AWGuard easy to show in a README without hiding the detailed SARIF, graph, and migration reports.
244
374
 
245
375
  ## Agentic Surface Inventory
@@ -252,6 +382,44 @@ node ./bin/awguard.js . --format inventory
252
382
 
253
383
  The inventory groups scanned files into GitHub Actions workflows, persistent agent context files, and MCP configs. It shows which surfaces exist, which rules fired, and what to review next. This is useful before a team enables new coding agents because it answers: "Where can agents read instructions, get tools, or act in CI?"
254
384
 
385
+ For dashboards, use JSON:
386
+
387
+ ```bash
388
+ node ./bin/awguard.js . --format inventory-json --output awguard-inventory.json
389
+ ```
390
+
391
+ ## Compare Reports
392
+
393
+ Track newly introduced agentic risk across branches or releases:
394
+
395
+ ```bash
396
+ node ./bin/awguard.js . --format json --output current-awguard.json
397
+ node ./bin/awguard.js --compare previous-awguard.json current-awguard.json
398
+ node ./bin/awguard.js --compare previous-awguard.json current-awguard.json --format json
399
+ ```
400
+
401
+ The comparison report shows introduced findings, resolved findings, added scanned files, removed scanned files, and agentic surface drift by workflows, agent context files, MCP configs, and other scanned files.
402
+
403
+ Machine-readable report schemas are documented in [docs/schemas.md](docs/schemas.md).
404
+
405
+ ## Policy Mode
406
+
407
+ Policy mode makes new agent surfaces visible during review. Add allowlists to `awguard.config.json`:
408
+
409
+ ```json
410
+ {
411
+ "policy": {
412
+ "approvedFiles": ["AGENTS.md", ".github/workflows/*"],
413
+ "approvedMcpServers": ["github"],
414
+ "approvedMcpPackages": ["@modelcontextprotocol/server-github@1.2.3"],
415
+ "approvedMcpPackageScopes": ["@modelcontextprotocol/"],
416
+ "approvedMcpCommands": ["npx", "node"]
417
+ }
418
+ }
419
+ ```
420
+
421
+ Anything outside the policy is reported as `AWG015`.
422
+
255
423
  ## Agent Context Guard
256
424
 
257
425
  AWGuard also scans persistent agent instruction files:
@@ -287,6 +455,7 @@ AWGuard also scans project-scoped MCP config files without starting the configur
287
455
  - `claude_desktop_config.json`
288
456
 
289
457
  It flags MCP configs that start mutable packages such as `npx package`, `uvx package@latest`, or unpinned Docker images, and configs that commit tokens, API keys, passwords, or authorization headers.
458
+ When `policy.approvedMcpPackageScopes` is configured, it also reports MCP packages outside reviewed publisher scopes as `AWG019` without contacting package registries.
290
459
 
291
460
  ## Fix Dry Run
292
461
 
@@ -296,6 +465,28 @@ Print remediation guidance without editing files:
296
465
  node ./bin/awguard.js examples/unsafe-agent.yml --fix-dry-run
297
466
  ```
298
467
 
468
+ Apply only narrow, deterministic workflow hardening edits:
469
+
470
+ ```bash
471
+ node ./bin/awguard.js . --fix
472
+ ```
473
+
474
+ Autofix currently handles safe `permissions: write-all` replacement, missing top-level `permissions: contents: read`, and `actions/checkout` `persist-credentials: false`. Review `git diff` before committing.
475
+
476
+ ## Explain And Demo
477
+
478
+ Explain any rule:
479
+
480
+ ```bash
481
+ node ./bin/awguard.js explain AWG004
482
+ ```
483
+
484
+ Run the built-in unsafe-to-fixed lab walkthrough without network access:
485
+
486
+ ```bash
487
+ node ./bin/awguard.js demo
488
+ ```
489
+
299
490
  ## Inline Suppressions
300
491
 
301
492
  Suppressions are for reviewed false positives. They must include a reason after `--`.
@@ -327,6 +518,38 @@ If you omit rule ids, the suppression applies to all findings on the target line
327
518
  | AWG012 | High/Critical | Agent instruction files that weaken approval, permission, or secret boundaries |
328
519
  | AWG013 | High | MCP configs that start mutable packages, unpinned containers, or shell wrappers |
329
520
  | AWG014 | Critical | MCP configs that hardcode secrets, tokens, passwords, or auth headers |
521
+ | AWG015 | Medium | Agentic surfaces, MCP servers, packages, or commands not approved by policy |
522
+ | AWG016 | High | Checkout credentials persisting in elevated agent workflows |
523
+ | AWG017 | Critical | Agent writeback without branch, PR, or artifact containment |
524
+ | AWG018 | High/Critical | Untrusted GitHub event text passed into MCP tool inputs or environment |
525
+ | AWG019 | Medium | MCP packages outside configured trusted package scopes |
526
+
527
+ JSON and SARIF outputs also include a stable `remediationCode` such as `permissions.tighten-token`, `mcp.pin-server`, or `writeback.use-pr-branch`. Use these codes for dashboards, routing, and automation that should not depend on free-text suggestions.
528
+
529
+ ## How It Compares
530
+
531
+ See [docs/comparison.md](docs/comparison.md) for how AWGuard fits beside `zizmor`, `actionlint`, OpenSSF Scorecard, secret scanners, and MCP runtime scanners.
532
+
533
+ ## Adoption Docs
534
+
535
+ - [Setup recipes](docs/setup-recipes.md): Claude Code, Codex, Cursor, GitHub Copilot, Cline, and safe PR comment bots.
536
+ - [Report gallery](docs/report-gallery.md): text, GitHub annotations, SARIF, inventory, attack graph, HTML, migration, score, badge, compare, and policy wizard outputs.
537
+ - [Rule authoring](docs/rule-authoring.md): how to add high-signal AWGuard rules and fixtures.
538
+ - [npm publishing](docs/npm-publishing.md): trusted publishing, OIDC, and provenance setup.
539
+ - [Release checklist](docs/release-checklist.md): Marketplace screenshots, package checks, and release steps.
540
+ - [VS Code extension POC](examples/vscode-extension/README.md): command palette scan, diagnostics, and `$awguard` problem matcher.
541
+ - [Dashboard POC](examples/dashboard/README.md): local trend dashboard for AWI score, findings, and agentic surface growth.
542
+
543
+ ## Example Corpus
544
+
545
+ The [real-world pattern corpus](examples/corpus/README.md) contains intentionally unsafe fixtures for PR review agents, `pull_request_target`, persistent instructions, reusable prompts, Cursor rules, and MCP configs.
546
+
547
+ Run it locally:
548
+
549
+ ```bash
550
+ node ./bin/awguard.js examples/corpus --format inventory
551
+ node ./bin/awguard.js examples/corpus --format migration
552
+ ```
330
553
 
331
554
  ## Example Finding
332
555
 
@@ -339,17 +562,14 @@ If you omit rule ids, the suppression applies to all findings on the target line
339
562
 
340
563
  ## Roadmap
341
564
 
342
- - Safe autofix for low-risk permission changes.
343
- - Safe-output migration patch previews for common triage and review bots.
344
565
  - Hosted AWI score API for dynamic cross-repository badges.
345
- - Agent instruction file rule packs for Copilot, Claude Code, Codex, Gemini, Cursor, and Windsurf.
346
- - MCP config rule packs for Claude Code, Copilot, VS Code, Cursor, Windsurf, Cline, and Roo.
347
- - Policy mode for approved MCP packages, actions, token scopes, and agent context files.
348
566
  - Agent capability SBOM for prompts, tools, MCP servers, permissions, and write paths.
349
567
  - Trend reports that show newly added agent surfaces and newly introduced findings.
350
568
  - GitHub App integration for always-on repository monitoring.
351
- - Rule packs for Claude Code, Codex, Gemini, Copilot, Aider, and custom agents.
352
- - Public vulnerable workflow lab with attack and fix walkthroughs.
569
+
570
+ ## Contributing And Security
571
+
572
+ Contributions are welcome. Start with [CONTRIBUTING.md](CONTRIBUTING.md) and [docs/rule-authoring.md](docs/rule-authoring.md), and report sensitive security issues using [SECURITY.md](SECURITY.md).
353
573
 
354
574
  ## Research Backing
355
575
 
package/action.yml CHANGED
@@ -7,7 +7,7 @@ inputs:
7
7
  required: false
8
8
  default: .
9
9
  format:
10
- description: Output format: github, text, json, markdown, sarif, graph, html, migration, score, badge, or inventory.
10
+ description: Output format: github, text, json, markdown, sarif, graph, html, migration, score, badge, inventory, or inventory-json.
11
11
  required: false
12
12
  default: github
13
13
  fail-on:
@@ -15,7 +15,7 @@ inputs:
15
15
  required: false
16
16
  default: high
17
17
  output:
18
- description: Optional file path for json, markdown, sarif, graph, html, migration, score, or badge output.
18
+ description: Optional file path for json, markdown, sarif, graph, html, migration, score, badge, inventory, or inventory-json output.
19
19
  required: false
20
20
  default: ''
21
21
  baseline:
@@ -38,8 +38,12 @@ inputs:
38
38
  description: Print remediation guidance instead of the normal report.
39
39
  required: false
40
40
  default: 'false'
41
+ fix:
42
+ description: Apply narrow safe workflow hardening edits instead of the normal report. Review git diff before committing generated changes.
43
+ required: false
44
+ default: 'false'
41
45
  runs:
42
- using: node20
46
+ using: node24
43
47
  main: bin/awguard.js
44
48
  branding:
45
49
  icon: shield
@@ -0,0 +1,19 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="920" height="430" viewBox="0 0 920 430" role="img" aria-labelledby="title desc">
2
+ <title id="title">Agentic Workflow Guard terminal demo</title>
3
+ <desc id="desc">A terminal-style screenshot showing AWGuard inventory and MCP findings.</desc>
4
+ <rect width="920" height="430" rx="10" fill="#101820"/>
5
+ <rect x="0" y="0" width="920" height="42" rx="10" fill="#17242f"/>
6
+ <circle cx="24" cy="21" r="6" fill="#ff5f57"/>
7
+ <circle cx="44" cy="21" r="6" fill="#ffbd2e"/>
8
+ <circle cx="64" cy="21" r="6" fill="#28c840"/>
9
+ <text x="88" y="27" fill="#d8e6ee" font-family="Menlo, Consolas, monospace" font-size="14">awguard demo</text>
10
+ <text x="28" y="78" fill="#7dd3fc" font-family="Menlo, Consolas, monospace" font-size="16">$ npx awguard . --format inventory</text>
11
+ <text x="28" y="118" fill="#e7f4f2" font-family="Menlo, Consolas, monospace" font-size="16">Agentic Surface Inventory</text>
12
+ <text x="28" y="154" fill="#a7f3d0" font-family="Menlo, Consolas, monospace" font-size="14">✓ GitHub Actions workflows: 2 files, 0 findings</text>
13
+ <text x="28" y="184" fill="#fde68a" font-family="Menlo, Consolas, monospace" font-size="14">! Agent context files: 1 file, AWG012</text>
14
+ <text x="28" y="214" fill="#fca5a5" font-family="Menlo, Consolas, monospace" font-size="14">! MCP configs: 1 file, AWG013, AWG014</text>
15
+ <text x="28" y="260" fill="#7dd3fc" font-family="Menlo, Consolas, monospace" font-size="16">$ npx awguard examples/.mcp.json --fix-dry-run</text>
16
+ <text x="28" y="300" fill="#fca5a5" font-family="Menlo, Consolas, monospace" font-size="14">CRITICAL AWG014 MCP config hardcodes secrets or auth material</text>
17
+ <text x="28" y="330" fill="#fdba74" font-family="Menlo, Consolas, monospace" font-size="14">HIGH AWG013 MCP config starts mutable tool servers</text>
18
+ <text x="28" y="372" fill="#d8e6ee" font-family="Menlo, Consolas, monospace" font-size="14">Fix: pin tool packages, move credentials to prompts/env, and review policy drift.</text>
19
+ </svg>
@@ -0,0 +1,168 @@
1
+ # How AWGuard Compares
2
+
3
+ Agentic Workflow Guard is not trying to replace general GitHub Actions linters, project health scorecards, secret scanners, or live MCP inspectors. Its lane is narrower: find places where repository automation gives AI agents attacker-influenced text, tools, secrets, or write authority.
4
+
5
+ ## Short Version
6
+
7
+ | Tool | Best at | AWGuard difference | Use together |
8
+ | --- | --- | --- | --- |
9
+ | `zizmor` | Static security analysis for GitHub Actions. | AWGuard adds AI-agent prompt flow, MCP config, persistent agent instruction, and writeback boundary checks. | Run `zizmor` for broad Actions hardening, then AWGuard for agentic workflow injection risk. |
10
+ | `actionlint` | Syntax, expression, input, and workflow semantics checks for GitHub Actions. | AWGuard is not a syntax checker. It assumes valid YAML and looks for trust-boundary patterns. | Run `actionlint` first so broken workflows are caught before security review. |
11
+ | OpenSSF Scorecard | Repository-level supply-chain health signals. | AWGuard produces a focused AWI score, inventory, SARIF, and attack graph for agentic surfaces. | Use Scorecard for public trust posture, AWGuard for AI-agent risk inside the repo. |
12
+ | Secret scanners | Hardcoded credential detection and push protection. | AWGuard looks for secrets exposed to untrusted agent workflows and MCP configs, even when the secret is referenced through `${{ secrets.NAME }}`. | Keep GitHub secret scanning enabled, then use AWGuard to check whether agents can reach secrets. |
13
+ | MCP runtime scanners | Live server and tool behavior inspection. | AWGuard is zero-execution. It reviews committed MCP config before a server starts. | Run AWGuard in CI, then run live MCP inspection in a sandbox for approved servers. |
14
+
15
+ ## What AWGuard Owns
16
+
17
+ AWGuard focuses on a threat shape that general CI tools rarely model:
18
+
19
+ ```text
20
+ untrusted GitHub event text
21
+ -> AI agent prompt, instruction, MCP input, or shell script
22
+ -> tools, secrets, token permissions, or repository writeback
23
+ -> repository change, data exposure, or unsafe automation
24
+ ```
25
+
26
+ The scanner turns that shape into:
27
+
28
+ - Rule findings such as `AWG001`, `AWG004`, `AWG012`, `AWG013`, `AWG017`, and `AWG018`.
29
+ - SARIF for GitHub code scanning.
30
+ - Human-readable attack graphs and migration plans.
31
+ - Agentic surface inventories for workflows, instruction files, and MCP configs.
32
+ - Baselines and compare reports for gradual adoption.
33
+ - Policy allowlists for reviewed files, MCP servers, packages, and commands.
34
+
35
+ ## Tool-by-tool Notes
36
+
37
+ ### zizmor
38
+
39
+ [`zizmor`](https://docs.zizmor.sh/) is a static analysis tool for GitHub Actions and can find common CI/CD security issues. AWGuard should sit beside it, not in front of it.
40
+
41
+ Use `zizmor` for:
42
+
43
+ - GitHub Actions security audits.
44
+ - Broad CI/CD hardening checks.
45
+ - Existing GitHub Actions security recipes and integrations.
46
+
47
+ Use AWGuard for:
48
+
49
+ - Agent prompts built from issue, comment, PR, branch, or workflow input text.
50
+ - Agent jobs with broad write permissions or persisted checkout credentials.
51
+ - Unsafe agent writeback paths.
52
+ - MCP configs that use mutable packages, shell wrappers, unpinned containers, or hardcoded credentials.
53
+ - Persistent agent instruction files that weaken approval or secret boundaries.
54
+
55
+ ### actionlint
56
+
57
+ [`actionlint`](https://github.com/rhysd/actionlint) is a static checker for GitHub Actions workflows. It checks syntax, expression semantics, action usage, reusable workflow contracts, and shell/python snippets.
58
+
59
+ Use `actionlint` for:
60
+
61
+ - Invalid workflow keys.
62
+ - Broken `${{ }}` expressions.
63
+ - Missing or mismatched reusable workflow inputs.
64
+ - Shellcheck-style script quality.
65
+
66
+ Use AWGuard after that for:
67
+
68
+ - Whether a valid workflow gives an AI agent too much authority.
69
+ - Whether untrusted GitHub context reaches an AI prompt, MCP input, or shell boundary.
70
+ - Whether an agent workflow is safe to run on PRs, comments, and issue events.
71
+
72
+ ### OpenSSF Scorecard
73
+
74
+ [OpenSSF Scorecard](https://github.com/ossf/scorecard) evaluates repository security health. Its checks include areas such as dangerous workflows, pinned dependencies, packaging, token permissions, and vulnerabilities.
75
+
76
+ Use Scorecard for:
77
+
78
+ - Public repository trust signals.
79
+ - Broad open-source security hygiene.
80
+ - A badge that maintainers and users already recognize.
81
+
82
+ Use AWGuard for:
83
+
84
+ - A narrower score around Agentic Workflow Injection risk.
85
+ - Reviewable findings that explain which exact prompt, workflow, instruction, or MCP config creates the risk.
86
+ - Repository-specific adoption artifacts: baselines, migration plans, and policy allowlists.
87
+
88
+ ### GitHub Secret Scanning And Other Secret Scanners
89
+
90
+ [GitHub secret scanning](https://docs.github.com/en/code-security/concepts/secret-security/about-secret-scanning) detects exposed credentials in code, issues, PRs, discussions, wikis, and other supported surfaces. GitHub also documents ways to enable additional leak detection and push protection.
91
+
92
+ Use secret scanners for:
93
+
94
+ - Detecting leaked token values.
95
+ - Blocking supported secrets before they land.
96
+ - Alerting and rotation workflows.
97
+
98
+ Use AWGuard for:
99
+
100
+ - Finding workflows where `${{ secrets.NAME }}` is available to an untrusted AI-agent job.
101
+ - Finding committed MCP auth material in project-scoped configs.
102
+ - Explaining how to split privileged secrets into reviewed workflows.
103
+
104
+ ### MCP Runtime Scanners
105
+
106
+ Runtime MCP scanners and inspectors can execute or introspect live servers. AWGuard intentionally does not start MCP servers. That makes it safe to run in pull requests and on untrusted branches.
107
+
108
+ Use runtime inspection for:
109
+
110
+ - Tool schemas.
111
+ - Server behavior.
112
+ - Network access and live capabilities.
113
+
114
+ Use AWGuard for:
115
+
116
+ - Pre-execution review of committed `.mcp.json`, `.vscode/mcp.json`, Cursor, Windsurf, Cline, Roo, and similar config files.
117
+ - Mutable package and container launch detection.
118
+ - Policy drift when a new MCP server appears in the repository.
119
+
120
+ ## Recommended Stack
121
+
122
+ For a public repository using AI coding agents:
123
+
124
+ ```yaml
125
+ name: Security
126
+
127
+ on:
128
+ pull_request:
129
+ push:
130
+ branches: [main]
131
+
132
+ permissions:
133
+ contents: read
134
+ security-events: write
135
+
136
+ jobs:
137
+ actions-lint:
138
+ runs-on: ubuntu-latest
139
+ steps:
140
+ - uses: actions/checkout@v6
141
+ - run: actionlint
142
+
143
+ agentic-workflow-guard:
144
+ runs-on: ubuntu-latest
145
+ steps:
146
+ - uses: actions/checkout@v6
147
+ - uses: Mughal-Baig/agentic-workflow-guard@v0
148
+ with:
149
+ preset: strict
150
+ format: sarif
151
+ output: awguard.sarif
152
+ fail-on: high
153
+ - uses: github/codeql-action/upload-sarif@v4
154
+ if: always()
155
+ with:
156
+ sarif_file: awguard.sarif
157
+ category: agentic-workflow-guard
158
+ ```
159
+
160
+ Add `zizmor`, Scorecard, and secret scanning according to the repository's security program. AWGuard is the agentic layer in that stack.
161
+
162
+ ## Official References
163
+
164
+ - zizmor documentation: <https://docs.zizmor.sh/>
165
+ - actionlint repository: <https://github.com/rhysd/actionlint>
166
+ - OpenSSF Scorecard repository: <https://github.com/ossf/scorecard>
167
+ - GitHub secret scanning docs: <https://docs.github.com/en/code-security/concepts/secret-security/about-secret-scanning>
168
+ - npm trusted publishing docs: <https://docs.npmjs.com/trusted-publishers/>