terp-cli 0.43.0__tar.gz → 0.44.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.
- {terp_cli-0.43.0 → terp_cli-0.44.0}/PKG-INFO +9 -9
- {terp_cli-0.43.0 → terp_cli-0.44.0}/pyproject.toml +9 -9
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/__init__.py +6 -7
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/audit_findings.py +15 -1
- terp_cli-0.44.0/src/terp/cli/dependency_risk.py +348 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/dependency_scan.py +6 -1
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/deployment_adopt.py +2 -1
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/guide_deployment.py +7 -3
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_plan.py +86 -5
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_render.py +2 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/manifest.py +39 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/promote.py +2 -1
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/sign.py +23 -2
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/risk_authority.py +4 -1
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/verify.py +12 -12
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/version.py +1 -1
- terp_cli-0.43.0/src/terp/cli/dependency_risk.py +0 -167
- {terp_cli-0.43.0 → terp_cli-0.44.0}/.gitignore +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/signer/Dockerfile +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/signer/terp-arch-releases.json +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/_appref.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/_cors_view.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/_engine.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/_output.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/_subjects.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/access.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/api_contract.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/api_contract_bounds.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/api_contract_check.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/api_contract_schemas.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/api_contract_shapes.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/apidocs.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/authz_surface.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/capabilities.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/dependency_audit.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/deploy_safety.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/deployment_app.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/deployment_check.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/deployment_declare.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/deployment_render.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/dev.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/docker.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/docker_masks.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/envfile.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/envrequired.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/envschema.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/envseams.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/fmt.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/grants.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/guide_capability.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/guide_files.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/guide_maintenance.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/guide_migrations.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/guide_passwords.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/heartbeat.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/jobs.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/leases.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/locks.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/maintenance/__init__.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/maintenance/_images.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/maintenance/_packages.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/maintenance/_platform.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/maintenance/_report.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/maintenance/_vulnerabilities.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/module_roles.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/npm_tree.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/openapi.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/outbox.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/ports.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/profiles.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/py.typed +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/python_audit.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/__init__.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_archives.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_common.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_compare.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_dockerfile.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_git.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_history.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_image.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_locks.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_migrations.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_npm_lock.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_osv.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_registry.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/_sandbox.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/build.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/cli.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/dsse.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/release/gate.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/reseal.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/reseal_report.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/routes.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/scaffold.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/scaffold_frontend.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/schema.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/seed.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/service_accounts.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/smoke.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/upgrade_recipes.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/users.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/workbench.py +0 -0
- {terp_cli-0.43.0 → terp_cli-0.44.0}/src/terp/cli/workbench_adopt.py +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: terp-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.44.0
|
|
4
4
|
Summary: Terp command-line tool — inspect, scaffolding, migrations, checks, api-docs.
|
|
5
5
|
Project-URL: Repository, https://github.com/AITT-NL/terp-framework
|
|
6
6
|
Project-URL: Changelog, https://github.com/AITT-NL/terp-framework/blob/main/CHANGELOG.md
|
|
7
7
|
License-Expression: Apache-2.0
|
|
8
8
|
Requires-Python: >=3.13
|
|
9
9
|
Requires-Dist: pyyaml>=6.0
|
|
10
|
-
Requires-Dist: terp-arch==0.
|
|
11
|
-
Requires-Dist: terp-core==0.
|
|
12
|
-
Requires-Dist: terp-migrations==0.
|
|
10
|
+
Requires-Dist: terp-arch==0.44.0
|
|
11
|
+
Requires-Dist: terp-core==0.44.0
|
|
12
|
+
Requires-Dist: terp-migrations==0.44.0
|
|
13
13
|
Provides-Extra: jobs
|
|
14
|
-
Requires-Dist: terp-cap-outbox==0.
|
|
15
|
-
Requires-Dist: terp-cap-scheduler-apscheduler==0.
|
|
14
|
+
Requires-Dist: terp-cap-outbox==0.44.0; extra == 'jobs'
|
|
15
|
+
Requires-Dist: terp-cap-scheduler-apscheduler==0.44.0; extra == 'jobs'
|
|
16
16
|
Provides-Extra: release
|
|
17
17
|
Requires-Dist: cryptography>=46; extra == 'release'
|
|
18
18
|
Requires-Dist: packaging>=24; extra == 'release'
|
|
19
|
-
Requires-Dist: terp-cap-egress==0.
|
|
19
|
+
Requires-Dist: terp-cap-egress==0.44.0; extra == 'release'
|
|
20
20
|
Provides-Extra: scheduler
|
|
21
|
-
Requires-Dist: terp-cap-scheduler-apscheduler==0.
|
|
21
|
+
Requires-Dist: terp-cap-scheduler-apscheduler==0.44.0; extra == 'scheduler'
|
|
22
22
|
Provides-Extra: worker
|
|
23
|
-
Requires-Dist: terp-cap-outbox==0.
|
|
23
|
+
Requires-Dist: terp-cap-outbox==0.44.0; extra == 'worker'
|
|
@@ -4,18 +4,18 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "terp-cli"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.44.0"
|
|
8
8
|
description = "Terp command-line tool — inspect, scaffolding, migrations, checks, api-docs."
|
|
9
9
|
requires-python = ">=3.13"
|
|
10
10
|
license = "Apache-2.0"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"terp-core==0.
|
|
12
|
+
"terp-core==0.44.0",
|
|
13
13
|
# `terp migrate` delegates to terp-migrations (lazily imported), keeping Alembic
|
|
14
14
|
# off the path for `terp inspect` / `terp guide` while making migrations work.
|
|
15
|
-
"terp-migrations==0.
|
|
15
|
+
"terp-migrations==0.44.0",
|
|
16
16
|
# `terp guide rules` projects the live rule registry; terp-arch is imported lazily
|
|
17
17
|
# (only when that topic is rendered), so it stays off the common `terp guide` path.
|
|
18
|
-
"terp-arch==0.
|
|
18
|
+
"terp-arch==0.44.0",
|
|
19
19
|
# `terp verify --only env-seams` and `terp smoke` read the compose profiles as data
|
|
20
20
|
# (anchors and `<<:` merge keys resolved), so both answer without a Docker daemon or
|
|
21
21
|
# even the `docker` binary. Declared explicitly rather than leant on: every app
|
|
@@ -29,11 +29,11 @@ dependencies = [
|
|
|
29
29
|
# or a scheduler engine into apps that only use inspect/check/migrate. Deployments can select
|
|
30
30
|
# one process role, while `jobs` is the convenient complete jobs-process bundle.
|
|
31
31
|
[project.optional-dependencies]
|
|
32
|
-
worker = ["terp-cap-outbox==0.
|
|
33
|
-
scheduler = ["terp-cap-scheduler-apscheduler==0.
|
|
32
|
+
worker = ["terp-cap-outbox==0.44.0"]
|
|
33
|
+
scheduler = ["terp-cap-scheduler-apscheduler==0.44.0"]
|
|
34
34
|
jobs = [
|
|
35
|
-
"terp-cap-outbox==0.
|
|
36
|
-
"terp-cap-scheduler-apscheduler==0.
|
|
35
|
+
"terp-cap-outbox==0.44.0",
|
|
36
|
+
"terp-cap-scheduler-apscheduler==0.44.0",
|
|
37
37
|
]
|
|
38
38
|
# `terp release` and `terp promote` (ADR 0187): the DSSE signature (cryptography), the lock's
|
|
39
39
|
# markers (packaging), and the one declared way to a registry, an index and the vulnerability
|
|
@@ -42,7 +42,7 @@ jobs = [
|
|
|
42
42
|
release = [
|
|
43
43
|
"cryptography>=46",
|
|
44
44
|
"packaging>=24",
|
|
45
|
-
"terp-cap-egress==0.
|
|
45
|
+
"terp-cap-egress==0.44.0",
|
|
46
46
|
]
|
|
47
47
|
|
|
48
48
|
[project.scripts]
|
|
@@ -1950,14 +1950,14 @@ Frontend module screens (@terpjs/react-core)
|
|
|
1950
1950
|
raw <form> -> Stack as="form" (terp guide forms)
|
|
1951
1951
|
raw fetch / XMLHttpRequest -> useTerpClient() + unwrap (typed client)
|
|
1952
1952
|
WebSocket / EventSource / sendBeacon -> the generated client (one egress path)
|
|
1953
|
-
style
|
|
1953
|
+
inline style / global classes -> primitives or a sibling CSS Module
|
|
1954
1954
|
<a href="/..."> -> the router's Link (role-aware, no reload)
|
|
1955
1955
|
deep imports (@terpjs/*/src, @terpjs/*/dist) -> import from the package root only
|
|
1956
1956
|
data-terp / data-terp-* anywhere in src -> compose the component that renders it
|
|
1957
1957
|
The data-terp markers are react-core's own: its stylesheet and the runtime layout check
|
|
1958
1958
|
trust them. A framework screen you replace (renderTerpApp({ login })) is yours, so its
|
|
1959
1959
|
tests find it by role and accessible name, not by the framework screen's markers.
|
|
1960
|
-
The bootstrap (src/main.tsx) is the one file that imports stylesheets, and only the token
|
|
1960
|
+
The bootstrap (src/main.tsx) is the one file that imports global stylesheets, and only the token
|
|
1961
1961
|
pipeline's three: @terpjs/contract/tokens.css, ./house-style.css and ./theme.css. A
|
|
1962
1962
|
library's stylesheet is refused there too: it would paint outside the palettes. A
|
|
1963
1963
|
stylesheet loaded through import() or import.meta.glob is refused the same way.
|
|
@@ -2045,7 +2045,7 @@ Forms (react-core primitives)
|
|
|
2045
2045
|
<Button type="submit" variant="primary">Save</Button>
|
|
2046
2046
|
</Stack>
|
|
2047
2047
|
- Field wraps label + control + hint/error for one field; Stack (vertical by default)
|
|
2048
|
-
|
|
2048
|
+
lays out fields. A custom layout can use a sibling CSS Module.
|
|
2049
2049
|
- Submit through the typed client: const client = useTerpClient();
|
|
2050
2050
|
await unwrap(client.POST("/api/v1/invoices/", { body })); a failure throws ApiError
|
|
2051
2051
|
({code, status, requestId, fields}) — map codes to copy with useErrorMessage, show
|
|
@@ -2108,10 +2108,9 @@ Forms (react-core primitives)
|
|
|
2108
2108
|
"theming": """\
|
|
2109
2109
|
Theming and branding (design tokens, palettes, the brand mark)
|
|
2110
2110
|
|
|
2111
|
-
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
itself would not follow the palette. Modules never need theme-specific code.
|
|
2111
|
+
- Use the shared tokens for palette, typography and spacing. For a custom screen, use a
|
|
2112
|
+
plain Page and import styles from "./Board.module.css". Apply className={styles.board}
|
|
2113
|
+
and define .board in that file. Global stylesheets belong to the bootstrap token pipeline.
|
|
2115
2114
|
- THE SHIPPED PALETTES, plus "system":
|
|
2116
2115
|
midday twilight evening night contrast
|
|
2117
2116
|
Named for the time of day they suit: midday is the light set, twilight a dimmed dark,
|
|
@@ -11,6 +11,11 @@ import json
|
|
|
11
11
|
import re
|
|
12
12
|
from typing import Any
|
|
13
13
|
|
|
14
|
+
#: The longest string and the longest list terp-spec's ``dependency-audit`` contract holds. A
|
|
15
|
+
#: finding past either is never written, so every document a scan writes is the contract's.
|
|
16
|
+
MAX_TEXT = 4096
|
|
17
|
+
MAX_ITEMS = 10_000
|
|
18
|
+
|
|
14
19
|
|
|
15
20
|
class AuditUnreadable(ValueError):
|
|
16
21
|
"""The scanner or lock did not provide complete evidence."""
|
|
@@ -44,8 +49,17 @@ def finding(*, advisory: str, aliases: list[str], ecosystem: str, package: str,
|
|
|
44
49
|
}
|
|
45
50
|
if not all(isinstance(v, str) and v for v in (advisory, package, version, lockfile)):
|
|
46
51
|
raise AuditUnreadable("a dependency finding has no identity")
|
|
52
|
+
fixed_versions = sorted(set(fixed))
|
|
53
|
+
lists = (identity["advisories"], identity["dependency_paths"], fixed_versions)
|
|
54
|
+
if any(len(values) > MAX_ITEMS for values in lists) or any(
|
|
55
|
+
len(text) > MAX_TEXT for text in (package, version, lockfile, *(text for values in lists for text in values))
|
|
56
|
+
):
|
|
57
|
+
raise AuditUnreadable(
|
|
58
|
+
f"a dependency finding is longer than the dependency-audit contract holds: {MAX_TEXT} "
|
|
59
|
+
f"characters to a string and {MAX_ITEMS} entries to a list"
|
|
60
|
+
)
|
|
47
61
|
return {**identity, "fingerprint": digest(identity), "severity": severity,
|
|
48
|
-
"fixed_versions":
|
|
62
|
+
"fixed_versions": fixed_versions, "dependency_scope": scope}
|
|
49
63
|
|
|
50
64
|
|
|
51
65
|
def npm_findings(report: object, lock: object, lockfile: str) -> list[dict]:
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"""Release permission over complete audits and authenticated, current acceptances.
|
|
2
|
+
|
|
3
|
+
This evaluator does not authenticate records. Its caller must verify the issuer and
|
|
4
|
+
obtain current revocation state outside the agent's execution boundary. Raw checks
|
|
5
|
+
and assurance are never modified. No other failed check can be accepted here.
|
|
6
|
+
|
|
7
|
+
A check's evidence and every acceptance an authority returns are documents of the Terp
|
|
8
|
+
Standard, terp-spec's ``dependency-audit`` and ``dependency-risk-acceptance``, and both
|
|
9
|
+
are read closed, as their schemas are: a field neither defines, a string the contract
|
|
10
|
+
counts as blank or holds longer than it allows, and a digest, commit or time with
|
|
11
|
+
anything around it are refused, never read past. A superseded acceptance is held to the
|
|
12
|
+
contract too; only its lifetime, its revocation and the release it names are left to
|
|
13
|
+
the decision that replaces it. The patterns and limits below are the schemas' own, and
|
|
14
|
+
``tests/architecture/test_dependency_risk.py`` holds this reader to the pinned release:
|
|
15
|
+
it runs the release's fixtures, and breaks the schemas' rules one at a time at every
|
|
16
|
+
field, requiring a refusal for each document the pinned schema refuses.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import json
|
|
22
|
+
import re
|
|
23
|
+
from datetime import UTC, datetime, timedelta
|
|
24
|
+
|
|
25
|
+
from terp.cli.audit_findings import MAX_ITEMS, MAX_TEXT, blocking, digest
|
|
26
|
+
|
|
27
|
+
AUDITS = {"dependency-audit-npm": "npm", "dependency-audit-python": "pypi"}
|
|
28
|
+
MAX_LIFETIME = timedelta(days=30)
|
|
29
|
+
MAX_SCAN_AGE = timedelta(hours=24)
|
|
30
|
+
IDENTITY = ("advisories", "ecosystem", "package", "version", "lockfile", "dependency_paths")
|
|
31
|
+
|
|
32
|
+
#: The longest ``revoked_at`` an acceptance may hold. The decision a release is read against
|
|
33
|
+
#: holds none (""); a superseded one may say when it was revoked.
|
|
34
|
+
MAX_REVOCATION = 40
|
|
35
|
+
|
|
36
|
+
#: The fields each contract defines: every one is required, and no other is allowed.
|
|
37
|
+
AUDIT_FIELDS = frozenset({"version", "complete", "scanned_at", "locks", "findings"})
|
|
38
|
+
FINDING_FIELDS = frozenset({*IDENTITY, "fingerprint", "severity", "fixed_versions", "dependency_scope"})
|
|
39
|
+
ACCEPTANCE_FIELDS = frozenset({
|
|
40
|
+
"version", "id", "project_id", "commit", "environments", "finding", "locks", "reason", "evidence",
|
|
41
|
+
"approved_by", "approved_at", "expires_at", "revoked_at",
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
#: The contracts' patterns as their schemas write them, applied as JSON Schema applies a
|
|
45
|
+
#: pattern: by a search. ``CONTENT`` finds one character the acceptance contract does not count
|
|
46
|
+
#: as blank, which each field saying who decided, for what, why and on what evidence must hold.
|
|
47
|
+
CONTENT = re.compile(r"[^\u0000-\u0020\u007F-\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]")
|
|
48
|
+
DIGEST = re.compile(r"^sha256:[0-9a-f]{64}(?![\s\S])")
|
|
49
|
+
COMMIT = re.compile(r"^([0-9a-f]{40}|[0-9a-f]{64})(?![\s\S])")
|
|
50
|
+
INSTANT = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,6})?(Z|\+00:00)$")
|
|
51
|
+
|
|
52
|
+
#: What ``INSTANT`` means read as JSON Schema reads it, which Python's matcher does not: ASCII
|
|
53
|
+
#: digits and nothing after the zone. The hour stops at 23 because Python 3.14 reads 24:00:00 as
|
|
54
|
+
#: the next midnight where 3.13 refuses it, and a verdict must not depend on the interpreter.
|
|
55
|
+
_UTC_TIME = re.compile(r"[0-9]{4}-[0-9]{2}-[0-9]{2}T(?:[01][0-9]|2[0-3]):[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,6})?(?:Z|\+00:00)")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class RiskRefused(ValueError):
|
|
59
|
+
"""Incomplete evidence or invalid acceptance; permission stays closed."""
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def time_value(value: object, what: str) -> datetime:
|
|
63
|
+
"""A UTC time in any ISO 8601 form Python reads, as a risk authority's own answer may write one.
|
|
64
|
+
|
|
65
|
+
*what* names the time in a refusal: the field, and the record it is in.
|
|
66
|
+
"""
|
|
67
|
+
if value is None:
|
|
68
|
+
raise RiskRefused(f"{what} is missing")
|
|
69
|
+
if not isinstance(value, str):
|
|
70
|
+
raise RiskRefused(f"{what} is not a string")
|
|
71
|
+
try:
|
|
72
|
+
result = datetime.fromisoformat(value.replace("Z", "+00:00"))
|
|
73
|
+
except ValueError as exc:
|
|
74
|
+
raise RiskRefused(f"{what} is not a date and time") from exc
|
|
75
|
+
if result.utcoffset() != timedelta(0):
|
|
76
|
+
raise RiskRefused(f"{what} must be UTC")
|
|
77
|
+
return result
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def instant(value: object, what: str) -> datetime:
|
|
81
|
+
"""A time as both contracts write one, ``2026-11-18T12:00:00Z``, or a refusal naming *what*."""
|
|
82
|
+
if not isinstance(value, str) or not INSTANT.search(value) or not _UTC_TIME.fullmatch(value):
|
|
83
|
+
raise RiskRefused(f"{what} must be UTC, written YYYY-MM-DDThh:mm:ss with at most six decimals, "
|
|
84
|
+
"then Z or +00:00")
|
|
85
|
+
return time_value(value, what)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def _names(fields: list[str]) -> str:
|
|
89
|
+
"""Field names as a refusal shows them: escaped, the first five, each cut at 64 characters."""
|
|
90
|
+
shown = ", ".join(json.dumps(name[:64]) for name in fields[:5])
|
|
91
|
+
return shown + (f" and {len(fields) - 5} more" if len(fields) > 5 else "")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _closed(document: dict, fields: frozenset[str], what: str, contract: str) -> None:
|
|
95
|
+
"""Refused unless *document* holds exactly the *fields* its *contract* defines."""
|
|
96
|
+
extra, missing = sorted(str(name) for name in set(document) - fields), sorted(fields - set(document))
|
|
97
|
+
if extra or missing:
|
|
98
|
+
said = [f"holds {_names(extra)}, which the {contract} contract does not define"] if extra else []
|
|
99
|
+
said += [f"lacks {_names(missing)}, which the {contract} contract requires"] if missing else []
|
|
100
|
+
raise RiskRefused(f"{what} {' and '.join(said)}: whatever writes it must write the contract's fields")
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _text_problem(value: object, *, said: bool = False) -> str | None:
|
|
104
|
+
"""What keeps *value* from being a string of the contracts, or None.
|
|
105
|
+
|
|
106
|
+
One of 1 to MAX_TEXT characters, and where *said*, one character outside the blank class.
|
|
107
|
+
"""
|
|
108
|
+
if not isinstance(value, str):
|
|
109
|
+
return "is not a string"
|
|
110
|
+
if not value:
|
|
111
|
+
return "is empty"
|
|
112
|
+
if len(value) > MAX_TEXT:
|
|
113
|
+
return f"is longer than {MAX_TEXT} characters"
|
|
114
|
+
if said and CONTENT.search(value) is None:
|
|
115
|
+
return "holds only characters the contract counts as blank"
|
|
116
|
+
return None
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _list_problem(value: object, *, said: bool = False, ordered: bool = False, required: bool = True) -> str | None:
|
|
120
|
+
"""What keeps *value* from being a list of the contracts, or None.
|
|
121
|
+
|
|
122
|
+
At most MAX_ITEMS distinct strings, each as :func:`_text_problem` reads one: sorted where
|
|
123
|
+
*ordered*, and not empty where *required*.
|
|
124
|
+
"""
|
|
125
|
+
if not isinstance(value, list):
|
|
126
|
+
return "is not a list"
|
|
127
|
+
if required and not value:
|
|
128
|
+
return "is empty"
|
|
129
|
+
if len(value) > MAX_ITEMS:
|
|
130
|
+
return f"lists more than {MAX_ITEMS} entries"
|
|
131
|
+
for item in value:
|
|
132
|
+
problem = _text_problem(item, said=said)
|
|
133
|
+
if problem is not None:
|
|
134
|
+
return f"has an entry that {problem}"
|
|
135
|
+
if len(set(value)) != len(value):
|
|
136
|
+
return "lists an entry more than once"
|
|
137
|
+
if ordered and value != sorted(value):
|
|
138
|
+
return "is not sorted"
|
|
139
|
+
return None
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def _lock_problem(value: object) -> str | None:
|
|
143
|
+
"""What keeps *value* from mapping each lock's path to its whole sha256 digest, or None."""
|
|
144
|
+
if not isinstance(value, dict):
|
|
145
|
+
return "is not an object of lock paths and digests"
|
|
146
|
+
for path, recorded in value.items():
|
|
147
|
+
if not isinstance(path, str) or not path:
|
|
148
|
+
return "names a lock with an empty path"
|
|
149
|
+
if not isinstance(recorded, str) or DIGEST.search(recorded) is None:
|
|
150
|
+
return f"gives {_names([path])} no whole sha256 digest"
|
|
151
|
+
return None
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _one_of(value: object, *choices: str) -> bool:
|
|
155
|
+
"""Whether *value* is one of the strings *choices*; a value of any other type is none of them."""
|
|
156
|
+
return isinstance(value, str) and value in choices
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def fingerprint(item: object, where: str = "a finding", contract: str = "dependency-audit") -> str:
|
|
160
|
+
"""The fingerprint of *item*, a finding of *contract*, or a refusal that names it as *where*."""
|
|
161
|
+
if not isinstance(item, dict):
|
|
162
|
+
raise RiskRefused(f"{where} is not an object")
|
|
163
|
+
_closed(item, FINDING_FIELDS, where, contract)
|
|
164
|
+
for key, problem in (
|
|
165
|
+
*((key, _list_problem(item[key], ordered=True)) for key in ("advisories", "dependency_paths")),
|
|
166
|
+
*((key, _text_problem(item[key])) for key in ("package", "version", "lockfile")),
|
|
167
|
+
("fixed_versions", _list_problem(item["fixed_versions"], ordered=True, required=False)),
|
|
168
|
+
):
|
|
169
|
+
if problem is not None:
|
|
170
|
+
raise RiskRefused(f"{where}: {key} {problem}")
|
|
171
|
+
if not _one_of(item["ecosystem"], "npm", "pypi"):
|
|
172
|
+
raise RiskRefused(f"{where}: ecosystem is not npm or pypi")
|
|
173
|
+
if not _one_of(item["severity"], "info", "low", "moderate", "high", "critical", "unknown"):
|
|
174
|
+
raise RiskRefused(f"{where}: severity is not info, low, moderate, high, critical or unknown")
|
|
175
|
+
if item["ecosystem"] == "npm" and item["severity"] == "unknown":
|
|
176
|
+
raise RiskRefused(f"{where}: severity is unknown, and npm classifies every advisory it reports")
|
|
177
|
+
if not _one_of(item["dependency_scope"], "runtime", "development", "unknown"):
|
|
178
|
+
raise RiskRefused(f"{where}: dependency_scope is not runtime, development or unknown")
|
|
179
|
+
result = digest({key: item[key] for key in IDENTITY})
|
|
180
|
+
if result != item["fingerprint"]:
|
|
181
|
+
raise RiskRefused(f"{where}: fingerprint is not the one its identity hashes to")
|
|
182
|
+
return result
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def audit_evidence(audit: object, *, now: datetime,
|
|
186
|
+
name: str = "the dependency scan") -> tuple[dict[str, str], dict[str, dict]]:
|
|
187
|
+
"""A complete, current ``dependency-audit`` document's locks, and its findings by fingerprint.
|
|
188
|
+
|
|
189
|
+
Refused unless the scan finished at most :data:`MAX_SCAN_AGE` before *now*, and each finding
|
|
190
|
+
is whole, belongs to one of the scan's locks and is listed once. *name* says which scan a
|
|
191
|
+
refusal is about.
|
|
192
|
+
"""
|
|
193
|
+
if not isinstance(audit, dict) or type(audit.get("version")) is not int or audit["version"] != 1:
|
|
194
|
+
raise RiskRefused(f"{name} is not version 1 of the dependency-audit contract: audit again with the "
|
|
195
|
+
"toolchain the release pins")
|
|
196
|
+
if audit.get("complete") is not True:
|
|
197
|
+
raise RiskRefused(f"{name} is incomplete")
|
|
198
|
+
_closed(audit, AUDIT_FIELDS, name, "dependency-audit")
|
|
199
|
+
scanned = instant(audit["scanned_at"], f"{name}: scanned_at")
|
|
200
|
+
if not now - MAX_SCAN_AGE <= scanned <= now:
|
|
201
|
+
raise RiskRefused(f"{name} is stale or in the future: audit again")
|
|
202
|
+
locks, items = audit["locks"], audit["findings"]
|
|
203
|
+
problem = _lock_problem(locks)
|
|
204
|
+
if problem is not None:
|
|
205
|
+
raise RiskRefused(f"{name}: locks {problem}")
|
|
206
|
+
if not isinstance(items, list):
|
|
207
|
+
raise RiskRefused(f"{name}: findings is not a list")
|
|
208
|
+
if len(items) > MAX_ITEMS:
|
|
209
|
+
raise RiskRefused(f"{name} lists more than {MAX_ITEMS} findings, more than its contract holds")
|
|
210
|
+
findings: dict[str, dict] = {}
|
|
211
|
+
for index, item in enumerate(items):
|
|
212
|
+
where = f"finding {index} of {name}"
|
|
213
|
+
key = fingerprint(item, where)
|
|
214
|
+
if item["lockfile"] not in locks:
|
|
215
|
+
raise RiskRefused(f"{where}: lockfile {_names([item['lockfile']])} is not one of the scan's locks")
|
|
216
|
+
if key in findings:
|
|
217
|
+
raise RiskRefused(f"{where} repeats an earlier finding of the scan")
|
|
218
|
+
findings[key] = item
|
|
219
|
+
return locks, findings
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def acceptance_form(record: object) -> tuple[dict, str, datetime]:
|
|
223
|
+
"""*record*, the fingerprint of the finding it accepts and when it was approved, or a refusal.
|
|
224
|
+
|
|
225
|
+
Refused unless *record* is a ``dependency-risk-acceptance`` document: version 1, the fields
|
|
226
|
+
the contract defines, content in each field that says who decided, for what, why and on what
|
|
227
|
+
evidence, an exact commit, at least one lock with its whole digest, and both times in the
|
|
228
|
+
contract's form. Nothing here depends on the release the record is read for, so every record
|
|
229
|
+
an authority returns is held to it, a superseded one included.
|
|
230
|
+
"""
|
|
231
|
+
if not isinstance(record, dict):
|
|
232
|
+
raise RiskRefused("an acceptance record is malformed: it is not an object")
|
|
233
|
+
if type(record.get("version")) is not int or record["version"] != 1:
|
|
234
|
+
raise RiskRefused(f"{_label(record)} is not version 1 of the dependency-risk-acceptance contract")
|
|
235
|
+
_closed(record, ACCEPTANCE_FIELDS, _label(record), "dependency-risk-acceptance")
|
|
236
|
+
problem = _text_problem(record["id"], said=True)
|
|
237
|
+
if problem is not None:
|
|
238
|
+
raise RiskRefused(f"an acceptance's id {problem}")
|
|
239
|
+
label = _label(record)
|
|
240
|
+
for key, problem in (
|
|
241
|
+
*((key, _text_problem(record[key], said=True)) for key in ("project_id", "reason", "approved_by")),
|
|
242
|
+
*((key, _list_problem(record[key], said=True)) for key in ("environments", "evidence")),
|
|
243
|
+
):
|
|
244
|
+
if problem is not None:
|
|
245
|
+
raise RiskRefused(f"{label}: {key} {problem}")
|
|
246
|
+
if not isinstance(record["commit"], str) or not COMMIT.search(record["commit"]):
|
|
247
|
+
raise RiskRefused(f"{label}: commit is not a whole commit id, 40 or 64 lowercase hex characters")
|
|
248
|
+
problem = "names no lock" if record["locks"] == {} else _lock_problem(record["locks"])
|
|
249
|
+
if problem is not None:
|
|
250
|
+
raise RiskRefused(f"{label}: locks {problem}")
|
|
251
|
+
if not isinstance(record["revoked_at"], str) or len(record["revoked_at"]) > MAX_REVOCATION:
|
|
252
|
+
raise RiskRefused(f"{label}: revoked_at is not a string of at most {MAX_REVOCATION} characters")
|
|
253
|
+
approved = instant(record["approved_at"], f"{label}: approved_at")
|
|
254
|
+
instant(record["expires_at"], f"{label}: expires_at")
|
|
255
|
+
return record, fingerprint(record["finding"], f"the finding of {label}", "dependency-risk-acceptance"), approved
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def _label(record: dict) -> str:
|
|
259
|
+
"""An acceptance as a refusal names it: by its id, where it has one that says something."""
|
|
260
|
+
named = record.get("id")
|
|
261
|
+
return f"acceptance {_names([named])}" if _text_problem(named, said=True) is None else "an acceptance"
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def valid_acceptance(record: object, *, project: str, commit: str, environment: str,
|
|
265
|
+
locks: dict, now: datetime) -> str:
|
|
266
|
+
"""The fingerprint *record* accepts, if it is the contract's and covers this release *now*."""
|
|
267
|
+
document, key, start = acceptance_form(record)
|
|
268
|
+
label = _label(document)
|
|
269
|
+
if document["project_id"] != project or document["commit"] != commit:
|
|
270
|
+
raise RiskRefused(f"{label} belongs to another project or commit")
|
|
271
|
+
if environment not in document["environments"]:
|
|
272
|
+
raise RiskRefused(f"{label} does not cover this environment")
|
|
273
|
+
if document["locks"] != locks:
|
|
274
|
+
raise RiskRefused(f"{label} covers another dependency lock set")
|
|
275
|
+
if document["revoked_at"] != "":
|
|
276
|
+
raise RiskRefused(f"{label} was revoked")
|
|
277
|
+
end = instant(document["expires_at"], f"{label}: expires_at")
|
|
278
|
+
if not start <= now < end or end - start > MAX_LIFETIME:
|
|
279
|
+
raise RiskRefused(f"{label} is expired, not yet valid, or longer than 30 days")
|
|
280
|
+
return key
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def evaluate(checks: list[dict], acceptances: list[dict], *, project: str,
|
|
284
|
+
commit: str, environment: str, now: datetime | None = None) -> dict:
|
|
285
|
+
"""Compute permission; inputs are authenticated by the trusted caller, not this function."""
|
|
286
|
+
now = now or datetime.now(UTC)
|
|
287
|
+
if (not project or not environment or not isinstance(commit, str) or not COMMIT.search(commit)
|
|
288
|
+
or now.utcoffset() != timedelta(0)):
|
|
289
|
+
raise RiskRefused("release permission requires an exact project, commit, environment and UTC time")
|
|
290
|
+
if not isinstance(checks, list) or not checks:
|
|
291
|
+
raise RiskRefused("release permission requires every release check")
|
|
292
|
+
ids = [c.get("id") for c in checks if isinstance(c, dict)]
|
|
293
|
+
if len(ids) != len(checks) or any(not isinstance(i, str) or not i for i in ids) or len(ids) != len(set(ids)):
|
|
294
|
+
raise RiskRefused("release checks are malformed or duplicated")
|
|
295
|
+
if not AUDITS.keys() <= set(ids):
|
|
296
|
+
raise RiskRefused("release checks omit a dependency audit")
|
|
297
|
+
locks, findings, failures = {}, {}, []
|
|
298
|
+
for check in checks:
|
|
299
|
+
if type(check.get("ok")) is not bool or type(check.get("applicable")) is not bool:
|
|
300
|
+
raise RiskRefused("a release check has no verdict")
|
|
301
|
+
if check["id"] not in AUDITS:
|
|
302
|
+
if not check["ok"]:
|
|
303
|
+
failures.append(check["id"])
|
|
304
|
+
continue
|
|
305
|
+
name = f"the {check['id']} scan"
|
|
306
|
+
scan_locks, scanned = audit_evidence(check.get("dependency_audit"), now=now, name=name)
|
|
307
|
+
for path, value in scan_locks.items():
|
|
308
|
+
if path in locks and locks[path] != value:
|
|
309
|
+
raise RiskRefused(f"{name} gives {_names([path])} another digest than the other scan does")
|
|
310
|
+
locks[path] = value
|
|
311
|
+
if check["applicable"] != bool(scan_locks) or (not check["applicable"] and scanned):
|
|
312
|
+
raise RiskRefused(f"{name} contradicts its applicability")
|
|
313
|
+
blocked = []
|
|
314
|
+
for key, item in scanned.items():
|
|
315
|
+
# A fingerprint covers the ecosystem, and each audit holds only its own, so the
|
|
316
|
+
# two audits can never list one finding between them: no repeat to refuse here.
|
|
317
|
+
if item["ecosystem"] != AUDITS[check["id"]]:
|
|
318
|
+
raise RiskRefused(f"{name} lists a {item['ecosystem']} finding, and it audits {AUDITS[check['id']]} alone")
|
|
319
|
+
findings[key] = item
|
|
320
|
+
if blocking(item):
|
|
321
|
+
blocked.append(key)
|
|
322
|
+
if check["ok"] != (not blocked):
|
|
323
|
+
raise RiskRefused(f"{name} contradicts its verdict")
|
|
324
|
+
# Every record is the contract's, a superseded one too. Then select the current
|
|
325
|
+
# decision before validating its lifetime or revocation: an expired older record must
|
|
326
|
+
# not defeat a renewal, and withdrawing the renewal must never bring an older approval
|
|
327
|
+
# back into force.
|
|
328
|
+
latest: dict[str, tuple[dict, datetime]] = {}
|
|
329
|
+
for record in acceptances:
|
|
330
|
+
document, key, approved = acceptance_form(record)
|
|
331
|
+
if key in latest:
|
|
332
|
+
previous = latest[key][1]
|
|
333
|
+
if approved == previous:
|
|
334
|
+
raise RiskRefused(f"{_label(document)} and {_label(latest[key][0])} decide one finding at the same time")
|
|
335
|
+
if approved < previous:
|
|
336
|
+
continue
|
|
337
|
+
latest[key] = (document, approved)
|
|
338
|
+
covered = {}
|
|
339
|
+
for record, _approved in latest.values():
|
|
340
|
+
key = valid_acceptance(record, project=project, commit=commit, environment=environment, locks=locks, now=now)
|
|
341
|
+
if key not in findings or record["finding"] != findings[key]:
|
|
342
|
+
raise RiskRefused(f"{_label(record)} is stale or describes another finding")
|
|
343
|
+
covered[key] = record["id"]
|
|
344
|
+
unaccepted = sorted(key for key, item in findings.items() if blocking(item) and key not in covered)
|
|
345
|
+
used = sorted(covered[key] for key, item in findings.items() if blocking(item) and key in covered)
|
|
346
|
+
return {"version": 1, "allowed": not failures and not unaccepted,
|
|
347
|
+
"status": "blocked" if failures or unaccepted else "accepted" if used else "passed",
|
|
348
|
+
"failed_checks": failures, "unaccepted_findings": unaccepted, "acceptance_ids": used}
|
|
@@ -7,7 +7,7 @@ import json
|
|
|
7
7
|
from datetime import UTC, datetime
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
10
|
-
from terp.cli.audit_findings import AuditUnreadable, blocking, npm_findings, python_findings
|
|
10
|
+
from terp.cli.audit_findings import MAX_ITEMS, AuditUnreadable, blocking, npm_findings, python_findings
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def dependency_checks(check_type):
|
|
@@ -99,6 +99,11 @@ def scan_dependencies(root: Path, ecosystem: str) -> tuple[int, str, dict]:
|
|
|
99
99
|
findings = python_findings(report, lock)
|
|
100
100
|
if (code == 1) != any(blocking(item) for item in findings):
|
|
101
101
|
raise AuditUnreadable("the scanner exit code contradicts its dependency findings")
|
|
102
|
+
if len(evidence["findings"]) + len(findings) > MAX_ITEMS:
|
|
103
|
+
raise AuditUnreadable(
|
|
104
|
+
f"the audits found more than {MAX_ITEMS} findings, more than the dependency-audit "
|
|
105
|
+
"contract holds: update the dependencies that carry the most of them, and audit again"
|
|
106
|
+
)
|
|
102
107
|
evidence["locks"][lock] = "sha256:" + hashlib.sha256(before).hexdigest()
|
|
103
108
|
evidence["findings"].extend(findings)
|
|
104
109
|
except (OSError, ValueError) as exc:
|
|
@@ -48,7 +48,7 @@ from terp.arch.deployment import (
|
|
|
48
48
|
read,
|
|
49
49
|
readable,
|
|
50
50
|
)
|
|
51
|
-
from terp.arch.deployment.generator import FRONTEND_LOCK, SITE_LOCK
|
|
51
|
+
from terp.arch.deployment.generator import FRONTEND_LOCK, SITE_LOCK, SUITE_LOCK
|
|
52
52
|
from terp.arch.deployment.profile import truth_findings
|
|
53
53
|
from terp.arch.deployment.render_check import (
|
|
54
54
|
ANSWER,
|
|
@@ -214,6 +214,7 @@ def plan_generated(root: pathlib.Path) -> Plan:
|
|
|
214
214
|
tables=published_tables(),
|
|
215
215
|
frontend_lock=(root / FRONTEND_LOCK).is_file(),
|
|
216
216
|
site_lock=(root / SITE_LOCK).is_file(),
|
|
217
|
+
conformance_lock=(root / SUITE_LOCK).is_file(),
|
|
217
218
|
)
|
|
218
219
|
if refused:
|
|
219
220
|
raise AdoptionRefused(
|
|
@@ -125,9 +125,11 @@ declaration's own: {"unmanaged": true, "reason": "..."}, or, for the third, "bui
|
|
|
125
125
|
|
|
126
126
|
THE GENERATED STATE (ADR 0187)
|
|
127
127
|
|
|
128
|
-
Under "build": "generated" the production build files are the framework's: the three,
|
|
128
|
+
Under "build": "generated" the production build files are the framework's: the three,
|
|
129
129
|
site/Dockerfile.prod as well when a web unit names the static-site recipe (A STATIC SITE,
|
|
130
|
-
below)
|
|
130
|
+
below), and conformance/Dockerfile.prod where the checkout commits
|
|
131
|
+
conformance/package-lock.json: the conformance suite's image (ADR 0219), on Playwright's own
|
|
132
|
+
image pinned by digest, which no service runs and a runner verifies a release with. Change deployment.json (or pyproject.toml's name, or the framework version), then:
|
|
131
133
|
|
|
132
134
|
uv run terp deployment render writes the render, every file or none, and
|
|
133
135
|
removes a generator-owned file the declaration
|
|
@@ -348,7 +350,9 @@ build container holds a credential or writes into what is built. Each takes the
|
|
|
348
350
|
(its full object name) and reads it from git's object store, never from a working copy:
|
|
349
351
|
|
|
350
352
|
uv run terp release build --sha <sha> --tag <tag> --registry registry.example/team
|
|
351
|
-
builds every image the profile builds from the commit's pristine tree,
|
|
353
|
+
builds every image the profile builds from the commit's pristine tree, and the
|
|
354
|
+
conformance suite's image, <project>-conformance-prod, where the commit holds
|
|
355
|
+
conformance/Dockerfile.prod (ADR 0219), in a BuildKit
|
|
352
356
|
builder made for the job and removed after it, with --pull and no cache, and pushes
|
|
353
357
|
<registry>/<image>:<tag> with the credential your docker configuration holds for this
|
|
354
358
|
release. It writes terp-release-build.json: BuildKit's own digests.
|