toolgate-io 0.3.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.
- toolgate_io-0.3.0/.github/workflows/ci.yml +18 -0
- toolgate_io-0.3.0/.github/workflows/pages.yml +30 -0
- toolgate_io-0.3.0/.github/workflows/publish.yml +22 -0
- toolgate_io-0.3.0/.gitignore +15 -0
- toolgate_io-0.3.0/CONTRIBUTING.md +34 -0
- toolgate_io-0.3.0/LICENSE +202 -0
- toolgate_io-0.3.0/NOTICE +4 -0
- toolgate_io-0.3.0/PKG-INFO +166 -0
- toolgate_io-0.3.0/README.md +136 -0
- toolgate_io-0.3.0/SECURITY.md +24 -0
- toolgate_io-0.3.0/docs/ARCHITECTURE.md +102 -0
- toolgate_io-0.3.0/docs/DEPLOYMENT.md +75 -0
- toolgate_io-0.3.0/docs/OPERATIONS.md +72 -0
- toolgate_io-0.3.0/docs/QUICKSTART.md +150 -0
- toolgate_io-0.3.0/docs/README.md +15 -0
- toolgate_io-0.3.0/docs/SECURITY.md +67 -0
- toolgate_io-0.3.0/docs/TOKEN-SPEC.md +103 -0
- toolgate_io-0.3.0/docs/adr/0001-delegation-not-impersonation.md +29 -0
- toolgate_io-0.3.0/docs/adr/0002-token-format.md +18 -0
- toolgate_io-0.3.0/docs/adr/0003-storage-and-runtime.md +19 -0
- toolgate_io-0.3.0/docs/adr/0004-approvals-and-audit.md +19 -0
- toolgate_io-0.3.0/docs/adr/0005-python-port.md +23 -0
- toolgate_io-0.3.0/docs/reference/API.md +219 -0
- toolgate_io-0.3.0/docs/reference/CLI.md +90 -0
- toolgate_io-0.3.0/pyproject.toml +64 -0
- toolgate_io-0.3.0/site/app.js +341 -0
- toolgate_io-0.3.0/site/index.html +216 -0
- toolgate_io-0.3.0/site/styles.css +293 -0
- toolgate_io-0.3.0/src/toolgate/__init__.py +3 -0
- toolgate_io-0.3.0/src/toolgate/cli/__init__.py +1 -0
- toolgate_io-0.3.0/src/toolgate/cli/client.py +49 -0
- toolgate_io-0.3.0/src/toolgate/cli/config.py +48 -0
- toolgate_io-0.3.0/src/toolgate/cli/main.py +717 -0
- toolgate_io-0.3.0/src/toolgate/core/__init__.py +152 -0
- toolgate_io-0.3.0/src/toolgate/core/assertion.py +189 -0
- toolgate_io-0.3.0/src/toolgate/core/audit.py +119 -0
- toolgate_io-0.3.0/src/toolgate/core/canonical.py +12 -0
- toolgate_io-0.3.0/src/toolgate/core/errors.py +51 -0
- toolgate_io-0.3.0/src/toolgate/core/ids.py +13 -0
- toolgate_io-0.3.0/src/toolgate/core/keys.py +47 -0
- toolgate_io-0.3.0/src/toolgate/core/policy.py +184 -0
- toolgate_io-0.3.0/src/toolgate/core/token.py +130 -0
- toolgate_io-0.3.0/src/toolgate/core/types.py +284 -0
- toolgate_io-0.3.0/src/toolgate/demo.py +280 -0
- toolgate_io-0.3.0/src/toolgate/sdk/__init__.py +19 -0
- toolgate_io-0.3.0/src/toolgate/sdk/client.py +170 -0
- toolgate_io-0.3.0/src/toolgate/server/__init__.py +15 -0
- toolgate_io-0.3.0/src/toolgate/server/app.py +57 -0
- toolgate_io-0.3.0/src/toolgate/server/context.py +132 -0
- toolgate_io-0.3.0/src/toolgate/server/control.py +364 -0
- toolgate_io-0.3.0/src/toolgate/server/gate.py +376 -0
- toolgate_io-0.3.0/src/toolgate/server/main.py +21 -0
- toolgate_io-0.3.0/src/toolgate/server/store.py +280 -0
- toolgate_io-0.3.0/src/toolgate/server/vault.py +35 -0
- toolgate_io-0.3.0/tests/test_assertion.py +87 -0
- toolgate_io-0.3.0/tests/test_audit.py +80 -0
- toolgate_io-0.3.0/tests/test_cli.py +174 -0
- toolgate_io-0.3.0/tests/test_policy.py +112 -0
- toolgate_io-0.3.0/tests/test_sdk.py +152 -0
- toolgate_io-0.3.0/tests/test_server.py +305 -0
- toolgate_io-0.3.0/tests/test_token.py +92 -0
- toolgate_io-0.3.0/uv.lock +591 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
checks:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: astral-sh/setup-uv@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.13"
|
|
16
|
+
- run: uv sync --dev
|
|
17
|
+
- run: uv run ruff check src tests
|
|
18
|
+
- run: uv run pytest tests/ -q
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Deploy portal
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths: ["site/**"]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pages: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: pages
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
deploy:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
environment:
|
|
22
|
+
name: github-pages
|
|
23
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/upload-pages-artifact@v3
|
|
27
|
+
with:
|
|
28
|
+
path: site
|
|
29
|
+
- id: deployment
|
|
30
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment: pypi
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write # PyPI Trusted Publishing (OIDC) — no stored secrets
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: astral-sh/setup-uv@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.13"
|
|
21
|
+
- run: uv build
|
|
22
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in Toolgate. The project is early and moving fast; this keeps contributions frictionless for everyone.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
- **Everything goes through issues and pull requests.** No direct pushes to `main`.
|
|
8
|
+
- Open or claim an issue before large changes — the [issue tracker](../../issues) is the roadmap.
|
|
9
|
+
- Branch from `main`, keep PRs focused, and reference the issue (`Closes #N`).
|
|
10
|
+
- CI must be green: `ruff check` + the full test suite.
|
|
11
|
+
|
|
12
|
+
## Development setup
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
uv sync
|
|
16
|
+
uv run ruff check src tests
|
|
17
|
+
uv run pytest tests/ -q
|
|
18
|
+
uv run toolgate-demo # end-to-end sanity
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Ground rules
|
|
22
|
+
|
|
23
|
+
- **Security-sensitive code** (`toolgate/core/token.py`, `toolgate/core/assertion.py`, `toolgate/core/audit.py`, the gate pipeline) requires tests for every behavior change — including the negative cases (theft, replay, tamper).
|
|
24
|
+
- The wire format (camelCase fields, token claims, endpoints) is a compatibility surface; changes to it need an ADR in `docs/adr/`.
|
|
25
|
+
- New behavior ships with documentation (`docs/`), not just code.
|
|
26
|
+
- No credentials, tokens, or real endpoints in code, tests, fixtures, or issue text — ever.
|
|
27
|
+
|
|
28
|
+
## Reporting security issues
|
|
29
|
+
|
|
30
|
+
Do **not** open public issues for exploitable findings — see [SECURITY.md](SECURITY.md).
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
By contributing you agree that your contributions are licensed under the [Apache License 2.0](LICENSE).
|
|
@@ -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.
|
toolgate_io-0.3.0/NOTICE
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: toolgate-io
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Capability control plane for embedded AI agents: scoped tokens, policy enforcement, credential injection, signed audit.
|
|
5
|
+
Project-URL: Homepage, https://maglionejm.github.io/toolgate/
|
|
6
|
+
Project-URL: Documentation, https://github.com/maglionejm/toolgate/blob/main/docs/README.md
|
|
7
|
+
Project-URL: Repository, https://github.com/maglionejm/toolgate
|
|
8
|
+
Project-URL: Issues, https://github.com/maglionejm/toolgate/issues
|
|
9
|
+
Author: Juan Martin Maglione
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: ai-agents,audit,capability-tokens,delegation,oauth,security
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Framework :: FastAPI
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: cryptography>=43
|
|
22
|
+
Requires-Dist: fastapi>=0.115
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: jwcrypto>=1.5.6
|
|
25
|
+
Requires-Dist: pydantic>=2.8
|
|
26
|
+
Requires-Dist: rich>=15.0.0
|
|
27
|
+
Requires-Dist: typer>=0.27.2
|
|
28
|
+
Requires-Dist: uvicorn>=0.30
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# Toolgate
|
|
32
|
+
|
|
33
|
+
**The capability control plane for embedded AI agents.**
|
|
34
|
+
|
|
35
|
+
[](https://github.com/maglionejm/toolgate/actions/workflows/ci.yml)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
[](pyproject.toml)
|
|
38
|
+
|
|
39
|
+
**Portal & live simulation: [maglionejm.github.io/toolgate](https://maglionejm.github.io/toolgate/)** — try the gate and tamper with a real hash chain in your browser.
|
|
40
|
+
|
|
41
|
+
Agents should never hold credentials — not the user's OAuth token, not a tenant API key, not anything. Toolgate sits between agents and the tools they call:
|
|
42
|
+
|
|
43
|
+
- the agent authenticates with **its own Ed25519 key** and a **delegation grant** from a human;
|
|
44
|
+
- it receives **short-lived capability tokens** (`sub` = the human, `act.sub` = the agent, RFC 8693 semantics) that are useless if stolen (proof-of-possession bound);
|
|
45
|
+
- every tool call is **policy-checked** (allow / deny / require human approval), **metered** against the grant's budget, and executed by the gate, which **injects the real credential server-side**;
|
|
46
|
+
- every decision — including denials — lands in a **hash-chained, Ed25519-signed audit trail**.
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Agent (no secrets) ── token + one-time proof ──▶ GATE ── real credential ──▶ Upstream API
|
|
50
|
+
│
|
|
51
|
+
verify → decide → budget → inject → execute → audit
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Try it
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
uvx --from toolgate-io toolgate demo # zero-install, straight from PyPI
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
or from source:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv sync
|
|
64
|
+
uv run toolgate demo
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The demo boots Toolgate plus two credential-guarded mock APIs and runs a six-act scenario: an allowed CRM read (the upstream rejects anything without its live key — proving injection), a policy denial, an external email parked for human approval and executed against the approved args only, budget exhaustion, revocation that kills a live token instantly, and audit chain verification with the full decision trace.
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
[OK ] read_contact executed -> {'contact': {...}}
|
|
71
|
+
[DENIED ] TG_DENIED: matched deny rule never-delete
|
|
72
|
+
[PARKED ] approval apr_... pending — agent is blocked, not trusted
|
|
73
|
+
[HUMAN ] Sam approved the exact parked arguments (args are hash-bound)
|
|
74
|
+
[OK ] send_email executed after approval
|
|
75
|
+
[BUDGET ] blocked: delegation grant budget exhausted
|
|
76
|
+
[REVOKED ] TG_REVOKED: live token died with the grant, no TTL wait
|
|
77
|
+
[AUDIT ] chain of 10 records — verification: VALID
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## How it works
|
|
81
|
+
|
|
82
|
+
1. **Register** a tenant, its users, agents (public keys only), and upstreams. Upstream credentials are sealed into the vault (AES-256-GCM) and never leave the server.
|
|
83
|
+
2. **Delegate**: a user grants an agent bounded authority — which upstreams/tools (RFC 9396-style `authorization_details`), what budget (cost units), which policy, until when.
|
|
84
|
+
3. **Exchange**: the agent presents a signed client assertion (RFC 7523 style) and receives a capability token — TTL ~2 minutes with jitter, audience-bound, sender-constrained via `cnf.jkt`.
|
|
85
|
+
4. **Call**: each gate call carries the token plus a one-time DPoP-style proof signed by the agent key (bound to method, URL, and token hash; replays rejected).
|
|
86
|
+
5. **Enforce**: token bounds → policy rules (first match wins, glob matching, dot-path argument constraints, cost ceilings) → default deny → atomic budget charge.
|
|
87
|
+
6. **Approve**: `require_approval` parks the call; a human decides on the exact argument set (hash-bound — no post-approval swaps); the agent polls and executes.
|
|
88
|
+
7. **Audit**: every decision appends to a hash chain signed by the gate key. `GET /v1/control/audit/verify` proves nothing was edited, removed, or reordered.
|
|
89
|
+
|
|
90
|
+
## CLI
|
|
91
|
+
|
|
92
|
+
Everything an operator does is a `toolgate` command ([full reference](docs/reference/CLI.md)):
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install toolgate-io
|
|
96
|
+
toolgate init # profile + connectivity check
|
|
97
|
+
toolgate keys generate --out agent-key.json # agent identity (private key stays local)
|
|
98
|
+
toolgate grants create -t tnt_... --user usr_... --agent agt_... \
|
|
99
|
+
--policy pol_... --budget 100 --authz "crm:*" # bounded delegation
|
|
100
|
+
toolgate approvals watch -t tnt_... --by usr_... # interactive human-in-the-loop inbox
|
|
101
|
+
toolgate audit export --out audit.json && toolgate audit verify --file audit.json # offline proof
|
|
102
|
+
toolgate dev call crm read_contact --grant grt_... --key agent-key.json # act as the agent
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Agent-side SDK
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from toolgate.sdk import ToolgateClient, PendingApproval, generate_ed25519_key_pair
|
|
109
|
+
|
|
110
|
+
client = ToolgateClient(
|
|
111
|
+
base_url=base_url,
|
|
112
|
+
agent_id=agent_id,
|
|
113
|
+
agent_private_jwk=agent_private_jwk, # the only secret an agent ever holds
|
|
114
|
+
grant_id=grant_id,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
result = client.call("crm", "read_contact", {"contactId": "c-001"})
|
|
118
|
+
if isinstance(result, PendingApproval):
|
|
119
|
+
result = client.wait_for_approval(result.approval_id)
|
|
120
|
+
# Denials, budget exhaustion, and revocation raise typed ToolgateCallError
|
|
121
|
+
# (TG_DENIED / TG_BUDGET_EXCEEDED / TG_REVOKED / TG_PROOF_INVALID / ...).
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Layout
|
|
125
|
+
|
|
126
|
+
| Module | Purpose |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| `toolgate.core` | Capability tokens, client assertions + PoP proofs, policy engine, audit chain |
|
|
129
|
+
| `toolgate.server` | Control plane (registry, grants, token endpoint, approvals, revocation, audit) + gate (enforcement pipeline, vault) |
|
|
130
|
+
| `toolgate.sdk` | Agent-side client: token exchange, signed calls, approval flow, typed errors |
|
|
131
|
+
| `toolgate.demo` | End-to-end scenario (`uv run toolgate-demo`) |
|
|
132
|
+
|
|
133
|
+
## Documentation
|
|
134
|
+
|
|
135
|
+
Full suite in [`docs/`](docs/README.md): [Quickstart](docs/QUICKSTART.md) · [API Reference](docs/reference/API.md) · [Token Spec](docs/TOKEN-SPEC.md) · [Security Model](docs/SECURITY.md) · [Deployment](docs/DEPLOYMENT.md) · [Operations](docs/OPERATIONS.md)
|
|
136
|
+
|
|
137
|
+
## Design
|
|
138
|
+
|
|
139
|
+
- `docs/ARCHITECTURE.md` — components, token design, threat model
|
|
140
|
+
- `docs/adr/0001` — delegation, never user-credential impersonation
|
|
141
|
+
- `docs/adr/0002` — JWT on OAuth rails (RFC 8693/9396/7800) over Biscuit/Macaroon/UCAN
|
|
142
|
+
- `docs/adr/0003` — original TS runtime decision (superseded by 0005)
|
|
143
|
+
- `docs/adr/0004` — approvals bound to args hashes; hash-chained signed audit
|
|
144
|
+
- `docs/adr/0005` — Python as the reference implementation
|
|
145
|
+
|
|
146
|
+
Roadmap lives in the [issue tracker](../../issues): MCP compatibility, upstream OAuth brokering, Merkle checkpoint anchoring, approvals via Slack/webhooks/CIBA push, dashboard, Postgres scale-out, TypeScript SDK rebuild.
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
uv sync
|
|
152
|
+
uv run ruff check src tests
|
|
153
|
+
uv run pytest tests/ -q # 39 tests: core unit + server integration + SDK-vs-server
|
|
154
|
+
uv run toolgate-demo # the six-act scenario
|
|
155
|
+
uv run toolgate-server # standalone server (prints the admin key on first boot)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Production env vars: `TOOLGATE_MASTER_KEY`, `TOOLGATE_ADMIN_KEY`, `TOOLGATE_PUBLIC_URL`, `TOOLGATE_DB`, `PORT`.
|
|
159
|
+
|
|
160
|
+
## Contributing & security
|
|
161
|
+
|
|
162
|
+
Contributions welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). Security findings go through [private vulnerability reporting](SECURITY.md), never public issues.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
[Apache License 2.0](LICENSE) © 2026 Juan Martin Maglione. Toolgate is early-stage software (pre-1.0): the wire format is a compatibility surface we take seriously, but expect movement before 1.0.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Toolgate
|
|
2
|
+
|
|
3
|
+
**The capability control plane for embedded AI agents.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/maglionejm/toolgate/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](pyproject.toml)
|
|
8
|
+
|
|
9
|
+
**Portal & live simulation: [maglionejm.github.io/toolgate](https://maglionejm.github.io/toolgate/)** — try the gate and tamper with a real hash chain in your browser.
|
|
10
|
+
|
|
11
|
+
Agents should never hold credentials — not the user's OAuth token, not a tenant API key, not anything. Toolgate sits between agents and the tools they call:
|
|
12
|
+
|
|
13
|
+
- the agent authenticates with **its own Ed25519 key** and a **delegation grant** from a human;
|
|
14
|
+
- it receives **short-lived capability tokens** (`sub` = the human, `act.sub` = the agent, RFC 8693 semantics) that are useless if stolen (proof-of-possession bound);
|
|
15
|
+
- every tool call is **policy-checked** (allow / deny / require human approval), **metered** against the grant's budget, and executed by the gate, which **injects the real credential server-side**;
|
|
16
|
+
- every decision — including denials — lands in a **hash-chained, Ed25519-signed audit trail**.
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
Agent (no secrets) ── token + one-time proof ──▶ GATE ── real credential ──▶ Upstream API
|
|
20
|
+
│
|
|
21
|
+
verify → decide → budget → inject → execute → audit
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Try it
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
uvx --from toolgate-io toolgate demo # zero-install, straight from PyPI
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
or from source:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv sync
|
|
34
|
+
uv run toolgate demo
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The demo boots Toolgate plus two credential-guarded mock APIs and runs a six-act scenario: an allowed CRM read (the upstream rejects anything without its live key — proving injection), a policy denial, an external email parked for human approval and executed against the approved args only, budget exhaustion, revocation that kills a live token instantly, and audit chain verification with the full decision trace.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
[OK ] read_contact executed -> {'contact': {...}}
|
|
41
|
+
[DENIED ] TG_DENIED: matched deny rule never-delete
|
|
42
|
+
[PARKED ] approval apr_... pending — agent is blocked, not trusted
|
|
43
|
+
[HUMAN ] Sam approved the exact parked arguments (args are hash-bound)
|
|
44
|
+
[OK ] send_email executed after approval
|
|
45
|
+
[BUDGET ] blocked: delegation grant budget exhausted
|
|
46
|
+
[REVOKED ] TG_REVOKED: live token died with the grant, no TTL wait
|
|
47
|
+
[AUDIT ] chain of 10 records — verification: VALID
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## How it works
|
|
51
|
+
|
|
52
|
+
1. **Register** a tenant, its users, agents (public keys only), and upstreams. Upstream credentials are sealed into the vault (AES-256-GCM) and never leave the server.
|
|
53
|
+
2. **Delegate**: a user grants an agent bounded authority — which upstreams/tools (RFC 9396-style `authorization_details`), what budget (cost units), which policy, until when.
|
|
54
|
+
3. **Exchange**: the agent presents a signed client assertion (RFC 7523 style) and receives a capability token — TTL ~2 minutes with jitter, audience-bound, sender-constrained via `cnf.jkt`.
|
|
55
|
+
4. **Call**: each gate call carries the token plus a one-time DPoP-style proof signed by the agent key (bound to method, URL, and token hash; replays rejected).
|
|
56
|
+
5. **Enforce**: token bounds → policy rules (first match wins, glob matching, dot-path argument constraints, cost ceilings) → default deny → atomic budget charge.
|
|
57
|
+
6. **Approve**: `require_approval` parks the call; a human decides on the exact argument set (hash-bound — no post-approval swaps); the agent polls and executes.
|
|
58
|
+
7. **Audit**: every decision appends to a hash chain signed by the gate key. `GET /v1/control/audit/verify` proves nothing was edited, removed, or reordered.
|
|
59
|
+
|
|
60
|
+
## CLI
|
|
61
|
+
|
|
62
|
+
Everything an operator does is a `toolgate` command ([full reference](docs/reference/CLI.md)):
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install toolgate-io
|
|
66
|
+
toolgate init # profile + connectivity check
|
|
67
|
+
toolgate keys generate --out agent-key.json # agent identity (private key stays local)
|
|
68
|
+
toolgate grants create -t tnt_... --user usr_... --agent agt_... \
|
|
69
|
+
--policy pol_... --budget 100 --authz "crm:*" # bounded delegation
|
|
70
|
+
toolgate approvals watch -t tnt_... --by usr_... # interactive human-in-the-loop inbox
|
|
71
|
+
toolgate audit export --out audit.json && toolgate audit verify --file audit.json # offline proof
|
|
72
|
+
toolgate dev call crm read_contact --grant grt_... --key agent-key.json # act as the agent
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Agent-side SDK
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from toolgate.sdk import ToolgateClient, PendingApproval, generate_ed25519_key_pair
|
|
79
|
+
|
|
80
|
+
client = ToolgateClient(
|
|
81
|
+
base_url=base_url,
|
|
82
|
+
agent_id=agent_id,
|
|
83
|
+
agent_private_jwk=agent_private_jwk, # the only secret an agent ever holds
|
|
84
|
+
grant_id=grant_id,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
result = client.call("crm", "read_contact", {"contactId": "c-001"})
|
|
88
|
+
if isinstance(result, PendingApproval):
|
|
89
|
+
result = client.wait_for_approval(result.approval_id)
|
|
90
|
+
# Denials, budget exhaustion, and revocation raise typed ToolgateCallError
|
|
91
|
+
# (TG_DENIED / TG_BUDGET_EXCEEDED / TG_REVOKED / TG_PROOF_INVALID / ...).
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Layout
|
|
95
|
+
|
|
96
|
+
| Module | Purpose |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| `toolgate.core` | Capability tokens, client assertions + PoP proofs, policy engine, audit chain |
|
|
99
|
+
| `toolgate.server` | Control plane (registry, grants, token endpoint, approvals, revocation, audit) + gate (enforcement pipeline, vault) |
|
|
100
|
+
| `toolgate.sdk` | Agent-side client: token exchange, signed calls, approval flow, typed errors |
|
|
101
|
+
| `toolgate.demo` | End-to-end scenario (`uv run toolgate-demo`) |
|
|
102
|
+
|
|
103
|
+
## Documentation
|
|
104
|
+
|
|
105
|
+
Full suite in [`docs/`](docs/README.md): [Quickstart](docs/QUICKSTART.md) · [API Reference](docs/reference/API.md) · [Token Spec](docs/TOKEN-SPEC.md) · [Security Model](docs/SECURITY.md) · [Deployment](docs/DEPLOYMENT.md) · [Operations](docs/OPERATIONS.md)
|
|
106
|
+
|
|
107
|
+
## Design
|
|
108
|
+
|
|
109
|
+
- `docs/ARCHITECTURE.md` — components, token design, threat model
|
|
110
|
+
- `docs/adr/0001` — delegation, never user-credential impersonation
|
|
111
|
+
- `docs/adr/0002` — JWT on OAuth rails (RFC 8693/9396/7800) over Biscuit/Macaroon/UCAN
|
|
112
|
+
- `docs/adr/0003` — original TS runtime decision (superseded by 0005)
|
|
113
|
+
- `docs/adr/0004` — approvals bound to args hashes; hash-chained signed audit
|
|
114
|
+
- `docs/adr/0005` — Python as the reference implementation
|
|
115
|
+
|
|
116
|
+
Roadmap lives in the [issue tracker](../../issues): MCP compatibility, upstream OAuth brokering, Merkle checkpoint anchoring, approvals via Slack/webhooks/CIBA push, dashboard, Postgres scale-out, TypeScript SDK rebuild.
|
|
117
|
+
|
|
118
|
+
## Development
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uv sync
|
|
122
|
+
uv run ruff check src tests
|
|
123
|
+
uv run pytest tests/ -q # 39 tests: core unit + server integration + SDK-vs-server
|
|
124
|
+
uv run toolgate-demo # the six-act scenario
|
|
125
|
+
uv run toolgate-server # standalone server (prints the admin key on first boot)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Production env vars: `TOOLGATE_MASTER_KEY`, `TOOLGATE_ADMIN_KEY`, `TOOLGATE_PUBLIC_URL`, `TOOLGATE_DB`, `PORT`.
|
|
129
|
+
|
|
130
|
+
## Contributing & security
|
|
131
|
+
|
|
132
|
+
Contributions welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). Security findings go through [private vulnerability reporting](SECURITY.md), never public issues.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
[Apache License 2.0](LICENSE) © 2026 Juan Martin Maglione. Toolgate is early-stage software (pre-1.0): the wire format is a compatibility surface we take seriously, but expect movement before 1.0.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
Toolgate is security infrastructure: reports are taken seriously and handled with priority.
|
|
4
|
+
|
|
5
|
+
## Reporting a vulnerability
|
|
6
|
+
|
|
7
|
+
- **Please do not open a public issue for exploitable findings.**
|
|
8
|
+
- Use GitHub's [private vulnerability reporting](../../security/advisories/new) on this repository.
|
|
9
|
+
- Include: affected component, reproduction steps, and impact assessment. Proof-of-concept code is welcome.
|
|
10
|
+
- You will receive an acknowledgement within 72 hours.
|
|
11
|
+
|
|
12
|
+
## Scope of interest
|
|
13
|
+
|
|
14
|
+
Highest-value targets, in order:
|
|
15
|
+
|
|
16
|
+
1. The proof-of-possession layer (`toolgate/core/assertion.py`) — hand-implemented (no maintained Python DPoP library exists); theft, replay, downgrade, and confusion attacks especially welcome.
|
|
17
|
+
2. Token verification and claim enforcement (`toolgate/core/token.py`, gate pipeline).
|
|
18
|
+
3. Audit-chain integrity (`toolgate/core/audit.py`) — any way to alter history that verification does not detect.
|
|
19
|
+
4. Policy-engine bypasses (glob/constraint edge cases, tool resolution).
|
|
20
|
+
5. Vault handling and credential-leak paths.
|
|
21
|
+
|
|
22
|
+
## Current status
|
|
23
|
+
|
|
24
|
+
Pre-1.0. The threat model, guarantees, and **known gaps** are documented honestly in [docs/SECURITY.md](docs/SECURITY.md) — please read it before reporting items already listed there (admin-plane hardening, external audit anchoring, and KMS envelope encryption are known and tracked).
|