horustrace 0.4.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 (75) hide show
  1. horustrace-0.4.0/LICENSE +202 -0
  2. horustrace-0.4.0/PKG-INFO +430 -0
  3. horustrace-0.4.0/README.md +401 -0
  4. horustrace-0.4.0/pyproject.toml +48 -0
  5. horustrace-0.4.0/setup.cfg +4 -0
  6. horustrace-0.4.0/src/horustrace/__init__.py +1 -0
  7. horustrace-0.4.0/src/horustrace/adapters/__init__.py +0 -0
  8. horustrace-0.4.0/src/horustrace/adapters/adk_config.py +215 -0
  9. horustrace-0.4.0/src/horustrace/adapters/google_adk.py +961 -0
  10. horustrace-0.4.0/src/horustrace/adapters/iac_identity.py +101 -0
  11. horustrace-0.4.0/src/horustrace/adapters/langgraph.py +256 -0
  12. horustrace-0.4.0/src/horustrace/adapters/manifest.py +262 -0
  13. horustrace-0.4.0/src/horustrace/adapters/mcp_config.py +78 -0
  14. horustrace-0.4.0/src/horustrace/adapters/openai_agents.py +361 -0
  15. horustrace-0.4.0/src/horustrace/adapters/registry.py +44 -0
  16. horustrace-0.4.0/src/horustrace/adapters/repository_adk.py +990 -0
  17. horustrace-0.4.0/src/horustrace/adg.py +542 -0
  18. horustrace-0.4.0/src/horustrace/aibom.py +66 -0
  19. horustrace-0.4.0/src/horustrace/analysis.py +277 -0
  20. horustrace-0.4.0/src/horustrace/benchmark.py +243 -0
  21. horustrace-0.4.0/src/horustrace/cli.py +288 -0
  22. horustrace-0.4.0/src/horustrace/config.py +90 -0
  23. horustrace-0.4.0/src/horustrace/coverage.py +169 -0
  24. horustrace-0.4.0/src/horustrace/flow.py +661 -0
  25. horustrace-0.4.0/src/horustrace/heuristics.py +110 -0
  26. horustrace-0.4.0/src/horustrace/limits.py +57 -0
  27. horustrace-0.4.0/src/horustrace/manifest_schema.py +63 -0
  28. horustrace-0.4.0/src/horustrace/models.py +459 -0
  29. horustrace-0.4.0/src/horustrace/path_safety.py +20 -0
  30. horustrace-0.4.0/src/horustrace/provenance.py +216 -0
  31. horustrace-0.4.0/src/horustrace/reporters/__init__.py +0 -0
  32. horustrace-0.4.0/src/horustrace/reporters/console.py +110 -0
  33. horustrace-0.4.0/src/horustrace/reporters/sarif.py +155 -0
  34. horustrace-0.4.0/src/horustrace/rule_registry.py +137 -0
  35. horustrace-0.4.0/src/horustrace/rules/__init__.py +0 -0
  36. horustrace-0.4.0/src/horustrace/rules/builtin.py +335 -0
  37. horustrace-0.4.0/src/horustrace/scanner.py +529 -0
  38. horustrace-0.4.0/src/horustrace/suppressions.py +217 -0
  39. horustrace-0.4.0/src/horustrace.egg-info/PKG-INFO +430 -0
  40. horustrace-0.4.0/src/horustrace.egg-info/SOURCES.txt +73 -0
  41. horustrace-0.4.0/src/horustrace.egg-info/dependency_links.txt +1 -0
  42. horustrace-0.4.0/src/horustrace.egg-info/entry_points.txt +2 -0
  43. horustrace-0.4.0/src/horustrace.egg-info/requires.txt +5 -0
  44. horustrace-0.4.0/src/horustrace.egg-info/top_level.txt +1 -0
  45. horustrace-0.4.0/tests/test_adversarial_scanning.py +44 -0
  46. horustrace-0.4.0/tests/test_analysis_interactions.py +125 -0
  47. horustrace-0.4.0/tests/test_attack_path_confidence.py +63 -0
  48. horustrace-0.4.0/tests/test_benchmark.py +206 -0
  49. horustrace-0.4.0/tests/test_cli_rules.py +53 -0
  50. horustrace-0.4.0/tests/test_config.py +32 -0
  51. horustrace-0.4.0/tests/test_config_suppression_order.py +38 -0
  52. horustrace-0.4.0/tests/test_control_semantics.py +144 -0
  53. horustrace-0.4.0/tests/test_coverage.py +94 -0
  54. horustrace-0.4.0/tests/test_dynamic_coverage.py +74 -0
  55. horustrace-0.4.0/tests/test_evidence_semantics.py +194 -0
  56. horustrace-0.4.0/tests/test_google_adk.py +255 -0
  57. horustrace-0.4.0/tests/test_layers.py +130 -0
  58. horustrace-0.4.0/tests/test_manifest.py +49 -0
  59. horustrace-0.4.0/tests/test_manifest_errors.py +62 -0
  60. horustrace-0.4.0/tests/test_manifest_schema.py +35 -0
  61. horustrace-0.4.0/tests/test_mcp_config.py +39 -0
  62. horustrace-0.4.0/tests/test_openai_adapter.py +62 -0
  63. horustrace-0.4.0/tests/test_owasp_mappings.py +41 -0
  64. horustrace-0.4.0/tests/test_path_safety.py +68 -0
  65. horustrace-0.4.0/tests/test_reachability_regressions.py +92 -0
  66. horustrace-0.4.0/tests/test_rule_registry.py +94 -0
  67. horustrace-0.4.0/tests/test_sarif.py +19 -0
  68. horustrace-0.4.0/tests/test_scanner_limits.py +70 -0
  69. horustrace-0.4.0/tests/test_suppressions.py +264 -0
  70. horustrace-0.4.0/tests/test_v03_public_regressions.py +387 -0
  71. horustrace-0.4.0/tests/test_v04_adapter_registry.py +65 -0
  72. horustrace-0.4.0/tests/test_v04_adg.py +62 -0
  73. horustrace-0.4.0/tests/test_v04_flow.py +163 -0
  74. horustrace-0.4.0/tests/test_v04_frameworks.py +99 -0
  75. horustrace-0.4.0/tests/test_v04_langgraph.py +33 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,430 @@
