httk.workflow.manifests¶
Deterministic signed project manifests.
Attributes¶
Classes¶
Record the holder of one workspace maintenance lock. |
|
What verifying one manifest against one tree established. |
Functions¶
|
Describe the workspace maintenance lock, or |
|
Remove a stale, or with force any, maintenance lock and report it. |
|
Fence manager launches while a project snapshot is inspected. |
|
Create and atomically publish the signed v2 project manifest. |
|
Return the trust anchors of project plus every explicitly named key. |
|
Report whether a v2 manifest describes root and its signature verifies. |
|
Verify a legacy manifest without modifying its project tree. |
|
Auto-detect a v2 or legacy manifest and verify it against its trust anchors. |
Module Contents¶
- class httk.workflow.manifests.MaintenanceLock[source]¶
Record the holder of one workspace maintenance lock.
- Parameters:
path – Locate the lock file.
pid – Record the holder process identifier, when readable.
hostname – Record the holder host, when readable.
created – Record the holder creation timestamp, when readable.
readable – Mark whether the lock contents could be read.
- path: pathlib.Path[source]¶
- property age_seconds: float | None[source]¶
Age of the lock, or
Nonewhen its timestamp is unusable.
- httk.workflow.manifests.read_maintenance_lock(workspace)[source]¶
Describe the workspace maintenance lock, or
Nonewhen it is absent.- Parameters:
workspace (httk.workflow.workspace.Workspace) – Locate the workspace whose lock to inspect.
- Returns:
The recorded lock, or
Nonewhen no lock exists.- Return type:
MaintenanceLock | None
- httk.workflow.manifests.release_maintenance_lock(workspace, *, force=False)[source]¶
Remove a stale, or with force any, maintenance lock and report it.
- Parameters:
workspace (httk.workflow.workspace.Workspace) – Locate the workspace whose lock to remove.
force (bool) – Permit removal of a lock that does not appear stale.
- Returns:
A human-readable removal result.
- Raises:
ValueError – If a live lock is protected by the default policy.
- Return type:
- httk.workflow.manifests.workspace_maintenance_guard(workspace)[source]¶
Fence manager launches while a project snapshot is inspected.
- Parameters:
workspace (httk.workflow.workspace.Workspace) – Lock and inspect this workspace around the guarded work.
- Returns:
A context manager that holds the maintenance lock.
- Raises:
ValueError – If the workspace is already maintained or not quiescent.
- Return type:
collections.abc.Iterator[None]
- httk.workflow.manifests.create_manifest(project=None, *, output=None)[source]¶
Create and atomically publish the signed v2 project manifest.
- Parameters:
project (str | os.PathLike[str] | None) – Locate the project to snapshot, or use discovery when unset.
output (str | os.PathLike[str] | None) – Publish the manifest at this path, or use the project default.
- Returns:
The published manifest path.
- Raises:
ValueError – If the project is invalid or cannot be snapshotted.
- Return type:
- class httk.workflow.manifests.ManifestVerification[source]¶
What verifying one manifest against one tree established.
A signature check answers two separate questions, and reporting them as one boolean loses the interesting one. Does this manifest describe this tree, unaltered? is answered by the digests and the signature. Was it made by somebody this project trusts? is answered only by comparing the signing key with a trust anchor that did not come from the manifest itself.
- Parameters:
verdict – Classify the verification result.
reason – Explain the classification.
manifest – Identify the verified manifest.
manifest_format – Identify the manifest format used.
public_key – Record the signing key, when readable.
trusted_keys – Record the trust anchors consulted.
- manifest: pathlib.Path[source]¶
- httk.workflow.manifests.resolve_trusted_keys(project=None, *, trusted_keys=None)[source]¶
Return the trust anchors of project plus every explicitly named key.
An entry of trusted_keys is either a recorded key —
ed25519:BASE64or the bare base64 — or the path of a*.pubfile holding one.- Parameters:
project (str | os.PathLike[str] | None) – Locate the project whose pinned keys to include.
trusted_keys (collections.abc.Sequence[str | os.PathLike[str]] | None) – Add explicit recorded keys or public-key files.
- Returns:
Unique canonical trust-anchor values in stable order.
- Raises:
ValueError – If an explicit key cannot be canonicalized.
- Return type:
- httk.workflow.manifests.verify_v2_manifest(root, path)[source]¶
Report whether a v2 manifest describes root and its signature verifies.
This deliberately says nothing about whose key signed it: the key comes out of the manifest header. Use
verify_manifest()for the trust decision.- Parameters:
root (pathlib.Path) – Locate the tree the manifest should describe.
path (pathlib.Path) – Locate the v2 manifest to verify.
- Returns:
Whether the tree and signature verify, without a trust decision.
- Return type:
- httk.workflow.manifests.verify_legacy_manifest(root, path)[source]¶
Verify a legacy manifest without modifying its project tree.
- Parameters:
root (pathlib.Path) – Locate the tree the manifest should describe.
path (pathlib.Path) – Locate the legacy manifest to verify.
- Returns:
Whether the legacy tree records and signature verify.
- Return type:
- httk.workflow.manifests.verify_manifest(project=None, *, manifest=None, trusted_keys=None)[source]¶
Auto-detect a v2 or legacy manifest and verify it against its trust anchors.
The trust anchor is the key pinned in
project.json— never the key the manifest being verified names in its own header — plus any key passed in trusted_keys, as a recorded value or as the path of a*.pubfile.- Parameters:
project (str | os.PathLike[str] | None) – Locate the project to discover and verify.
manifest (str | os.PathLike[str] | None) – Select a manifest path instead of the project default.
trusted_keys (collections.abc.Sequence[str | os.PathLike[str]] | None) – Add explicit trust anchors to the project keys.
- Returns:
The detailed verification verdict.
- Raises:
ValueError – If no project or usable manifest exists.
- Return type: