harnessguard 0.1.0__tar.gz

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 (31) hide show
  1. harnessguard-0.1.0/.github/workflows/ci.yml +22 -0
  2. harnessguard-0.1.0/.github/workflows/release.yml +19 -0
  3. harnessguard-0.1.0/.gitignore +10 -0
  4. harnessguard-0.1.0/LICENSE +201 -0
  5. harnessguard-0.1.0/PKG-INFO +144 -0
  6. harnessguard-0.1.0/README.md +116 -0
  7. harnessguard-0.1.0/SECURITY.md +13 -0
  8. harnessguard-0.1.0/action.yml +41 -0
  9. harnessguard-0.1.0/fixtures/clean-repo/.github/workflows/release-notes.yml +22 -0
  10. harnessguard-0.1.0/fixtures/vulnerable-repo/.github/workflows/review.yml +12 -0
  11. harnessguard-0.1.0/fixtures/vulnerable-repo/.github/workflows/triage.yml +20 -0
  12. harnessguard-0.1.0/pyproject.toml +75 -0
  13. harnessguard-0.1.0/src/harnessguard/__init__.py +3 -0
  14. harnessguard-0.1.0/src/harnessguard/__main__.py +4 -0
  15. harnessguard-0.1.0/src/harnessguard/checks.py +151 -0
  16. harnessguard-0.1.0/src/harnessguard/cli.py +114 -0
  17. harnessguard-0.1.0/src/harnessguard/discovery.py +47 -0
  18. harnessguard-0.1.0/src/harnessguard/engine.py +38 -0
  19. harnessguard-0.1.0/src/harnessguard/facts.py +166 -0
  20. harnessguard-0.1.0/src/harnessguard/models.py +79 -0
  21. harnessguard-0.1.0/src/harnessguard/report.py +107 -0
  22. harnessguard-0.1.0/src/harnessguard/rules/__init__.py +4 -0
  23. harnessguard-0.1.0/src/harnessguard/rules/loader.py +32 -0
  24. harnessguard-0.1.0/src/harnessguard/rules/model.py +20 -0
  25. harnessguard-0.1.0/src/harnessguard/rules_data/HG001-secrets-untrusted-event.yaml +17 -0
  26. harnessguard-0.1.0/src/harnessguard/rules_data/HG002-untrusted-context-flow.yaml +14 -0
  27. harnessguard-0.1.0/src/harnessguard/rules_data/HG003-write-permissions-untrusted-event.yaml +13 -0
  28. harnessguard-0.1.0/src/harnessguard/rules_data/HG004-pull-request-target-agent.yaml +15 -0
  29. harnessguard-0.1.0/src/harnessguard/rules_data/HG005-egress-tool-grants.yaml +25 -0
  30. harnessguard-0.1.0/tests/test_scan.py +60 -0
  31. harnessguard-0.1.0/uv.lock +388 -0
@@ -0,0 +1,22 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master, main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: astral-sh/setup-uv@v5
14
+ - run: uv sync --all-groups
15
+ - name: Lint
16
+ run: uv run ruff check .
17
+ - name: Tests
18
+ run: uv run pytest
19
+ - name: Self-scan (vulnerable fixture; report only)
20
+ run: uv run harnessguard scan fixtures/vulnerable-repo --fail-on none --sarif harnessguard-vulnerable.sarif
21
+ - name: Self-scan (clean fixture; must pass)
22
+ run: uv run harnessguard scan fixtures/clean-repo --fail-on low
@@ -0,0 +1,19 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ pypi:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: astral-sh/setup-uv@v5
16
+ - name: Build
17
+ run: uv build
18
+ - name: Publish to PyPI (trusted publishing)
19
+ run: uv publish
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+ *.sarif
10
+ .DS_Store
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.5
2
+ Name: harnessguard
3
+ Version: 0.1.0
4
+ Summary: Static hardening linter for GitHub Actions workflows that run AI agents — Agent Rule of Two, OWASP ASI mapping. Never executes anything.
5
+ Project-URL: Homepage, https://github.com/dtduc-git/harnessguard
6
+ Project-URL: Issues, https://github.com/dtduc-git/harnessguard/issues
7
+ Project-URL: Changelog, https://github.com/dtduc-git/harnessguard/releases
8
+ Author-email: Duke - Duc Dinh <dtduc.contact@gmail.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: ai-agents,cicd,github-actions,owasp,prompt-injection,sarif,sast,security,supply-chain
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Security
21
+ Classifier: Topic :: Software Development :: Quality Assurance
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: pydantic>=2.7
24
+ Requires-Dist: pyyaml>=6.0
25
+ Requires-Dist: rich>=13.7
26
+ Requires-Dist: typer>=0.12
27
+ Description-Content-Type: text/markdown
28
+
29
+ # harnessguard
30
+
31
+ Static hardening linter for GitHub Actions workflows that run **AI agents**.
32
+
33
+ Agents in CI (Claude Code Action, Gemini CLI Action, Codex, Copilot agents and
34
+ friends) read attacker-controlled text — issue bodies, PR titles, comments —
35
+ while the runner holds secrets and write tokens. That combination is the new
36
+ CI/CD supply-chain attack surface: a public comment becomes instructions the
37
+ agent obeys.
38
+
39
+ harnessguard enforces Microsoft's **[Agents Rule of Two](https://www.microsoft.com/en-us/security/blog/2026/06/05/securing-ci-cd-in-agentic-world-claude-code-github-action-case)**:
40
+ an AI-powered workflow must never combine untrusted input, privileged access,
41
+ and external communication. It runs as a **static, deterministic** check in
42
+ pull requests — it never executes your workflows or your agents.
43
+
44
+ ## Why
45
+
46
+ Real incidents, all from 2026:
47
+
48
+ - **Comment and Control** (April 2026) — hijacked Claude Code Security Review,
49
+ Gemini CLI Action and Copilot Agent via PR titles / issue bodies; leaked
50
+ `ANTHROPIC_API_KEY`, `GEMINI_API_KEY` and `GITHUB_TOKEN` through public
51
+ comments.
52
+ - **Black Hat USA 2026** (August) — an unprivileged GitHub issue reached CI
53
+ runner secrets in the vendors' own repositories; Gemini CLI Action got
54
+ CVE-2026-12537 (CVSS 10.0).
55
+ - **MSRC** — Claude Code Action's Read tool reached `/proc/self/environ`;
56
+ fixed in 2.1.128.
57
+
58
+ Existing Actions linters (`zizmor`, `actionlint`, `poutine`…) are excellent
59
+ but agent-blind: they don't model "this step is an LLM that will obey text."
60
+
61
+ ## Install
62
+
63
+ ```bash
64
+ pip install harnessguard
65
+ # or from source
66
+ uv sync && uv run harnessguard --version
67
+ ```
68
+
69
+ ## Usage
70
+
71
+ ```bash
72
+ # scan the current repo (finds .github/workflows/)
73
+ harnessguard scan .
74
+
75
+ # fail CI on high and above, write SARIF for code scanning
76
+ harnessguard scan . --fail-on high --sarif harnessguard.sarif
77
+
78
+ # machine-readable output
79
+ harnessguard scan . --format json
80
+
81
+ # list rules
82
+ harnessguard rules list
83
+ ```
84
+
85
+ Exit code is 1 when findings at or above `--fail-on` exist. `--fail-on none`
86
+ reports without failing.
87
+
88
+ ### GitHub Action
89
+
90
+ ```yaml
91
+ name: harnessguard
92
+ on: [push, pull_request]
93
+
94
+ jobs:
95
+ harnessguard:
96
+ runs-on: ubuntu-latest
97
+ permissions:
98
+ contents: read
99
+ security-events: write
100
+ steps:
101
+ - uses: actions/checkout@v4
102
+ - uses: dtduc-git/harnessguard@main
103
+ with:
104
+ fail-on: high
105
+ ```
106
+
107
+ ## Rules
108
+
109
+ | Rule | Severity | What it catches |
110
+ |-------|----------|-----------------|
111
+ | HG001 | critical | Agent step on untrusted events with secrets in scope |
112
+ | HG002 | high | Attacker-controlled event data interpolated into an agent step |
113
+ | HG003 | high | Agent step on untrusted events with write permissions |
114
+ | HG004 | high | Agent step in a `pull_request_target` workflow |
115
+ | HG005 | medium | Agent step with shell/network tool grants or egress commands |
116
+
117
+ Findings map to the OWASP Top 10 for Agentic Applications (ASI01–ASI03).
118
+ Rules are data — YAML in `src/harnessguard/rules_data/` — and checks are small
119
+ named functions in `checks.py`. Add your own with `--rules-dir`.
120
+
121
+ ## Design principles
122
+
123
+ - **Never executes anything.** No workflow runs, no agent calls, no network.
124
+ - **Local-first.** No account, no telemetry, no SaaS.
125
+ - **Deterministic.** Same input → same findings; no LLM in the detection path.
126
+ - **Rules as data.** Extend coverage without touching the engine.
127
+
128
+ ## Non-goals
129
+
130
+ - Not a general-purpose Actions linter — use zizmor alongside it.
131
+ - No runtime enforcement or proxy — that is a different (complementary) tool.
132
+ - Not GitLab/Jenkins (yet).
133
+
134
+ ## References
135
+
136
+ - Microsoft Security Blog — *Securing CI/CD in an agentic world* (Agents Rule
137
+ of Two), June 2026
138
+ - CSA — *Comment and Control: GitHub AI Agents as Credential Exfiltrators*,
139
+ April 2026
140
+ - OWASP — Top 10 for Agentic Applications 2026
141
+
142
+ ## License
143
+
144
+ Apache-2.0
@@ -0,0 +1,116 @@
1
+ # harnessguard
2
+
3
+ Static hardening linter for GitHub Actions workflows that run **AI agents**.
4
+
5
+ Agents in CI (Claude Code Action, Gemini CLI Action, Codex, Copilot agents and
6
+ friends) read attacker-controlled text — issue bodies, PR titles, comments —
7
+ while the runner holds secrets and write tokens. That combination is the new
8
+ CI/CD supply-chain attack surface: a public comment becomes instructions the
9
+ agent obeys.
10
+
11
+ harnessguard enforces Microsoft's **[Agents Rule of Two](https://www.microsoft.com/en-us/security/blog/2026/06/05/securing-ci-cd-in-agentic-world-claude-code-github-action-case)**:
12
+ an AI-powered workflow must never combine untrusted input, privileged access,
13
+ and external communication. It runs as a **static, deterministic** check in
14
+ pull requests — it never executes your workflows or your agents.
15
+
16
+ ## Why
17
+
18
+ Real incidents, all from 2026:
19
+
20
+ - **Comment and Control** (April 2026) — hijacked Claude Code Security Review,
21
+ Gemini CLI Action and Copilot Agent via PR titles / issue bodies; leaked
22
+ `ANTHROPIC_API_KEY`, `GEMINI_API_KEY` and `GITHUB_TOKEN` through public
23
+ comments.
24
+ - **Black Hat USA 2026** (August) — an unprivileged GitHub issue reached CI
25
+ runner secrets in the vendors' own repositories; Gemini CLI Action got
26
+ CVE-2026-12537 (CVSS 10.0).
27
+ - **MSRC** — Claude Code Action's Read tool reached `/proc/self/environ`;
28
+ fixed in 2.1.128.
29
+
30
+ Existing Actions linters (`zizmor`, `actionlint`, `poutine`…) are excellent
31
+ but agent-blind: they don't model "this step is an LLM that will obey text."
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ pip install harnessguard
37
+ # or from source
38
+ uv sync && uv run harnessguard --version
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ```bash
44
+ # scan the current repo (finds .github/workflows/)
45
+ harnessguard scan .
46
+
47
+ # fail CI on high and above, write SARIF for code scanning
48
+ harnessguard scan . --fail-on high --sarif harnessguard.sarif
49
+
50
+ # machine-readable output
51
+ harnessguard scan . --format json
52
+
53
+ # list rules
54
+ harnessguard rules list
55
+ ```
56
+
57
+ Exit code is 1 when findings at or above `--fail-on` exist. `--fail-on none`
58
+ reports without failing.
59
+
60
+ ### GitHub Action
61
+
62
+ ```yaml
63
+ name: harnessguard
64
+ on: [push, pull_request]
65
+
66
+ jobs:
67
+ harnessguard:
68
+ runs-on: ubuntu-latest
69
+ permissions:
70
+ contents: read
71
+ security-events: write
72
+ steps:
73
+ - uses: actions/checkout@v4
74
+ - uses: dtduc-git/harnessguard@main
75
+ with:
76
+ fail-on: high
77
+ ```
78
+
79
+ ## Rules
80
+
81
+ | Rule | Severity | What it catches |
82
+ |-------|----------|-----------------|
83
+ | HG001 | critical | Agent step on untrusted events with secrets in scope |
84
+ | HG002 | high | Attacker-controlled event data interpolated into an agent step |
85
+ | HG003 | high | Agent step on untrusted events with write permissions |
86
+ | HG004 | high | Agent step in a `pull_request_target` workflow |
87
+ | HG005 | medium | Agent step with shell/network tool grants or egress commands |
88
+
89
+ Findings map to the OWASP Top 10 for Agentic Applications (ASI01–ASI03).
90
+ Rules are data — YAML in `src/harnessguard/rules_data/` — and checks are small
91
+ named functions in `checks.py`. Add your own with `--rules-dir`.
92
+
93
+ ## Design principles
94
+
95
+ - **Never executes anything.** No workflow runs, no agent calls, no network.
96
+ - **Local-first.** No account, no telemetry, no SaaS.
97
+ - **Deterministic.** Same input → same findings; no LLM in the detection path.
98
+ - **Rules as data.** Extend coverage without touching the engine.
99
+
100
+ ## Non-goals
101
+
102
+ - Not a general-purpose Actions linter — use zizmor alongside it.
103
+ - No runtime enforcement or proxy — that is a different (complementary) tool.
104
+ - Not GitLab/Jenkins (yet).
105
+
106
+ ## References
107
+
108
+ - Microsoft Security Blog — *Securing CI/CD in an agentic world* (Agents Rule
109
+ of Two), June 2026
110
+ - CSA — *Comment and Control: GitHub AI Agents as Credential Exfiltrators*,
111
+ April 2026
112
+ - OWASP — Top 10 for Agentic Applications 2026
113
+
114
+ ## License
115
+
116
+ Apache-2.0
@@ -0,0 +1,13 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Please report vulnerabilities privately via GitHub Security Advisories:
6
+ https://github.com/dtduc-git/harnessguard/security/advisories/new
7
+
8
+ Do not open a public issue for security problems.
9
+
10
+ ## Scope
11
+
12
+ harnessguard is a static analyzer. It never executes scanned workflows, agents
13
+ or MCP servers, and it makes no network requests during a scan.
@@ -0,0 +1,41 @@
1
+ name: harnessguard
2
+ description: Static hardening linter for GitHub Actions workflows that run AI agents. Never executes anything.
3
+ author: dtduc-git
4
+ branding:
5
+ icon: shield
6
+ color: red
7
+
8
+ inputs:
9
+ paths:
10
+ description: Files or directories to scan
11
+ required: false
12
+ default: "."
13
+ fail-on:
14
+ description: "Exit 1 at this severity or above: critical | high | medium | low | info | none"
15
+ required: false
16
+ default: "high"
17
+ sarif-file:
18
+ description: SARIF output path
19
+ required: false
20
+ default: "harnessguard.sarif"
21
+
22
+ runs:
23
+ using: composite
24
+ steps:
25
+ - uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.12"
28
+ - name: Install harnessguard
29
+ shell: bash
30
+ run: pip install harnessguard || pip install "git+https://github.com/dtduc-git/harnessguard"
31
+ - name: Scan
32
+ shell: bash
33
+ run: |
34
+ harnessguard scan ${{ inputs.paths }} \
35
+ --fail-on ${{ inputs.fail-on }} \
36
+ --sarif ${{ inputs.sarif-file }}
37
+ - name: Upload SARIF
38
+ if: always()
39
+ uses: github/codeql-action/upload-sarif@v3
40
+ with:
41
+ sarif_file: ${{ inputs.sarif-file }}
@@ -0,0 +1,22 @@
1
+ name: Release notes agent
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ version:
6
+ description: Release version
7
+ required: true
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ notes:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - name: Draft notes
18
+ uses: anthropics/claude-code-action@v1
19
+ with:
20
+ anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
21
+ prompt: "Draft release notes for version ${{ inputs.version }}"
22
+ claude_args: '--allowedTools "Read"'
@@ -0,0 +1,12 @@
1
+ name: PR review agent
2
+ on: pull_request_target
3
+
4
+ jobs:
5
+ review:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v4
9
+ with:
10
+ ref: ${{ github.event.pull_request.head.ref }}
11
+ - name: Gemini review
12
+ run: npx @google/gemini-cli --prompt "Review the diff in this pull request"
@@ -0,0 +1,20 @@
1
+ name: Issue triage agent
2
+ on:
3
+ issues:
4
+ types: [opened]
5
+
6
+ permissions:
7
+ contents: write
8
+ issues: write
9
+
10
+ jobs:
11
+ triage:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Claude triage
16
+ uses: anthropics/claude-code-action@v1
17
+ with:
18
+ anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
19
+ prompt: "Triage this issue: ${{ github.event.issue.title }} — ${{ github.event.issue.body }}"
20
+ claude_args: '--allowedTools "Bash,Write,Read"'