teef 0.1.1__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.
- teef-0.1.1/.gitattributes +3 -0
- teef-0.1.1/.github/workflows/publish.yml +64 -0
- teef-0.1.1/.gitignore +16 -0
- teef-0.1.1/.python-version +1 -0
- teef-0.1.1/LICENSE +202 -0
- teef-0.1.1/PKG-INFO +299 -0
- teef-0.1.1/README.md +271 -0
- teef-0.1.1/pyproject.toml +69 -0
- teef-0.1.1/src/teef/__init__.py +84 -0
- teef-0.1.1/src/teef/__main__.py +5 -0
- teef-0.1.1/src/teef/catalog.py +128 -0
- teef-0.1.1/src/teef/cli.py +466 -0
- teef-0.1.1/src/teef/context.py +49 -0
- teef-0.1.1/src/teef/errors.py +13 -0
- teef-0.1.1/src/teef/findings.py +17 -0
- teef-0.1.1/src/teef/jose.py +199 -0
- teef-0.1.1/src/teef/keys.py +141 -0
- teef-0.1.1/src/teef/models.py +387 -0
- teef-0.1.1/src/teef/package.py +272 -0
- teef-0.1.1/src/teef/parsing.py +73 -0
- teef-0.1.1/src/teef/py.typed +0 -0
- teef-0.1.1/src/teef/reader.py +171 -0
- teef-0.1.1/src/teef/recipient.py +510 -0
- teef-0.1.1/src/teef/report.py +229 -0
- teef-0.1.1/src/teef/rules.py +297 -0
- teef-0.1.1/src/teef/schema.py +42 -0
- teef-0.1.1/src/teef/schemas/tprm-evidence-exchange-0.1.0.schema.json +425 -0
- teef-0.1.1/src/teef/serialize.py +38 -0
- teef-0.1.1/src/teef/sources.py +303 -0
- teef-0.1.1/src/teef/templates/report.css +93 -0
- teef-0.1.1/src/teef/templates/report.html.j2 +276 -0
- teef-0.1.1/tests/conftest.py +26 -0
- teef-0.1.1/tests/test_cli.py +200 -0
- teef-0.1.1/tests/test_cli_sig.py +245 -0
- teef-0.1.1/tests/test_conformance_full.py +69 -0
- teef-0.1.1/tests/test_context_catalog.py +35 -0
- teef-0.1.1/tests/test_keys.py +181 -0
- teef-0.1.1/tests/test_models_basic.py +126 -0
- teef-0.1.1/tests/test_models_full.py +126 -0
- teef-0.1.1/tests/test_models_spec.py +54 -0
- teef-0.1.1/tests/test_package.py +249 -0
- teef-0.1.1/tests/test_package_sig.py +151 -0
- teef-0.1.1/tests/test_parsing.py +51 -0
- teef-0.1.1/tests/test_public_api.py +16 -0
- teef-0.1.1/tests/test_reader.py +120 -0
- teef-0.1.1/tests/test_reader_jwe.py +211 -0
- teef-0.1.1/tests/test_reader_sig.py +231 -0
- teef-0.1.1/tests/test_recipient_basic.py +172 -0
- teef-0.1.1/tests/test_recipient_review.py +235 -0
- teef-0.1.1/tests/test_report_model.py +104 -0
- teef-0.1.1/tests/test_report_render.py +250 -0
- teef-0.1.1/tests/test_review_fixes.py +234 -0
- teef-0.1.1/tests/test_rules.py +256 -0
- teef-0.1.1/tests/test_rules_conformance.py +51 -0
- teef-0.1.1/tests/test_scaffold.py +15 -0
- teef-0.1.1/tests/test_schema.py +38 -0
- teef-0.1.1/tests/test_serialize.py +28 -0
- teef-0.1.1/tests/test_sources_folder.py +95 -0
- teef-0.1.1/tests/test_sources_zip.py +163 -0
- teef-0.1.1/uv.lock +1143 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Push a tag like v0.1.0 to publish. The tag must match the version in src/teef/__init__.py.
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
tags:
|
|
7
|
+
- "v*"
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
name: Test and build
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: astral-sh/setup-uv@v6
|
|
20
|
+
|
|
21
|
+
- name: Install
|
|
22
|
+
run: uv sync --locked
|
|
23
|
+
|
|
24
|
+
- name: Check the tag matches the package version
|
|
25
|
+
run: |
|
|
26
|
+
version=$(uv run python -c "import teef; print(teef.__version__)")
|
|
27
|
+
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
|
|
28
|
+
echo "Tag $GITHUB_REF_NAME does not match package version $version"
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
- name: Lint
|
|
33
|
+
run: uv run ruff check .
|
|
34
|
+
|
|
35
|
+
- name: Type check
|
|
36
|
+
run: uv run mypy src
|
|
37
|
+
|
|
38
|
+
- name: Test
|
|
39
|
+
run: uv run pytest
|
|
40
|
+
|
|
41
|
+
- name: Build
|
|
42
|
+
run: uv build
|
|
43
|
+
|
|
44
|
+
- uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: dist
|
|
47
|
+
path: dist/
|
|
48
|
+
|
|
49
|
+
publish:
|
|
50
|
+
name: Publish
|
|
51
|
+
needs: build
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
environment:
|
|
54
|
+
name: pypi
|
|
55
|
+
url: https://pypi.org/project/teef/
|
|
56
|
+
permissions:
|
|
57
|
+
id-token: write # PyPI trusted publishing, no API token needed
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/download-artifact@v4
|
|
60
|
+
with:
|
|
61
|
+
name: dist
|
|
62
|
+
path: dist/
|
|
63
|
+
|
|
64
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
teef-0.1.1/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
teef-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
https://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
|
+
https://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.
|
teef-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: teef
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Build, verify and read TEEF (TPRM Evidence Exchange Format) packages
|
|
5
|
+
Project-URL: Source, https://github.com/stalpers/pyTEEF
|
|
6
|
+
Project-URL: Issues, https://github.com/stalpers/pyTEEF/issues
|
|
7
|
+
Project-URL: Specification, https://github.com/stalpers/TEEF
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: evidence,jose,questionnaire,third-party risk,tprm
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Security
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: jinja2>=3.1
|
|
22
|
+
Requires-Dist: joserfc>=1.8
|
|
23
|
+
Requires-Dist: jsonschema>=4.18
|
|
24
|
+
Requires-Dist: pydantic>=2.7
|
|
25
|
+
Requires-Dist: rfc3339-validator>=0.1.4
|
|
26
|
+
Requires-Dist: rfc3986-validator>=0.1.1
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# teef
|
|
30
|
+
|
|
31
|
+
A Python package for building, verifying and reading [TEEF](https://github.com/stalpers/TEEF) (TPRM Evidence Exchange Format) packages: questionnaire responses and evidence that a supplier sends to the organisations assessing it.
|
|
32
|
+
|
|
33
|
+
**Status:** early development, tracking TEEF draft 0.1.0. Suppliers can build packages, and recipients can verify and read them. teef passes every case of the TEEF 0.1.0 conformance suite.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
From a checkout, with [uv](https://docs.astral.sh/uv/):
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
uv sync
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Python 3.11 or later is required.
|
|
44
|
+
|
|
45
|
+
## Build a package
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from datetime import date
|
|
49
|
+
|
|
50
|
+
from teef import (
|
|
51
|
+
Evidence,
|
|
52
|
+
EvidenceRef,
|
|
53
|
+
InlineContent,
|
|
54
|
+
Organization,
|
|
55
|
+
Package,
|
|
56
|
+
Questionnaire,
|
|
57
|
+
Response,
|
|
58
|
+
Subject,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
supplier = Organization(name="Example Supplier AG", identifier="https://supplier.example/id/ag")
|
|
62
|
+
pkg = Package(
|
|
63
|
+
publisher=supplier,
|
|
64
|
+
subject=Subject(organization=supplier, service="Example Cloud Backup"),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
pkg.add_evidence(
|
|
68
|
+
Evidence(
|
|
69
|
+
id="backup-policy",
|
|
70
|
+
kind="policy",
|
|
71
|
+
title="Backup policy summary",
|
|
72
|
+
issuer=supplier,
|
|
73
|
+
content=InlineContent(text="The recovery point objective is 24 hours."),
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
pkg.attach_file(
|
|
78
|
+
id="subprocessors",
|
|
79
|
+
kind="subprocessor-list",
|
|
80
|
+
title="Subprocessor list, November 2026",
|
|
81
|
+
source="exports/subprocessors.json",
|
|
82
|
+
issuer=supplier,
|
|
83
|
+
valid_from=date(2026, 11, 1),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
pkg.add_questionnaire(
|
|
87
|
+
Questionnaire(
|
|
88
|
+
id="https://buyer.example/questionnaires/cloud-due-diligence",
|
|
89
|
+
version="2026-11",
|
|
90
|
+
responses=[
|
|
91
|
+
Response(
|
|
92
|
+
question_id="RESILIENCE-03",
|
|
93
|
+
status="answered",
|
|
94
|
+
answer=24,
|
|
95
|
+
evidence_refs=[EvidenceRef(evidence_id="backup-policy")],
|
|
96
|
+
),
|
|
97
|
+
Response(
|
|
98
|
+
question_id="PRIVACY-02",
|
|
99
|
+
status="reference",
|
|
100
|
+
evidence_refs=[EvidenceRef(evidence_id="subprocessors")],
|
|
101
|
+
),
|
|
102
|
+
Response(
|
|
103
|
+
question_id="PRIVACY-04",
|
|
104
|
+
status="notApplicable",
|
|
105
|
+
note="This service does not offer an on-premises deployment.",
|
|
106
|
+
),
|
|
107
|
+
],
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
pkg.write_zip("out/package.zip") # or pkg.write_dir("out/package")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The builder fills in `schemaVersion`, a new `packageId`, `generatedAt` in UTC, and each attached file's path, media type and SHA-256 digest. Model fields use snake_case in Python and the spec's camelCase names in JSON. `Manifest.model_validate(data)` and every model accept either.
|
|
115
|
+
|
|
116
|
+
## What is checked
|
|
117
|
+
|
|
118
|
+
Mistakes in a single object, such as an `answered` response without an answer or a lowercase country code, fail when the object is created. Before a package is written, `check()` runs on the exact manifest bytes and the attached files:
|
|
119
|
+
|
|
120
|
+
| Rule | Check |
|
|
121
|
+
|---|---|
|
|
122
|
+
| TEEF-SCHEMA-01 | The manifest validates against the bundled JSON Schema, with format assertions |
|
|
123
|
+
| TEEF-ID-03 | Evidence IDs, questionnaires, question IDs and file paths are unique |
|
|
124
|
+
| TEEF-REF-03 to 07 | Evidence references resolve, `bridges` links a bridge letter to an assurance report, no self-references, `supersedes` is not the package's own ID |
|
|
125
|
+
| TEEF-DATE-03 | Validity and coverage ranges are not inverted |
|
|
126
|
+
| TEEF-AR-02, 03 | Type 1 reports cover one date, type 2 reports cover more than one |
|
|
127
|
+
| TEEF-EV-11 | Every declared file is present and matches its digest |
|
|
128
|
+
| TEEF-ARC-01, 03, 06 | No undeclared files, reserved device names, or case-insensitive path collisions |
|
|
129
|
+
| TEEF-SIG-03 to 08, 11, 12, 13 | Signing, encryption and signature checks, see "Sign and encrypt" |
|
|
130
|
+
|
|
131
|
+
`write_dir` and `write_zip` raise `PackageValidationError` with the findings when any rule is broken, and write nothing. `teef.check_package(manifest_dict, files)` runs the same checks on any manifest.
|
|
132
|
+
|
|
133
|
+
## Verify a package
|
|
134
|
+
|
|
135
|
+
`teef verify` checks a package you received, given as a folder, a ZIP archive, or a bare `manifest.json`, and lists what a reviewer must look at:
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
$ uv run teef verify supplier-package.zip
|
|
139
|
+
VALID supplier-package.zip
|
|
140
|
+
0 errors, 5 warnings
|
|
141
|
+
|
|
142
|
+
Warnings
|
|
143
|
+
TEEF-AR-08 Surface reported exceptions
|
|
144
|
+
SOC 2 Type 2 report, Example Cloud Backup (soc2-type2) reports 1 exception
|
|
145
|
+
at /evidence/5/assuranceReport/exceptions
|
|
146
|
+
TEEF-AR-09 Surface carved-out subservice organisations
|
|
147
|
+
Example Hosting SA is carved out of SOC 2 Type 2 report, Example Cloud Backup (soc2-type2)
|
|
148
|
+
at /evidence/5/assuranceReport/subserviceOrganizations/0
|
|
149
|
+
...
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Errors mean the package must be rejected. Warnings are findings the reviewer must or should look at, and do not make a package invalid. The exit code is `0` for a valid package, `1` for an invalid one, and `2` for a usage error.
|
|
153
|
+
|
|
154
|
+
| Option | Use |
|
|
155
|
+
|---|---|
|
|
156
|
+
| `--basedir DIR` | When the path is a `manifest.json`, read the package files from `DIR`, checked like a package folder. A `manifest.json` in `DIR` is ignored. |
|
|
157
|
+
| `--previous MANIFEST` | A manifest you received before, for package ID reuse and `supersedes` checks. Repeatable. |
|
|
158
|
+
| `--intake-date YYYY-MM-DD` | The date you take the package in, for expiry. Defaults to the package's generation date. |
|
|
159
|
+
| `--known-questionnaire URI VERSION` | A questionnaire you know. Repeatable. When given, other questionnaires are reported. |
|
|
160
|
+
| `--max-archive-bytes`, `--max-entries`, `--max-expanded-bytes` | Archive limits. Defaults: 100 MiB, 1000 entries, 200 MiB. |
|
|
161
|
+
| `--json` | Print `{"source", "result", "packageId", "errors", "warnings"}`, each finding with `ruleId`, `title`, `message` and `location`. |
|
|
162
|
+
| `--trusted-keys JWKS` | A JWK Set of the publisher keys you trust, used to verify `manifest.jws`. |
|
|
163
|
+
| `--require-signature` | Report a package without a verified signature as an error. Needs `--trusted-keys`. |
|
|
164
|
+
| `--decryption-key PEM` | Your private key, to read an encrypted package. |
|
|
165
|
+
| `--decryption-key-id KID` | The key ID of `--decryption-key`. |
|
|
166
|
+
| `--key-password-env NAME` | The environment variable holding the password of `--decryption-key`. |
|
|
167
|
+
| `--html FILE` | Also write the HTML review report to `FILE`, replacing an existing file. |
|
|
168
|
+
|
|
169
|
+
ZIP archives are read in memory and never extracted. Entry names, links, duplicates and limits are checked before any entry is read.
|
|
170
|
+
|
|
171
|
+
## Read a package in Python
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
from datetime import date
|
|
175
|
+
|
|
176
|
+
import teef
|
|
177
|
+
|
|
178
|
+
result = teef.read(
|
|
179
|
+
"incoming/package.zip",
|
|
180
|
+
teef.Context(intake_date=date(2027, 1, 15)),
|
|
181
|
+
)
|
|
182
|
+
if result.valid:
|
|
183
|
+
for response in result.manifest.questionnaires[0].responses:
|
|
184
|
+
print(response.question_id, response.status, response.answer)
|
|
185
|
+
for finding in result.warnings:
|
|
186
|
+
print(finding.rule_id, teef.rule_title(finding.rule_id), finding.message)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`teef.read` never raises because of package content. A broken package is a result with errors, and `result.manifest` is `None` when the manifest does not pass the schema check. `result.files` holds the bytes of the declared files.
|
|
190
|
+
|
|
191
|
+
Besides every check above, reading adds:
|
|
192
|
+
|
|
193
|
+
- archive safety (TEEF-ARC-02 to 07)
|
|
194
|
+
- manifest encoding and duplicate members (TEEF-PKG-02, 03)
|
|
195
|
+
- package ID reuse and `supersedes` checks against previous packages (TEEF-ID-02, TEEF-REF-08)
|
|
196
|
+
- these reviewer warnings:
|
|
197
|
+
|
|
198
|
+
| Rule | Warning |
|
|
199
|
+
|---|---|
|
|
200
|
+
| TEEF-AR-07 to 10 | Opinion other than unmodified, reported exceptions, carved-out subservice organisations, complementary user entity controls |
|
|
201
|
+
| TEEF-CERT-07, 09, 10 | Certificate without a number, without an accreditation body, or last audited more than 12 months ago |
|
|
202
|
+
| TEEF-SCOPE-06, 08, 09 | Subject organisation or countries the evidence does not cover, or cannot be compared without identifiers |
|
|
203
|
+
| TEEF-DATE-02, 05 | Gap or overlap between a report and its bridge letter; evidence expired at generation or intake |
|
|
204
|
+
| TEEF-EV-10 | Evidence without a stated scope |
|
|
205
|
+
| TEEF-ANS-12 | A questionnaire or version you did not list as known |
|
|
206
|
+
| TEEF-URI-06 | An external link that appears to carry credentials |
|
|
207
|
+
| TEEF-SIG-12 | An invalid signature is an error. A signature or timestamp that teef did not verify (no trusted keys, or timestamps) is a warning |
|
|
208
|
+
|
|
209
|
+
Not covered yet: timestamps (TEEF-SIG-09, 10), keys held in a KMS or HSM, and checks against questionnaire definitions (TEEF-ANS-11, 14).
|
|
210
|
+
|
|
211
|
+
## Sign and encrypt
|
|
212
|
+
|
|
213
|
+
A publisher signs a package so the recipient can tell who produced it and that it was not changed. The signature is a detached JWS over the exact `manifest.json` bytes, stored as `manifest.jws`. A package can also be encrypted for one recipient as a JWE. Use separate keys for signing and for encryption (TEEF-SIG-11), and keep private keys out of packages and version control.
|
|
214
|
+
|
|
215
|
+
### Create keys
|
|
216
|
+
|
|
217
|
+
RSA-3072 keys with `openssl`:
|
|
218
|
+
|
|
219
|
+
```text
|
|
220
|
+
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:3072 -out signing.pem
|
|
221
|
+
openssl pkey -in signing.pem -pubout -out signing-public.pem
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Repeat with other file names for the encryption key pair. `openssl` cannot write JWKs, so build the JWK Set of keys you publish or trust with a few lines of Python:
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
import json
|
|
228
|
+
from pathlib import Path
|
|
229
|
+
|
|
230
|
+
from joserfc.jwk import RSAKey
|
|
231
|
+
|
|
232
|
+
key = RSAKey.import_key(
|
|
233
|
+
Path("signing-public.pem").read_bytes(), parameters={"kid": "publisher-2026", "use": "sig"}
|
|
234
|
+
)
|
|
235
|
+
Path("trusted.jwks").write_text(json.dumps({"keys": [key.as_dict(private=False)]}))
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Build a signed or encrypted package
|
|
239
|
+
|
|
240
|
+
```python
|
|
241
|
+
from teef.keys import load_private_key, load_public_key
|
|
242
|
+
|
|
243
|
+
signer = load_private_key("signing.pem", kid="publisher-2026")
|
|
244
|
+
recipient = load_public_key("buyer-public.pem", kid="buyer-2026")
|
|
245
|
+
|
|
246
|
+
pkg.write_zip("out/package.zip", sign_with=signer)
|
|
247
|
+
pkg.write_zip("out/package.jwe", encrypt_for=recipient, sign_with=signer) # signed, then encrypted
|
|
248
|
+
pkg.write_dir("out/package", sign_with=signer)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`load_public_key` and `load_private_key` read PEM or JWK files, `load_private_key` takes a `password=` (bytes), and `teef.keys.load_key_set(path)` reads a JWK Set. An existing package can be signed or encrypted afterwards:
|
|
252
|
+
|
|
253
|
+
```text
|
|
254
|
+
uv run teef sign package.zip --key signing.pem --kid publisher-2026 -o signed.zip
|
|
255
|
+
uv run teef sign out/package --key signing.pem --kid publisher-2026
|
|
256
|
+
uv run teef encrypt signed.zip --recipient-key buyer-public.pem --kid buyer-2026 -o signed.jwe
|
|
257
|
+
uv run teef decrypt signed.jwe --key buyer.pem --kid buyer-2026 -o signed.zip
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
`sign` signs a folder in place, or a ZIP into the new ZIP given by `-o`. `--force` replaces an existing `manifest.jws` or output file. `--kid` on `encrypt` is only needed for a PEM key, since a JWK has its own. For a key that is protected by a password, name an environment variable with `--key-password-env NAME`. The password is never taken from the command line.
|
|
261
|
+
|
|
262
|
+
### Verify and read
|
|
263
|
+
|
|
264
|
+
```text
|
|
265
|
+
uv run teef verify signed.jwe --decryption-key buyer.pem --decryption-key-id buyer-2026 \
|
|
266
|
+
--trusted-keys trusted.jwks --require-signature
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Without `--trusted-keys` the signature is reported as not verified, with a TEEF-SIG-12 warning. `--require-signature` makes a missing or unverified signature an error (TEEF-SIG-13) and needs `--trusted-keys`; without trusted keys a signature cannot be verified, so `teef verify` refuses the combination. The text output and the HTML report show the signature status and, for an encrypted package, the key it was encrypted for. In Python, pass `teef.Context(trusted_keys=..., decryption_key=...)` to `teef.read`, and read `result.signature` and `result.encryption`.
|
|
270
|
+
|
|
271
|
+
## Review report
|
|
272
|
+
|
|
273
|
+
```text
|
|
274
|
+
uv run teef verify package.zip --html report.html
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
This writes a self-contained HTML review document next to the usual output:
|
|
278
|
+
|
|
279
|
+
- **Layout:** a contents sidebar with finding counts per section and evidence item, then the verdict, signature and encryption status, and findings summary, the subject and its scope, every evidence item (issuer, dates, scope, certificate and assurance report details), the questionnaire answers, and the files.
|
|
280
|
+
- **Findings:** each finding appears in the summary and again next to the item it concerns.
|
|
281
|
+
- **Print:** the report prints cleanly on A4, with the contents list on page 1.
|
|
282
|
+
- **Safety:** the report contains no scripts and loads nothing from outside. Supplier links are shown as text, never as clickable links.
|
|
283
|
+
- **Confidentiality:** the report repeats package content, so a note at the top asks the reader to handle it like the package.
|
|
284
|
+
|
|
285
|
+
From Python: `html = teef.render_html(teef.read("package.zip"))`.
|
|
286
|
+
|
|
287
|
+
## Development
|
|
288
|
+
|
|
289
|
+
```text
|
|
290
|
+
uv run pytest
|
|
291
|
+
uv run ruff check .
|
|
292
|
+
uv run mypy src
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Tests that compare against the specification use a checkout of the [spec repository](https://github.com/stalpers/TEEF). They look for it in the folder next to this one, or at the path in `TEEF_SPEC_DIR`, and are skipped when it is not found.
|
|
296
|
+
|
|
297
|
+
## License
|
|
298
|
+
|
|
299
|
+
Apache License, Version 2.0. See [LICENSE](LICENSE).
|