1
+ Metadata-Version: 2.4
2
+ Name: horustrace
3
+ Version: 0.4.0
4
+ Summary: Policy-as-code security analysis for AI agents
5
+ Author: HorusTrace contributors
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/psandhir/horustrace
8
+ Project-URL: Repository, https://github.com/psandhir/horustrace
9
+ Project-URL: Issues, https://github.com/psandhir/horustrace/issues
10
+ Project-URL: Security, https://github.com/psandhir/horustrace/security/policy
11
+ Keywords: ai-security,agents,mcp,openai,google-adk,gcp,security,static-analysis
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Security
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: PyYAML<7,>=6.0.2
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest<9,>=8.3; extra == "dev"
27
+ Requires-Dist: ruff<1,>=0.12; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # HorusTrace
31
+
32
+ [![CI](https://github.com/psandhir/horustrace/actions/workflows/ci.yml/badge.svg)](https://github.com/psandhir/horustrace/actions/workflows/ci.yml)
33
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
34
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue.svg)](pyproject.toml)
35
+
36
+ **Five-layer policy-as-code security analysis for AI agents.**
37
+
38
+ HorusTrace statically discovers agent configuration and evaluates five connected security layers:
39
+
40
+ 1. **Agent configuration** — tools, approvals, guardrails, MCP, code execution and framework-specific controls.
41
+ 2. **Capability analysis** — effective authority, capability budgets, prohibited actions and dangerous combinations.
42
+ 3. **Identity & permissions** — cloud/IAM roles, wildcard permissions, OAuth scopes and credential source.
43
+ 4. **Data & network reachability** — sensitive resources, resource scope, outbound destinations and allowlist violations.
44
+ 5. **Attack-path analysis** — potential risk combinations such as untrusted content → delegated agent → shell, or confidential data → agent → external write.
45
+
46
+ > Status: **v0.4 development** on the `v0.4-dev` branch; this branch is being prepared for the first HorusTrace v0.4.0 release. Findings are deterministic within supported constructs. HorusTrace does not prove runtime exploitability or complete live cloud authority.
47
+
48
+ ## Security model
49
+
50
+ ```text
51
+ What is configured?
52
+
53
+ What can the agent do directly or through delegation?
54
+
55
+ What authority does its identity have?
56
+
57
+ What data/resources/destinations are reachable?
58
+
59
+ Which end-to-end attack paths exist?
60
+ ```
61
+
62
+ The scanner is **static-first and local-first**. It does not import target Python modules and does not launch MCP servers or agents.
63
+
64
+ ## Current framework/input coverage
65
+
66
+ - **Google Agent Development Kit (ADK) Python 2.x — first-class adapter**.
67
+ - **Google ADK Agent Config YAML** (`root_agent.yaml` and related agent configs).
68
+ - OpenAI Agents SDK Python constructs, including v0.4 handoff normalization.
69
+ - Initial LangGraph `StateGraph` / `MessageGraph` normalization in v0.4 development.
70
+ - Common MCP JSON configuration (`mcp.json`, `.mcp.json`).
71
+ - Framework-neutral `horustrace.manifest.yaml` for business/security intent.
72
+ - Terraform (`.tf`) for an initial GCP/Azure/AWS IAM view.
73
+ - ADK `.env` credential-source checks without exposing secret values in findings.
74
+
75
+ ## Google ADK coverage
76
+
77
+ The v0.3 release (published as HorusTrace) performs repository-aware analysis of security-relevant ADK composition rather than only matching individual `Agent(...)` declarations.
78
+
79
+ ### Agents and orchestration
80
+
81
+ - `Agent` / `LlmAgent`.
82
+ - `SequentialAgent`, `ParallelAgent`, `LoopAgent`.
83
+ - `sub_agents` and transitive delegated authority.
84
+ - `AgentTool` delegation and `include_plugins` isolation.
85
+ - `RemoteA2aAgent` consumption and `to_a2a(...)` exposure.
86
+ - transfer restrictions and workflow metadata.
87
+ - cross-file Python/config delegation aliases.
88
+
89
+ ### Tools and execution
90
+
91
+ - plain Python functions used as ADK tools.
92
+ - `FunctionTool`, `LongRunningFunctionTool`, `AuthenticatedFunctionTool`.
93
+ - `require_confirmation`.
94
+ - `ExecuteBashTool` and `BashToolPolicy`.
95
+ - `EnvironmentToolset` / `LocalEnvironment`.
96
+ - `UnsafeLocalCodeExecutor`, `BuiltInCodeExecutor`, `AgentEngineSandboxCodeExecutor`, `GkeCodeExecutor`.
97
+ - `ComputerUseToolset`.
98
+ - BigQuery/Bigtable/Data Agent toolsets.
99
+ - Google API/Gmail/Calendar/Docs/Sheets/Slides/YouTube toolsets.
100
+ - search/retrieval tools and inferred untrusted external content.
101
+ - OpenAPI/API Hub/Application Integration/REST-style tool surfaces.
102
+ - memory/artifact/MCP-resource tools represented as data capabilities.
103
+
104
+ ### MCP
105
+
106
+ - `McpToolset` / `MCPToolset`.
107
+ - stdio, SSE and Streamable HTTP connection parameters.
108
+ - URL/transport analysis.
109
+ - auth scheme/credential/header-provider detection.
110
+ - recognized authorization headers.
111
+ - tool filters.
112
+ - confirmation requirements.
113
+
114
+ ### Safety controls
115
+
116
+ - `before_agent_callback`, `after_agent_callback`.
117
+ - `before_model_callback`, `after_model_callback`.
118
+ - `before_tool_callback`, `after_tool_callback`.
119
+ - model/tool error callbacks.
120
+ - security/safety/policy-style plugins attached through `App`/`Runner`.
121
+ - tool-level confirmation.
122
+
123
+ ### Google identity context
124
+
125
+ - `google.auth.default(scopes=...)`.
126
+ - service-account-file use.
127
+ - ADK credentials config objects.
128
+ - Google API toolset `additional_scopes`.
129
+ - client-secret literals (reported without secret material).
130
+ - `.env` API-key/service-account-file indicators.
131
+ - Terraform GCP IAM bindings feeding Layer 3.
132
+
133
+ See [`docs/google-adk.md`](docs/google-adk.md) for the exact supported surface and limitations.
134
+
135
+ ## Quick start
136
+
137
+
138
+ ```bash
139
+ python -m venv .venv
140
+ source .venv/bin/activate
141
+ pip install horustrace
142
+ horustrace scan .
143
+ ```
144
+
145
+ List the built-in rule catalogue without scanning a project:
146
+
147
+ ```bash
148
+ horustrace rules
149
+ horustrace rules --format json --output rules.json
150
+ ```
151
+
152
+ ### ADK demo
153
+
154
+ ```bash
155
+ horustrace scan examples/google-adk-vulnerable --fail-on none
156
+ horustrace scan examples/google-adk-secure --fail-on none
157
+ ```
158
+
159
+ The vulnerable ADK fixture intentionally exercises all five layers. The secure fixture should return zero findings under the current rule catalogue.
160
+
161
+ Generate SARIF:
162
+
163
+ ```bash
164
+ horustrace scan . --format sarif --output horustrace.sarif --fail-on none
165
+ ```
166
+
167
+ Fail CI on high/critical findings:
168
+
169
+ ```bash
170
+ horustrace scan . --fail-on high
171
+ ```
172
+
173
+ Malformed, unreadable, or structurally invalid policy manifests stop the scan with exit
174
+ code 1 and an error on stderr. This also applies with `--fail-on none`; that option
175
+ only disables failure for security findings. No report is written for a failed scan.
176
+
177
+ ### Coverage and strict CI
178
+
179
+ ```bash
180
+ horustrace scan . --strict --format json --output report.json
181
+ ```
182
+
183
+ All report formats include file counts and coverage diagnostics. JSON exposes a
184
+ `coverage` object; SARIF exposes coverage in run properties and diagnostics as tool
185
+ execution notifications. Console output separates coverage from findings by layer.
186
+ `--strict` returns exit code 1 for detected incomplete analysis, regardless of
187
+ `--fail-on`. Unlike a fatal manifest error, incomplete analysis still writes the
188
+ report so CI can retain the diagnostics. Security threshold failures return exit
189
+ code 2; incomplete analysis takes precedence in strict mode.
190
+
191
+ Diagnostics use stable `ARG-COV-*` identifiers and currently cover read/parse
192
+ failures, unresolved Python tool/MCP references, unresolved delegation, dynamic
193
+ agent configuration sequences or expanded keyword arguments, unresolved external
194
+ helper semantics, dynamic MCP endpoints/tool filters, unknown MCP authentication
195
+ state, and scans with no supported security targets.
196
+ Files in default ignored directories, and subtrees containing an
197
+ `.horustrace-ignore` marker, are excluded from file counts. Other unsupported
198
+ file types are counted as skipped. A scanned file was read and parsed;
199
+ that count does not mean its entire application behavior was understood.
200
+
201
+ No detected coverage gaps is not proof of complete analysis. Runtime-generated
202
+ behavior, arbitrary function semantics, cloud authorization, and control effectiveness
203
+ remain outside these diagnostics. A clean report means no supported rules triggered.
204
+
205
+ ### Fingerprints, baselines and suppressions
206
+
207
+ Every finding has an `arg-v1:` fingerprint based on its rule, agent, repository-relative
208
+ path, and evidence. Line numbers and checkout roots are excluded, so fingerprints
209
+ survive routine source movement and different CI workspaces. A material evidence or
210
+ scope change produces a new fingerprint.
211
+
212
+ Create an initial baseline of current findings:
213
+
214
+ ```bash
215
+ horustrace baseline . \
216
+ --output .horustrace.suppressions.yaml \
217
+ --reason "Initial adoption backlog SEC-42" \
218
+ --expires 2026-12-31
219
+ ```
220
+
221
+ Baseline creation scans without applying existing suppressions. It requires a reason
222
+ and a non-past expiry and refuses to replace an existing file unless `--force` is
223
+ passed. It also refuses to write when coverage diagnostics show incomplete analysis.
224
+ Review the generated entries before committing them; a baseline records
225
+ temporary risk acceptance rather than making the findings safe.
226
+
227
+ Suppression files use this schema:
228
+
229
+ ```yaml
230
+ version: 1
231
+ suppressions:
232
+ - id: accepted-shell-migration
233
+ reason: Temporary migration path owned by SEC-42
234
+ expires: 2026-12-31
235
+ fingerprint: arg-v1:0123456789abcdef01234567
236
+ rule_id: AGT020
237
+ ```
238
+
239
+ A fingerprint is the narrowest scope. A rule suppression without a fingerprint must
240
+ also specify `agent` or a repository-relative `path` glob. IDs, reasons, and expiry
241
+ dates are mandatory; unknown fields and duplicate IDs or YAML keys fail closed.
242
+ IDs use letters, digits, dots, underscores, and dashes; reasons are single-line;
243
+ path scopes cannot be absolute or escape the scan root.
244
+ Expired entries never hide findings. Stale, matched, and expired entries remain in
245
+ console, JSON, and SARIF audit output. `--strict` also fails when an exception has
246
+ expired. Use `--suppressions path/to/file.yaml` to select a non-default file.
247
+
248
+ ### Reviewed benchmark
249
+
250
+ ```bash
251
+ horustrace benchmark benchmarks/cases.yaml
252
+ ```
253
+
254
+ The reviewed corpus declares the exact `RULE@agent` findings expected for each case.
255
+ Unexpected findings are measured as false positives and missing findings as false
256
+ negatives. The v0.3 corpus contains 26 reviewed scenarios across secure, execution,
257
+ delegation, MCP, identity, data/network, attack-path and dynamic/unresolved analysis.
258
+ One case intentionally expects incomplete analysis and an exact coverage diagnostic;
259
+ all other cases fail on incomplete coverage. The command exits nonzero on any drift
260
+ and supports `--format json` for CI artifacts. See
261
+ [`benchmarks/README.md`](benchmarks/README.md).
262
+
263
+ ### Evidence and control semantics
264
+
265
+ Findings retain their rule IDs and severity thresholds and now include:
266
+
267
+ - `assessment`: `static_configuration`, `policy_violation`, `heuristic_risk`, or
268
+ `potential_risk`.
269
+ - `provenance`: facts with a subject, origin, and source location. `observed` means
270
+ a supported static configuration was discovered; `declared` means a manifest
271
+ assertion; `inferred` means a heuristic or derived relationship.
272
+ - `limitations`: uncertainty about runtime authority, controls, and exploitability.
273
+
274
+ Configuration findings include local evidence; aggregate capability/data/path
275
+ findings include agent context, which is not a formal data-flow trace. A manifest
276
+ policy violation may involve declared or inferred capabilities; it does not establish
277
+ runtime authority. Function capabilities are heuristic, while recognized built-in
278
+ capabilities follow the scanner's supported static semantics.
279
+
280
+ `control_observations` in JSON and SARIF distinguish approval configuration,
281
+ callback hooks, plugin-name inference, sandbox configuration, and possible network
282
+ destinations. For supported ADK and MCP configuration, they also record static
283
+ evidence of sandbox timeout/network/filesystem limits, Bash allowlist plus blocklist
284
+ policies, MCP tool allowlists, and whether every discovered egress destination fits
285
+ a declared allowlist. Their runtime effectiveness is always `not_verified`.
286
+ Callback or plugin presence can satisfy a missing-hook rule, but does not prove that
287
+ arbitrary callback/plugin code authorizes actions safely. Approval callbacks alone
288
+ do not establish an approval requirement. Mixed hosted-MCP approval policies are
289
+ treated as unknown rather than blanket approval.
290
+
291
+ Attack paths are labeled potential risks with `basis: capability_cooccurrence` and
292
+ `exploitability: not_verified`. Their severity reflects potential impact, not proven
293
+ exploitability. A literal URL inside a function establishes a possible destination,
294
+ not an egress allowlist; such functions now trigger the missing-restriction rule.
295
+ No runtime enforcement is inferred from those literals.
296
+
297
+ ### Manifest schema
298
+
299
+ Manifests support schema version `1`. Omitting `version` retains the legacy v1
300
+ behavior. Unknown fields, unsupported versions, duplicate YAML keys, invalid nested
301
+ types, cyclic YAML aliases, and negative capability limits are rejected. Approval,
302
+ guardrail, authentication, and restriction fields require actual booleans;
303
+ capability/scope fields accept strings or lists of strings. Policy errors identify
304
+ the field and source line/column without printing its value. Existing documented
305
+ field aliases remain supported. The schema definitions live in
306
+ [`manifest_schema.py`](src/horustrace/manifest_schema.py).
307
+
308
+
309
+ ## ADK-specific rule highlights
310
+
311
+ - `ADK001` — privileged ADK agent lacks a detected tool-control callback/plugin/confirmation boundary.
312
+ - `ADK002` — unsafe local code executor.
313
+ - `ADK003` — `LocalEnvironment` exposes local shell/file I/O.
314
+ - `ADK004` — bash execution without a detected restrictive `BashToolPolicy`.
315
+ - `ADK012` — sandboxed code execution lacks an explicit timeout, network, or filesystem limit.
316
+ - `ADK005` — computer-use capability lacks an explicit action boundary.
317
+ - `ADK006` — BigQuery write capability is not statically blocked.
318
+ - `ADK007` — broad generated/API toolset without a tool filter.
319
+ - `ADK008` — delegated `AgentTool` disables inherited plugins.
320
+ - `ADK009` — remote A2A agent card uses plaintext HTTP.
321
+ - `ADK010` — remote A2A agent has no detected authentication.
322
+ - `ADK011` — privileged agent is exposed over A2A without a detected safety control.
323
+
324
+ These run in addition to the framework-neutral AGT/CAP/IDN/DATA/NET/PATH rules.
325
+
326
+ ## Framework-neutral security manifest
327
+
328
+ The manifest declares business intent and runtime context that static source parsing cannot prove:
329
+
330
+ ```yaml
331
+ version: 1
332
+ agents:
333
+ - name: invoice-agent
334
+
335
+ inputs:
336
+ - name: supplier-portal
337
+ kind: web
338
+ trust: untrusted
339
+
340
+ data:
341
+ - name: invoices
342
+ classification: confidential
343
+ selector: /finance/invoices/**
344
+
345
+ identities:
346
+ - name: invoice-agent-sa
347
+ provider: gcp
348
+ roles: [roles/storage.objectViewer]
349
+ resource_scope: projects/acme/buckets/invoices
350
+ credential_source: workload_identity
351
+
352
+ network:
353
+ - target: https://erp.example.com/**
354
+ restricted: true
355
+
356
+ policy:
357
+ required: [data.read, external.write, network.external]
358
+ denied_capabilities: [process.execute, destructive.write]
359
+ allowed_resources: [/finance/invoices/**]
360
+ allowed_destinations: [https://erp.example.com/**]
361
+ require_approval_for: [external.write]
362
+ max_privileged_capabilities: 1
363
+ ```
364
+
365
+ This enables least-privilege comparison between **required** and **effective** capabilities and lets Layers 4–5 reason about data and network paths.
366
+
367
+ ## GitHub Action
368
+
369
+ ```yaml
370
+ - uses: psandhir/horustrace@v0.4.0
371
+ with:
372
+ path: .
373
+ fail-on: high
374
+ strict: "true"
375
+ suppressions: .horustrace.suppressions.yaml
376
+ ```
377
+
378
+ ## Design principles
379
+
380
+ 1. **Do not execute the target.** Static analysis must be safe on untrusted repositories.
381
+ 2. **Separate observation from policy.** Adapters discover facts; policy adds business/security intent.
382
+ 3. **Analyse effective authority.** Direct and delegated tool combinations matter more than isolated calls.
383
+ 4. **Connect identity, data and egress.** Agent risk is an end-to-end property.
384
+ 5. **Explain the path.** Findings include nodes forming the attack chain.
385
+ 6. **Prefer deterministic CI findings.** Semantic/LLM analysis can be additive later.
386
+
387
+ ## Scope boundary
388
+
389
+ The Google ADK adapter is intended to be comprehensive for **security-relevant static constructs in current Python ADK 2.x and native Agent Config YAML**. It is not a claim that arbitrary third-party tool implementations, dynamically generated Python, runtime cloud authorization, or separate Java/Go/JavaScript/Kotlin ADK SDK syntax is fully analysed. Those require dedicated adapters or runtime/cloud-control-plane enrichment.
390
+
391
+ HorusTrace is not a runtime firewall, formal taint verifier, malware scanner or proof that a prompt injection is exploitable. It does not execute the application or call cloud control planes during a normal scan.
392
+
393
+ ## Project roadmap
394
+
395
+ See [ROADMAP.md](ROADMAP.md) for planned live GCP authority resolution, change-aware analysis, reachability enrichment, and framework expansion.
396
+
397
+ ## Support
398
+
399
+ See [SUPPORT.md](SUPPORT.md).
400
+
401
+ ## Security
402
+
403
+ See [SECURITY.md](SECURITY.md).
404
+
405
+ ## Contributing
406
+
407
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
408
+
409
+ ## License
410
+
411
+ Apache-2.0. See [LICENSE](LICENSE).
412
+
413
+ ### Repository scanner configuration
414
+
415
+ Use `.horustrace.yaml` to tune scanner policy separately from the security intent manifest and temporary suppressions:
416
+
417
+ ```yaml
418
+ version: 1
419
+ scanner:
420
+ strict: true
421
+ rules:
422
+ ADK007: {severity: high}
423
+ AGT022: {enabled: false}
424
+ ```
425
+
426
+ Use `horustrace scan . --config path/to/config.yaml` to select a file explicitly. Disabled rules are reported separately from suppressions; severity overrides affect reporting and failure thresholds but not rule metadata or finding fingerprints.
427
+
428
+ ### v0.3 release notes
429
+
430
+ v0.3 (released as HorusTrace) moved the project from primarily file-level ADK parsing toward repository-level security reachability analysis. It adds cross-file tool and helper resolution, conservative factory and collection resolution, static MCP constant resolution, improved ADK execution/control semantics, stronger identity and OAuth linkage, and lower-noise network and capability inference. Coverage gaps remain explicit rather than being treated as safe. See [`docs/releases/v0.3.0.md`](docs/releases/v0.3.0.md) for the release summary.