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.
- package/CHANGELOG.md +40 -0
- package/Dockerfile +15 -0
- package/README.md +230 -10
- package/action.yml +7 -3
- package/docs/assets/terminal-demo.svg +19 -0
- package/docs/comparison.md +168 -0
- package/docs/launch-plan.md +35 -17
- package/docs/market-analysis.md +3 -1
- package/docs/marketplace-listing.md +59 -0
- package/docs/npm-publishing.md +68 -0
- package/docs/release-checklist.md +71 -0
- package/docs/report-gallery.md +166 -0
- package/docs/roadmap.md +41 -7
- package/docs/rule-authoring.md +99 -0
- package/docs/schemas.md +16 -0
- package/docs/setup-recipes.md +199 -0
- package/docs/site/index.html +280 -0
- package/examples/.gitlab-ci.yml +6 -0
- package/examples/.vscode/tasks.json +33 -0
- package/examples/README.md +11 -0
- package/examples/awguard.config.example.json +14 -0
- package/examples/corpus/.cursor/rules/autonomy.mdc +3 -0
- package/examples/corpus/.github/prompts/auto-fix.prompt.md +3 -0
- package/examples/corpus/.github/workflows/agentic-pr-review.yml +20 -0
- package/examples/corpus/.github/workflows/pull-request-target-head.yml +13 -0
- package/examples/corpus/.mcp.json +15 -0
- package/examples/corpus/AGENTS.md +5 -0
- package/examples/corpus/README.md +23 -0
- package/examples/dashboard/README.md +55 -0
- package/examples/dashboard/index.html +313 -0
- package/examples/dashboard/sample-history.json +53 -0
- package/examples/lab/README.md +33 -0
- package/examples/lab/fixed/.github/workflows/ai-triage.yml +20 -0
- package/examples/lab/fixed/.mcp.json +12 -0
- package/examples/lab/fixed/AGENTS.md +5 -0
- package/examples/lab/unsafe/.github/workflows/ai-triage.yml +16 -0
- package/examples/lab/unsafe/.mcp.json +11 -0
- package/examples/lab/unsafe/AGENTS.md +4 -0
- package/examples/pr-comment-bot.yml +43 -0
- package/examples/pre-commit-config.yaml +8 -0
- package/examples/pull-request-target.yml +1 -1
- package/examples/safe-agent.yml +1 -1
- package/examples/unsafe-agent.yml +1 -1
- package/examples/vscode-extension/README.md +49 -0
- package/examples/vscode-extension/assets/problems-panel.svg +23 -0
- package/examples/vscode-extension/package.json +68 -0
- package/examples/vscode-extension/src/extension.js +116 -0
- package/package.json +3 -1
- package/schemas/awguard.badge.schema.json +25 -0
- package/schemas/awguard.baseline.schema.json +40 -0
- package/schemas/awguard.comparison.schema.json +146 -0
- package/schemas/awguard.config.schema.json +167 -0
- package/schemas/awguard.inventory.schema.json +124 -0
- package/schemas/awguard.report.schema.json +121 -0
- package/src/autofix.js +201 -0
- package/src/badges.js +63 -0
- package/src/baseline.js +77 -0
- package/src/cli.js +281 -5
- package/src/compare.js +166 -0
- package/src/config.js +58 -2
- package/src/demo.js +90 -0
- package/src/doctor.js +189 -0
- package/src/explain.js +147 -0
- package/src/graph.js +6 -1
- package/src/init.js +84 -0
- package/src/inventory.js +11 -0
- package/src/migration.js +10 -0
- package/src/policy-packs.js +99 -0
- package/src/policy-wizard.js +165 -0
- package/src/presets.js +2 -1
- package/src/remediation.js +92 -1
- package/src/reporters.js +92 -5
- package/src/scanner.js +295 -10
- package/src/score.js +3 -0
- package/src/templates.js +132 -0
package/docs/launch-plan.md
CHANGED
|
@@ -10,62 +10,79 @@ Short pitch:
|
|
|
10
10
|
|
|
11
11
|
## Star-Worthy Demo
|
|
12
12
|
|
|
13
|
-
1. Show `
|
|
14
|
-
2.
|
|
13
|
+
1. Show the terminal demo image in `docs/assets/terminal-demo.svg`.
|
|
14
|
+
2. Show `examples/unsafe-agent.yml`.
|
|
15
|
+
3. Run:
|
|
15
16
|
|
|
16
17
|
```bash
|
|
17
18
|
node ./bin/awguard.js examples/unsafe-agent.yml --format graph
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
4. Show the generated Mermaid chain.
|
|
22
|
+
5. Run:
|
|
22
23
|
|
|
23
24
|
```bash
|
|
24
25
|
node ./bin/awguard.js examples/unsafe-agent.yml --fix-dry-run
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
6. Show the safe remediation steps.
|
|
29
|
+
7. Run:
|
|
29
30
|
|
|
30
31
|
```bash
|
|
31
32
|
node ./bin/awguard.js examples/unsafe-agent.yml --format migration
|
|
32
33
|
```
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
8. Show the migration from unsafe agent job to read-only proposal job plus safe outputs or an approved apply job.
|
|
36
|
+
9. Run:
|
|
36
37
|
|
|
37
38
|
```bash
|
|
38
39
|
node ./bin/awguard.js . --format score
|
|
39
40
|
```
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
10. Show the README badge and say: "Add an AWI risk badge to your repo before adding AI agents to CI."
|
|
43
|
+
11. Run:
|
|
43
44
|
|
|
44
45
|
```bash
|
|
45
46
|
node ./bin/awguard.js . --format inventory
|
|
46
47
|
```
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
12. Show the surface map and say: "Before you secure agent workflows, find every place the repository gives agents instructions or tools."
|
|
50
|
+
13. Run:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
node ./bin/awguard.js init
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
14. Show the one-command setup guide.
|
|
57
|
+
15. Show an unsafe `AGENTS.md` or `.github/copilot-instructions.md` line and run:
|
|
50
58
|
|
|
51
59
|
```bash
|
|
52
60
|
node ./bin/awguard.js . --format text
|
|
53
61
|
```
|
|
54
62
|
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
16. Explain that AWGuard scans both the workflow and the persistent agent instructions that shape agent behavior.
|
|
64
|
+
17. Show an unsafe `.mcp.json` with `npx @modelcontextprotocol/server-github` and a committed token, then run:
|
|
57
65
|
|
|
58
66
|
```bash
|
|
59
67
|
node ./bin/awguard.js examples/.mcp.json --format text
|
|
60
68
|
```
|
|
61
69
|
|
|
62
|
-
|
|
70
|
+
18. Explain the new hook: "This scanner checks repo-provided MCP tool wiring without executing the MCP server."
|
|
71
|
+
19. Show the real-world corpus:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
node ./bin/awguard.js examples/corpus --format inventory
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
20. Explain that visitors can clone the repo and see high-signal findings immediately, without needing a real vulnerable project.
|
|
63
78
|
|
|
64
79
|
## Release Checklist
|
|
65
80
|
|
|
66
|
-
-
|
|
81
|
+
- Use `docs/release-checklist.md` for the release gate.
|
|
82
|
+
- Use `docs/report-gallery.md` for screenshot commands.
|
|
83
|
+
- Publish GitHub release notes for the target version.
|
|
67
84
|
- Add the action to GitHub Marketplace from the release UI.
|
|
68
|
-
- Publish the npm package as `awguard
|
|
85
|
+
- Publish the npm package as `awguard` with trusted publishing when possible.
|
|
69
86
|
- Pin the README demo to the attack graph, not the rule table.
|
|
70
87
|
- Post with the headline: "I built a scanner that maps and migrates Agentic Workflow Injection in GitHub Actions."
|
|
71
88
|
- Include the AWI attack chain screenshot in social posts.
|
|
@@ -73,6 +90,7 @@ Short pitch:
|
|
|
73
90
|
- Include the AWI risk badge as the final screenshot because it is the easiest artifact for other maintainers to copy.
|
|
74
91
|
- Include a short "workflow looked safe, AGENTS.md made it unsafe" example because it is the most surprising hook.
|
|
75
92
|
- Include a short "MCP config looked like developer tooling, but it gave the agent a mutable tool server and a token" example because MCP is the hottest adjacent security topic.
|
|
93
|
+
- Include the setup recipes link so Claude Code, Codex, Cursor, Copilot, and Cline users have an immediate next step.
|
|
76
94
|
|
|
77
95
|
## Distribution Targets
|
|
78
96
|
|
package/docs/market-analysis.md
CHANGED
|
@@ -211,7 +211,9 @@ Agentic Workflow Guard now supports:
|
|
|
211
211
|
|
|
212
212
|
- `--format inventory` for a surface map grouped by workflows, agent context files, and MCP configs.
|
|
213
213
|
- scanning `.github/agents/*.md`, `.github/prompts/*.prompt.md`, and `.github/skills/**/SKILL.md` as persistent agent context.
|
|
214
|
-
-
|
|
214
|
+
- `awguard init` for adoption snippets, `--format inventory-json` for dashboards, and `--compare` for trend reports.
|
|
215
|
+
- first policy allowlists for approved files, MCP servers, MCP packages, and MCP commands.
|
|
216
|
+
- a roadmap that moves toward agent capability SBOMs, richer policy ownership, and hosted monitoring.
|
|
215
217
|
|
|
216
218
|
This widens the project while preserving its niche: AWGuard remains a zero-execution repository scanner for agentic risk, not a broad runtime agent firewall.
|
|
217
219
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# GitHub Marketplace Listing Draft
|
|
2
|
+
|
|
3
|
+
## Name
|
|
4
|
+
|
|
5
|
+
Agentic Workflow Guard
|
|
6
|
+
|
|
7
|
+
## Short Description
|
|
8
|
+
|
|
9
|
+
Scan GitHub Actions, agent instruction files, and MCP configs for AI-agent injection risk.
|
|
10
|
+
|
|
11
|
+
## Categories
|
|
12
|
+
|
|
13
|
+
- Security
|
|
14
|
+
- Code quality
|
|
15
|
+
- Utilities
|
|
16
|
+
|
|
17
|
+
## Full Description
|
|
18
|
+
|
|
19
|
+
Agentic Workflow Guard finds where untrusted GitHub issue, pull request, comment, branch, or artifact text can steer AI agents inside CI.
|
|
20
|
+
|
|
21
|
+
It scans:
|
|
22
|
+
|
|
23
|
+
- GitHub Actions workflows;
|
|
24
|
+
- persistent agent instruction files such as `AGENTS.md`, Copilot instructions, custom agents, prompts, and skills;
|
|
25
|
+
- MCP configs such as `.mcp.json`, `.vscode/mcp.json`, Cursor, Windsurf, Cline, and Roo config files.
|
|
26
|
+
|
|
27
|
+
Outputs include GitHub annotations, SARIF for code scanning, attack graphs, migration plans, AWI scorecards, badges, and agentic surface inventory reports.
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
- uses: Mughal-Baig/agentic-workflow-guard@v0
|
|
33
|
+
with:
|
|
34
|
+
preset: strict
|
|
35
|
+
fail-on: high
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Suggested Release Note
|
|
39
|
+
|
|
40
|
+
Use this Action before adding AI agents, custom prompts, or MCP tools to a repository.
|
|
41
|
+
|
|
42
|
+
## Screenshot Plan
|
|
43
|
+
|
|
44
|
+
1. Terminal demo from `docs/assets/terminal-demo.svg`.
|
|
45
|
+
2. Inventory output from `node ./bin/awguard.js examples/corpus --format inventory`.
|
|
46
|
+
3. Attack graph from `node ./bin/awguard.js examples/lab/unsafe --format graph`.
|
|
47
|
+
4. Migration plan from `node ./bin/awguard.js examples/lab/unsafe --format migration`.
|
|
48
|
+
5. GitHub Code Scanning page after SARIF upload.
|
|
49
|
+
6. Policy wizard output from `node ./bin/awguard.js policy-wizard examples/corpus --dry-run`.
|
|
50
|
+
7. Dashboard POC from `examples/dashboard`.
|
|
51
|
+
8. VS Code Problems panel from `examples/vscode-extension`.
|
|
52
|
+
|
|
53
|
+
## Docs To Link
|
|
54
|
+
|
|
55
|
+
- Comparison: `docs/comparison.md`
|
|
56
|
+
- Setup recipes: `docs/setup-recipes.md`
|
|
57
|
+
- Report gallery: `docs/report-gallery.md`
|
|
58
|
+
- Rule authoring: `docs/rule-authoring.md`
|
|
59
|
+
- Release checklist: `docs/release-checklist.md`
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# npm Trusted Publishing And Provenance
|
|
2
|
+
|
|
3
|
+
This project publishes the `awguard` npm package. The preferred release path is npm trusted publishing from GitHub Actions, which uses OIDC instead of a long-lived npm automation token.
|
|
4
|
+
|
|
5
|
+
## Why Use Trusted Publishing
|
|
6
|
+
|
|
7
|
+
Trusted publishing reduces risk because npm accepts a short-lived publish identity from a specific workflow instead of requiring a saved token. npm also generates provenance automatically for public packages published through trusted publishing from a public GitHub repository.
|
|
8
|
+
|
|
9
|
+
Official docs:
|
|
10
|
+
|
|
11
|
+
- npm trusted publishing: <https://docs.npmjs.com/trusted-publishers/>
|
|
12
|
+
- npm provenance statements: <https://docs.npmjs.com/generating-provenance-statements/>
|
|
13
|
+
- npm provenance viewing: <https://docs.npmjs.com/viewing-package-provenance/>
|
|
14
|
+
|
|
15
|
+
## One-time npm Setup
|
|
16
|
+
|
|
17
|
+
On npmjs.com:
|
|
18
|
+
|
|
19
|
+
1. Open the `awguard` package.
|
|
20
|
+
2. Go to package settings.
|
|
21
|
+
3. Find Trusted Publisher.
|
|
22
|
+
4. Select GitHub Actions.
|
|
23
|
+
5. Use these fields:
|
|
24
|
+
|
|
25
|
+
| Field | Value |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| Organization or user | `Mughal-Baig` |
|
|
28
|
+
| Repository | `agentic-workflow-guard` |
|
|
29
|
+
| Workflow filename | `npm-publish.yml` |
|
|
30
|
+
| Environment name | leave empty unless using a protected GitHub environment |
|
|
31
|
+
| Allowed actions | `npm publish` |
|
|
32
|
+
|
|
33
|
+
After the first successful trusted publish, consider setting publishing access to require 2FA and disallow tokens. Do this only after trusted publishing is verified.
|
|
34
|
+
|
|
35
|
+
## Release Workflow
|
|
36
|
+
|
|
37
|
+
The repository includes `.github/workflows/npm-publish.yml`.
|
|
38
|
+
|
|
39
|
+
It:
|
|
40
|
+
|
|
41
|
+
- Runs only on GitHub-hosted runners.
|
|
42
|
+
- Uses `permissions: id-token: write`.
|
|
43
|
+
- Runs tests before publishing.
|
|
44
|
+
- Publishes with `npm publish --access public`.
|
|
45
|
+
- Avoids storing `NPM_TOKEN`.
|
|
46
|
+
|
|
47
|
+
## Maintainer Release Checklist
|
|
48
|
+
|
|
49
|
+
1. Confirm `npm test` passes locally.
|
|
50
|
+
2. Confirm `git status` is clean.
|
|
51
|
+
3. Update `CHANGELOG.md`.
|
|
52
|
+
4. Bump `package.json` version.
|
|
53
|
+
5. Commit and push.
|
|
54
|
+
6. Create a GitHub Release or run the workflow manually.
|
|
55
|
+
7. Confirm the package appears on npm.
|
|
56
|
+
8. Confirm npm shows provenance for the version.
|
|
57
|
+
9. Confirm GitHub Actions, Code Scanning, and Docker image workflows pass.
|
|
58
|
+
|
|
59
|
+
## Manual Fallback
|
|
60
|
+
|
|
61
|
+
Manual publish is still possible for emergencies:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm login
|
|
65
|
+
npm publish --access public --provenance
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Manual publishing may require 2FA depending on account settings. Prefer the trusted publishing workflow for normal releases.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Release And Marketplace Checklist
|
|
2
|
+
|
|
3
|
+
Use this checklist before cutting a public AWGuard release or updating the GitHub Marketplace listing.
|
|
4
|
+
|
|
5
|
+
## Pre-release
|
|
6
|
+
|
|
7
|
+
- Confirm `npm test` passes.
|
|
8
|
+
- Confirm `git diff --check` passes.
|
|
9
|
+
- Confirm `npm pack --dry-run` includes the intended docs, examples, schemas, action metadata, and CLI files.
|
|
10
|
+
- Run `node ./bin/awguard.js . --format inventory`.
|
|
11
|
+
- Run `node ./bin/awguard.js . --format score`.
|
|
12
|
+
- Run `node ./bin/awguard.js examples/lab/unsafe --format html --output /tmp/awguard-report.html`.
|
|
13
|
+
- Review `CHANGELOG.md`.
|
|
14
|
+
- Confirm README badges render.
|
|
15
|
+
- Confirm the project site loads.
|
|
16
|
+
- Confirm the GitHub Marketplace draft matches current features.
|
|
17
|
+
|
|
18
|
+
## Screenshots To Capture
|
|
19
|
+
|
|
20
|
+
| Screenshot | Command or page |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| Terminal demo | `node ./bin/awguard.js demo` |
|
|
23
|
+
| Inventory report | `node ./bin/awguard.js examples/lab/unsafe --format inventory` |
|
|
24
|
+
| AWI score | `node ./bin/awguard.js examples/lab/unsafe --format score` |
|
|
25
|
+
| SARIF / code scanning | GitHub Security tab after SARIF upload |
|
|
26
|
+
| HTML attack graph | `node ./bin/awguard.js examples/lab/unsafe --format html --output awguard-report.html` |
|
|
27
|
+
| Policy wizard | `node ./bin/awguard.js policy-wizard examples/lab/unsafe --dry-run` |
|
|
28
|
+
| Baseline review | `node ./bin/awguard.js baseline-review . --baseline awguard.baseline.json` |
|
|
29
|
+
|
|
30
|
+
## Marketplace Copy
|
|
31
|
+
|
|
32
|
+
Short description:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
Scan GitHub Actions, agent instruction files, and MCP configs for AI-agent injection risk.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Recommended categories:
|
|
39
|
+
|
|
40
|
+
- Security
|
|
41
|
+
- Code quality
|
|
42
|
+
- Utilities
|
|
43
|
+
|
|
44
|
+
Primary value points:
|
|
45
|
+
|
|
46
|
+
- Finds untrusted GitHub text reaching AI prompts, MCP inputs, or shell scripts.
|
|
47
|
+
- Flags agent jobs with unsafe write permissions, secrets, and writeback.
|
|
48
|
+
- Scans AGENTS.md, Copilot instructions, custom agents, prompts, skills, Cursor rules, and MCP configs.
|
|
49
|
+
- Produces SARIF, attack graphs, migration plans, inventories, scorecards, badges, and baselines.
|
|
50
|
+
|
|
51
|
+
## Release
|
|
52
|
+
|
|
53
|
+
1. Bump `package.json` version.
|
|
54
|
+
2. Commit with a concise release message.
|
|
55
|
+
3. Push `main`.
|
|
56
|
+
4. Create a GitHub tag such as `v1.7.0`.
|
|
57
|
+
5. Create a GitHub Release from the tag.
|
|
58
|
+
6. Confirm `npm-publish.yml` publishes `awguard`.
|
|
59
|
+
7. Confirm `docker.yml` publishes GHCR images.
|
|
60
|
+
8. Update the moving `v0` action tag if the Action entrypoint changed.
|
|
61
|
+
9. Confirm `npx awguard@latest . --version` or `npm view awguard version`.
|
|
62
|
+
10. Add release screenshots and notes to the GitHub Release.
|
|
63
|
+
|
|
64
|
+
## Post-release
|
|
65
|
+
|
|
66
|
+
- Check GitHub Actions.
|
|
67
|
+
- Check npm package contents.
|
|
68
|
+
- Check GitHub code scanning.
|
|
69
|
+
- Check the GitHub Pages site.
|
|
70
|
+
- Close any release tracking issues that were not closed by commit messages.
|
|
71
|
+
- Post a short launch note with the new report, rule, or workflow users can copy.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Report Gallery
|
|
2
|
+
|
|
3
|
+
AWGuard has several report formats because different users need different entry points. The gallery below shows when to use each report and which command creates it.
|
|
4
|
+
|
|
5
|
+
## Text Findings
|
|
6
|
+
|
|
7
|
+
Use for local terminal review.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx awguard@latest examples/lab/unsafe
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Best for:
|
|
14
|
+
|
|
15
|
+
- First scans.
|
|
16
|
+
- Quick triage.
|
|
17
|
+
- Copying a finding into an issue.
|
|
18
|
+
|
|
19
|
+
## GitHub Annotations
|
|
20
|
+
|
|
21
|
+
Use inside GitHub Actions.
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
- uses: Mughal-Baig/agentic-workflow-guard@v0
|
|
25
|
+
with:
|
|
26
|
+
preset: strict
|
|
27
|
+
fail-on: high
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Best for:
|
|
31
|
+
|
|
32
|
+
- Pull request checks.
|
|
33
|
+
- Inline workflow annotations.
|
|
34
|
+
- Blocking newly introduced high-risk patterns.
|
|
35
|
+
|
|
36
|
+
## SARIF
|
|
37
|
+
|
|
38
|
+
Use for GitHub code scanning.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx awguard@latest . --format sarif --output awguard.sarif --fail-on none
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Best for:
|
|
45
|
+
|
|
46
|
+
- Security tab visibility.
|
|
47
|
+
- Alert tracking.
|
|
48
|
+
- Teams that already use CodeQL or third-party SARIF uploads.
|
|
49
|
+
|
|
50
|
+
## Inventory
|
|
51
|
+
|
|
52
|
+
Use to explain the repository's agentic surface area.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx awguard@latest . --format inventory
|
|
56
|
+
npx awguard@latest . --format inventory-json --output awguard-inventory.json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Best for:
|
|
60
|
+
|
|
61
|
+
- Security reviews before adding coding agents.
|
|
62
|
+
- Finding all instruction files and MCP configs.
|
|
63
|
+
- Showing non-security maintainers where agent authority lives.
|
|
64
|
+
|
|
65
|
+
## Attack Graph
|
|
66
|
+
|
|
67
|
+
Use to explain why a finding matters.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx awguard@latest examples/lab/unsafe --format graph
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Best for:
|
|
74
|
+
|
|
75
|
+
- Pull request discussions.
|
|
76
|
+
- Issue reports.
|
|
77
|
+
- Design reviews where a table of findings is too flat.
|
|
78
|
+
|
|
79
|
+
## HTML Report
|
|
80
|
+
|
|
81
|
+
Use when you need a standalone shareable artifact.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx awguard@latest examples/lab/unsafe --format html --output awguard-report.html
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Best for:
|
|
88
|
+
|
|
89
|
+
- Release assets.
|
|
90
|
+
- Blog posts.
|
|
91
|
+
- Marketplace screenshots.
|
|
92
|
+
|
|
93
|
+
## Migration Plan
|
|
94
|
+
|
|
95
|
+
Use when a project needs practical fixes.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx awguard@latest examples/lab/unsafe --format migration --output awguard-migration.md
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Best for:
|
|
102
|
+
|
|
103
|
+
- Converting unsafe agent jobs into read-only proposal jobs.
|
|
104
|
+
- Splitting privileged writeback into reviewed workflows.
|
|
105
|
+
- Turning findings into task lists.
|
|
106
|
+
|
|
107
|
+
## Score And Badge
|
|
108
|
+
|
|
109
|
+
Use when you want a public progress signal.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npx awguard@latest . --format score
|
|
113
|
+
npx awguard@latest . --format badge --output docs/awguard-badge.json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Best for:
|
|
117
|
+
|
|
118
|
+
- README badges.
|
|
119
|
+
- Tracking cleanup progress.
|
|
120
|
+
- Showing an easy-to-understand risk grade.
|
|
121
|
+
|
|
122
|
+
## Compare
|
|
123
|
+
|
|
124
|
+
Use to show what changed between branches, releases, or scheduled scans.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npx awguard@latest . --format json --output current-awguard.json
|
|
128
|
+
npx awguard@latest --compare previous-awguard.json current-awguard.json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Best for:
|
|
132
|
+
|
|
133
|
+
- Release gates.
|
|
134
|
+
- Scheduled drift monitoring.
|
|
135
|
+
- Baseline cleanup work.
|
|
136
|
+
|
|
137
|
+
## Dashboard POC
|
|
138
|
+
|
|
139
|
+
Use to show AWI score, finding count, introduced/resolved findings, and agentic surface growth over time.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
cd examples/dashboard
|
|
143
|
+
python3 -m http.server 8090
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Open `http://127.0.0.1:8090/`.
|
|
147
|
+
|
|
148
|
+
Best for:
|
|
149
|
+
|
|
150
|
+
- GitHub App dashboard planning.
|
|
151
|
+
- GitHub Pages demos.
|
|
152
|
+
- Organization-level trend conversations.
|
|
153
|
+
|
|
154
|
+
## Policy Wizard
|
|
155
|
+
|
|
156
|
+
Use to generate a starter allowlist for reviewed agentic surfaces.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npx awguard@latest policy-wizard . --dry-run
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Best for:
|
|
163
|
+
|
|
164
|
+
- Moving from detection to governance.
|
|
165
|
+
- Reviewing newly added MCP servers or agent instruction files.
|
|
166
|
+
- Making repository-specific policy explicit.
|
package/docs/roadmap.md
CHANGED
|
@@ -54,18 +54,52 @@ Current research points:
|
|
|
54
54
|
|
|
55
55
|
### Now
|
|
56
56
|
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
57
|
+
- Shipped `--format inventory`.
|
|
58
|
+
- Shipped `--format inventory-json`.
|
|
59
|
+
- Shipped `awguard init`.
|
|
60
|
+
- Shipped `awguard doctor`.
|
|
61
|
+
- Shipped `awguard explain`.
|
|
62
|
+
- Shipped `awguard badges`.
|
|
63
|
+
- Shipped `awguard demo`.
|
|
64
|
+
- Shipped `awguard templates`.
|
|
65
|
+
- Shipped `awguard policy-pack`.
|
|
66
|
+
- Shipped `scan.include` and `scan.exclude` config globs.
|
|
67
|
+
- Shipped Node 24 action runtime readiness.
|
|
68
|
+
- Shipped SARIF columns, snippets, stable AWGuard fingerprints, and rule categories.
|
|
69
|
+
- Shipped `AWG016`, `AWG017`, and `AWG018` for checkout credentials, unsafe writeback, and MCP input injection.
|
|
70
|
+
- Shipped machine-readable remediation codes.
|
|
71
|
+
- Shipped large-repo scan guardrails.
|
|
72
|
+
- Shipped end-to-end golden tests for lab, compare, inventory, and score outputs.
|
|
73
|
+
- Shipped baseline review/prune command.
|
|
74
|
+
- Shipped policy wizard starter config command.
|
|
75
|
+
- Shipped PR comment bot example and Docker image publish workflow.
|
|
76
|
+
- Shipped expanded comparison docs for `zizmor`, `actionlint`, OpenSSF Scorecard, secret scanning, and MCP runtime scanners.
|
|
77
|
+
- Shipped setup recipes for Claude Code, Codex, Cursor, GitHub Copilot, and Cline.
|
|
78
|
+
- Shipped report gallery, rule authoring guide, npm trusted publishing guide, and release checklist.
|
|
79
|
+
- Shipped npm trusted publishing workflow for tokenless OIDC publishing.
|
|
80
|
+
- Shipped real-world pattern corpus for public demos and regression coverage.
|
|
81
|
+
- Shipped VS Code task problem matcher and extension proof of concept.
|
|
82
|
+
- Shipped local AWI trend dashboard proof of concept with sample history data.
|
|
83
|
+
- Shipped opt-in safe autofix mode for narrow workflow permission and checkout hardening edits.
|
|
84
|
+
- Shipped offline MCP package reputation policy checks with trusted package scopes.
|
|
85
|
+
- Shipped `awguard.config.json` schema support.
|
|
86
|
+
- Shipped stable schemas for machine-readable report outputs.
|
|
87
|
+
- Shipped GitHub Actions job summaries.
|
|
88
|
+
- Shipped `--compare previous.json current.json`.
|
|
89
|
+
- Shipped agentic surface diffs in compare reports.
|
|
90
|
+
- Shipped first policy allowlists with `AWG015`.
|
|
91
|
+
- Expanded `AWG012` coverage to Copilot custom agents, prompts, and skills.
|
|
92
|
+
- Added Docker, GitLab CI, pre-commit, VS Code task, Marketplace, comparison, visual demo, and vulnerable lab assets.
|
|
60
93
|
|
|
61
94
|
### Next
|
|
62
95
|
|
|
63
|
-
- Add
|
|
64
|
-
- Add
|
|
65
|
-
- Add
|
|
96
|
+
- Add agent capability SBOM export for prompts, tools, MCP servers, permissions, and write paths.
|
|
97
|
+
- Add richer policy ownership fields for approved file owners and review cadence.
|
|
98
|
+
- Add screenshot automation for the report gallery and Marketplace listing.
|
|
99
|
+
- Add more public corpus fixtures for popular agent PR review and triage patterns.
|
|
100
|
+
- Turn the VS Code and dashboard POCs into installable, tested integrations.
|
|
66
101
|
|
|
67
102
|
### Later
|
|
68
103
|
|
|
69
104
|
- Add trend reports for "new agent surface introduced" diffs.
|
|
70
|
-
- Build the vulnerable lab and screenshot-friendly walkthroughs.
|
|
71
105
|
- Explore a GitHub App after the CLI and Action adoption path is stable.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Rule Authoring Guide
|
|
2
|
+
|
|
3
|
+
This guide is for contributors adding new AWGuard rules or improving existing detections.
|
|
4
|
+
|
|
5
|
+
## Rule Design Principles
|
|
6
|
+
|
|
7
|
+
Good AWGuard rules are:
|
|
8
|
+
|
|
9
|
+
- Agentic: they involve AI agents, MCP servers, persistent instructions, or automation that hands authority to a model-driven tool.
|
|
10
|
+
- Boundary-focused: they explain a trust boundary, not only a style preference.
|
|
11
|
+
- Reviewable: the finding should point to a specific file, line, evidence string, and remediation.
|
|
12
|
+
- CI-safe: rules must not execute repository code, start MCP servers, call network services, or require secrets.
|
|
13
|
+
- Low-noise: false positives should have clear suppression and configuration paths.
|
|
14
|
+
|
|
15
|
+
## Add A Rule
|
|
16
|
+
|
|
17
|
+
1. Add a `ruleCatalog` entry in `src/scanner.js`.
|
|
18
|
+
2. Choose a stable rule id such as `AWG020`.
|
|
19
|
+
3. Set `title`, default `severity`, `remediationCode`, and `suggestion`.
|
|
20
|
+
4. Implement a focused detector function in `src/scanner.js`.
|
|
21
|
+
5. Call the detector from the relevant scan path:
|
|
22
|
+
- `scanWorkflowText` for workflow content.
|
|
23
|
+
- `scanAgentInstructionText` for persistent instruction files.
|
|
24
|
+
- `scanMcpConfigText` for MCP configs.
|
|
25
|
+
- `scanFile` or `detectFilePolicy` for file-level policy checks.
|
|
26
|
+
6. Add unit tests that cover the unsafe and safe pattern.
|
|
27
|
+
7. Add an example fixture if the rule teaches a common real-world pattern.
|
|
28
|
+
8. Update README rule tables and any docs that mention rule coverage.
|
|
29
|
+
9. Run `npm test`.
|
|
30
|
+
|
|
31
|
+
## Severity Guidance
|
|
32
|
+
|
|
33
|
+
| Severity | Use when |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| `critical` | Untrusted input can plausibly reach secrets, write tokens, privileged checkout, protected branch writeback, or hardcoded auth material. |
|
|
36
|
+
| `high` | The pattern can change repository state, guide an agent with attacker-controlled text, or weaken approval boundaries. |
|
|
37
|
+
| `medium` | The pattern creates drift, missing guardrails, or review ambiguity without direct exploitability. |
|
|
38
|
+
| `low` | The pattern is hardening guidance for security-sensitive agent workflows. |
|
|
39
|
+
|
|
40
|
+
## Remediation Codes
|
|
41
|
+
|
|
42
|
+
Every finding has a `remediationCode` because dashboards should not depend on free-text suggestions.
|
|
43
|
+
|
|
44
|
+
Use this naming shape:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
domain.action-specific-fix
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Examples:
|
|
51
|
+
|
|
52
|
+
- `permissions.tighten-token`
|
|
53
|
+
- `mcp.pin-server`
|
|
54
|
+
- `prompt.isolate-untrusted-text`
|
|
55
|
+
- `writeback.use-pr-branch`
|
|
56
|
+
|
|
57
|
+
Do not rename existing remediation codes unless there is a compatibility reason and changelog entry.
|
|
58
|
+
|
|
59
|
+
## Detector Checklist
|
|
60
|
+
|
|
61
|
+
Before opening a PR, confirm:
|
|
62
|
+
|
|
63
|
+
- The detector does not execute code or parse arbitrary shell with unsafe side effects.
|
|
64
|
+
- The finding evidence is short and specific.
|
|
65
|
+
- The detector respects inline suppressions through `addFinding`.
|
|
66
|
+
- Rule severity can be overridden through config.
|
|
67
|
+
- JSON, Markdown, SARIF, GitHub annotation, and text outputs still render.
|
|
68
|
+
- The unsafe test fails before the detector and passes after it.
|
|
69
|
+
- The safe test proves a recommended remediation avoids the finding.
|
|
70
|
+
|
|
71
|
+
## Fixture Checklist
|
|
72
|
+
|
|
73
|
+
Examples should be safe to publish:
|
|
74
|
+
|
|
75
|
+
- No real tokens, secrets, domains, private names, or customer data.
|
|
76
|
+
- Intentionally fake secrets should use obvious placeholder values.
|
|
77
|
+
- Unsafe examples should be labeled as unsafe.
|
|
78
|
+
- Fixed examples should show the recommended pattern, not only silence the scanner.
|
|
79
|
+
- Every new fixture should be referenced from `examples/README.md`.
|
|
80
|
+
|
|
81
|
+
## Documentation Checklist
|
|
82
|
+
|
|
83
|
+
When adding or changing a rule, update:
|
|
84
|
+
|
|
85
|
+
- `README.md` rule table.
|
|
86
|
+
- `CHANGELOG.md`.
|
|
87
|
+
- `docs/report-gallery.md` if the output teaches a new report shape.
|
|
88
|
+
- `docs/comparison.md` only if the rule changes AWGuard's position beside other tools.
|
|
89
|
+
- `schemas/` only if the machine-readable contract changes.
|
|
90
|
+
|
|
91
|
+
## Review Checklist
|
|
92
|
+
|
|
93
|
+
Reviewers should ask:
|
|
94
|
+
|
|
95
|
+
- Does this find a real agentic workflow risk?
|
|
96
|
+
- Could a maintainer understand and fix the finding in less than five minutes?
|
|
97
|
+
- Does the safe example avoid the risk rather than hiding it?
|
|
98
|
+
- Does the rule duplicate a better tool such as `actionlint` or a secret scanner?
|
|
99
|
+
- Does this rule keep AWGuard zero-dependency and safe for pull request scans?
|
package/docs/schemas.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# AWGuard Report Schemas
|
|
2
|
+
|
|
3
|
+
AWGuard publishes JSON Schema files for the outputs that are designed for automation.
|
|
4
|
+
|
|
5
|
+
| Output | Command | Schema |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| Scan report | `awguard . --format json` | [`schemas/awguard.report.schema.json`](../schemas/awguard.report.schema.json) |
|
|
8
|
+
| Inventory | `awguard . --format inventory-json` | [`schemas/awguard.inventory.schema.json`](../schemas/awguard.inventory.schema.json) |
|
|
9
|
+
| Compare | `awguard --compare old.json new.json --format json` | [`schemas/awguard.comparison.schema.json`](../schemas/awguard.comparison.schema.json) |
|
|
10
|
+
| Baseline | `awguard . --write-baseline awguard.baseline.json` | [`schemas/awguard.baseline.schema.json`](../schemas/awguard.baseline.schema.json) |
|
|
11
|
+
| Badge | `awguard . --format badge` | [`schemas/awguard.badge.schema.json`](../schemas/awguard.badge.schema.json) |
|
|
12
|
+
| Config | `awguard.config.json` | [`schemas/awguard.config.schema.json`](../schemas/awguard.config.schema.json) |
|
|
13
|
+
|
|
14
|
+
The SARIF output uses the official SARIF 2.1.0 schema.
|
|
15
|
+
|
|
16
|
+
The comparison JSON includes both finding diffs and agentic surface diffs so dashboards can show when workflows, agent context files, or MCP configs are added or removed.
|