iops-permissions 0.1.0a2__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.
- iops_permissions-0.1.0a2/CHANGELOG.md +31 -0
- iops_permissions-0.1.0a2/LICENSE +202 -0
- iops_permissions-0.1.0a2/MANIFEST.in +2 -0
- iops_permissions-0.1.0a2/NOTICE +6 -0
- iops_permissions-0.1.0a2/PKG-INFO +137 -0
- iops_permissions-0.1.0a2/POLICY_SPEC.md +93 -0
- iops_permissions-0.1.0a2/README.md +118 -0
- iops_permissions-0.1.0a2/examples/action-allowed.json +13 -0
- iops_permissions-0.1.0a2/examples/action-api.json +13 -0
- iops_permissions-0.1.0a2/examples/action-approval.json +13 -0
- iops_permissions-0.1.0a2/examples/action-coding.json +13 -0
- iops_permissions-0.1.0a2/examples/action-denied.json +13 -0
- iops_permissions-0.1.0a2/examples/action-unknown.json +13 -0
- iops_permissions-0.1.0a2/examples/coding-manifest.json +55 -0
- iops_permissions-0.1.0a2/examples/generated-policy-scenario.json +69 -0
- iops_permissions-0.1.0a2/examples/generated-protected-file-scenario.json +88 -0
- iops_permissions-0.1.0a2/examples/manifest.json +36 -0
- iops_permissions-0.1.0a2/examples/operations-manifest.json +55 -0
- iops_permissions-0.1.0a2/examples/policy.json +78 -0
- iops_permissions-0.1.0a2/examples/protected-file-fixture.json +9 -0
- iops_permissions-0.1.0a2/pyproject.toml +40 -0
- iops_permissions-0.1.0a2/setup.cfg +4 -0
- iops_permissions-0.1.0a2/src/iops_permissions/__init__.py +29 -0
- iops_permissions-0.1.0a2/src/iops_permissions/__main__.py +5 -0
- iops_permissions-0.1.0a2/src/iops_permissions/_schemas/permissions-v0.1/action-request.schema.json +76 -0
- iops_permissions-0.1.0a2/src/iops_permissions/_schemas/permissions-v0.1/fixture-descriptor.schema.json +42 -0
- iops_permissions-0.1.0a2/src/iops_permissions/_schemas/permissions-v0.1/policy.schema.json +132 -0
- iops_permissions-0.1.0a2/src/iops_permissions/_schemas/v0.1/action-event.schema.json +336 -0
- iops_permissions-0.1.0a2/src/iops_permissions/_schemas/v0.1/capability-manifest.schema.json +205 -0
- iops_permissions-0.1.0a2/src/iops_permissions/_schemas/v0.1/evidence-result.schema.json +283 -0
- iops_permissions-0.1.0a2/src/iops_permissions/_schemas/v0.1/scenario-definition.schema.json +427 -0
- iops_permissions-0.1.0a2/src/iops_permissions/cli.py +172 -0
- iops_permissions-0.1.0a2/src/iops_permissions/export.py +163 -0
- iops_permissions-0.1.0a2/src/iops_permissions/inputs.py +113 -0
- iops_permissions-0.1.0a2/src/iops_permissions/matching.py +44 -0
- iops_permissions-0.1.0a2/src/iops_permissions/py.typed +0 -0
- iops_permissions-0.1.0a2/src/iops_permissions/simulator.py +225 -0
- iops_permissions-0.1.0a2/src/iops_permissions/validation.py +251 -0
- iops_permissions-0.1.0a2/src/iops_permissions/wizard.py +595 -0
- iops_permissions-0.1.0a2/src/iops_permissions.egg-info/PKG-INFO +137 -0
- iops_permissions-0.1.0a2/src/iops_permissions.egg-info/SOURCES.txt +48 -0
- iops_permissions-0.1.0a2/src/iops_permissions.egg-info/dependency_links.txt +1 -0
- iops_permissions-0.1.0a2/src/iops_permissions.egg-info/entry_points.txt +2 -0
- iops_permissions-0.1.0a2/src/iops_permissions.egg-info/requires.txt +3 -0
- iops_permissions-0.1.0a2/src/iops_permissions.egg-info/top_level.txt +1 -0
- iops_permissions-0.1.0a2/tests/test_cli.py +164 -0
- iops_permissions-0.1.0a2/tests/test_inputs_export.py +152 -0
- iops_permissions-0.1.0a2/tests/test_simulator.py +238 -0
- iops_permissions-0.1.0a2/tests/test_validation.py +124 -0
- iops_permissions-0.1.0a2/tests/test_wizard.py +569 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Permission Simulator changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0a2 — local candidate, unreleased
|
|
4
|
+
|
|
5
|
+
- A bare `iops-permissions` run by a person at a terminal now opens a first-run
|
|
6
|
+
wizard: choose a policy, evaluate one action, optionally export a scenario.
|
|
7
|
+
The preselected answer to every question is the one that writes nothing.
|
|
8
|
+
- A bare run that is not a person is unchanged, byte for byte. The wizard needs
|
|
9
|
+
both stdin and stdout to be terminals, no `CI` in the environment, `TERM` other
|
|
10
|
+
than `dumb` and no `IOPS_NO_WIZARD`; anything else still prints the
|
|
11
|
+
`invalid_arguments` error and exits 2, because a prompt in a pipeline is a hang.
|
|
12
|
+
- Esc or Ctrl-C leaves the terminal as it was found and exits 130 having changed
|
|
13
|
+
nothing. A console with no byte for a block character gets an ASCII wordmark.
|
|
14
|
+
- No new dependencies: the three declared schema packages are unchanged.
|
|
15
|
+
- Every existing subcommand, flag, JSON payload and exit code is unchanged.
|
|
16
|
+
- Not a gate-reviewed candidate. 0.1.0a1 remains the reviewed one, and the
|
|
17
|
+
artifact and verification records still describe it.
|
|
18
|
+
|
|
19
|
+
## 0.1.0a1 — local candidate, unreleased
|
|
20
|
+
|
|
21
|
+
- Independently installed CLI and Python API for explicit declared-policy analysis.
|
|
22
|
+
- Deterministic allow/deny/approval/unknown decisions with bounded explanations.
|
|
23
|
+
- Provenance-tagged capability findings without complete-authority claims.
|
|
24
|
+
- Policy-only export and explicit protected-file scenario export, verified through
|
|
25
|
+
real Crash Lab execution using independent product environments.
|
|
26
|
+
- Bounded strict JSON, local schemas, redacted errors and private atomic output.
|
|
27
|
+
|
|
28
|
+
No execution/enforcement, model calls, framework certification, automatic result
|
|
29
|
+
analysis UI, hosted service or managed cloud. The project license/package name
|
|
30
|
+
decision and final human release approval are recorded separately. No release
|
|
31
|
+
date or published package is claimed by this candidate version.
|
|
@@ -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,6 @@
|
|
|
1
|
+
I-Ops Labs
|
|
2
|
+
Copyright 2026 I-Ops Labs contributors
|
|
3
|
+
|
|
4
|
+
Permission Simulator and Crash Lab are independent I-Ops Labs products.
|
|
5
|
+
Third-party dependencies and official image components retain their own licenses.
|
|
6
|
+
See docs/THIRD_PARTY_LICENSES.md in the source repository for the review record.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iops-permissions
|
|
3
|
+
Version: 0.1.0a2
|
|
4
|
+
Summary: Permission Simulator: local declared-policy analysis and portable test scenarios
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://github.com/i-ops-hq/labs/tree/main/products/permissions
|
|
7
|
+
Project-URL: Repository, https://github.com/i-ops-hq/labs
|
|
8
|
+
Project-URL: Issues, https://github.com/i-ops-hq/labs/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/i-ops-hq/labs/blob/main/products/permissions/CHANGELOG.md
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
License-File: NOTICE
|
|
15
|
+
Requires-Dist: jsonschema<5,>=4.23
|
|
16
|
+
Requires-Dist: rfc3339-validator<0.2,>=0.1.4
|
|
17
|
+
Requires-Dist: referencing<1,>=0.35
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# Permission Simulator — local development alpha
|
|
21
|
+
|
|
22
|
+
Inspect explicit capability declarations, evaluate structured actions against
|
|
23
|
+
deterministic policy, and export portable policy-oriented test scenarios.
|
|
24
|
+
This package works independently of Crash Lab and other I-Ops products.
|
|
25
|
+
It does not execute an agent or enforce actual runtime permissions.
|
|
26
|
+
|
|
27
|
+
This project is Apache-2.0 and ships as the distribution and CLI
|
|
28
|
+
`iops-permissions`. That name and licence were selected for local candidate
|
|
29
|
+
0.1.0a1.
|
|
30
|
+
|
|
31
|
+
## Install and try locally
|
|
32
|
+
|
|
33
|
+
From this product directory, with uv and Python 3.11+ installed. These commands
|
|
34
|
+
assume a checkout of this repository: the example files they read are part of the
|
|
35
|
+
source tree and are not included in an installed package.
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
export UV_CACHE_DIR="$PWD/../../.cache/uv"
|
|
39
|
+
uv sync --python 3.12 --frozen
|
|
40
|
+
uv run --frozen iops-permissions inspect examples/operations-manifest.json
|
|
41
|
+
uv run --frozen iops-permissions evaluate --policy examples/policy.json --action examples/action-allowed.json --manifest examples/operations-manifest.json
|
|
42
|
+
uv run --frozen iops-permissions evaluate --policy examples/policy.json --action examples/action-denied.json --format text
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The last command intentionally exits **3** for denied. Evaluation exits are
|
|
46
|
+
allowed 0, denied 3, requires_approval 4 and unknown 5. Input/I/O errors exit 2;
|
|
47
|
+
unsupported exports exit 6. All decisions are scoped to declared policy and,
|
|
48
|
+
when supplied, manifest coverage. They are not effective permission guarantees.
|
|
49
|
+
|
|
50
|
+
`action-approval.json`, `action-unknown.json` and `action-api.json` exercise other
|
|
51
|
+
paths. `coding-manifest.json` plus `action-coding.json` demonstrates synthetic
|
|
52
|
+
coding-agent declarations, without claiming a real vendor integration.
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
# Policy-only scenario: requires no runner, adapter or physical test fixture.
|
|
56
|
+
uv run --frozen iops-permissions export --policy examples/policy.json --action examples/action-allowed.json --output /tmp/iops-policy-case.json
|
|
57
|
+
# Isolated test definition: explicitly declares its required fixture and adapter.
|
|
58
|
+
uv run --frozen iops-permissions export --policy examples/policy.json --action examples/action-denied.json --manifest examples/operations-manifest.json --fixture examples/protected-file-fixture.json --output /tmp/iops-protected-case.json
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Exports refuse existing output files/symlinks, use private permissions and never
|
|
62
|
+
execute a test. Choose a fresh output filename if those example paths exist.
|
|
63
|
+
The supplied fixture descriptor is test metadata, not an installed fixture or
|
|
64
|
+
verified adapter. Unsupported fixture/action combinations produce no file.
|
|
65
|
+
Generated examples in this directory are actual CLI exports, not execution
|
|
66
|
+
results; their execution_status is not_executed.
|
|
67
|
+
|
|
68
|
+
## The first run
|
|
69
|
+
|
|
70
|
+
A bare `iops-permissions`, run by a person at a terminal, opens a short wizard:
|
|
71
|
+
choose a policy, evaluate one action, and optionally export the result as a
|
|
72
|
+
scenario Crash Lab can run. Arrow keys choose, Enter confirms, Esc cancels and
|
|
73
|
+
exits 130 having changed nothing. The preselected answer to every question is
|
|
74
|
+
the one that writes nothing, so holding Enter down finishes the wizard with the
|
|
75
|
+
working directory unchanged.
|
|
76
|
+
|
|
77
|
+
A bare run that is **not** a person is unchanged. The wizard needs both stdin and
|
|
78
|
+
stdout to be terminals, no `CI` in the environment, `TERM` other than `dumb`, and
|
|
79
|
+
no `IOPS_NO_WIZARD`; anything else prints the `invalid_arguments` JSON error and
|
|
80
|
+
exits 2, exactly as before. These commands run inside CI and inside other agents'
|
|
81
|
+
harnesses, where a prompt is a hang and a hang is worse than an error. Set
|
|
82
|
+
`IOPS_NO_WIZARD=1` to suppress it on an interactive terminal, and `NO_COLOR` to
|
|
83
|
+
drop the colour. Every subcommand, flag, JSON payload and exit code is untouched.
|
|
84
|
+
|
|
85
|
+
## Python API
|
|
86
|
+
|
|
87
|
+
As in the quickstart, the files read below are examples from this repository
|
|
88
|
+
rather than package data; substitute your own paths outside a checkout.
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from pathlib import Path
|
|
92
|
+
from iops_permissions import (
|
|
93
|
+
evaluate,
|
|
94
|
+
export_scenario,
|
|
95
|
+
inspect_manifest,
|
|
96
|
+
loads_policy,
|
|
97
|
+
loads_action_request,
|
|
98
|
+
loads_document,
|
|
99
|
+
loads_fixture_descriptor,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
policy = loads_policy(Path("examples/policy.json").read_bytes())
|
|
103
|
+
request = loads_action_request(Path("examples/action-denied.json").read_bytes())
|
|
104
|
+
manifest = loads_document(
|
|
105
|
+
"capability-manifest", Path("examples/operations-manifest.json").read_bytes()
|
|
106
|
+
)
|
|
107
|
+
result = evaluate(policy, request, manifest)
|
|
108
|
+
assert result.decision == "denied"
|
|
109
|
+
print(result.to_dict())
|
|
110
|
+
exported = export_scenario(policy, request, manifest)
|
|
111
|
+
assert exported.execution_status == "not_executed"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
All public input boundaries raise `ContractValidationError` with structured,
|
|
115
|
+
redacted issues. `validate_document` / `loads_document` still support all four
|
|
116
|
+
shared data contracts. `loads_policy`, `loads_action_request`, and
|
|
117
|
+
`loads_fixture_descriptor` validate this product's separate local input formats.
|
|
118
|
+
See [POLICY_SPEC.md](https://github.com/i-ops-hq/labs/blob/main/products/permissions/POLICY_SPEC.md) for selectors, precedence, conservative
|
|
119
|
+
manifest guards, limits and export semantics.
|
|
120
|
+
|
|
121
|
+
Default reports omit raw resource identifiers/patterns, unknown text, constraint
|
|
122
|
+
text and credential references. IDs must be logical references without secrets.
|
|
123
|
+
Exported scenario files necessarily retain their explicitly selected action
|
|
124
|
+
resource; treat those local artifacts as potentially sensitive configuration.
|
|
125
|
+
|
|
126
|
+
## Validation and boundaries
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
uv run --frozen pytest -q
|
|
130
|
+
uv build
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The repository verifier additionally installs wheels and rebuilt source
|
|
134
|
+
distributions outside the source tree, tests SDK/CLI functionality without Crash
|
|
135
|
+
Lab, and checks matching shared schema bytes. Supported matching is lexical and
|
|
136
|
+
bounded; no regex policy language, path resolution, arbitrary static analysis,
|
|
137
|
+
runtime hooks, enforcement, model calls, gateway, or cloud service is provided.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Permission Simulator local inputs and behavior — v0.1.0
|
|
2
|
+
|
|
3
|
+
These product-specific inputs do not change the five shared Labs contracts.
|
|
4
|
+
The bundled private schemas define their complete shape. JSON only; no code,
|
|
5
|
+
expressions, external references, YAML, environment expansion or policy plugins.
|
|
6
|
+
All inputs use the existing bounded JSON parser and redacted diagnostics.
|
|
7
|
+
|
|
8
|
+
## Policy and structured action request
|
|
9
|
+
|
|
10
|
+
A policy contains schema_version, policy_id, agent_ids (IDs or `*`), an explicit
|
|
11
|
+
default_decision, and up to 256 rules. Each rule has a unique rule_id, effect,
|
|
12
|
+
action_kinds, operations, resource_types and resource_patterns. Selector arrays
|
|
13
|
+
are disjunctions; dimensions are conjunctions. `*` selects all kinds/operations/
|
|
14
|
+
types. Resource patterns are exact strings or literal prefixes with one trailing
|
|
15
|
+
`*`. No regex, glob character classes, `?`, normalization or filesystem access.
|
|
16
|
+
|
|
17
|
+
An action request contains schema_version, request_id, agent_id and the same
|
|
18
|
+
structured action shape used in Action Event. It is a proposed input only and
|
|
19
|
+
contains no stage or outcome. A supplied manifest must describe the same agent.
|
|
20
|
+
|
|
21
|
+
All matching rules participate. Precedence is denied > requires_approval >
|
|
22
|
+
unknown > allowed, independent of rule order. The default is used only when no
|
|
23
|
+
rule matches. Explicit default allowed is possible and is reported as a default,
|
|
24
|
+
not an inferred grant. An out-of-scope agent yields unknown. Missing/invalid
|
|
25
|
+
policy, duplicate rule IDs, malformed selectors and unknown fields are errors.
|
|
26
|
+
|
|
27
|
+
Evaluation uses case-sensitive lexical identifiers only. Dot segments, repeated
|
|
28
|
+
path separators, backslashes, control characters, percent escapes, query strings,
|
|
29
|
+
fragments and user-info markers are unsupported because their interpretation
|
|
30
|
+
could differ from the declared pattern. They yield unknown, never an allow.
|
|
31
|
+
Canonical-looking paths still do not resolve symlinks, OS permissions, endpoint
|
|
32
|
+
authority or indirect effects. A prefix must include `/` when a directory boundary
|
|
33
|
+
is intended: `/workspace/*` differs from `/workspace*`.
|
|
34
|
+
|
|
35
|
+
## Optional manifest guards and output
|
|
36
|
+
|
|
37
|
+
The result preserves policy_decision separately from the final scoped decision.
|
|
38
|
+
No manifest means policy-only analysis; it does not assert actual capability.
|
|
39
|
+
With a manifest, a non-denied/non-unknown policy decision requires a supported
|
|
40
|
+
kind/resource capability match. No match, inferred-only matches, unsupported
|
|
41
|
+
patterns in relevant declarations, or uninterpreted constraint text yields
|
|
42
|
+
unknown. A matching approval_required declaration upgrades allowed to approval.
|
|
43
|
+
Explicit denial remains denial regardless of missing capability coverage.
|
|
44
|
+
|
|
45
|
+
Results include matched rule IDs, matching capability IDs/bases, fixed explanation
|
|
46
|
+
codes and coverage counts/labels. They omit raw resources, patterns, descriptions,
|
|
47
|
+
unknown text, credential references and extensions by default. Logical IDs must
|
|
48
|
+
not contain secrets; the tool is not a general secret detector.
|
|
49
|
+
|
|
50
|
+
## Bounded findings
|
|
51
|
+
|
|
52
|
+
Inspect validates a declared manifest and reports: filesystem plus network/API
|
|
53
|
+
coexistence, process plus network/API coexistence, and a literal all-resources
|
|
54
|
+
pattern (`*`). Findings include contributing capability IDs and provenance,
|
|
55
|
+
and say that a chain, write access, exfiltration or actual side effect has not
|
|
56
|
+
been demonstrated. Filesystem action kinds alone do not establish write access.
|
|
57
|
+
Empty results mean these specific checks found nothing, not global safety.
|
|
58
|
+
|
|
59
|
+
## Scenario export
|
|
60
|
+
|
|
61
|
+
An explicit policy/action pair exports a deterministic policy_simulation scenario
|
|
62
|
+
using the shared Scenario Definition schema. It records the expected scoped
|
|
63
|
+
decision in its policy constraint and assertion; non-semantic extensions retain
|
|
64
|
+
source IDs and execution/readiness labels. The source policy remains external
|
|
65
|
+
for later re-evaluation; the exported expectation is not an executable policy. The
|
|
66
|
+
`fixture://policy-only` environment is a logical input fixture; no runtime is
|
|
67
|
+
required or executed. Unknown outcomes remain explicitly unknown.
|
|
68
|
+
|
|
69
|
+
Supplying a fixture descriptor explicitly requests an isolated-execution export.
|
|
70
|
+
The only initial template is protected-file-write: it requires the matching
|
|
71
|
+
agent, an explicit fixture:// identifier and protected resource, a supported
|
|
72
|
+
runtime declaration, an exact selected filesystem write to that protected file,
|
|
73
|
+
and an explicit denied policy decision. Export declares runner/adapter/fixture
|
|
74
|
+
requirements and both a protected-state assertion and an attempted-write assertion,
|
|
75
|
+
so unchanged state alone cannot establish that the test action was exercised.
|
|
76
|
+
These are declarative verifier requirements, not an implemented verifier or a
|
|
77
|
+
claim prerequisites are installed or verified. Mismatches yield a
|
|
78
|
+
typed unsupported export with no scenario and no silent policy-only fallback.
|
|
79
|
+
No export emits an Evidence Result or claims execution success.
|
|
80
|
+
|
|
81
|
+
## CLI
|
|
82
|
+
|
|
83
|
+
`iops-permissions inspect MANIFEST`, `evaluate --policy POLICY --action REQUEST
|
|
84
|
+
[--manifest MANIFEST]`, and `export --policy POLICY --action REQUEST
|
|
85
|
+
[--manifest MANIFEST] [--fixture DESCRIPTOR] --output SCENARIO`.
|
|
86
|
+
JSON is default; `--format text` provides a concise human report. Output errors
|
|
87
|
+
are redacted. Evaluation exit codes: allowed 0, denied 3, approval 4, unknown 5;
|
|
88
|
+
input/I/O/usage error 2; unsupported export 6. Inspect/export success is 0.
|
|
89
|
+
Export writes a private local file atomically and refuses overwrite, including
|
|
90
|
+
existing symlinks. Input file reads are bounded and require regular files.
|
|
91
|
+
|
|
92
|
+
This is a local simulator, not an enforcement integration. No agents, commands,
|
|
93
|
+
fixtures, model calls or artifact references are executed by these commands.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Permission Simulator — local development alpha
|
|
2
|
+
|
|
3
|
+
Inspect explicit capability declarations, evaluate structured actions against
|
|
4
|
+
deterministic policy, and export portable policy-oriented test scenarios.
|
|
5
|
+
This package works independently of Crash Lab and other I-Ops products.
|
|
6
|
+
It does not execute an agent or enforce actual runtime permissions.
|
|
7
|
+
|
|
8
|
+
This project is Apache-2.0 and ships as the distribution and CLI
|
|
9
|
+
`iops-permissions`. That name and licence were selected for local candidate
|
|
10
|
+
0.1.0a1.
|
|
11
|
+
|
|
12
|
+
## Install and try locally
|
|
13
|
+
|
|
14
|
+
From this product directory, with uv and Python 3.11+ installed. These commands
|
|
15
|
+
assume a checkout of this repository: the example files they read are part of the
|
|
16
|
+
source tree and are not included in an installed package.
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
export UV_CACHE_DIR="$PWD/../../.cache/uv"
|
|
20
|
+
uv sync --python 3.12 --frozen
|
|
21
|
+
uv run --frozen iops-permissions inspect examples/operations-manifest.json
|
|
22
|
+
uv run --frozen iops-permissions evaluate --policy examples/policy.json --action examples/action-allowed.json --manifest examples/operations-manifest.json
|
|
23
|
+
uv run --frozen iops-permissions evaluate --policy examples/policy.json --action examples/action-denied.json --format text
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The last command intentionally exits **3** for denied. Evaluation exits are
|
|
27
|
+
allowed 0, denied 3, requires_approval 4 and unknown 5. Input/I/O errors exit 2;
|
|
28
|
+
unsupported exports exit 6. All decisions are scoped to declared policy and,
|
|
29
|
+
when supplied, manifest coverage. They are not effective permission guarantees.
|
|
30
|
+
|
|
31
|
+
`action-approval.json`, `action-unknown.json` and `action-api.json` exercise other
|
|
32
|
+
paths. `coding-manifest.json` plus `action-coding.json` demonstrates synthetic
|
|
33
|
+
coding-agent declarations, without claiming a real vendor integration.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
# Policy-only scenario: requires no runner, adapter or physical test fixture.
|
|
37
|
+
uv run --frozen iops-permissions export --policy examples/policy.json --action examples/action-allowed.json --output /tmp/iops-policy-case.json
|
|
38
|
+
# Isolated test definition: explicitly declares its required fixture and adapter.
|
|
39
|
+
uv run --frozen iops-permissions export --policy examples/policy.json --action examples/action-denied.json --manifest examples/operations-manifest.json --fixture examples/protected-file-fixture.json --output /tmp/iops-protected-case.json
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Exports refuse existing output files/symlinks, use private permissions and never
|
|
43
|
+
execute a test. Choose a fresh output filename if those example paths exist.
|
|
44
|
+
The supplied fixture descriptor is test metadata, not an installed fixture or
|
|
45
|
+
verified adapter. Unsupported fixture/action combinations produce no file.
|
|
46
|
+
Generated examples in this directory are actual CLI exports, not execution
|
|
47
|
+
results; their execution_status is not_executed.
|
|
48
|
+
|
|
49
|
+
## The first run
|
|
50
|
+
|
|
51
|
+
A bare `iops-permissions`, run by a person at a terminal, opens a short wizard:
|
|
52
|
+
choose a policy, evaluate one action, and optionally export the result as a
|
|
53
|
+
scenario Crash Lab can run. Arrow keys choose, Enter confirms, Esc cancels and
|
|
54
|
+
exits 130 having changed nothing. The preselected answer to every question is
|
|
55
|
+
the one that writes nothing, so holding Enter down finishes the wizard with the
|
|
56
|
+
working directory unchanged.
|
|
57
|
+
|
|
58
|
+
A bare run that is **not** a person is unchanged. The wizard needs both stdin and
|
|
59
|
+
stdout to be terminals, no `CI` in the environment, `TERM` other than `dumb`, and
|
|
60
|
+
no `IOPS_NO_WIZARD`; anything else prints the `invalid_arguments` JSON error and
|
|
61
|
+
exits 2, exactly as before. These commands run inside CI and inside other agents'
|
|
62
|
+
harnesses, where a prompt is a hang and a hang is worse than an error. Set
|
|
63
|
+
`IOPS_NO_WIZARD=1` to suppress it on an interactive terminal, and `NO_COLOR` to
|
|
64
|
+
drop the colour. Every subcommand, flag, JSON payload and exit code is untouched.
|
|
65
|
+
|
|
66
|
+
## Python API
|
|
67
|
+
|
|
68
|
+
As in the quickstart, the files read below are examples from this repository
|
|
69
|
+
rather than package data; substitute your own paths outside a checkout.
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from pathlib import Path
|
|
73
|
+
from iops_permissions import (
|
|
74
|
+
evaluate,
|
|
75
|
+
export_scenario,
|
|
76
|
+
inspect_manifest,
|
|
77
|
+
loads_policy,
|
|
78
|
+
loads_action_request,
|
|
79
|
+
loads_document,
|
|
80
|
+
loads_fixture_descriptor,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
policy = loads_policy(Path("examples/policy.json").read_bytes())
|
|
84
|
+
request = loads_action_request(Path("examples/action-denied.json").read_bytes())
|
|
85
|
+
manifest = loads_document(
|
|
86
|
+
"capability-manifest", Path("examples/operations-manifest.json").read_bytes()
|
|
87
|
+
)
|
|
88
|
+
result = evaluate(policy, request, manifest)
|
|
89
|
+
assert result.decision == "denied"
|
|
90
|
+
print(result.to_dict())
|
|
91
|
+
exported = export_scenario(policy, request, manifest)
|
|
92
|
+
assert exported.execution_status == "not_executed"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
All public input boundaries raise `ContractValidationError` with structured,
|
|
96
|
+
redacted issues. `validate_document` / `loads_document` still support all four
|
|
97
|
+
shared data contracts. `loads_policy`, `loads_action_request`, and
|
|
98
|
+
`loads_fixture_descriptor` validate this product's separate local input formats.
|
|
99
|
+
See [POLICY_SPEC.md](https://github.com/i-ops-hq/labs/blob/main/products/permissions/POLICY_SPEC.md) for selectors, precedence, conservative
|
|
100
|
+
manifest guards, limits and export semantics.
|
|
101
|
+
|
|
102
|
+
Default reports omit raw resource identifiers/patterns, unknown text, constraint
|
|
103
|
+
text and credential references. IDs must be logical references without secrets.
|
|
104
|
+
Exported scenario files necessarily retain their explicitly selected action
|
|
105
|
+
resource; treat those local artifacts as potentially sensitive configuration.
|
|
106
|
+
|
|
107
|
+
## Validation and boundaries
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
uv run --frozen pytest -q
|
|
111
|
+
uv build
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The repository verifier additionally installs wheels and rebuilt source
|
|
115
|
+
distributions outside the source tree, tests SDK/CLI functionality without Crash
|
|
116
|
+
Lab, and checks matching shared schema bytes. Supported matching is lexical and
|
|
117
|
+
bounded; no regex policy language, path resolution, arbitrary static analysis,
|
|
118
|
+
runtime hooks, enforcement, model calls, gateway, or cloud service is provided.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "0.1.0",
|
|
3
|
+
"request_id": "allowed-request",
|
|
4
|
+
"agent_id": "python-ops-fixture",
|
|
5
|
+
"action": {
|
|
6
|
+
"kind": "filesystem",
|
|
7
|
+
"operation": "read",
|
|
8
|
+
"resource": {
|
|
9
|
+
"type": "file",
|
|
10
|
+
"identifier": "fixture://protected-workspace/readme.txt"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "0.1.0",
|
|
3
|
+
"request_id": "api-request",
|
|
4
|
+
"agent_id": "python-ops-fixture",
|
|
5
|
+
"action": {
|
|
6
|
+
"kind": "api",
|
|
7
|
+
"operation": "update",
|
|
8
|
+
"resource": {
|
|
9
|
+
"type": "record",
|
|
10
|
+
"identifier": "fixture://fake-customer-api/customer-1"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "0.1.0",
|
|
3
|
+
"request_id": "approval-request",
|
|
4
|
+
"agent_id": "python-ops-fixture",
|
|
5
|
+
"action": {
|
|
6
|
+
"kind": "filesystem",
|
|
7
|
+
"operation": "delete",
|
|
8
|
+
"resource": {
|
|
9
|
+
"type": "file",
|
|
10
|
+
"identifier": "fixture://protected-workspace/scratch.txt"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "0.1.0",
|
|
3
|
+
"request_id": "coding-read-request",
|
|
4
|
+
"agent_id": "coding-fixture",
|
|
5
|
+
"action": {
|
|
6
|
+
"kind": "filesystem",
|
|
7
|
+
"operation": "read",
|
|
8
|
+
"resource": {
|
|
9
|
+
"type": "file",
|
|
10
|
+
"identifier": "fixture://protected-workspace/readme.txt"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|