owenloop 0.4.1 → 0.5.1
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.
- package/CHANGELOG.md +71 -0
- package/README.md +182 -53
- package/bin/owenloop.mjs +50 -2
- package/dist/packages/work/src/agent/brief.d.ts +176 -0
- package/dist/packages/work/src/agent/brief.js +197 -0
- package/dist/packages/work/src/agent/loop.d.ts +141 -0
- package/dist/packages/work/src/agent/loop.js +669 -0
- package/dist/packages/work/src/agent/model-policy.d.ts +49 -0
- package/dist/packages/work/src/agent/model-policy.js +138 -0
- package/dist/packages/work/src/agent/workdir.d.ts +210 -0
- package/dist/packages/work/src/agent/workdir.js +319 -0
- package/dist/packages/work/src/bundle/cache.d.ts +92 -0
- package/dist/packages/work/src/bundle/cache.js +338 -0
- package/dist/packages/work/src/bundle/fetch.d.ts +87 -0
- package/dist/packages/work/src/bundle/fetch.js +345 -0
- package/dist/packages/work/src/bundle/types.d.ts +164 -0
- package/dist/packages/work/src/bundle/types.js +1 -0
- package/dist/packages/work/src/consumed-verifier.d.ts +45 -0
- package/dist/packages/work/src/consumed-verifier.js +205 -0
- package/dist/packages/work/src/credentials/owenloop.d.ts +11 -0
- package/dist/packages/work/src/credentials/owenloop.js +28 -0
- package/dist/packages/work/src/credentials/reader.d.ts +36 -0
- package/dist/packages/work/src/credentials/reader.js +32 -0
- package/dist/packages/work/src/credentials/resolve.d.ts +19 -0
- package/dist/packages/work/src/credentials/resolve.js +56 -0
- package/dist/packages/work/src/exec/instructions.d.ts +99 -0
- package/dist/packages/work/src/exec/instructions.js +323 -0
- package/dist/packages/work/src/exec/loop.d.ts +40 -0
- package/dist/packages/work/src/exec/loop.js +332 -0
- package/dist/packages/work/src/exec/payload.d.ts +29 -0
- package/dist/packages/work/src/exec/payload.js +54 -0
- package/dist/packages/work/src/exec/receipt.d.ts +41 -0
- package/dist/packages/work/src/exec/receipt.js +32 -0
- package/dist/packages/work/src/exec/runner.d.ts +71 -0
- package/dist/packages/work/src/exec/runner.js +256 -0
- package/dist/packages/work/src/harness/child-env.d.ts +100 -0
- package/dist/packages/work/src/harness/child-env.js +134 -0
- package/dist/packages/work/src/harness/claude.d.ts +140 -0
- package/dist/packages/work/src/harness/claude.js +837 -0
- package/dist/packages/work/src/harness/codex.d.ts +111 -0
- package/dist/packages/work/src/harness/codex.js +1024 -0
- package/dist/packages/work/src/harness/contract.d.ts +308 -0
- package/dist/packages/work/src/harness/contract.js +32 -0
- package/dist/packages/work/src/harness/fake.d.ts +59 -0
- package/dist/packages/work/src/harness/fake.js +91 -0
- package/dist/packages/work/src/harness/jsonrpc-stdio.d.ts +108 -0
- package/dist/packages/work/src/harness/jsonrpc-stdio.js +351 -0
- package/dist/packages/work/src/harness/permissions.d.ts +75 -0
- package/dist/packages/work/src/harness/permissions.js +182 -0
- package/dist/packages/work/src/harness/registry.d.ts +47 -0
- package/dist/packages/work/src/harness/registry.js +45 -0
- package/dist/packages/work/src/harness/session-store.d.ts +181 -0
- package/dist/packages/work/src/harness/session-store.js +523 -0
- package/dist/packages/work/src/harness/types.d.ts +29 -0
- package/dist/packages/work/src/harness/types.js +14 -0
- package/dist/packages/work/src/harnesses.d.ts +38 -0
- package/dist/packages/work/src/harnesses.js +38 -0
- package/dist/packages/work/src/hold/loop.d.ts +36 -0
- package/dist/packages/work/src/hold/loop.js +23 -0
- package/dist/packages/work/src/hold/mcp.d.ts +75 -0
- package/dist/packages/work/src/hold/mcp.js +264 -0
- package/dist/packages/work/src/hub/client.d.ts +23 -0
- package/dist/packages/work/src/hub/client.js +91 -0
- package/dist/packages/work/src/hub/types.d.ts +326 -0
- package/dist/packages/work/src/hub/types.js +26 -0
- package/dist/packages/work/src/lease/loop.d.ts +94 -0
- package/dist/packages/work/src/lease/loop.js +277 -0
- package/dist/packages/work/src/main.d.ts +1 -0
- package/dist/packages/work/src/main.js +48 -0
- package/dist/packages/work/src/mcp/server.d.ts +125 -0
- package/dist/packages/work/src/mcp/server.js +320 -0
- package/dist/packages/work/src/owenloop-bin.d.ts +1 -0
- package/dist/packages/work/src/owenloop-bin.js +18 -0
- package/dist/packages/work/src/roles/agent-run.d.ts +124 -0
- package/dist/packages/work/src/roles/agent-run.js +529 -0
- package/dist/packages/work/src/roles/exec.d.ts +48 -0
- package/dist/packages/work/src/roles/exec.js +228 -0
- package/dist/packages/work/src/roles/hold.d.ts +72 -0
- package/dist/packages/work/src/roles/hold.js +363 -0
- package/dist/packages/work/src/roles/join.d.ts +18 -0
- package/dist/packages/work/src/roles/join.js +204 -0
- package/dist/packages/work/src/roles/lint.d.ts +58 -0
- package/dist/packages/work/src/roles/lint.js +234 -0
- package/dist/packages/work/src/roles/prepare.d.ts +1 -0
- package/dist/packages/work/src/roles/prepare.js +249 -0
- package/dist/packages/work/src/roles/release.d.ts +48 -0
- package/dist/packages/work/src/roles/release.js +137 -0
- package/dist/packages/work/src/roles/sessions.d.ts +61 -0
- package/dist/packages/work/src/roles/sessions.js +180 -0
- package/dist/packages/work/src/roles/settings.d.ts +6 -0
- package/dist/packages/work/src/roles/settings.js +71 -0
- package/dist/packages/work/src/roles/shift.d.ts +13 -0
- package/dist/packages/work/src/roles/shift.js +250 -0
- package/dist/packages/work/src/roles/signals.d.ts +55 -0
- package/dist/packages/work/src/roles/signals.js +62 -0
- package/dist/packages/work/src/settings/provision.d.ts +21 -0
- package/dist/packages/work/src/settings/provision.js +47 -0
- package/dist/packages/work/src/settings/settings.d.ts +136 -0
- package/dist/packages/work/src/settings/settings.js +155 -0
- package/dist/packages/work/src/shift/client.d.ts +24 -0
- package/dist/packages/work/src/shift/client.js +124 -0
- package/dist/packages/work/src/shift/loop.d.ts +131 -0
- package/dist/packages/work/src/shift/loop.js +751 -0
- package/dist/packages/work/src/shift/protocol.d.ts +95 -0
- package/dist/packages/work/src/shift/protocol.js +24 -0
- package/dist/packages/work/src/shift/routing.d.ts +35 -0
- package/dist/packages/work/src/shift/routing.js +50 -0
- package/dist/packages/work/src/shift/runtime.d.ts +45 -0
- package/dist/packages/work/src/shift/runtime.js +337 -0
- package/dist/packages/work/src/shift/server.d.ts +23 -0
- package/dist/packages/work/src/shift/server.js +716 -0
- package/dist/packages/work/src/shift/spawn.d.ts +109 -0
- package/dist/packages/work/src/shift/spawn.js +158 -0
- package/dist/packages/work/src/shift/state.d.ts +79 -0
- package/dist/packages/work/src/shift/state.js +385 -0
- package/dist/packages/work/src/submit-proof.d.ts +36 -0
- package/dist/packages/work/src/submit-proof.js +93 -0
- package/dist/packages/work/src/usage.d.ts +6 -0
- package/dist/packages/work/src/usage.js +175 -0
- package/dist/src/add.d.ts +189 -0
- package/dist/src/add.js +300 -0
- package/dist/src/archive.d.ts +97 -0
- package/dist/src/archive.js +591 -0
- package/dist/src/bundle/index.d.ts +64 -0
- package/dist/src/bundle/index.js +508 -0
- package/dist/src/bundle/manifest.d.ts +50 -0
- package/dist/src/bundle/manifest.js +435 -0
- package/dist/src/bundle/runtime.d.ts +26 -0
- package/dist/src/bundle/runtime.js +64 -0
- package/dist/src/bundle/tar.d.ts +62 -0
- package/dist/src/bundle/tar.js +238 -0
- package/dist/src/bundle/types.d.ts +105 -0
- package/dist/src/bundle/types.js +21 -0
- package/dist/{cli.d.ts → src/cli.d.ts} +92 -7
- package/dist/src/cli.js +5968 -0
- package/dist/{credentials.d.ts → src/credentials.d.ts} +22 -15
- package/dist/{credentials.js → src/credentials.js} +35 -31
- package/dist/src/crypto/allowed-signers.d.ts +68 -0
- package/dist/src/crypto/allowed-signers.js +307 -0
- package/dist/src/crypto/canonical.d.ts +8 -0
- package/dist/src/crypto/canonical.js +92 -0
- package/dist/src/crypto/chain.d.ts +65 -0
- package/dist/src/crypto/chain.js +377 -0
- package/dist/src/crypto/dsse.d.ts +209 -0
- package/dist/src/crypto/dsse.js +282 -0
- package/dist/src/crypto/enrollment.d.ts +78 -0
- package/dist/src/crypto/enrollment.js +186 -0
- package/dist/src/crypto/index.d.ts +48 -0
- package/dist/src/crypto/index.js +44 -0
- package/dist/src/crypto/keys.d.ts +258 -0
- package/dist/src/crypto/keys.js +908 -0
- package/dist/src/crypto/org-root.d.ts +33 -0
- package/dist/src/crypto/org-root.js +78 -0
- package/dist/src/crypto/origin-rules.d.ts +56 -0
- package/dist/src/crypto/origin-rules.js +143 -0
- package/dist/src/crypto/policy-floor.d.ts +98 -0
- package/dist/src/crypto/policy-floor.js +353 -0
- package/dist/src/crypto/records.d.ts +316 -0
- package/dist/src/crypto/records.js +157 -0
- package/dist/src/crypto/scope.d.ts +49 -0
- package/dist/src/crypto/scope.js +83 -0
- package/dist/src/crypto/ssh.d.ts +171 -0
- package/dist/src/crypto/ssh.js +396 -0
- package/dist/src/crypto/submission.d.ts +33 -0
- package/dist/src/crypto/submission.js +47 -0
- package/dist/src/crypto/trust-roots.d.ts +29 -0
- package/dist/src/crypto/trust-roots.js +39 -0
- package/dist/src/crypto/verify-consumed.d.ts +67 -0
- package/dist/src/crypto/verify-consumed.js +259 -0
- package/dist/src/crypto/verify-origin.d.ts +50 -0
- package/dist/src/crypto/verify-origin.js +151 -0
- package/dist/src/crypto/verify-publication.d.ts +60 -0
- package/dist/src/crypto/verify-publication.js +150 -0
- package/dist/{defs.d.ts → src/defs.d.ts} +24 -1
- package/dist/{defs.js → src/defs.js} +181 -61
- package/dist/{engine.d.ts → src/engine.d.ts} +105 -9
- package/dist/{engine.js → src/engine.js} +251 -47
- package/dist/{factory.d.ts → src/factory.d.ts} +16 -0
- package/dist/{factory.js → src/factory.js} +16 -4
- package/dist/src/global-config.d.ts +59 -0
- package/dist/src/global-config.js +84 -0
- package/dist/{hub.d.ts → src/hub.d.ts} +280 -31
- package/dist/{hub.js → src/hub.js} +493 -52
- package/dist/src/index.d.ts +47 -0
- package/dist/src/index.js +41 -0
- package/dist/src/install.d.ts +538 -0
- package/dist/src/install.js +1981 -0
- package/dist/src/lock.d.ts +38 -0
- package/dist/src/lock.js +325 -0
- package/dist/src/mcp/serve.d.ts +109 -0
- package/dist/{mcp → src/mcp}/serve.js +335 -75
- package/dist/{mcp → src/mcp}/server.d.ts +6 -9
- package/dist/{mcp → src/mcp}/server.js +18 -10
- package/dist/{model.d.ts → src/model.d.ts} +15 -0
- package/dist/{model.js → src/model.js} +112 -2
- package/dist/src/order-resolver.d.ts +184 -0
- package/dist/src/order-resolver.js +252 -0
- package/dist/src/package-version.d.ts +10 -0
- package/dist/src/package-version.js +42 -0
- package/dist/{paths.d.ts → src/paths.d.ts} +14 -1
- package/dist/{paths.js → src/paths.js} +18 -0
- package/dist/src/schemas/enrollment-grant.v1.schema.json +90 -0
- package/dist/src/schemas/index.d.ts +1416 -0
- package/dist/src/schemas/index.js +31 -0
- package/dist/src/schemas/order.v1.schema.json +106 -0
- package/dist/src/schemas/origin.v1.schema.json +68 -0
- package/dist/src/schemas/policy-floor.v1.schema.json +29 -0
- package/dist/src/schemas/publication.v1.schema.json +31 -0
- package/dist/src/schemas/revocation.v1.schema.json +39 -0
- package/dist/src/schemas/submission.v1.schema.json +61 -0
- package/dist/src/store/def-source.d.ts +52 -0
- package/dist/src/store/def-source.js +335 -0
- package/dist/src/store/index-file.d.ts +69 -0
- package/dist/src/store/index-file.js +151 -0
- package/dist/src/store/index.d.ts +27 -0
- package/dist/src/store/index.js +22 -0
- package/dist/src/store/ingestor.d.ts +43 -0
- package/dist/src/store/ingestor.js +211 -0
- package/dist/src/store/install.d.ts +228 -0
- package/dist/src/store/install.js +555 -0
- package/dist/src/store/instruction-source.d.ts +49 -0
- package/dist/src/store/instruction-source.js +298 -0
- package/dist/src/store/origin-evidence.d.ts +21 -0
- package/dist/src/store/origin-evidence.js +66 -0
- package/dist/src/store/pre-commit-verifier.d.ts +68 -0
- package/dist/src/store/pre-commit-verifier.js +418 -0
- package/dist/src/store/resolve.d.ts +138 -0
- package/dist/src/store/resolve.js +363 -0
- package/dist/src/store/types.d.ts +288 -0
- package/dist/src/store/types.js +356 -0
- package/dist/{types.d.ts → src/types.d.ts} +58 -24
- package/dist/{untar.d.ts → src/untar.d.ts} +8 -23
- package/dist/src/untar.js +38 -0
- package/dist/{util.d.ts → src/util.d.ts} +3 -2
- package/dist/{util.js → src/util.js} +3 -2
- package/dist/{owenwork.d.ts → src/work-settings.d.ts} +22 -22
- package/dist/{owenwork.js → src/work-settings.js} +27 -27
- package/docs/agent-runner.md +86 -0
- package/docs/authoring.md +150 -59
- package/docs/bundles.md +250 -0
- package/docs/cli.md +1758 -163
- package/docs/crypto.md +816 -0
- package/docs/design.md +374 -52
- package/docs/embedding.md +135 -27
- package/docs/wire-contracts.md +380 -0
- package/examples/workflows/{command-worker.yaml → command-executor.yaml} +15 -15
- package/examples/workflows/compile-dev-playbook.yaml +338 -0
- package/examples/workflows/judges/gate-sharpness.md +39 -0
- package/examples/workflows/judges/security.md +34 -0
- package/package.json +22 -8
- package/plugins/claude-code/.claude-plugin/marketplace.json +14 -0
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +8 -0
- package/plugins/claude-code/plugin/.mcp.json +14 -0
- package/plugins/claude-code/plugin/hooks/hooks.json +26 -0
- package/plugins/claude-code/plugin/hooks/session-end.sh +40 -0
- package/plugins/claude-code/plugin/hooks/session-start.sh +52 -0
- package/plugins/claude-code/plugin/skills/author/SKILL.md +181 -0
- package/plugins/claude-code/plugin/skills/conduct/SKILL.md +106 -0
- package/plugins/claude-code/plugin/skills/shift/SKILL.md +105 -0
- package/plugins/codex/.agents/plugins/marketplace.json +21 -0
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +7 -0
- package/plugins/codex/plugins/owenloop/.mcp.json +20 -0
- package/plugins/codex/plugins/owenloop/hooks/hooks.json +26 -0
- package/plugins/codex/plugins/owenloop/hooks/session-end.sh +40 -0
- package/plugins/codex/plugins/owenloop/hooks/session-start.sh +52 -0
- package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +181 -0
- package/plugins/codex/plugins/owenloop/skills/conduct/SKILL.md +106 -0
- package/plugins/codex/plugins/owenloop/skills/shift/SKILL.md +105 -0
- package/dist/add.d.ts +0 -384
- package/dist/add.js +0 -834
- package/dist/cli.js +0 -3270
- package/dist/index.d.ts +0 -32
- package/dist/index.js +0 -23
- package/dist/lock.d.ts +0 -80
- package/dist/lock.js +0 -217
- package/dist/mcp/serve.d.ts +0 -84
- package/dist/untar.js +0 -164
- /package/dist/{schema.d.ts → src/schema.d.ts} +0 -0
- /package/dist/{schema.js → src/schema.js} +0 -0
- /package/dist/{store.d.ts → src/store.d.ts} +0 -0
- /package/dist/{store.js → src/store.js} +0 -0
- /package/dist/{types.js → src/types.js} +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-level definitions for the versioned records carried in DSSE envelopes.
|
|
3
|
+
*
|
|
4
|
+
* This module defines shapes only. Signing, verification, enrollment, revocation
|
|
5
|
+
* processing, scope attenuation, and policy evaluation belong to later layers.
|
|
6
|
+
* Field manifests intentionally sit beside each type: TypeScript checks the
|
|
7
|
+
* manifest against the type, while the wire-contract test checks the manifest
|
|
8
|
+
* against the checked-in JSON Schema. Neither side is generated from the other,
|
|
9
|
+
* so a drift changes a deliberate check into a failure instead of being hidden.
|
|
10
|
+
*/
|
|
11
|
+
import { PAYLOAD_TYPE_ENROLLMENT_GRANT, PAYLOAD_TYPE_ORIGIN, PAYLOAD_TYPE_POLICY_FLOOR, PAYLOAD_TYPE_PUBLICATION, PAYLOAD_TYPE_REVOCATION, PAYLOAD_TYPE_SUBMISSION, } from "./dsse.js";
|
|
12
|
+
export const SUBMISSION_FIELDS = {
|
|
13
|
+
run: 'required',
|
|
14
|
+
workflow: 'required',
|
|
15
|
+
defDigest: 'required',
|
|
16
|
+
step: 'required',
|
|
17
|
+
key: 'required',
|
|
18
|
+
index: 'optional',
|
|
19
|
+
produced: 'required',
|
|
20
|
+
consumedFingerprint: 'required',
|
|
21
|
+
producerKeyId: 'required',
|
|
22
|
+
timestamp: 'required',
|
|
23
|
+
};
|
|
24
|
+
export const PUBLICATION_FIELDS = {
|
|
25
|
+
digest: 'required',
|
|
26
|
+
name: 'required',
|
|
27
|
+
version: 'required',
|
|
28
|
+
publisherKeyId: 'required',
|
|
29
|
+
timestamp: 'required',
|
|
30
|
+
};
|
|
31
|
+
export const ORIGIN_FIELDS = {
|
|
32
|
+
digest: 'required',
|
|
33
|
+
name: 'required',
|
|
34
|
+
version: 'required',
|
|
35
|
+
source: 'required',
|
|
36
|
+
attesterKeyId: 'required',
|
|
37
|
+
timestamp: 'required',
|
|
38
|
+
};
|
|
39
|
+
export const ORIGIN_SOURCE_GIT_FIELDS = {
|
|
40
|
+
kind: 'required',
|
|
41
|
+
repo: 'required',
|
|
42
|
+
commit: 'required',
|
|
43
|
+
};
|
|
44
|
+
export const ORIGIN_SOURCE_CONSOLE_FIELDS = {
|
|
45
|
+
kind: 'required',
|
|
46
|
+
user: 'required',
|
|
47
|
+
};
|
|
48
|
+
export const ORIGIN_SOURCE_AGENT_FIELDS = {
|
|
49
|
+
kind: 'required',
|
|
50
|
+
agent: 'required',
|
|
51
|
+
session: 'required',
|
|
52
|
+
};
|
|
53
|
+
export const SUBMISSION_PRODUCED_FIELDS = {
|
|
54
|
+
artifact: 'required',
|
|
55
|
+
version: 'required',
|
|
56
|
+
valueDigest: 'required',
|
|
57
|
+
};
|
|
58
|
+
export const ENROLLMENT_GRANT_FIELDS = {
|
|
59
|
+
newKey: 'required',
|
|
60
|
+
principal: 'required',
|
|
61
|
+
scope: 'required',
|
|
62
|
+
grantedBy: 'required',
|
|
63
|
+
validFrom: 'required',
|
|
64
|
+
};
|
|
65
|
+
export const ENROLLMENT_KEY_FIELDS = {
|
|
66
|
+
keyid: 'required',
|
|
67
|
+
keyType: 'required',
|
|
68
|
+
openSshPublicKey: 'required',
|
|
69
|
+
comment: 'optional',
|
|
70
|
+
};
|
|
71
|
+
export const PRINCIPAL_REFERENCE_FIELDS = {
|
|
72
|
+
kind: 'required',
|
|
73
|
+
id: 'required',
|
|
74
|
+
};
|
|
75
|
+
export const GRANT_SCOPE_FIELDS = {
|
|
76
|
+
pools: 'required',
|
|
77
|
+
labels: 'required',
|
|
78
|
+
namespaces: 'required',
|
|
79
|
+
delegation: 'required',
|
|
80
|
+
};
|
|
81
|
+
export const GRANT_DELEGATION_DENIED_FIELDS = {
|
|
82
|
+
allowed: 'required',
|
|
83
|
+
};
|
|
84
|
+
export const GRANT_DELEGATION_ALLOWED_FIELDS = {
|
|
85
|
+
allowed: 'required',
|
|
86
|
+
maxDepth: 'required',
|
|
87
|
+
};
|
|
88
|
+
export const REVOCATION_FIELDS = {
|
|
89
|
+
revokedKey: 'required',
|
|
90
|
+
principal: 'required',
|
|
91
|
+
revokedBy: 'required',
|
|
92
|
+
issuedAt: 'required',
|
|
93
|
+
effectiveFrom: 'required',
|
|
94
|
+
backdated: 'required',
|
|
95
|
+
reason: 'optional',
|
|
96
|
+
};
|
|
97
|
+
export const POLICY_FLOOR_RECORD_FIELDS = {
|
|
98
|
+
org: 'required',
|
|
99
|
+
issuedAt: 'required',
|
|
100
|
+
signedBy: 'required',
|
|
101
|
+
floor: 'required',
|
|
102
|
+
preset: 'optional',
|
|
103
|
+
};
|
|
104
|
+
export const POLICY_FLOOR_FIELDS = {
|
|
105
|
+
trustMode: 'required',
|
|
106
|
+
unsignedDefs: 'required',
|
|
107
|
+
unsignedArtifacts: 'required',
|
|
108
|
+
originRules: 'required',
|
|
109
|
+
};
|
|
110
|
+
/** The existing frozen reference-mode Order is the fifth launch contract. */
|
|
111
|
+
export const ORDER_FIELDS = {
|
|
112
|
+
run: 'required',
|
|
113
|
+
workflow: 'required',
|
|
114
|
+
step: 'required',
|
|
115
|
+
key: 'required',
|
|
116
|
+
index: 'optional',
|
|
117
|
+
defDigest: 'required',
|
|
118
|
+
inputs: 'required',
|
|
119
|
+
outputs: 'required',
|
|
120
|
+
workdir: 'optional',
|
|
121
|
+
model: 'optional',
|
|
122
|
+
worker: 'optional',
|
|
123
|
+
judge: 'optional',
|
|
124
|
+
spec: 'optional',
|
|
125
|
+
x: 'optional',
|
|
126
|
+
consumes: 'required',
|
|
127
|
+
consumedFingerprint: 'optional',
|
|
128
|
+
owes: 'required',
|
|
129
|
+
consumesProof: 'optional',
|
|
130
|
+
cause: 'optional',
|
|
131
|
+
};
|
|
132
|
+
/** Indexed access pins the already-emitted nested Order shape without cloning it. */
|
|
133
|
+
export const ORDER_OWED_FIELDS = {
|
|
134
|
+
path: 'required',
|
|
135
|
+
version: 'optional',
|
|
136
|
+
judgmentRejects: 'required',
|
|
137
|
+
schemaRejects: 'required',
|
|
138
|
+
reasons: 'required',
|
|
139
|
+
proof: 'optional',
|
|
140
|
+
};
|
|
141
|
+
export const ORDER_REASON_FIELDS = {
|
|
142
|
+
at: 'required',
|
|
143
|
+
action: 'required',
|
|
144
|
+
kind: 'required',
|
|
145
|
+
by: 'required',
|
|
146
|
+
text: 'required',
|
|
147
|
+
fromVersion: 'optional',
|
|
148
|
+
};
|
|
149
|
+
/** Bind every record definition in this package to a frozen DSSE media type. */
|
|
150
|
+
export const RECORD_PAYLOAD_TYPES = {
|
|
151
|
+
enrollmentGrant: PAYLOAD_TYPE_ENROLLMENT_GRANT,
|
|
152
|
+
revocation: PAYLOAD_TYPE_REVOCATION,
|
|
153
|
+
submission: PAYLOAD_TYPE_SUBMISSION,
|
|
154
|
+
policyFloor: PAYLOAD_TYPE_POLICY_FLOOR,
|
|
155
|
+
origin: PAYLOAD_TYPE_ORIGIN,
|
|
156
|
+
publication: PAYLOAD_TYPE_PUBLICATION,
|
|
157
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure enrollment-scope attenuation arithmetic.
|
|
3
|
+
*
|
|
4
|
+
* This module decides whether a child enrollment grant is no wider than the
|
|
5
|
+
* scope already held by its signer, and whether an effective scope permits one
|
|
6
|
+
* requested pool, label, or namespace. The module deliberately does not read
|
|
7
|
+
* keys, verify signatures, or perform filesystem or network I/O; chain.ts owns
|
|
8
|
+
* those concerns.
|
|
9
|
+
*/
|
|
10
|
+
import type { GrantDelegation, GrantScope } from './records.ts';
|
|
11
|
+
/** One scope axis: an explicit allow-list or the all-values identity. */
|
|
12
|
+
export type ScopeAxis = string[] | '*';
|
|
13
|
+
/** Whether a child axis is contained by a parent's effective axis. */
|
|
14
|
+
export declare function axisPermits(parent: ScopeAxis, child: ScopeAxis): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Check whether a child delegation declaration is permitted by its parent.
|
|
17
|
+
* `maxDepth: N` means a grant signed by that key may delegate at most N - 1
|
|
18
|
+
* further levels; zero therefore permits only non-delegating child grants.
|
|
19
|
+
*/
|
|
20
|
+
export declare function delegationPermits(parent: GrantDelegation, child: GrantDelegation): {
|
|
21
|
+
ok: true;
|
|
22
|
+
} | {
|
|
23
|
+
ok: false;
|
|
24
|
+
reason: string;
|
|
25
|
+
};
|
|
26
|
+
/** Check every axis and the delegation limit in one attenuation decision. */
|
|
27
|
+
export declare function attenuate(parent: GrantScope, child: GrantScope): {
|
|
28
|
+
ok: true;
|
|
29
|
+
} | {
|
|
30
|
+
ok: false;
|
|
31
|
+
reason: string;
|
|
32
|
+
};
|
|
33
|
+
/** The identity scope held by the local organization root anchor. */
|
|
34
|
+
export declare const ORG_ROOT_SCOPE: GrantScope;
|
|
35
|
+
/**
|
|
36
|
+
* Check whether a producer demand is contained by an effective grant scope.
|
|
37
|
+
* Omitted demand fields are not constrained; present fields must be allowed by
|
|
38
|
+
* their corresponding axis.
|
|
39
|
+
*/
|
|
40
|
+
export declare function scopePermits(scope: GrantScope, demand: {
|
|
41
|
+
pool?: string;
|
|
42
|
+
label?: string;
|
|
43
|
+
namespace?: string;
|
|
44
|
+
}): {
|
|
45
|
+
ok: true;
|
|
46
|
+
} | {
|
|
47
|
+
ok: false;
|
|
48
|
+
reason: string;
|
|
49
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure enrollment-scope attenuation arithmetic.
|
|
3
|
+
*
|
|
4
|
+
* This module decides whether a child enrollment grant is no wider than the
|
|
5
|
+
* scope already held by its signer, and whether an effective scope permits one
|
|
6
|
+
* requested pool, label, or namespace. The module deliberately does not read
|
|
7
|
+
* keys, verify signatures, or perform filesystem or network I/O; chain.ts owns
|
|
8
|
+
* those concerns.
|
|
9
|
+
*/
|
|
10
|
+
/** Whether a child axis is contained by a parent's effective axis. */
|
|
11
|
+
export function axisPermits(parent, child) {
|
|
12
|
+
if (parent === '*')
|
|
13
|
+
return true;
|
|
14
|
+
if (child === '*')
|
|
15
|
+
return false;
|
|
16
|
+
const allowed = new Set(parent);
|
|
17
|
+
return child.every((value) => allowed.has(value));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Check whether a child delegation declaration is permitted by its parent.
|
|
21
|
+
* `maxDepth: N` means a grant signed by that key may delegate at most N - 1
|
|
22
|
+
* further levels; zero therefore permits only non-delegating child grants.
|
|
23
|
+
*/
|
|
24
|
+
export function delegationPermits(parent, child) {
|
|
25
|
+
if (!parent.allowed) {
|
|
26
|
+
return { ok: false, reason: 'parent delegation is not allowed to sign grants' };
|
|
27
|
+
}
|
|
28
|
+
if (parent.maxDepth === 'unbounded')
|
|
29
|
+
return { ok: true };
|
|
30
|
+
if (!child.allowed)
|
|
31
|
+
return { ok: true };
|
|
32
|
+
if (child.maxDepth === 'unbounded') {
|
|
33
|
+
return {
|
|
34
|
+
ok: false,
|
|
35
|
+
reason: `child delegation is unbounded but parent permits at most ${parent.maxDepth - 1} further level(s)`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (child.maxDepth > parent.maxDepth - 1) {
|
|
39
|
+
return {
|
|
40
|
+
ok: false,
|
|
41
|
+
reason: `child delegation depth ${child.maxDepth} exceeds parent limit ${parent.maxDepth - 1}`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return { ok: true };
|
|
45
|
+
}
|
|
46
|
+
/** Check every axis and the delegation limit in one attenuation decision. */
|
|
47
|
+
export function attenuate(parent, child) {
|
|
48
|
+
for (const axis of ['pools', 'labels', 'namespaces']) {
|
|
49
|
+
if (!axisPermits(parent[axis], child[axis])) {
|
|
50
|
+
const parentText = parent[axis] === '*' ? '*' : `[${parent[axis].join(', ')}]`;
|
|
51
|
+
const childText = child[axis] === '*' ? '*' : `[${child[axis].join(', ')}]`;
|
|
52
|
+
return { ok: false, reason: `${axis} scope widens from ${parentText} to ${childText}` };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return delegationPermits(parent.delegation, child.delegation);
|
|
56
|
+
}
|
|
57
|
+
/** The identity scope held by the local organization root anchor. */
|
|
58
|
+
export const ORG_ROOT_SCOPE = {
|
|
59
|
+
pools: '*',
|
|
60
|
+
labels: '*',
|
|
61
|
+
namespaces: '*',
|
|
62
|
+
delegation: { allowed: true, maxDepth: 'unbounded' },
|
|
63
|
+
};
|
|
64
|
+
function axisContains(axis, value) {
|
|
65
|
+
return axis === '*' || axis.includes(value);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Check whether a producer demand is contained by an effective grant scope.
|
|
69
|
+
* Omitted demand fields are not constrained; present fields must be allowed by
|
|
70
|
+
* their corresponding axis.
|
|
71
|
+
*/
|
|
72
|
+
export function scopePermits(scope, demand) {
|
|
73
|
+
if (demand.pool !== undefined && !axisContains(scope.pools, demand.pool)) {
|
|
74
|
+
return { ok: false, reason: `pool '${demand.pool}' is outside the granted scope` };
|
|
75
|
+
}
|
|
76
|
+
if (demand.label !== undefined && !axisContains(scope.labels, demand.label)) {
|
|
77
|
+
return { ok: false, reason: `label '${demand.label}' is outside the granted scope` };
|
|
78
|
+
}
|
|
79
|
+
if (demand.namespace !== undefined && !axisContains(scope.namespaces, demand.namespace)) {
|
|
80
|
+
return { ok: false, reason: `namespace '${demand.namespace}' is outside the granted scope` };
|
|
81
|
+
}
|
|
82
|
+
return { ok: true };
|
|
83
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSHSIG signing/verification through stock OpenSSH, behind one async
|
|
3
|
+
* `Signer` interface.
|
|
4
|
+
*
|
|
5
|
+
* **Why stock OpenSSH (and not a pure-JS SSHSIG implementation):** invoking
|
|
6
|
+
* `ssh-keygen -Y sign` / `ssh-keygen -Y verify` gives byte-level
|
|
7
|
+
* interoperability with the system verifier, adds no cryptographic
|
|
8
|
+
* parser/encoder dependency, and delegates SSHSIG format and `allowed_signers`
|
|
9
|
+
* policy semantics to maintained OpenSSH code. The portability cost is an
|
|
10
|
+
* external runtime requirement: `ssh-keygen` must support `-Y`. Support is
|
|
11
|
+
* PROBED (a harmless capability invocation), never inferred from a version
|
|
12
|
+
* string; when unavailable the probe result is an actionable error.
|
|
13
|
+
*
|
|
14
|
+
* **Secrecy discipline.** Private key material never appears in argv, captured
|
|
15
|
+
* stdout/stderr, thrown messages, or logs:
|
|
16
|
+
* - every invocation is `shell: false` (argv is a vector, never a shell line);
|
|
17
|
+
* - the message bytes ride on child stdin; the private key rides only as a
|
|
18
|
+
* `-f <path>` argument (a PATH — never the key contents);
|
|
19
|
+
* - child stdout/stderr is captured only where it is public by nature (the
|
|
20
|
+
* armored SSH signature; verification status). A verification failure
|
|
21
|
+
* throws a FIXED diagnostic that never interpolates child output.
|
|
22
|
+
*
|
|
23
|
+
* **Signer semantics.** `verify` returns a `VerifiedSignature` descriptor on a
|
|
24
|
+
* successful OpenSSH verification against the configured principal +
|
|
25
|
+
* `allowed_signers` content, or `null` on a normal verification miss. A
|
|
26
|
+
* tool/configuration failure (no binary, missing `-Y` support, timeout,
|
|
27
|
+
* oversized output) THROWS — a miss and a broken toolchain are different
|
|
28
|
+
* facts. Authorization is decided by OpenSSH itself; a signature's `keyid`
|
|
29
|
+
* (candidate hint) is never treated as identity.
|
|
30
|
+
*/
|
|
31
|
+
/** The result of signing: which key signed (`keyid`) and the signature bytes. */
|
|
32
|
+
export interface DetachedSignature {
|
|
33
|
+
/** The signer's keyid (the `SHA256:<b64>` public-key fingerprint). */
|
|
34
|
+
keyid: string;
|
|
35
|
+
/**
|
|
36
|
+
* The signature bytes. For the SSH signer this is the ARMORED SSH signature
|
|
37
|
+
* text (`-----BEGIN SSH SIGNATURE-----` …) as UTF-8 bytes — the armored form
|
|
38
|
+
* is what OpenSSH consumes and emits, and it is public information.
|
|
39
|
+
*/
|
|
40
|
+
sig: Buffer;
|
|
41
|
+
}
|
|
42
|
+
/** Describes a signature that verified — non-secret public descriptors only. */
|
|
43
|
+
export interface VerifiedSignature {
|
|
44
|
+
/** The verified signer's keyid (fingerprint of the verifying public key). */
|
|
45
|
+
keyid: string;
|
|
46
|
+
/** The SSH principal (signer identity) OpenSSH matched in allowed_signers. */
|
|
47
|
+
principal: string;
|
|
48
|
+
/** The format that produced the signature, e.g. `'sshsig'`. */
|
|
49
|
+
format: 'sshsig';
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The async, format-neutral signer contract. DSSE depends only on this
|
|
53
|
+
* interface, so a future Sigstore signer can implement the same contract
|
|
54
|
+
* without changing DSSE. `sign` produces a detached signature over EXACT
|
|
55
|
+
* bytes; `verify` returns the verified descriptor or `null` on a normal miss
|
|
56
|
+
* (tool failures throw).
|
|
57
|
+
*/
|
|
58
|
+
export interface Signer {
|
|
59
|
+
sign(exactBytes: Buffer): Promise<DetachedSignature>;
|
|
60
|
+
verify(exactBytes: Buffer, signature: Buffer): Promise<VerifiedSignature | null>;
|
|
61
|
+
}
|
|
62
|
+
/** The SSH signer's configuration. */
|
|
63
|
+
export interface SshSignerConfig {
|
|
64
|
+
/** The SSHSIG namespace (the `-n` domain string). Required. */
|
|
65
|
+
namespace: string;
|
|
66
|
+
/**
|
|
67
|
+
* Signing key handle — a filesystem path to a PRIVATE key (or to a public
|
|
68
|
+
* key whose private half is reachable through ssh-agent). Present ⇒ this
|
|
69
|
+
* signer can sign; absent ⇒ verify-only.
|
|
70
|
+
*/
|
|
71
|
+
signKeyPath?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Verification context: the expected signer principal (`-I`) and the raw
|
|
74
|
+
* `allowed_signers` file content. Present ⇒ this signer can verify.
|
|
75
|
+
*/
|
|
76
|
+
verify?: {
|
|
77
|
+
principal: string;
|
|
78
|
+
allowedSignersText: string;
|
|
79
|
+
};
|
|
80
|
+
/** Injectable process adapter (hermetic tests). */
|
|
81
|
+
process?: SshProcessAdapter;
|
|
82
|
+
/** Injectable temp-dir factory (hermetic tests). */
|
|
83
|
+
tempDir?: (prefix: string) => string;
|
|
84
|
+
/** Per-invocation timeout in ms (default 10s). */
|
|
85
|
+
timeoutMs?: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The minimal process seam the SSH signer needs. Defaults to a `spawn` wrapper
|
|
89
|
+
* (`shell: false`, never inherits stdio); tests inject a fake to assert argv
|
|
90
|
+
* and stdin secrecy without a real `ssh-keygen`.
|
|
91
|
+
*/
|
|
92
|
+
export interface SshProcessAdapter {
|
|
93
|
+
run(cmd: string, args: string[], opts: {
|
|
94
|
+
stdin?: Buffer;
|
|
95
|
+
timeoutMs: number;
|
|
96
|
+
maxBuffer?: number;
|
|
97
|
+
}): Promise<{
|
|
98
|
+
status: number | null;
|
|
99
|
+
stdout: Buffer;
|
|
100
|
+
stderr: Buffer;
|
|
101
|
+
timedOut: boolean;
|
|
102
|
+
truncated: boolean;
|
|
103
|
+
}>;
|
|
104
|
+
/** Synchronous, non-secret feature probe used by createSshSigner. */
|
|
105
|
+
probe?(cmd: string, args: string[], opts: {
|
|
106
|
+
timeoutMs: number;
|
|
107
|
+
}): {
|
|
108
|
+
status: number | null;
|
|
109
|
+
stderr: Buffer;
|
|
110
|
+
errorCode?: string;
|
|
111
|
+
timedOut?: boolean;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Thrown for SSHSIG tool/configuration failures. Message is fixed, non-secret. */
|
|
115
|
+
export declare class SshSignerError extends Error {
|
|
116
|
+
constructor(message: string);
|
|
117
|
+
}
|
|
118
|
+
/** The default `spawn`-based adapter: `shell: false`, captured stdio, timeout + output cap. */
|
|
119
|
+
export declare const defaultSshProcess: SshProcessAdapter;
|
|
120
|
+
export declare function probeSshKeygenY(adapter?: SshProcessAdapter, tempDir?: (prefix: string) => string): {
|
|
121
|
+
ok: boolean;
|
|
122
|
+
detail: string;
|
|
123
|
+
};
|
|
124
|
+
/** Reset the cached capability (tests only). */
|
|
125
|
+
export declare function resetSshKeygenProbe(): void;
|
|
126
|
+
/**
|
|
127
|
+
* The OpenSSH SSHSIG signer. Construct via `createSshSigner`. Signing and
|
|
128
|
+
* verification are separate capabilities configured at construction; using an
|
|
129
|
+
* unconfigured capability throws a fixed `SshSignerError`.
|
|
130
|
+
*/
|
|
131
|
+
export declare class SshSigner implements Signer {
|
|
132
|
+
private readonly config;
|
|
133
|
+
private readonly proc;
|
|
134
|
+
private readonly makeTempDir;
|
|
135
|
+
/** The verification temp dir (created lazily), removed in `dispose`. */
|
|
136
|
+
private verifyDir;
|
|
137
|
+
constructor(config: SshSignerConfig);
|
|
138
|
+
/**
|
|
139
|
+
* Sign `exactBytes` by placing the private key path in `-f`, the configured
|
|
140
|
+
* namespace in `-n`, and the message on stdin. The armored SSH signature is
|
|
141
|
+
* captured from stdout (public information). Payload and private bytes never
|
|
142
|
+
* appear in argv.
|
|
143
|
+
*/
|
|
144
|
+
sign(exactBytes: Buffer): Promise<DetachedSignature>;
|
|
145
|
+
/**
|
|
146
|
+
* Verify `exactBytes` against a detached armored signature. Writes the
|
|
147
|
+
* armored signature and the raw `allowed_signers` text to temporary
|
|
148
|
+
* NON-SECRET files, passes the expected principal with `-I`, the namespace
|
|
149
|
+
* with `-n`, and the message on stdin.
|
|
150
|
+
*
|
|
151
|
+
* Zero exit ⇒ valid: returns `{ keyid, principal, format: 'sshsig' }`.
|
|
152
|
+
* A normal verification miss ⇒ `null`. Tool/configuration failures throw a
|
|
153
|
+
* fixed diagnostic that includes no child output.
|
|
154
|
+
*/
|
|
155
|
+
verify(exactBytes: Buffer, signature: Buffer): Promise<VerifiedSignature | null>;
|
|
156
|
+
/** Remove the verification temp dir. */
|
|
157
|
+
dispose(): void;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Create an `SshSigner` from a config. Verifies the capability probe once
|
|
161
|
+
* (cached for the process lifetime) and throws an actionable error when the
|
|
162
|
+
* system `ssh-keygen` lacks `-Y`.
|
|
163
|
+
*/
|
|
164
|
+
export declare function createSshSigner(config: SshSignerConfig): SshSigner;
|
|
165
|
+
/**
|
|
166
|
+
* Validate that a candidate SSH key is Ed25519 by reading its public key text
|
|
167
|
+
* (private bytes are never read). Throws a fixed error for non-Ed25519 keys —
|
|
168
|
+
* WP-A2 rejects them even though `allowed_signers` can represent other stock
|
|
169
|
+
* key types.
|
|
170
|
+
*/
|
|
171
|
+
export declare function assertEd25519PubText(pubText: string, label: string): void;
|