approval-md 0.1.0 → 0.2.0
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/README.md +584 -553
- package/SPEC.md +42 -13
- package/dist/src/adapters/agentmail.d.ts +426 -0
- package/dist/src/adapters/agentmail.js +2 -2
- package/dist/src/adapters/conformance.d.ts +149 -0
- package/dist/src/adapters/contract.d.ts +628 -0
- package/dist/src/adapters/contract.js +110 -16
- package/dist/src/adapters/contract.js.map +1 -1
- package/dist/src/adapters/email.d.ts +324 -0
- package/dist/src/adapters/env-passphrase.d.ts +93 -0
- package/dist/src/adapters/public.d.ts +11 -0
- package/dist/src/adapters/public.js +11 -0
- package/dist/src/adapters/public.js.map +1 -0
- package/dist/src/adapters/registry.d.ts +59 -0
- package/dist/src/adapters/registry.js +2 -1
- package/dist/src/adapters/registry.js.map +1 -1
- package/dist/src/adapters/smtp.d.ts +213 -0
- package/dist/src/adapters/vault-provider.d.ts +114 -0
- package/dist/src/adapters/vault-provider.js +3 -3
- package/dist/src/adapters/zzz.d.ts +66 -0
- package/dist/src/adapters/zzz.js +299 -0
- package/dist/src/adapters/zzz.js.map +1 -0
- package/dist/src/channels/batch.d.ts +109 -0
- package/dist/src/channels/cli.d.ts +193 -0
- package/dist/src/channels/conformance.d.ts +92 -0
- package/dist/src/channels/contract.d.ts +623 -0
- package/dist/src/channels/payload-view.d.ts +35 -0
- package/dist/src/channels/render-queue.d.ts +149 -0
- package/dist/src/channels/tagging.d.ts +196 -0
- package/dist/src/channels/telegram.d.ts +1832 -0
- package/dist/src/channels/web.d.ts +341 -0
- package/dist/src/cli/adapter.d.ts +90 -0
- package/dist/src/cli/adapter.js +25 -15
- package/dist/src/cli/adapter.js.map +1 -1
- package/dist/src/cli/amend.d.ts +59 -0
- package/dist/src/cli/args.d.ts +43 -0
- package/dist/src/cli/attest.d.ts +41 -0
- package/dist/src/cli/audit-card.d.ts +62 -0
- package/dist/src/cli/audit.d.ts +59 -0
- package/dist/src/cli/channel-telegram.d.ts +806 -0
- package/dist/src/cli/channel-web.d.ts +131 -0
- package/dist/src/cli/channel.d.ts +71 -0
- package/dist/src/cli/checkpoint-tap.d.ts +169 -0
- package/dist/src/cli/codex.d.ts +2 -0
- package/dist/src/cli/codex.js +172 -0
- package/dist/src/cli/codex.js.map +1 -0
- package/dist/src/cli/coverage.d.ts +61 -0
- package/dist/src/cli/daemon.d.ts +120 -0
- package/dist/src/cli/doctor.d.ts +129 -0
- package/dist/src/cli/doctor.js +119 -5
- package/dist/src/cli/doctor.js.map +1 -1
- package/dist/src/cli/env.d.ts +65 -0
- package/dist/src/cli/execute.d.ts +202 -0
- package/dist/src/cli/exit-codes.d.ts +73 -0
- package/dist/src/cli/feedback.d.ts +60 -0
- package/dist/src/cli/gate-window.d.ts +40 -0
- package/dist/src/cli/gate.d.ts +68 -0
- package/dist/src/cli/git-scope.d.ts +190 -0
- package/dist/src/cli/gloss-attach.d.ts +85 -0
- package/dist/src/cli/gloss-codex-child.d.ts +9 -0
- package/dist/src/cli/gloss-codex.d.ts +24 -0
- package/dist/src/cli/gloss-options.d.ts +42 -0
- package/dist/src/cli/gloss.d.ts +265 -0
- package/dist/src/cli/help.d.ts +103 -0
- package/dist/src/cli/help.js +173 -51
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/hook-codex.d.ts +78 -0
- package/dist/src/cli/hook-codex.js +167 -0
- package/dist/src/cli/hook-codex.js.map +1 -0
- package/dist/src/cli/hook.d.ts +331 -0
- package/dist/src/cli/hook.js +186 -80
- package/dist/src/cli/hook.js.map +1 -1
- package/dist/src/cli/import.d.ts +35 -0
- package/dist/src/cli/init.d.ts +84 -0
- package/dist/src/cli/init.js +2 -2
- package/dist/src/cli/init.js.map +1 -1
- package/dist/src/cli/instructions.d.ts +23 -0
- package/dist/src/cli/journal.d.ts +41 -0
- package/dist/src/cli/log-advance.d.ts +287 -0
- package/dist/src/cli/log-advance.js +102 -11
- package/dist/src/cli/log-advance.js.map +1 -1
- package/dist/src/cli/log-anchor.d.ts +176 -0
- package/dist/src/cli/log-checkpoint.d.ts +22 -0
- package/dist/src/cli/log-sync.d.ts +243 -0
- package/dist/src/cli/log-verbs.d.ts +16 -0
- package/dist/src/cli/log-verbs.js +7 -1
- package/dist/src/cli/log-verbs.js.map +1 -1
- package/dist/src/cli/long-help.d.ts +70 -0
- package/dist/src/cli/main.d.ts +77 -0
- package/dist/src/cli/main.js +155 -5
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/cli/mcp.d.ts +52 -0
- package/dist/src/cli/paths.d.ts +56 -0
- package/dist/src/cli/payload.d.ts +58 -0
- package/dist/src/cli/policy.d.ts +43 -0
- package/dist/src/cli/preflight.d.ts +363 -0
- package/dist/src/cli/preflight.js +294 -7
- package/dist/src/cli/preflight.js.map +1 -1
- package/dist/src/cli/progress.d.ts +78 -0
- package/dist/src/cli/prompt.d.ts +209 -0
- package/dist/src/cli/quickstart.d.ts +46 -0
- package/dist/src/cli/quickstart.js +297 -0
- package/dist/src/cli/quickstart.js.map +1 -0
- package/dist/src/cli/records.d.ts +34 -0
- package/dist/src/cli/render.d.ts +22 -0
- package/dist/src/cli/sandbox.d.ts +51 -0
- package/dist/src/cli/scaffold.d.ts +79 -0
- package/dist/src/cli/setup-adapter.d.ts +137 -0
- package/dist/src/cli/setup-adapter.js +38 -4
- package/dist/src/cli/setup-adapter.js.map +1 -1
- package/dist/src/cli/setup-channel.d.ts +117 -0
- package/dist/src/cli/setup-checkpoint.d.ts +57 -0
- package/dist/src/cli/setup-common.d.ts +275 -0
- package/dist/src/cli/setup-flow.d.ts +287 -0
- package/dist/src/cli/setup-service.d.ts +96 -0
- package/dist/src/cli/setup.d.ts +202 -0
- package/dist/src/cli/style.d.ts +320 -0
- package/dist/src/cli/token.d.ts +39 -0
- package/dist/src/cli/up.d.ts +155 -0
- package/dist/src/cli/up.js +4 -2
- package/dist/src/cli/up.js.map +1 -1
- package/dist/src/cli/usage.d.ts +37 -0
- package/dist/src/cli/values.d.ts +40 -0
- package/dist/src/cli/vault.d.ts +59 -0
- package/dist/src/cli/vault.js +2 -2
- package/dist/src/cli/vault.js.map +1 -1
- package/dist/src/cli/verb-registry.d.ts +76 -0
- package/dist/src/cli/verb-registry.js +176 -8
- package/dist/src/cli/verb-registry.js.map +1 -1
- package/dist/src/cli/wordmark.d.ts +31 -0
- package/dist/src/cli/wordmark.js +2 -2
- package/dist/src/codex/doctor.d.ts +13 -0
- package/dist/src/codex/doctor.js +41 -0
- package/dist/src/codex/doctor.js.map +1 -0
- package/dist/src/codex/manifest.d.ts +49 -0
- package/dist/src/codex/manifest.js +103 -0
- package/dist/src/codex/manifest.js.map +1 -0
- package/dist/src/codex/templates.d.ts +41 -0
- package/dist/src/codex/templates.js +319 -0
- package/dist/src/codex/templates.js.map +1 -0
- package/dist/src/codex/trust.d.ts +19 -0
- package/dist/src/codex/trust.js +183 -0
- package/dist/src/codex/trust.js.map +1 -0
- package/dist/src/codex/workspace-plan.d.ts +131 -0
- package/dist/src/codex/workspace-plan.js +561 -0
- package/dist/src/codex/workspace-plan.js.map +1 -0
- package/dist/src/core/actor.d.ts +2 -0
- package/dist/src/core/actor.js +5 -0
- package/dist/src/core/actor.js.map +1 -0
- package/dist/src/core/advance-cycle.d.ts +170 -0
- package/dist/src/core/agents-md.d.ts +276 -0
- package/dist/src/core/apply-patch.d.ts +49 -0
- package/dist/src/core/apply-patch.js +266 -0
- package/dist/src/core/apply-patch.js.map +1 -0
- package/dist/src/core/attest.d.ts +420 -0
- package/dist/src/core/attest.js +13 -1
- package/dist/src/core/attest.js.map +1 -1
- package/dist/src/core/audit.d.ts +492 -0
- package/dist/src/core/budgets.d.ts +238 -0
- package/dist/src/core/checkpoint.d.ts +500 -0
- package/dist/src/core/child-env.d.ts +88 -0
- package/dist/src/core/clock.d.ts +52 -0
- package/dist/src/core/command-class.d.ts +543 -0
- package/dist/src/core/command-class.js +43 -8
- package/dist/src/core/command-class.js.map +1 -1
- package/dist/src/core/coverage-sources/adapter.d.ts +40 -0
- package/dist/src/core/coverage-sources/gh.d.ts +48 -0
- package/dist/src/core/coverage-sources/git.d.ts +101 -0
- package/dist/src/core/coverage.d.ts +217 -0
- package/dist/src/core/credential-spec.d.ts +72 -0
- package/dist/src/core/dark-session.d.ts +331 -0
- package/dist/src/core/decision-refusal.d.ts +185 -0
- package/dist/src/core/env-file.d.ts +450 -0
- package/dist/src/core/execute.d.ts +858 -0
- package/dist/src/core/execute.js +44 -6
- package/dist/src/core/execute.js.map +1 -1
- package/dist/src/core/frontmatter.d.ts +78 -0
- package/dist/src/core/gate-window.d.ts +312 -0
- package/dist/src/core/gate.d.ts +1364 -0
- package/dist/src/core/gate.js +68 -13
- package/dist/src/core/gate.js.map +1 -1
- package/dist/src/core/git-run.d.ts +73 -0
- package/dist/src/core/harness-version.d.ts +157 -0
- package/dist/src/core/harness-version.js +2 -1
- package/dist/src/core/harness-version.js.map +1 -1
- package/dist/src/core/harness-wait.d.ts +55 -0
- package/dist/src/core/head-retry.d.ts +107 -0
- package/dist/src/core/instance.d.ts +253 -0
- package/dist/src/core/intake-limits.d.ts +247 -0
- package/dist/src/core/jcs.d.ts +52 -0
- package/dist/src/core/journal.d.ts +144 -0
- package/dist/src/core/live-draw.d.ts +436 -0
- package/dist/src/core/log-reconcile.d.ts +89 -0
- package/dist/src/core/log-subscribe.d.ts +36 -0
- package/dist/src/core/log-subscribe.js +162 -0
- package/dist/src/core/log-subscribe.js.map +1 -0
- package/dist/src/core/log.d.ts +278 -0
- package/dist/src/core/loop.d.ts +274 -0
- package/dist/src/core/loop.js +11 -0
- package/dist/src/core/loop.js.map +1 -1
- package/dist/src/core/md-fence.d.ts +41 -0
- package/dist/src/core/money.d.ts +147 -0
- package/dist/src/core/payload-census.d.ts +74 -0
- package/dist/src/core/payload-store.d.ts +175 -0
- package/dist/src/core/payload.d.ts +71 -0
- package/dist/src/core/policy-diff.d.ts +292 -0
- package/dist/src/core/policy-diff.js +27 -4
- package/dist/src/core/policy-diff.js.map +1 -1
- package/dist/src/core/policy-expectations.d.ts +199 -0
- package/dist/src/core/policy-explain.d.ts +150 -0
- package/dist/src/core/policy-explain.js +31 -3
- package/dist/src/core/policy-explain.js.map +1 -1
- package/dist/src/core/policy-load.d.ts +527 -0
- package/dist/src/core/policy-load.js +15 -3
- package/dist/src/core/policy-load.js.map +1 -1
- package/dist/src/core/policy-match.d.ts +281 -0
- package/dist/src/core/policy-match.js +20 -9
- package/dist/src/core/policy-match.js.map +1 -1
- package/dist/src/core/policy-proposal.d.ts +265 -0
- package/dist/src/core/prompt-layout.d.ts +221 -0
- package/dist/src/core/protected-path-guard.d.ts +453 -0
- package/dist/src/core/protected-path-guard.js +514 -35
- package/dist/src/core/protected-path-guard.js.map +1 -1
- package/dist/src/core/registration.d.ts +25 -0
- package/dist/src/core/reindex.d.ts +99 -0
- package/dist/src/core/sampler.d.ts +313 -0
- package/dist/src/core/sandbox.d.ts +290 -0
- package/dist/src/core/seal.d.ts +165 -0
- package/dist/src/core/state.d.ts +505 -0
- package/dist/src/core/task-file.d.ts +185 -0
- package/dist/src/core/telegram-config.d.ts +93 -0
- package/dist/src/core/token.d.ts +409 -0
- package/dist/src/core/token.js +21 -38
- package/dist/src/core/token.js.map +1 -1
- package/dist/src/core/validate.d.ts +138 -0
- package/dist/src/core/values.d.ts +137 -0
- package/dist/src/core/vault.d.ts +291 -0
- package/dist/src/core/verified-snapshot.d.ts +204 -0
- package/dist/src/core/verify.d.ts +336 -0
- package/dist/src/core/version.d.ts +8 -0
- package/dist/src/core/wysiwys.d.ts +370 -0
- package/dist/src/daemon/advance-child.d.ts +39 -0
- package/dist/src/daemon/advance.d.ts +466 -0
- package/dist/src/daemon/audit.d.ts +87 -0
- package/dist/src/daemon/daemon.d.ts +1180 -0
- package/dist/src/daemon/dark-session.d.ts +64 -0
- package/dist/src/daemon/draw-child.d.ts +36 -0
- package/dist/src/daemon/draw.d.ts +154 -0
- package/dist/src/daemon/git-evidence.d.ts +173 -0
- package/dist/src/daemon/git-evidence.js +1 -1
- package/dist/src/daemon/projection.d.ts +180 -0
- package/dist/src/daemon/prune.d.ts +207 -0
- package/dist/src/mcp/http.d.ts +113 -0
- package/dist/src/mcp/server.d.ts +265 -0
- package/dist/src/mcp/server.js +9 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/docs/adapter-api.md +106 -0
- package/docs/cli-reference.md +389 -36
- package/docs/codex-enforced-session.md +30 -0
- package/package.json +12 -2
- package/schema/codex-instance.schema.json +82 -0
- package/schema/event.schema.json +2 -1
- package/schema/fixtures/codex-instance/invalid/unpinned-codex-version.json +40 -0
- package/schema/fixtures/codex-instance/valid/canonical.json +40 -0
- package/schema/policy.schema.json +21 -1
- package/templates/codex/README.md +9 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { lstatSync, realpathSync, statSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
function ancestors(path) {
|
|
5
|
+
const values = [];
|
|
6
|
+
let current = resolve(path);
|
|
7
|
+
for (;;) {
|
|
8
|
+
values.unshift(current);
|
|
9
|
+
const parent = dirname(current);
|
|
10
|
+
if (parent === current)
|
|
11
|
+
return values;
|
|
12
|
+
current = parent;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function systemUid(name) {
|
|
16
|
+
const result = spawnSync("/usr/bin/id", ["-u", name], {
|
|
17
|
+
encoding: "utf8", timeout: 2_000, maxBuffer: 16_384, env: { PATH: "/usr/bin:/bin" },
|
|
18
|
+
});
|
|
19
|
+
if (result.status !== 0)
|
|
20
|
+
return null;
|
|
21
|
+
const value = Number(result.stdout.trim());
|
|
22
|
+
return Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
23
|
+
}
|
|
24
|
+
function systemGroups(name) {
|
|
25
|
+
const result = spawnSync("/usr/bin/id", ["-G", name], {
|
|
26
|
+
encoding: "utf8", timeout: 2_000, maxBuffer: 16_384, env: { PATH: "/usr/bin:/bin" },
|
|
27
|
+
});
|
|
28
|
+
if (result.status !== 0)
|
|
29
|
+
return null;
|
|
30
|
+
const groups = result.stdout.trim().split(/\s+/u).map(Number);
|
|
31
|
+
return groups.length > 0 && groups.every((value) => Number.isSafeInteger(value) && value >= 0)
|
|
32
|
+
? groups
|
|
33
|
+
: null;
|
|
34
|
+
}
|
|
35
|
+
export function parseCodexVersionOutput(stdout, stderr) {
|
|
36
|
+
if (stderr.length !== 0)
|
|
37
|
+
return null;
|
|
38
|
+
return /^codex-cli (\d+\.\d+\.\d+)$/u.exec(stdout.trim())?.[1] ?? null;
|
|
39
|
+
}
|
|
40
|
+
export function parseNodeVersionOutput(stdout, stderr) {
|
|
41
|
+
if (stderr.length !== 0)
|
|
42
|
+
return null;
|
|
43
|
+
return /^v(\d+\.\d+\.\d+)$/u.exec(stdout.trim())?.[1] ?? null;
|
|
44
|
+
}
|
|
45
|
+
function add(findings, code, message, path) {
|
|
46
|
+
findings.push(path === undefined ? { code, message } : { code, path, message });
|
|
47
|
+
}
|
|
48
|
+
function inspectNoSymlinks(path, findings) {
|
|
49
|
+
let safe = true;
|
|
50
|
+
for (const candidate of ancestors(path)) {
|
|
51
|
+
try {
|
|
52
|
+
if (lstatSync(candidate).isSymbolicLink()) {
|
|
53
|
+
add(findings, "path-symlink", "path or ancestor is a symbolic link", candidate);
|
|
54
|
+
safe = false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
add(findings, "path-missing", "path or ancestor does not exist", candidate);
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
if (realpathSync(path) !== resolve(path)) {
|
|
64
|
+
add(findings, "path-canonical", "real path differs from the manifest path", path);
|
|
65
|
+
safe = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return safe;
|
|
72
|
+
}
|
|
73
|
+
function inspectRootCustody(path, findings) {
|
|
74
|
+
let safe = true;
|
|
75
|
+
for (const candidate of ancestors(path)) {
|
|
76
|
+
let stat;
|
|
77
|
+
try {
|
|
78
|
+
stat = statSync(candidate);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (stat.uid !== 0) {
|
|
84
|
+
add(findings, "owner-not-root", `trusted path ancestor is owned by uid ${String(stat.uid)}, expected 0`, candidate);
|
|
85
|
+
safe = false;
|
|
86
|
+
}
|
|
87
|
+
if ((stat.mode & 0o022) !== 0) {
|
|
88
|
+
add(findings, "trusted-path-writable", "trusted path ancestor is group- or world-writable", candidate);
|
|
89
|
+
safe = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return safe;
|
|
93
|
+
}
|
|
94
|
+
function inspectExecutable(path, findings) {
|
|
95
|
+
try {
|
|
96
|
+
const stat = statSync(path);
|
|
97
|
+
let safe = true;
|
|
98
|
+
if (!stat.isFile()) {
|
|
99
|
+
add(findings, "component-not-file", "component is not a regular file", path);
|
|
100
|
+
safe = false;
|
|
101
|
+
}
|
|
102
|
+
if ((stat.mode & 0o111) === 0) {
|
|
103
|
+
add(findings, "component-not-executable", "component has no execute bit", path);
|
|
104
|
+
safe = false;
|
|
105
|
+
}
|
|
106
|
+
return safe;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
add(findings, "component-missing", "required enforcement component is missing", path);
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export function diagnoseCodexInstance(manifest, options = {}) {
|
|
114
|
+
const findings = [];
|
|
115
|
+
const platform = options.platform ?? process.platform;
|
|
116
|
+
if (platform !== manifest.platform) {
|
|
117
|
+
add(findings, "unsupported-platform", `manifest requires ${manifest.platform}; this host is ${platform}`);
|
|
118
|
+
}
|
|
119
|
+
const resolveUid = options.resolveUid ?? systemUid;
|
|
120
|
+
const groupsFor = options.groupsFor ?? systemGroups;
|
|
121
|
+
const identities = Object.values(manifest.principals).map((name) => ({
|
|
122
|
+
name, uid: resolveUid(name), groups: groupsFor(name),
|
|
123
|
+
}));
|
|
124
|
+
for (const identity of identities) {
|
|
125
|
+
if (identity.uid === null || identity.groups === null) {
|
|
126
|
+
add(findings, "principal-missing", `principal ${identity.name} does not exist or cannot be resolved`);
|
|
127
|
+
}
|
|
128
|
+
else if (identity.uid === 0) {
|
|
129
|
+
add(findings, "principal-root", `service principal ${identity.name} must not be uid 0`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const knownUids = identities.flatMap((identity) => identity.uid === null ? [] : [identity.uid]);
|
|
133
|
+
if (new Set(knownUids).size !== knownUids.length) {
|
|
134
|
+
add(findings, "principal-overlap", "Codex, broker and runner principals must have distinct non-root uids");
|
|
135
|
+
}
|
|
136
|
+
for (const path of Object.values(manifest.paths)) {
|
|
137
|
+
inspectNoSymlinks(path, findings);
|
|
138
|
+
}
|
|
139
|
+
const trusted = [
|
|
140
|
+
manifest.paths.install_root,
|
|
141
|
+
manifest.paths.package_root,
|
|
142
|
+
manifest.paths.manifest,
|
|
143
|
+
manifest.paths.codex_executable,
|
|
144
|
+
manifest.paths.node_executable,
|
|
145
|
+
manifest.paths.mcp_executable,
|
|
146
|
+
manifest.paths.broker_executable,
|
|
147
|
+
manifest.paths.runner_executable,
|
|
148
|
+
];
|
|
149
|
+
for (const path of trusted)
|
|
150
|
+
inspectRootCustody(path, findings);
|
|
151
|
+
const executables = [
|
|
152
|
+
manifest.paths.codex_executable,
|
|
153
|
+
manifest.paths.node_executable,
|
|
154
|
+
manifest.paths.mcp_executable,
|
|
155
|
+
manifest.paths.broker_executable,
|
|
156
|
+
manifest.paths.runner_executable,
|
|
157
|
+
];
|
|
158
|
+
for (const path of executables)
|
|
159
|
+
inspectExecutable(path, findings);
|
|
160
|
+
add(findings, "trusted-path-acl-unproven", "POSIX ownership and mode do not prove that trusted paths have no writable ACL; APRV-325.1 executes no manifest-selected binary");
|
|
161
|
+
add(findings, "codex-version-unchecked", "Codex version was not executed because ACL-aware executable custody is not implemented", manifest.paths.codex_executable);
|
|
162
|
+
add(findings, "node-version-unchecked", "Node version was not executed because ACL-aware executable custody is not implemented", manifest.paths.node_executable);
|
|
163
|
+
const codex = identities.find((entry) => entry.name === manifest.principals.codex);
|
|
164
|
+
if (codex !== undefined && codex.uid !== null && codex.groups !== null) {
|
|
165
|
+
try {
|
|
166
|
+
const stat = statSync(manifest.paths.workspace);
|
|
167
|
+
const ownerWritable = stat.uid === codex.uid && (stat.mode & 0o200) !== 0;
|
|
168
|
+
const groupWritable = codex.groups.includes(stat.gid) && (stat.mode & 0o020) !== 0;
|
|
169
|
+
const worldWritable = (stat.mode & 0o002) !== 0;
|
|
170
|
+
if (ownerWritable || groupWritable || worldWritable) {
|
|
171
|
+
add(findings, "workspace-writable-by-codex", "workspace root is writable by the Codex principal under POSIX ownership and mode", manifest.paths.workspace);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
// Missing paths were already reported.
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
add(findings, "workspace-custody-unproven", "root mode inspection does not prove subtree and ACL non-write; APRV-325.3 must perform a principal-executed denial probe", manifest.paths.workspace);
|
|
179
|
+
add(findings, "broker-not-ready", "APRV-325.1 ships preparation only; the policy-bound broker is not implemented", manifest.paths.broker_executable);
|
|
180
|
+
add(findings, "runner-not-ready", "APRV-325.1 ships preparation only; the confined runner is not implemented", manifest.paths.runner_executable);
|
|
181
|
+
return { ok: false, ready: false, findings };
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=trust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trust.js","sourceRoot":"","sources":["../../../src/codex/trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,OAAO,EA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C;IAEjJ,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only planning for a future policy-bound Codex workspace broker (APRV-325.2.1).
|
|
3
|
+
*
|
|
4
|
+
* This module validates a closed change language, classifies every endpoint,
|
|
5
|
+
* and binds the bytes and filesystem identities it observes. It does not append
|
|
6
|
+
* to the approval log, mutate a workspace, establish OS custody, or make the
|
|
7
|
+
* supplied context trustworthy. A future broker must supply that context from
|
|
8
|
+
* its protected configuration and retain exclusive write custody while it
|
|
9
|
+
* revalidates and applies an authorized plan.
|
|
10
|
+
*/
|
|
11
|
+
import type { PolicyLoadResult } from "../core/policy-load.js";
|
|
12
|
+
export declare const WORKSPACE_PLAN_VERSION: "approval.codex.workspace-plan.v1";
|
|
13
|
+
export declare const MAX_WORKSPACE_OPERATIONS = 64;
|
|
14
|
+
export declare const MAX_WORKSPACE_PATH_BYTES = 1024;
|
|
15
|
+
export declare const MAX_WORKSPACE_IMAGE_BYTES = 1048576;
|
|
16
|
+
export declare const MAX_WORKSPACE_TOTAL_BYTES = 8388608;
|
|
17
|
+
export declare const MAX_WORKSPACE_DIRECTORY_ENTRIES = 4096;
|
|
18
|
+
export type WorkspaceOperationInput = {
|
|
19
|
+
kind: "create";
|
|
20
|
+
path: string;
|
|
21
|
+
after_base64: string;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "replace";
|
|
24
|
+
path: string;
|
|
25
|
+
expected_before_sha256: string;
|
|
26
|
+
after_base64: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "delete";
|
|
29
|
+
path: string;
|
|
30
|
+
expected_before_sha256: string;
|
|
31
|
+
} | {
|
|
32
|
+
kind: "move";
|
|
33
|
+
from: string;
|
|
34
|
+
to: string;
|
|
35
|
+
expected_before_sha256: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Assertions supplied by the future trusted broker. The planner validates their
|
|
39
|
+
* shape and binds them; possession of this object proves no custody or attestation.
|
|
40
|
+
*/
|
|
41
|
+
export interface WorkspacePlanContext {
|
|
42
|
+
actor: string;
|
|
43
|
+
root: string;
|
|
44
|
+
policy_sha256: string;
|
|
45
|
+
policy: PolicyLoadResult;
|
|
46
|
+
}
|
|
47
|
+
export interface FsIdentity {
|
|
48
|
+
dev: string;
|
|
49
|
+
ino: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DirectoryBinding extends FsIdentity {
|
|
52
|
+
path: string;
|
|
53
|
+
}
|
|
54
|
+
export interface FileMetadata extends FsIdentity {
|
|
55
|
+
mode: string;
|
|
56
|
+
uid: string;
|
|
57
|
+
gid: string;
|
|
58
|
+
nlink: string;
|
|
59
|
+
size: string;
|
|
60
|
+
mtime_ns: string;
|
|
61
|
+
ctime_ns: string;
|
|
62
|
+
}
|
|
63
|
+
export interface BoundImage {
|
|
64
|
+
base64: string;
|
|
65
|
+
sha256: string;
|
|
66
|
+
byte_length: number;
|
|
67
|
+
}
|
|
68
|
+
export interface BoundFileImage extends BoundImage {
|
|
69
|
+
metadata: FileMetadata;
|
|
70
|
+
}
|
|
71
|
+
export type PlannedWorkspaceOperation = {
|
|
72
|
+
kind: "create";
|
|
73
|
+
path: string;
|
|
74
|
+
class: string;
|
|
75
|
+
directories: readonly DirectoryBinding[];
|
|
76
|
+
after: BoundImage;
|
|
77
|
+
} | {
|
|
78
|
+
kind: "replace";
|
|
79
|
+
path: string;
|
|
80
|
+
class: string;
|
|
81
|
+
directories: readonly DirectoryBinding[];
|
|
82
|
+
before: BoundFileImage;
|
|
83
|
+
after: BoundImage;
|
|
84
|
+
} | {
|
|
85
|
+
kind: "delete";
|
|
86
|
+
path: string;
|
|
87
|
+
class: string;
|
|
88
|
+
directories: readonly DirectoryBinding[];
|
|
89
|
+
before: BoundFileImage;
|
|
90
|
+
} | {
|
|
91
|
+
kind: "move";
|
|
92
|
+
from: string;
|
|
93
|
+
to: string;
|
|
94
|
+
classes: readonly string[];
|
|
95
|
+
source_directories: readonly DirectoryBinding[];
|
|
96
|
+
destination_directories: readonly DirectoryBinding[];
|
|
97
|
+
before: BoundFileImage;
|
|
98
|
+
after: BoundImage;
|
|
99
|
+
};
|
|
100
|
+
export interface WorkspacePlanPayload {
|
|
101
|
+
version: typeof WORKSPACE_PLAN_VERSION;
|
|
102
|
+
actor: string;
|
|
103
|
+
root: string;
|
|
104
|
+
root_identity: FsIdentity;
|
|
105
|
+
policy_sha256: string;
|
|
106
|
+
operations: readonly PlannedWorkspaceOperation[];
|
|
107
|
+
}
|
|
108
|
+
export interface WorkspaceActionLeg {
|
|
109
|
+
class: string;
|
|
110
|
+
reversible: false;
|
|
111
|
+
payload_hash: string;
|
|
112
|
+
}
|
|
113
|
+
export interface WorkspacePlan {
|
|
114
|
+
payload: WorkspacePlanPayload;
|
|
115
|
+
payload_hash: string;
|
|
116
|
+
actions: readonly WorkspaceActionLeg[];
|
|
117
|
+
}
|
|
118
|
+
export type WorkspacePlanRefusalCode = "input-invalid" | "operation-limit" | "path-invalid" | "path-conflict" | "payload-too-large" | "policy-unavailable" | "class-human-only" | "root-unsafe" | "parent-unsafe" | "source-unsafe" | "destination-exists" | "preimage-mismatch" | "workspace-drift" | "context-drift";
|
|
119
|
+
export type WorkspacePlanResult = {
|
|
120
|
+
ok: true;
|
|
121
|
+
plan: WorkspacePlan;
|
|
122
|
+
} | {
|
|
123
|
+
ok: false;
|
|
124
|
+
code: WorkspacePlanRefusalCode;
|
|
125
|
+
message: string;
|
|
126
|
+
path?: string;
|
|
127
|
+
};
|
|
128
|
+
/** Build a deterministic immutable proposal without changing the workspace. */
|
|
129
|
+
export declare function planWorkspaceProposal(input: unknown, context: WorkspacePlanContext): WorkspacePlanResult;
|
|
130
|
+
/** Re-read and reclassify a plan. Success means only that the snapshot still matches. */
|
|
131
|
+
export declare function revalidateWorkspacePlan(plan: WorkspacePlan, context: WorkspacePlanContext): WorkspacePlanResult;
|