awguard 1.6.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 +32 -0
- package/Dockerfile +8 -1
- package/README.md +176 -12
- package/action.yml +5 -1
- package/docs/comparison.md +161 -16
- package/docs/launch-plan.md +12 -2
- package/docs/marketplace-listing.md +19 -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 +32 -2
- 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 +29 -0
- package/examples/.vscode/tasks.json +17 -1
- package/examples/README.md +7 -0
- package/examples/awguard.config.example.json +8 -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 +6 -0
- package/examples/pr-comment-bot.yml +43 -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 +2 -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 +248 -6
- package/src/compare.js +60 -4
- package/src/config.js +31 -2
- package/src/demo.js +90 -0
- package/src/doctor.js +189 -0
- package/src/explain.js +147 -0
- package/src/init.js +4 -1
- package/src/policy-packs.js +99 -0
- package/src/policy-wizard.js +165 -0
- package/src/remediation.js +73 -1
- package/src/reporters.js +86 -3
- package/src/scanner.js +204 -5
- package/src/templates.js +132 -0
|
@@ -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
|
@@ -57,7 +57,36 @@ Current research points:
|
|
|
57
57
|
- Shipped `--format inventory`.
|
|
58
58
|
- Shipped `--format inventory-json`.
|
|
59
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.
|
|
60
88
|
- Shipped `--compare previous.json current.json`.
|
|
89
|
+
- Shipped agentic surface diffs in compare reports.
|
|
61
90
|
- Shipped first policy allowlists with `AWG015`.
|
|
62
91
|
- Expanded `AWG012` coverage to Copilot custom agents, prompts, and skills.
|
|
63
92
|
- Added Docker, GitLab CI, pre-commit, VS Code task, Marketplace, comparison, visual demo, and vulnerable lab assets.
|
|
@@ -65,11 +94,12 @@ Current research points:
|
|
|
65
94
|
### Next
|
|
66
95
|
|
|
67
96
|
- Add agent capability SBOM export for prompts, tools, MCP servers, permissions, and write paths.
|
|
68
|
-
- Add safer patch previews for common workflow permission fixes.
|
|
69
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.
|
|
70
101
|
|
|
71
102
|
### Later
|
|
72
103
|
|
|
73
104
|
- Add trend reports for "new agent surface introduced" diffs.
|
|
74
|
-
- Build the vulnerable lab and screenshot-friendly walkthroughs.
|
|
75
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.
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Setup Recipes For AI Coding Agent Repositories
|
|
2
|
+
|
|
3
|
+
Use these recipes when a repository already has AI coding agents, prompt files, MCP configs, or GitHub Actions that call LLM tools.
|
|
4
|
+
|
|
5
|
+
## Universal First Run
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx awguard@latest doctor
|
|
9
|
+
npx awguard@latest . --format inventory
|
|
10
|
+
npx awguard@latest policy-wizard . --dry-run
|
|
11
|
+
npx awguard@latest . --preset strict --format sarif --output awguard.sarif --fail-on none
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Review the inventory first. It shows which files give agents instructions, tools, credentials, or workflow authority.
|
|
15
|
+
|
|
16
|
+
## GitHub Actions
|
|
17
|
+
|
|
18
|
+
Create `.github/workflows/agentic-workflow-guard.yml`:
|
|
19
|
+
|
|
20
|
+
```yaml
|
|
21
|
+
name: Agentic Workflow Guard
|
|
22
|
+
|
|
23
|
+
on:
|
|
24
|
+
pull_request:
|
|
25
|
+
push:
|
|
26
|
+
branches: [main]
|
|
27
|
+
workflow_dispatch:
|
|
28
|
+
|
|
29
|
+
permissions:
|
|
30
|
+
contents: read
|
|
31
|
+
security-events: write
|
|
32
|
+
|
|
33
|
+
jobs:
|
|
34
|
+
scan:
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v6
|
|
38
|
+
- uses: Mughal-Baig/agentic-workflow-guard@v0
|
|
39
|
+
with:
|
|
40
|
+
preset: strict
|
|
41
|
+
format: sarif
|
|
42
|
+
output: awguard.sarif
|
|
43
|
+
fail-on: high
|
|
44
|
+
- uses: github/codeql-action/upload-sarif@v4
|
|
45
|
+
if: always()
|
|
46
|
+
with:
|
|
47
|
+
sarif_file: awguard.sarif
|
|
48
|
+
category: agentic-workflow-guard
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If the repository has many old findings, start with a baseline:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx awguard@latest . --write-baseline awguard.baseline.json --fail-on none
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Then add `baseline: awguard.baseline.json` to the Action inputs.
|
|
58
|
+
|
|
59
|
+
## Claude Code
|
|
60
|
+
|
|
61
|
+
Files to review:
|
|
62
|
+
|
|
63
|
+
- `CLAUDE.md`
|
|
64
|
+
- `AGENTS.md`
|
|
65
|
+
- `.mcp.json`
|
|
66
|
+
- `claude_desktop_config.json`
|
|
67
|
+
- `.github/workflows/*.yml`
|
|
68
|
+
|
|
69
|
+
Recommended checks:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npx awguard@latest . --preset claude-code --format inventory
|
|
73
|
+
npx awguard@latest CLAUDE.md --format text
|
|
74
|
+
npx awguard@latest .mcp.json --format text
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Hardening checklist:
|
|
78
|
+
|
|
79
|
+
- Keep `CLAUDE.md` conservative about approvals and command execution.
|
|
80
|
+
- Do not commit MCP auth tokens.
|
|
81
|
+
- Pin MCP server packages to exact versions.
|
|
82
|
+
- Avoid telling agents to obey issue, PR, or comment text as commands.
|
|
83
|
+
- Split read-only agent analysis from any writeback job.
|
|
84
|
+
|
|
85
|
+
## Codex
|
|
86
|
+
|
|
87
|
+
Files to review:
|
|
88
|
+
|
|
89
|
+
- `AGENTS.md`
|
|
90
|
+
- `CODEX.md`
|
|
91
|
+
- `.mcp.json`
|
|
92
|
+
- `.github/workflows/*.yml`
|
|
93
|
+
|
|
94
|
+
Recommended checks:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx awguard@latest . --preset codex --format inventory
|
|
98
|
+
npx awguard@latest AGENTS.md --format text
|
|
99
|
+
npx awguard@latest . --format migration
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Hardening checklist:
|
|
103
|
+
|
|
104
|
+
- Keep repository instructions focused on code style, testing, and review expectations.
|
|
105
|
+
- Require human approval before file writes, shell execution, or privileged repository changes.
|
|
106
|
+
- Do not put secrets or package tokens in MCP config.
|
|
107
|
+
- Use `permissions: contents: read` for agent analysis jobs.
|
|
108
|
+
|
|
109
|
+
## Cursor
|
|
110
|
+
|
|
111
|
+
Files to review:
|
|
112
|
+
|
|
113
|
+
- `.cursorrules`
|
|
114
|
+
- `.cursor/rules/*.{md,mdc,txt}`
|
|
115
|
+
- `.cursor/mcp.json`
|
|
116
|
+
- `.github/workflows/*.yml`
|
|
117
|
+
|
|
118
|
+
Recommended checks:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx awguard@latest . --format inventory
|
|
122
|
+
npx awguard@latest .cursor/mcp.json --format text
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Hardening checklist:
|
|
126
|
+
|
|
127
|
+
- Treat Cursor rules as persistent agent instructions.
|
|
128
|
+
- Avoid global autonomy instructions such as "never ask for approval."
|
|
129
|
+
- Pin project MCP packages and containers.
|
|
130
|
+
- Keep workspace rules separate from secrets and credentials.
|
|
131
|
+
|
|
132
|
+
## GitHub Copilot
|
|
133
|
+
|
|
134
|
+
Files to review:
|
|
135
|
+
|
|
136
|
+
- `.github/copilot-instructions.md`
|
|
137
|
+
- `.github/instructions/*.instructions.md`
|
|
138
|
+
- `.github/agents/*.md`
|
|
139
|
+
- `.github/prompts/*.prompt.md`
|
|
140
|
+
- `.github/skills/**/SKILL.md`
|
|
141
|
+
- `.github/workflows/*.yml`
|
|
142
|
+
|
|
143
|
+
Recommended checks:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npx awguard@latest . --format inventory
|
|
147
|
+
npx awguard@latest .github --format text
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Hardening checklist:
|
|
151
|
+
|
|
152
|
+
- Keep reusable prompts bounded and reviewable.
|
|
153
|
+
- Do not tell Copilot agents to follow PR or issue text as trusted instructions.
|
|
154
|
+
- Keep skills and custom agents scoped to specific safe tasks.
|
|
155
|
+
- Use branch, pull request, or artifact containment for any AI-generated patch.
|
|
156
|
+
|
|
157
|
+
## Cline
|
|
158
|
+
|
|
159
|
+
Files to review:
|
|
160
|
+
|
|
161
|
+
- `.clinerules`
|
|
162
|
+
- `cline_mcp_settings.json`
|
|
163
|
+
- `.cline/mcp_settings.json`
|
|
164
|
+
- `.github/workflows/*.yml`
|
|
165
|
+
|
|
166
|
+
Recommended checks:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npx awguard@latest . --format inventory
|
|
170
|
+
npx awguard@latest cline_mcp_settings.json --format text
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Hardening checklist:
|
|
174
|
+
|
|
175
|
+
- Keep `.clinerules` from weakening approval boundaries.
|
|
176
|
+
- Do not commit tokens in Cline MCP settings.
|
|
177
|
+
- Prefer pinned MCP package versions.
|
|
178
|
+
- Review new MCP servers before they are available to an agent.
|
|
179
|
+
|
|
180
|
+
## Safe PR Comment Bot Pattern
|
|
181
|
+
|
|
182
|
+
Copy `examples/pr-comment-bot.yml` into `.github/workflows/awguard-pr-comment.yml` if you want AWGuard to comment on pull requests.
|
|
183
|
+
|
|
184
|
+
The example intentionally uses:
|
|
185
|
+
|
|
186
|
+
- `pull_request`, not `pull_request_target`.
|
|
187
|
+
- `contents: read`.
|
|
188
|
+
- `pull-requests: write` only for same-repository PR comments.
|
|
189
|
+
- No secrets in forked PR execution.
|
|
190
|
+
|
|
191
|
+
## Adoption Order
|
|
192
|
+
|
|
193
|
+
1. Run `doctor` and `inventory`.
|
|
194
|
+
2. Add the GitHub Action with `fail-on: none`.
|
|
195
|
+
3. Generate and commit a baseline if needed.
|
|
196
|
+
4. Enable SARIF upload.
|
|
197
|
+
5. Turn on `fail-on: high`.
|
|
198
|
+
6. Add a reviewed `awguard.config.json` policy.
|
|
199
|
+
7. Review baseline drift weekly with `awguard baseline-review`.
|