@jbkjr/relay 0.0.0-stage → 1.2.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/LICENSE +21 -0
- package/LICENSES/Apache-2.0.txt +201 -0
- package/LICENSES/README.md +19 -0
- package/LICENSES/codex-NOTICE.txt +6 -0
- package/README.md +386 -2
- package/SECURITY.md +145 -0
- package/adapters/briefs/claude.md +43 -0
- package/adapters/briefs/codex.md +56 -0
- package/adapters/briefs/models.json +33 -0
- package/adapters/build.mjs +8 -0
- package/adapters/claude/.claude-plugin/marketplace.json +13 -0
- package/adapters/claude/relay/.claude-plugin/plugin.json +5 -0
- package/adapters/claude/relay/agents/codex.md +21 -0
- package/adapters/claude/relay/agents/operator.md +21 -0
- package/adapters/claude/relay/skills/ask/SKILL.md +20 -0
- package/adapters/claude/relay/skills/chat/SKILL.md +13 -0
- package/adapters/claude/relay/skills/delegate/SKILL.md +21 -0
- package/adapters/claude/relay/skills/discuss/SKILL.md +19 -0
- package/adapters/claude/relay/skills/review/SKILL.md +21 -0
- package/adapters/claude/relay/skills/tree/SKILL.md +10 -0
- package/adapters/claude/relay/skills/write-for-codex/SKILL.md +78 -0
- package/adapters/codex/.agents/plugins/marketplace.json +20 -0
- package/adapters/codex/AGENTS.snippet.md +5 -0
- package/adapters/codex/relay/.codex-plugin/plugin.json +6 -0
- package/adapters/codex/relay/skills/relay-ask/SKILL.md +20 -0
- package/adapters/codex/relay/skills/relay-chat/SKILL.md +13 -0
- package/adapters/codex/relay/skills/relay-delegate/SKILL.md +21 -0
- package/adapters/codex/relay/skills/relay-discuss/SKILL.md +19 -0
- package/adapters/codex/relay/skills/relay-review/SKILL.md +21 -0
- package/adapters/codex/relay/skills/relay-tree/SKILL.md +10 -0
- package/adapters/codex/relay/skills/relay-write-for-claude/SKILL.md +66 -0
- package/adapters/generate.mjs +124 -0
- package/bin/relay +59 -0
- package/codex-pin.json +12 -0
- package/dist/backends/acp.js +1424 -0
- package/dist/backends/claude.js +890 -0
- package/dist/backends/cli-version.js +112 -0
- package/dist/backends/codex-app.js +1525 -0
- package/dist/backends/codex-daybreak.js +75 -0
- package/dist/backends/codex-env.js +656 -0
- package/dist/backends/codex-network.js +304 -0
- package/dist/backends/codex-pin.js +320 -0
- package/dist/backends/codex-shell-policy.js +182 -0
- package/dist/backends/codex-stage2.js +998 -0
- package/dist/backends/codex-subagents.js +47 -0
- package/dist/backends/codex.js +637 -0
- package/dist/backends/copilot.js +246 -0
- package/dist/backends/env.js +147 -0
- package/dist/backends/gemini.js +607 -0
- package/dist/backends/grok.js +337 -0
- package/dist/backends/index.js +8 -0
- package/dist/backends/native-temp.js +187 -0
- package/dist/backends/never-admission.js +90 -0
- package/dist/backends/run.js +67 -0
- package/dist/backends/stream.js +230 -0
- package/dist/backends/tool-discovery.js +15 -0
- package/dist/backends/types.js +264 -0
- package/dist/build-info.json +5 -0
- package/dist/cli.js +344 -0
- package/dist/confine/bridge.js +113 -0
- package/dist/confine/broker-core.js +76 -0
- package/dist/confine/broker-http.js +650 -0
- package/dist/confine/broker-names.js +9 -0
- package/dist/confine/broker.js +258 -0
- package/dist/confine/canary.js +380 -0
- package/dist/confine/diagnostics.js +122 -0
- package/dist/confine/gemini-tools-main.js +8 -0
- package/dist/confine/gemini-tools.js +181 -0
- package/dist/confine/hardlinks.js +58 -0
- package/dist/confine/harness-config.js +16 -0
- package/dist/confine/index.js +117 -0
- package/dist/confine/leases.js +217 -0
- package/dist/confine/paths.js +6 -0
- package/dist/confine/peer.js +115 -0
- package/dist/confine/port-policy.js +8 -0
- package/dist/confine/ports.js +365 -0
- package/dist/confine/private-root.js +208 -0
- package/dist/confine/probe-stage2.js +501 -0
- package/dist/confine/probe.js +1109 -0
- package/dist/confine/proxy.js +783 -0
- package/dist/confine/sbcheck.js +208 -0
- package/dist/confine/seatbelt-never.js +41 -0
- package/dist/confine/seatbelt-stage2.js +139 -0
- package/dist/confine/seatbelt.js +1129 -0
- package/dist/confine/sockets.js +36 -0
- package/dist/confine/turn-probe.js +19 -0
- package/dist/confine/turn.js +86 -0
- package/dist/core/adoption.js +124 -0
- package/dist/core/api-keys.js +423 -0
- package/dist/core/approvals.js +740 -0
- package/dist/core/build-identity.js +248 -0
- package/dist/core/caller.js +749 -0
- package/dist/core/calls.js +102 -0
- package/dist/core/claude-settings.js +1045 -0
- package/dist/core/config.js +453 -0
- package/dist/core/context.js +186 -0
- package/dist/core/db.js +753 -0
- package/dist/core/dispatch.js +110 -0
- package/dist/core/env-broker.js +505 -0
- package/dist/core/env-policy.js +182 -0
- package/dist/core/escalation-authority.js +76 -0
- package/dist/core/escalation-contract.js +13 -0
- package/dist/core/escalation-person-path.js +131 -0
- package/dist/core/escalation-policy.js +79 -0
- package/dist/core/escalation-runtime.js +135 -0
- package/dist/core/escalation-state.js +42 -0
- package/dist/core/escalations.js +191 -0
- package/dist/core/events.js +235 -0
- package/dist/core/executables.js +147 -0
- package/dist/core/extensions.js +645 -0
- package/dist/core/families.js +204 -0
- package/dist/core/git.js +657 -0
- package/dist/core/identity.js +113 -0
- package/dist/core/liveness.js +68 -0
- package/dist/core/mediated-network-provider.js +81 -0
- package/dist/core/never-checkpoint.js +76 -0
- package/dist/core/never-coverage.js +97 -0
- package/dist/core/never-network.js +49 -0
- package/dist/core/never-policy.js +302 -0
- package/dist/core/never-proxy-policy.js +109 -0
- package/dist/core/never-schema.js +61 -0
- package/dist/core/never-tools.js +56 -0
- package/dist/core/notices.js +48 -0
- package/dist/core/ops.js +959 -0
- package/dist/core/outcome.js +224 -0
- package/dist/core/params.js +32 -0
- package/dist/core/presence.js +174 -0
- package/dist/core/procs.js +546 -0
- package/dist/core/prompts.js +363 -0
- package/dist/core/protected-config.js +238 -0
- package/dist/core/raw-network.js +192 -0
- package/dist/core/redact.js +152 -0
- package/dist/core/refusal.js +33 -0
- package/dist/core/relay-command.js +310 -0
- package/dist/core/reported.js +3 -0
- package/dist/core/restart-overlay.js +651 -0
- package/dist/core/retention.js +1135 -0
- package/dist/core/secrets.js +329 -0
- package/dist/core/session-token.js +175 -0
- package/dist/core/session.js +744 -0
- package/dist/core/shell.js +2 -0
- package/dist/core/shipped-pin.js +47 -0
- package/dist/core/shown.js +42 -0
- package/dist/core/slots.js +67 -0
- package/dist/core/stage2-executors.js +453 -0
- package/dist/core/stage2-switch.js +5 -0
- package/dist/core/steering.js +149 -0
- package/dist/core/storage.js +358 -0
- package/dist/core/toml.js +175 -0
- package/dist/core/views.js +324 -0
- package/dist/core/wait.js +114 -0
- package/dist/core/wake.js +207 -0
- package/dist/core/watch.js +247 -0
- package/dist/core/worktree.js +213 -0
- package/dist/hosts/claude-desktop.js +274 -0
- package/dist/hosts/claude.js +249 -0
- package/dist/hosts/codex.js +329 -0
- package/dist/hosts/desktop-shared.js +20 -0
- package/dist/hosts/index.js +11 -0
- package/dist/hosts/types.js +4 -0
- package/dist/install/basics.js +18 -0
- package/dist/install/claude-init.js +133 -0
- package/dist/install/common.js +655 -0
- package/dist/install/doctor.js +629 -0
- package/dist/install/qualify-codex.js +205 -0
- package/dist/install.js +524 -0
- package/dist/mcp/elicit.js +209 -0
- package/dist/mcp/gateway.js +218 -0
- package/dist/mcp/host.js +253 -0
- package/dist/mcp/server.js +1124 -0
- package/dist/mcp/stdio.js +37 -0
- package/dist/modes/discussion.js +393 -0
- package/dist/modes/review.js +722 -0
- package/dist/native/relay-sbcheck +0 -0
- package/dist/targets/briefs.js +86 -0
- package/dist/targets/claude.js +94 -0
- package/dist/targets/codex.js +66 -0
- package/dist/targets/copilot.js +93 -0
- package/dist/targets/gemini.js +119 -0
- package/dist/targets/grok.js +126 -0
- package/dist/targets/index.js +192 -0
- package/dist/targets/types.js +18 -0
- package/dist/targets/verified.js +35 -0
- package/dist/worker.js +113 -0
- package/docs/UPGRADING.md +1502 -0
- package/docs/pinned-codex.md +321 -0
- package/experiments/stage2-redteam/lib/oracles.mjs +214 -0
- package/experiments/stage2-redteam/lib/report.mjs +35 -0
- package/npm-shrinkwrap.json +1632 -0
- package/package.json +82 -4
- package/scripts/codex-qualify/codex-pin-store.mjs +353 -0
- package/scripts/codex-qualify/codex-qualifier-process.mjs +265 -0
- package/scripts/codex-qualify/codex-qualifier.example.json +5 -0
- package/scripts/codex-qualify/codex-qualifier.mjs +281 -0
- package/scripts/codex-qualify/codex-shipped-pin.mjs +158 -0
- package/scripts/codex-qualify/codex-stage2-pin.mjs +48 -0
- package/scripts/codex-qualify/codex-stage2.mjs +2381 -0
- package/scripts/codex-qualify/install-codex-qualifier.mjs +98 -0
- package/scripts/codex-qualify/main-module.mjs +14 -0
- package/scripts/codex-qualify/relay-codex-qualifier.plist +37 -0
- package/scripts/codex-qualify/scratch-env.mjs +31 -0
- package/scripts/codex-qualify/session.mjs +96 -0
- package/scripts/codex-qualify/stage2-escalation-cases.mjs +125 -0
- package/test/codex-permissions.test.ts +875 -0
- package/test/fixtures/boundary-probes.mjs +17 -0
- package/test/fixtures/denial-stream-host.mjs +7 -0
- package/test/fixtures/families.json +246 -0
- package/test/fixtures/install-snapshots/claude-desktop-foreign.txt +158 -0
- package/test/fixtures/install-snapshots/claude-desktop-fresh.txt +101 -0
- package/test/fixtures/install-snapshots/claude-desktop-installed.txt +161 -0
- package/test/fixtures/install-snapshots/claude-foreign.txt +133 -0
- package/test/fixtures/install-snapshots/claude-fresh.txt +77 -0
- package/test/fixtures/install-snapshots/claude-installed.txt +133 -0
- package/test/fixtures/install-snapshots/codex-foreign.txt +159 -0
- package/test/fixtures/install-snapshots/codex-fresh.txt +107 -0
- package/test/fixtures/install-snapshots/codex-installed.txt +161 -0
- package/test/fixtures/link-parent.mjs +6 -0
- package/test/fixtures/mediated-command.cjs +72 -0
- package/test/fixtures/native-skill-isolation.json +280 -0
- package/test/fixtures/pinned-codex-app-server.mjs +25 -0
- package/test/fixtures/qualified-ext-adapters.mjs +36 -0
- package/test/fixtures/refusals/README.md +52 -0
- package/test/fixtures/refusals/claude-source-result.json +7 -0
- package/test/fixtures/refusals/openai-app-capacity.json +24 -0
- package/test/fixtures/refusals/openai-app-cyberPolicy.json +24 -0
- package/test/fixtures/refusals/openai-gpt-6-astra-max.json +12 -0
- package/test/fixtures/refusals/openai-gpt-6.1-sol-xhigh.json +12 -0
- package/test/fixtures/refusals/openai-review-capacity.json +24 -0
- package/test/fixtures/relay-0.2.0.sql +57 -0
- package/test/fixtures/relay-0.9.1.gen.mjs +212 -0
- package/test/fixtures/relay-0.9.1.sql +340 -0
- package/test/fixtures/slow-boundary-probes.mjs +37 -0
- package/test/fixtures/stable-surfaces/config.json +1122 -0
- package/test/fixtures/stable-surfaces/escalation.json +128 -0
- package/test/fixtures/stable-surfaces/events.json +37 -0
- package/test/fixtures/stable-surfaces/gemini-native-resume.json +4 -0
- package/test/fixtures/stable-surfaces/inbox.jsonl +2 -0
- package/test/fixtures/stable-surfaces/notice.txt +1 -0
- package/test/fixtures/stable-surfaces/refusal-item.json +28 -0
- package/test/fixtures/stable-surfaces/refusal-review.json +23 -0
- package/test/fixtures/stable-surfaces/registry.json +49 -0
- package/test/fixtures/stable-surfaces/tools-desktop.json +575 -0
- package/test/fixtures/stable-surfaces/tools.json +716 -0
- package/test/fixtures/stable-surfaces/usage.txt +46 -0
- package/test/fixtures/stage2-acp-native.mjs +138 -0
- package/test/fixtures/stage2-app-server.mjs +23 -0
- package/test/fixtures/stage2-catalog.json +91 -0
- package/test/fixtures/stage2-hostile-web.mjs +35 -0
- package/test/fixtures/stage2-native-network.mjs +62 -0
- package/test/fixtures/stage2-worker.ts +87 -0
- package/test/fixtures/status-views/expected.json +7825 -0
- package/test/fixtures/status-views/registries.json +1 -0
- package/test/fixtures/steering.json +209 -0
- package/test/helpers.ts +740 -0
- package/test/host-env.ts +7 -0
- package/test/keychain-decoy.ts +197 -0
- package/test/live-scope.ts +44 -0
- package/test/mediated-network.test.ts +192 -0
- package/test/mediated-proxy.test.ts +264 -0
- package/test/native-temp-alias.ts +10 -0
- package/test/never-policy.test.ts +629 -0
- package/test/never-tools.test.ts +136 -0
- package/test/process-home.ts +18 -0
- package/test/proxy.test.ts +531 -0
- package/test/restart-overlay-live.test.ts +85 -0
- package/test/restart-overlay-profile.test.ts +66 -0
- package/test/restart-overlay.test.ts +416 -0
- package/test/stable-surfaces.test.ts +249 -0
- package/test/stage2-escalation-live.test.ts +544 -0
- package/test/stage2-escalation-qualification.test.ts +170 -0
- package/test/stage2-escalation.test.ts +747 -0
- package/test/stage2-executor.test.ts +849 -0
- package/test/stage2-grant.test.ts +603 -0
- package/test/stage2-native-live.test.ts +647 -0
- package/test/stage2-network-decisions.test.ts +70 -0
- package/test/stage2-probe.test.ts +845 -0
- package/test/stage2-standing-live.test.ts +203 -0
- package/test/stubs/broker-host.mjs +59 -0
- package/test/stubs/broker-peer.mjs +20 -0
- package/test/stubs/confined-harness.mjs +91 -0
- package/test/stubs/ext-broken-server.mjs +2 -0
- package/test/stubs/ext-odd-server.mjs +21 -0
- package/test/stubs/ext-server.mjs +31 -0
- package/test/stubs/fake-host-cli.mjs +218 -0
- package/test/stubs/procargs.mjs +30 -0
- package/test/stubs/stub-acp +4 -0
- package/test/stubs/stub-agent.mjs +322 -0
- package/test/stubs/stub-claude +4 -0
- package/test/stubs/stub-codex +4 -0
- package/test/stubs/targets/acp.mjs +307 -0
- package/test/stubs/targets/claude.mjs +149 -0
- package/test/stubs/targets/codex.mjs +479 -0
- package/test/stubs/targets/gemini.mjs +604 -0
- package/test/temp-root.ts +11 -0
- package/test/wp4-adapters.test.ts +353 -0
- package/test/wp4-interlock.test.ts +136 -0
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
import "./helpers.ts";
|
|
2
|
+
import { nonTempScratch } from "./helpers.ts";
|
|
3
|
+
import assert from "node:assert/strict";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { test } from "node:test";
|
|
8
|
+
import { spawn } from "node:child_process";
|
|
9
|
+
import { DatabaseSync } from "node:sqlite";
|
|
10
|
+
import { NEVER_RETIRED_BUILTIN_IDS, NeverConfigSchema, normalizeNeverHost } from "../dist/core/never-schema.js";
|
|
11
|
+
import { resolveNeverPolicy, mergeNeverPolicies, neverPathProblem, neverEndpointProblem, neverGrantProblem, neverIdentityProblem } from "../dist/core/never-policy.js";
|
|
12
|
+
import { assertNeverCurrent, assertNeverLaunchCurrent, checkpointNever, readNeverFloor } from "../dist/core/never-checkpoint.js";
|
|
13
|
+
import { closeDbForTests, createRun, db, getRun, insertNode, insertTurn, registryBackup, runConfig } from "../dist/core/db.js";
|
|
14
|
+
import { configDeprecations, withDefaults } from "../dist/core/config.js";
|
|
15
|
+
import { checkNativeTempAlias, ensureNativeTempAlias, nativeTempAlias, nativeTempRoot, privateStateRoot, setNativeTempAliasParentForTests } from "../dist/confine/private-root.js";
|
|
16
|
+
import { harnessHome, worktreesHome } from "../dist/core/config.js";
|
|
17
|
+
import { nativeTemp } from "../dist/backends/native-temp.js";
|
|
18
|
+
import { prepareCodexHome } from "../dist/backends/codex-pin.js";
|
|
19
|
+
import { decide, getRequest, neverApprovalProblem, requestApproval } from "../dist/core/approvals.js";
|
|
20
|
+
import { admitWork } from "../dist/core/caller.js";
|
|
21
|
+
import { relayCodexProtected, relayPathDirs, relayWriteProtected } from "../dist/core/protected-config.js";
|
|
22
|
+
|
|
23
|
+
function fixture(home = scratch(), config = withDefaults({ ask_user: "never", allow_temp_home: true, approval_timeout_s: 1 })) {
|
|
24
|
+
const old = { RELAY_HOME: process.env.RELAY_HOME, RELAY_CONFIG: process.env.RELAY_CONFIG };
|
|
25
|
+
process.env.RELAY_HOME = path.join(home, "registry"); process.env.RELAY_CONFIG = path.join(home, "config.json");
|
|
26
|
+
fs.writeFileSync(process.env.RELAY_CONFIG, JSON.stringify(config));
|
|
27
|
+
const run = createRun(home, config, "test-root");
|
|
28
|
+
const write = (never: unknown) => fs.writeFileSync(process.env.RELAY_CONFIG!, JSON.stringify({ ...config, never }));
|
|
29
|
+
return { home, run, write, close() {
|
|
30
|
+
closeDbForTests(); for (const [k, v] of Object.entries(old)) if (v === undefined) delete process.env[k]; else process.env[k] = v;
|
|
31
|
+
fs.rmSync(home, { recursive: true, force: true });
|
|
32
|
+
} };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const scratch = () => fs.mkdtempSync(path.join(os.tmpdir(), "relay-never-"));
|
|
36
|
+
const policy = (never: unknown = {}, home = os.homedir()) => resolveNeverPolicy({ never: NeverConfigSchema.parse(never), home, builtins: false });
|
|
37
|
+
|
|
38
|
+
test("never schema is strict, additive and rejects ambiguous resources and silent overrides", () => {
|
|
39
|
+
assert.deepEqual(NeverConfigSchema.parse({}), { paths: [], ports: [], hosts: [], override_builtin: [] });
|
|
40
|
+
for (const bad of [
|
|
41
|
+
{ paths: [{ path: "relative" }] }, { paths: [{ path: "/a/../b" }] }, { paths: [{ path: "/a/*" }] },
|
|
42
|
+
{ paths: [{ path: "/a", extra: 1 }] }, { ports: [{ port: 0 }] }, { ports: [{ port: 1.2 }] },
|
|
43
|
+
{ hosts: ["https://secret.example"] }, { hosts: ["*.example"] }, { hosts: ["fe80::1%en0"] },
|
|
44
|
+
{ hosts: ["127.1"] }, { hosts: ["0x7f000001"] }, { extra: [] },
|
|
45
|
+
{ override_builtin: [{ id: "unknown", acknowledge: "x", reason: "x" }] },
|
|
46
|
+
{ override_builtin: [{ id: "relay.install", acknowledge: "REMOVE BUILT-IN NEVER relay.install", reason: "x" }] },
|
|
47
|
+
{ override_builtin: [{ id: "service.sshd", acknowledge: "yes", reason: "x" }] },
|
|
48
|
+
]) assert.equal(NeverConfigSchema.safeParse(bad).success, false, JSON.stringify(bad));
|
|
49
|
+
assert.equal(normalizeNeverHost("BÜCHER.example."), "xn--bcher-kva.example");
|
|
50
|
+
assert.equal(normalizeNeverHost("::ffff:192.0.2.40"), "192.0.2.40");
|
|
51
|
+
assert.equal(normalizeNeverHost("2001:0DB8:0:0::40"), "2001:db8::40");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("never paths retain aliases, write semantics, missing tails, hard links and identities", () => {
|
|
55
|
+
const home = scratch();
|
|
56
|
+
try {
|
|
57
|
+
fs.mkdirSync(path.join(home, "real"));
|
|
58
|
+
fs.symlinkSync("real", path.join(home, "named"));
|
|
59
|
+
fs.writeFileSync(path.join(home, "secret"), "decoy");
|
|
60
|
+
fs.linkSync(path.join(home, "secret"), path.join(home, "alias"));
|
|
61
|
+
const p = policy({ paths: [{ path: "~/named/missing" }, { path: "~/secret" }, { path: "~/archive", access: "write" }] }, home);
|
|
62
|
+
for (const name of ["named/missing/file", "real/missing/file", "REAL/MISSING/file", "alias"]) assert.ok(neverPathProblem(p, path.join(home, name), "read"), name);
|
|
63
|
+
assert.equal(neverPathProblem(p, path.join(home, "archive/a"), "read"), null);
|
|
64
|
+
assert.ok(neverPathProblem(p, path.join(home, "archive/a"), "write"));
|
|
65
|
+
assert.equal(neverPathProblem(p, path.join(home, "real/sibling"), "write"), null);
|
|
66
|
+
assert.ok(neverGrantProblem(p, { write_paths: [home] }));
|
|
67
|
+
assert.equal(neverIdentityProblem(p), null);
|
|
68
|
+
fs.unlinkSync(path.join(home, "named"));
|
|
69
|
+
fs.symlinkSync("elsewhere", path.join(home, "named"));
|
|
70
|
+
assert.match(neverIdentityProblem(p)!, /identity/);
|
|
71
|
+
} finally { fs.rmSync(home, { recursive: true, force: true }); }
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("never endpoint rules preserve local IPv4 service semantics and fail raw closed with hosts", () => {
|
|
75
|
+
const p = policy({ hosts: ["SECRET.example.", "::ffff:192.0.2.40"], ports: [{ port: 2525, destinations: "this-machine" }, { port: 443, transport: "udp" }] });
|
|
76
|
+
assert.ok(neverEndpointProblem(p, { host: "secret.example", port: 80, transport: "tcp" }));
|
|
77
|
+
assert.ok(neverEndpointProblem(p, { host: "192.0.2.40", port: 80, transport: "tcp" }));
|
|
78
|
+
assert.ok(neverEndpointProblem(p, { host: "127.0.0.2", port: 2525, transport: "udp" }));
|
|
79
|
+
assert.equal(neverEndpointProblem(p, { host: "192.0.2.41", port: 2525, transport: "tcp" }), null);
|
|
80
|
+
assert.ok(neverEndpointProblem(p, { host: "192.0.2.41", port: 2525, transport: "tcp", operation: "listen" }));
|
|
81
|
+
assert.ok(neverEndpointProblem(p, { host: "2001:db8::2", port: 2525, transport: "tcp" }));
|
|
82
|
+
assert.equal(neverEndpointProblem(p, { host: "example.org", port: 443, transport: "tcp" }), null);
|
|
83
|
+
assert.ok(neverGrantProblem(p, { raw_network: true }));
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("never merge is deterministic and cumulative, including old path identities and removals", () => {
|
|
87
|
+
const a = policy({ hosts: ["a.example"] }); const b = policy({ hosts: ["b.example"] });
|
|
88
|
+
const union = mergeNeverPolicies(a, b);
|
|
89
|
+
assert.throws(() => union.hosts.push({ id: "injected", host: "other.example" }), TypeError, "hashed policy snapshots cannot be mutated by consumers");
|
|
90
|
+
assert.deepEqual(union.hosts.map(h => h.host), ["a.example", "b.example"]);
|
|
91
|
+
assert.equal(mergeNeverPolicies(union, a).hash, union.hash);
|
|
92
|
+
assert.equal(mergeNeverPolicies(a, b).hash, mergeNeverPolicies(b, a).hash);
|
|
93
|
+
assert.equal(mergeNeverPolicies(union, policy()).hash, union.hash);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test("checkpoint durably keeps add approve remove launch and rejects malformed reload without loss", () => {
|
|
97
|
+
const home = scratch(); const old = { RELAY_HOME: process.env.RELAY_HOME, RELAY_CONFIG: process.env.RELAY_CONFIG };
|
|
98
|
+
try {
|
|
99
|
+
process.env.RELAY_HOME = path.join(home, "registry"); process.env.RELAY_CONFIG = path.join(home, "config.json");
|
|
100
|
+
fs.writeFileSync(process.env.RELAY_CONFIG, "{}");
|
|
101
|
+
const run = createRun(home, withDefaults({}), "test-root");
|
|
102
|
+
fs.writeFileSync(process.env.RELAY_CONFIG, JSON.stringify({ never: { hosts: ["a.example"] } }));
|
|
103
|
+
const a = checkpointNever(run, "approval");
|
|
104
|
+
fs.writeFileSync(process.env.RELAY_CONFIG, JSON.stringify({ never: { hosts: ["b.example"] } }));
|
|
105
|
+
checkpointNever(run, "approval");
|
|
106
|
+
fs.writeFileSync(process.env.RELAY_CONFIG, "{}");
|
|
107
|
+
closeDbForTests();
|
|
108
|
+
const launch = checkpointNever(run, "launch");
|
|
109
|
+
assert.deepEqual(launch.hosts.map(h => h.host), ["a.example", "b.example"]);
|
|
110
|
+
assert.notEqual(a.hash, launch.hash);
|
|
111
|
+
fs.writeFileSync(process.env.RELAY_CONFIG, "{ malformed");
|
|
112
|
+
assert.throws(() => checkpointNever(run, "approval"), /config/);
|
|
113
|
+
assert.equal(readNeverFloor(run)!.hash, launch.hash);
|
|
114
|
+
fs.unlinkSync(process.env.RELAY_CONFIG);
|
|
115
|
+
assert.throws(() => checkpointNever(run, "launch"), /config/);
|
|
116
|
+
} finally {
|
|
117
|
+
closeDbForTests();
|
|
118
|
+
for (const [k, v] of Object.entries(old)) if (v === undefined) delete process.env[k]; else process.env[k] = v;
|
|
119
|
+
fs.rmSync(home, { recursive: true, force: true });
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("built-ins include exact service ports, whole Codex home, X1 and immutable authority", () => {
|
|
124
|
+
const f = fixture();
|
|
125
|
+
try {
|
|
126
|
+
const p = resolveNeverPolicy({ codexHome: path.join(f.home, "configured-codex") });
|
|
127
|
+
assert.deepEqual(p.ports.map(x => x.port).sort((a, b) => a - b), [22, 5900]);
|
|
128
|
+
assert.deepEqual(p.ports.map(x => x.id).sort(), ["service.screen-sharing", "service.sshd"], "generic macOS services only");
|
|
129
|
+
for (const suffix of [".ssh", ".aws", ".gnupg", ".netrc", ".codex/auth.json", ".local/share/relay-codex-home/any-file"]) assert.ok(neverPathProblem(p, path.join(os.homedir(), suffix), "read"), suffix);
|
|
130
|
+
assert.ok(neverPathProblem(p, path.join(f.home, "configured-codex/any-file"), "read"));
|
|
131
|
+
assert.equal(neverPathProblem(p, process.execPath, "read"), null, "X1 remains write-only");
|
|
132
|
+
assert.ok(neverPathProblem(p, process.execPath, "write"));
|
|
133
|
+
const removed = resolveNeverPolicy({ never: { override_builtin: [{ id: "service.sshd", acknowledge: "REMOVE BUILT-IN NEVER service.sshd", reason: "decoy policy test" }] } });
|
|
134
|
+
assert.equal(removed.ports.some(x => x.id === "service.sshd"), false);
|
|
135
|
+
assert.ok(mergeNeverPolicies(p, removed).ports.some(x => x.id === "service.sshd"), "a new override cannot shrink a running floor");
|
|
136
|
+
} finally { f.close(); }
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test("an override of a retired built-in (1.2.1) is still accepted, removes nothing and is warned about", () => {
|
|
140
|
+
const f = fixture();
|
|
141
|
+
try {
|
|
142
|
+
const plain = resolveNeverPolicy({});
|
|
143
|
+
for (const id of NEVER_RETIRED_BUILTIN_IDS) {
|
|
144
|
+
const override_builtin = [{ id, acknowledge: `REMOVE BUILT-IN NEVER ${id}`, reason: "kept from an earlier config" }];
|
|
145
|
+
const p = resolveNeverPolicy({ never: { override_builtin } });
|
|
146
|
+
assert.deepEqual(p.removed, [], "nothing was removed, so nothing is reported removed");
|
|
147
|
+
assert.equal(p.hash, plain.hash, "the floor is the one without the override");
|
|
148
|
+
const warnings = configDeprecations({ never: { override_builtin } } as never);
|
|
149
|
+
assert.equal(warnings.length, 1);
|
|
150
|
+
assert.match(warnings[0], new RegExp(`${id.replace(".", "\\.")}, which is no longer a built-in never entry .*removes nothing.*never\\.ports.*this-machine.*throughout relay 1\\.x`));
|
|
151
|
+
assert.doesNotMatch(warnings[0], /NEVER PROTECTION REMOVED/);
|
|
152
|
+
assert.throws(() => NeverConfigSchema.parse({ override_builtin: [{ ...override_builtin[0], acknowledge: "REMOVE BUILT-IN NEVER service.sshd" }] }), /acknowledgment/);
|
|
153
|
+
}
|
|
154
|
+
assert.throws(() => NeverConfigSchema.parse({ override_builtin: [{ id: "service.unknown", acknowledge: "REMOVE BUILT-IN NEVER service.unknown", reason: "x" }] }));
|
|
155
|
+
} finally { f.close(); }
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("grant admission rechecks kept raw grants and outside writes against current cumulative policy", () => {
|
|
159
|
+
const f = fixture(nonTempScratch("relay-never-grant-"));
|
|
160
|
+
try {
|
|
161
|
+
fs.mkdirSync(path.join(f.home, "forbidden"));
|
|
162
|
+
f.write({ hosts: ["secret.example"], paths: [{ path: path.join(f.home, "forbidden") }] });
|
|
163
|
+
const caller: any = { runId: f.run };
|
|
164
|
+
const raw = admitWork(caller, "codex", { mode: "write", kept: { network: true, raw_network: true }, continues: true }, {});
|
|
165
|
+
assert.match((raw as any).reason, /never.hosts/);
|
|
166
|
+
const write = admitWork(caller, "claude", { mode: "write", kept: { write_paths: [path.join(f.home, "forbidden")] }, continues: true }, {});
|
|
167
|
+
assert.match((write as any).reason, /user.path/);
|
|
168
|
+
f.write({});
|
|
169
|
+
assert.match((admitWork(caller, "codex", { mode: "write", kept: { network: true, raw_network: true }, continues: true }, {}) as any).reason, /never.hosts/);
|
|
170
|
+
} finally {
|
|
171
|
+
f.close();
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("file requests refuse before prompting; stale decisions expire and retain newly observed additions", async () => {
|
|
176
|
+
const f = fixture();
|
|
177
|
+
try {
|
|
178
|
+
const node = insertNode({ id: "j_00000001", run_id: f.run, kind: "job", target: "codex", mode: "write", depth: 1, task: "decoy", cwd: f.home, status: "running" });
|
|
179
|
+
const turn = insertTurn(node.id, "test", "", "write", "running");
|
|
180
|
+
f.write({ paths: [{ path: path.join(f.home, "secret") }] });
|
|
181
|
+
const blocked = await requestApproval(node.id, turn, { kind: "file", summary: "decoy", paths: [path.join(f.home, "secret/file")] });
|
|
182
|
+
assert.equal(blocked.allow, false); assert.match(blocked.note!, /user.path/);
|
|
183
|
+
assert.equal((db().prepare("SELECT COUNT(*) AS n FROM requests").get() as any).n, 0);
|
|
184
|
+
const before = checkpointNever(f.run, "approval");
|
|
185
|
+
db().prepare("INSERT INTO requests (id, run_id, node_id, turn_id, kind, summary, detail_json, status, created_at) VALUES ('q_00000001', ?, ?, ?, 'command', 'decoy', ?, 'pending', ?)").run(f.run, node.id, turn, JSON.stringify({ never_hash: before.hash }), Date.now());
|
|
186
|
+
f.write({ hosts: ["new.example"] });
|
|
187
|
+
assert.match(String(decide("q_00000001", true, "user").error), /stale never policy hash/);
|
|
188
|
+
assert.equal(getRequest("q_00000001")!.status, "expired");
|
|
189
|
+
assert.ok(readNeverFloor(f.run)!.hosts.some(h => h.host === "new.example"));
|
|
190
|
+
assert.ok(neverApprovalProblem(readNeverFloor(f.run)!, "web", [], f.home));
|
|
191
|
+
assert.ok(neverApprovalProblem(readNeverFloor(f.run)!, "raw_network", [], f.home));
|
|
192
|
+
} finally { f.close(); }
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test("an address the Mac gains while a person decides keeps their answer, joins the floor, and is refused from then on", async () => {
|
|
196
|
+
const f = fixture();
|
|
197
|
+
const real = os.networkInterfaces;
|
|
198
|
+
try {
|
|
199
|
+
const node = insertNode({ id: "j_00000001", run_id: f.run, kind: "job", target: "codex", mode: "write", depth: 1, task: "decoy", cwd: f.home, status: "running" });
|
|
200
|
+
const turn = insertTurn(node.id, "test", "", "write", "running");
|
|
201
|
+
const before = checkpointNever(f.run, "approval");
|
|
202
|
+
db().prepare("INSERT INTO requests (id, run_id, node_id, turn_id, kind, summary, detail_json, status, created_at) VALUES ('q_00000001', ?, ?, ?, 'command', 'decoy', ?, 'pending', ?)").run(f.run, node.id, turn, JSON.stringify({ never_hash: before.hash, never_version: before.version, never_removed: before.removed }), Date.now());
|
|
203
|
+
// AirDrop's awdl0 and llw0 come and go by themselves, with a link-local address.
|
|
204
|
+
const added = "fe80::2:3:4:5";
|
|
205
|
+
(os as any).networkInterfaces = () => ({ ...real(), awdl0: [{ address: `${added}%awdl0`, netmask: "ffff:ffff:ffff:ffff::", family: "IPv6", mac: "00:00:00:00:00:00", internal: false, cidr: `${added}/64`, scopeid: 20 }] });
|
|
206
|
+
assert.equal(decide("q_00000001", true, "user").error, undefined);
|
|
207
|
+
assert.equal(getRequest("q_00000001")!.status, "allowed");
|
|
208
|
+
const after = readNeverFloor(f.run)!;
|
|
209
|
+
assert.equal(after.hash, before.hash, "the hash stands for what the person was asked against, not the Mac's addresses");
|
|
210
|
+
assert.ok(after.localAddresses.includes(added), "still observed, and kept");
|
|
211
|
+
assert.deepEqual(assertNeverCurrent(f.run, before.hash).localAddresses, after.localAddresses);
|
|
212
|
+
(os as any).networkInterfaces = real;
|
|
213
|
+
assert.ok(checkpointNever(f.run, "approval").localAddresses.includes(added), "an address that went away stays in the floor");
|
|
214
|
+
const port = after.authorityPorts[0];
|
|
215
|
+
assert.match(String(neverEndpointProblem(after, { host: added, port, transport: "tcp" })), /relay.authority/);
|
|
216
|
+
} finally { (os as any).networkInterfaces = real; f.close(); }
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test("a launch whose proxy would miss a routable address the floor gained is refused; a rotating link-local one is not", async () => {
|
|
220
|
+
const f = fixture();
|
|
221
|
+
const real = os.networkInterfaces;
|
|
222
|
+
const gain = (address: string, family: string) => { (os as any).networkInterfaces = () => ({ ...real(), en9: [{ address, netmask: "255.255.255.255", family, mac: "00:00:00:00:00:00", internal: false, cidr: `${address}/32` }] }); };
|
|
223
|
+
try {
|
|
224
|
+
const captured = checkpointNever(f.run, "launch");
|
|
225
|
+
assert.doesNotThrow(() => assertNeverLaunchCurrent(f.run, captured));
|
|
226
|
+
for (const rotating of ["fe80::2:3:4:5", "169.254.7.8"]) {
|
|
227
|
+
gain(rotating, rotating.includes(":") ? "IPv6" : "IPv4");
|
|
228
|
+
assert.ok(checkpointNever(f.run, "launch").localAddresses.includes(rotating));
|
|
229
|
+
assert.doesNotThrow(() => assertNeverLaunchCurrent(f.run, captured), rotating);
|
|
230
|
+
}
|
|
231
|
+
gain("203.0.113.9", "IPv4");
|
|
232
|
+
checkpointNever(f.run, "launch");
|
|
233
|
+
(os as any).networkInterfaces = real;
|
|
234
|
+
assert.equal(readNeverFloor(f.run)!.hash, captured.hash, "the person's answer still stands");
|
|
235
|
+
assert.throws(() => assertNeverLaunchCurrent(f.run, captured), /203\.0\.113\.9/, "gone again, but in the floor: the captured proxy would permit it");
|
|
236
|
+
assert.doesNotThrow(() => assertNeverLaunchCurrent(f.run, checkpointNever(f.run, "launch")), "a plan rebuilt on the current floor launches");
|
|
237
|
+
} finally { (os as any).networkInterfaces = real; f.close(); }
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
test("built-in file refusals keep relay's person-facing reason while the cumulative floor remains enforced", async () => {
|
|
241
|
+
const f = fixture();
|
|
242
|
+
try {
|
|
243
|
+
const node = insertNode({ id: "j_00000001", run_id: f.run, kind: "job", target: "claude", mode: "write", depth: 1, task: "decoy", cwd: f.home, status: "running" });
|
|
244
|
+
const turn = insertTurn(node.id, "test", "", "write", "running");
|
|
245
|
+
for (const [name, reason] of [
|
|
246
|
+
[path.join(process.env.RELAY_HOME!, "relay.db"), /inside relay's own directories, which no job may change/],
|
|
247
|
+
[path.join(os.homedir(), ".config/relay-keys/gemini-api-key"), /overlaps the directory of relay's API keys .*which no job may change/],
|
|
248
|
+
] as const) {
|
|
249
|
+
const answer = await requestApproval(node.id, turn, { kind: "file", summary: "decoy", paths: [name] });
|
|
250
|
+
assert.equal(answer.allow, false); assert.match(answer.note!, reason);
|
|
251
|
+
}
|
|
252
|
+
const reached = await requestApproval(node.id, turn, { kind: "path", summary: "decoy", paths: [process.env.RELAY_HOME!], detail: { access: "read" } });
|
|
253
|
+
assert.equal(reached.allow, false); assert.match(reached.note!, /no approval lets a job reach/);
|
|
254
|
+
assert.equal((db().prepare("SELECT COUNT(*) AS n FROM requests").get() as any).n, 0);
|
|
255
|
+
} finally { f.close(); }
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test("concurrent processes atomically merge independently observed additions", async () => {
|
|
259
|
+
const f = fixture();
|
|
260
|
+
try {
|
|
261
|
+
checkpointNever(f.run, "approval"); closeDbForTests();
|
|
262
|
+
const module = new URL("../dist/core/never-checkpoint.js", import.meta.url).href;
|
|
263
|
+
const script = `import { checkpointNever } from ${JSON.stringify(module)}; checkpointNever(process.argv[1], "launch");`;
|
|
264
|
+
const files = ["a", "b", "c"].map(n => { const file = path.join(f.home, `${n}.json`); fs.writeFileSync(file, JSON.stringify({ never: { hosts: [`${n}.example`] } })); return file; });
|
|
265
|
+
await Promise.all(files.map(file => new Promise<void>((resolve, reject) => {
|
|
266
|
+
const child = spawn(process.execPath, ["--input-type=module", "-e", script, f.run], { env: { ...process.env, RELAY_CONFIG: file }, stdio: ["ignore", "ignore", "pipe"] });
|
|
267
|
+
let error = ""; child.stderr.on("data", data => error += data); child.on("error", reject); child.on("exit", code => code === 0 ? resolve() : reject(new Error(error)));
|
|
268
|
+
})));
|
|
269
|
+
assert.deepEqual(readNeverFloor(f.run)!.hosts.map(h => h.host), ["a.example", "b.example", "c.example"]);
|
|
270
|
+
} finally { f.close(); }
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
test("checkpoint identity history retains both targets after protected symlink replacement", () => {
|
|
274
|
+
const f = fixture();
|
|
275
|
+
try {
|
|
276
|
+
const named = path.join(f.home, "named"); const a = path.join(f.home, "a"); const b = path.join(f.home, "b");
|
|
277
|
+
fs.mkdirSync(a); fs.mkdirSync(b); fs.symlinkSync(a, named);
|
|
278
|
+
f.write({ paths: [{ path: named }, { path: path.join(f.home, "future/secret") }] });
|
|
279
|
+
const before = checkpointNever(f.run, "approval");
|
|
280
|
+
fs.unlinkSync(named); fs.symlinkSync(b, named);
|
|
281
|
+
fs.mkdirSync(path.join(f.home, "future"));
|
|
282
|
+
assert.ok(neverIdentityProblem(before), "unobserved namespace change invalidates the captured plan");
|
|
283
|
+
const after = checkpointNever(f.run, "launch");
|
|
284
|
+
assert.notEqual(after.hash, before.hash);
|
|
285
|
+
assert.equal(neverIdentityProblem(after), null, "new checkpoint preserves history and current identities");
|
|
286
|
+
for (const target of [a, b]) assert.ok(neverPathProblem(after, path.join(target, "file"), "read"), target);
|
|
287
|
+
f.write({});
|
|
288
|
+
assert.ok(neverPathProblem(checkpointNever(f.run, "launch"), path.join(a, "file"), "read"));
|
|
289
|
+
} finally { f.close(); }
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
test("schema 4 stores the run floor in JSON params without migration and reconstructs old runs", () => {
|
|
293
|
+
const f = fixture();
|
|
294
|
+
try {
|
|
295
|
+
const file = path.join(process.env.RELAY_HOME!, "relay.db"); closeDbForTests();
|
|
296
|
+
const old = new DatabaseSync(file);
|
|
297
|
+
assert.equal((old.prepare("PRAGMA user_version").get() as any).user_version, 4);
|
|
298
|
+
assert.equal(old.prepare("PRAGMA table_info(runs)").all().some((c: any) => c.name === "never_floor_json"), false);
|
|
299
|
+
// An existing schema-4 run has no private params yet. Reopening must not migrate it.
|
|
300
|
+
old.prepare("UPDATE runs SET config_json = json_remove(config_json, '$.params_json') WHERE id = ?").run(f.run);
|
|
301
|
+
old.close();
|
|
302
|
+
db();
|
|
303
|
+
assert.equal(registryBackup(), null);
|
|
304
|
+
assert.equal((db().prepare("PRAGMA user_version").get() as any).user_version, 4);
|
|
305
|
+
db().prepare("UPDATE runs SET config_json = json_set(config_json, '$.params_json.unrelated', 7) WHERE id = ?").run(f.run);
|
|
306
|
+
const config = runConfig(f.run);
|
|
307
|
+
assert.equal("params_json" in config, false, "private run params are not configuration");
|
|
308
|
+
assert.ok(checkpointNever(f.run, "launch").hash);
|
|
309
|
+
assert.equal(JSON.parse(getRun(f.run)!.config_json).params_json.unrelated, 7);
|
|
310
|
+
assert.deepEqual(runConfig(f.run), config, "floor updates preserve the configuration snapshot");
|
|
311
|
+
db().prepare("UPDATE runs SET config_json = json_set(config_json, '$.params_json.never_floor', 'malformed') WHERE id = ?").run(f.run);
|
|
312
|
+
assert.throws(() => checkpointNever(f.run, "approval"));
|
|
313
|
+
assert.equal(JSON.parse(getRun(f.run)!.config_json).params_json.never_floor, "malformed");
|
|
314
|
+
} finally { f.close(); }
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
test("relay-managed roots may appear or be recreated without invalidating a launch snapshot", () => {
|
|
318
|
+
const savedHome = process.env.HOME; const home = scratch();
|
|
319
|
+
process.env.HOME = home;
|
|
320
|
+
const f = fixture();
|
|
321
|
+
const aliases = path.join(home, "aliases"); fs.mkdirSync(aliases);
|
|
322
|
+
setNativeTempAliasParentForTests(aliases);
|
|
323
|
+
try {
|
|
324
|
+
const before = checkpointNever(f.run, "launch");
|
|
325
|
+
for (const root of [nativeTempRoot(), privateStateRoot(), worktreesHome(), harnessHome()]) {
|
|
326
|
+
fs.mkdirSync(root, { recursive: true });
|
|
327
|
+
fs.mkdirSync(path.join(root, "first-turn"));
|
|
328
|
+
assert.doesNotThrow(() => assertNeverCurrent(f.run, before.hash), root);
|
|
329
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
330
|
+
fs.mkdirSync(root, { recursive: true });
|
|
331
|
+
fs.mkdirSync(path.join(root, "next-turn"));
|
|
332
|
+
assert.doesNotThrow(() => assertNeverCurrent(f.run, before.hash), `${root} recreated`);
|
|
333
|
+
assert.ok(neverPathProblem(before, path.join(root, "private-state"), "write"), "name/containment protection remains");
|
|
334
|
+
}
|
|
335
|
+
fs.symlinkSync(nativeTempRoot(), nativeTempAlias());
|
|
336
|
+
assert.doesNotThrow(() => assertNeverCurrent(f.run, before.hash));
|
|
337
|
+
fs.unlinkSync(nativeTempAlias()); fs.symlinkSync(nativeTempRoot(), nativeTempAlias());
|
|
338
|
+
assert.doesNotThrow(() => assertNeverCurrent(f.run, before.hash));
|
|
339
|
+
assert.equal(checkpointNever(f.run, "launch").hash, before.hash, "ordinary state creation adds no authority inode identities");
|
|
340
|
+
} finally {
|
|
341
|
+
setNativeTempAliasParentForTests(null); f.close();
|
|
342
|
+
if (savedHome === undefined) delete process.env.HOME; else process.env.HOME = savedHome;
|
|
343
|
+
fs.rmSync(home, { recursive: true, force: true });
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
test("Codex home bootstrap precedes launch snapshots and repeated preparation cannot invalidate sibling launches", () => {
|
|
348
|
+
const savedHome = process.env.HOME; const home = scratch(); process.env.HOME = home;
|
|
349
|
+
const f = fixture();
|
|
350
|
+
try {
|
|
351
|
+
const cfg = runConfig(f.run);
|
|
352
|
+
const beforeBootstrap = checkpointNever(f.run, "launch");
|
|
353
|
+
const codexHome = prepareCodexHome(cfg);
|
|
354
|
+
const firstLaunch = checkpointNever(f.run, "launch");
|
|
355
|
+
assert.notEqual(firstLaunch.hash, beforeBootstrap.hash, "new credential-home identities must enter the durable floor");
|
|
356
|
+
assert.ok(firstLaunch.paths.some(entry => entry.path === codexHome && entry.pins.some(pin => pin.path === codexHome)));
|
|
357
|
+
for (let sibling = 0; sibling < 3; sibling++) {
|
|
358
|
+
prepareCodexHome(cfg);
|
|
359
|
+
assert.equal(checkpointNever(f.run, "launch").hash, firstLaunch.hash);
|
|
360
|
+
assert.doesNotThrow(() => assertNeverCurrent(f.run, firstLaunch.hash));
|
|
361
|
+
}
|
|
362
|
+
fs.renameSync(codexHome, `${codexHome}-replaced`); fs.mkdirSync(codexHome);
|
|
363
|
+
assert.throws(() => assertNeverCurrent(f.run, firstLaunch.hash), /identity changed/, "bootstrap ordering must not weaken identity checks");
|
|
364
|
+
} finally {
|
|
365
|
+
f.close(); if (savedHome === undefined) delete process.env.HOME; else process.env.HOME = savedHome;
|
|
366
|
+
fs.rmSync(home, { recursive: true, force: true });
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
test("grant hard-link screen considers all authorized roots while outside and immutable metadata links still refuse", () => {
|
|
371
|
+
const f = fixture(nonTempScratch("relay-never-hardlinks-"));
|
|
372
|
+
try {
|
|
373
|
+
const worktree = path.join(f.home, "worktree"), grant = path.join(f.home, "grant"), second = path.join(f.home, "second");
|
|
374
|
+
for (const root of [worktree, grant, second]) fs.mkdirSync(root);
|
|
375
|
+
fs.writeFileSync(path.join(worktree, "file"), "decoy");
|
|
376
|
+
fs.linkSync(path.join(worktree, "file"), path.join(grant, "file"));
|
|
377
|
+
const p = checkpointNever(f.run, "grant");
|
|
378
|
+
const given = { write_paths: [grant] };
|
|
379
|
+
assert.match(neverGrantProblem(p, given)!, /outside hard link/, "a new job cannot treat another job's tree as writable");
|
|
380
|
+
assert.equal(neverGrantProblem(p, given, [worktree]), null, "a resumed job may link between its own writable roots");
|
|
381
|
+
fs.writeFileSync(path.join(grant, "shared"), "decoy"); fs.linkSync(path.join(grant, "shared"), path.join(second, "shared"));
|
|
382
|
+
assert.equal(neverGrantProblem(p, { write_paths: [grant, second] }, [worktree]), null, "two granted roots are one writable set");
|
|
383
|
+
const caller = { runId: f.run, node: null, depth: 0, cwd: f.home, access: "write" as const };
|
|
384
|
+
assert.ok(!("reason" in admitWork(caller, "claude", { mode: "write", grant: { write_paths: [grant, second] }, continues: true, worktree }, {})), "resume admission passes its existing worktree to the shared screen");
|
|
385
|
+
const outside = path.join(f.home, "outside"); fs.writeFileSync(outside, "decoy");
|
|
386
|
+
fs.linkSync(outside, path.join(second, "outside"));
|
|
387
|
+
assert.match(neverGrantProblem(p, { write_paths: [grant, second] }, [worktree])!, /outside hard link/);
|
|
388
|
+
fs.unlinkSync(path.join(second, "outside"));
|
|
389
|
+
for (const metadata of [".git", ".relay"]) {
|
|
390
|
+
fs.mkdirSync(path.join(worktree, metadata)); fs.writeFileSync(path.join(worktree, metadata, "authority"), "decoy");
|
|
391
|
+
fs.linkSync(path.join(worktree, metadata, "authority"), path.join(grant, "alias"));
|
|
392
|
+
assert.match(neverGrantProblem(p, { write_paths: [grant, second] }, [worktree])!, /outside hard link/, metadata);
|
|
393
|
+
fs.unlinkSync(path.join(grant, "alias"));
|
|
394
|
+
}
|
|
395
|
+
fs.writeFileSync(path.join(grant, ".mcp.json"), "{}");
|
|
396
|
+
fs.linkSync(path.join(grant, ".mcp.json"), path.join(second, "config-alias"));
|
|
397
|
+
assert.match(neverGrantProblem(p, { write_paths: [grant, second] }, [worktree])!, /outside hard link/, "protected harness config stays immutable across writable roots");
|
|
398
|
+
fs.unlinkSync(path.join(second, "config-alias"));
|
|
399
|
+
} finally { f.close(); }
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
test("stale native temp alias repair keeps the launch checkpoint and denies grants and never writes by both names", () => {
|
|
403
|
+
const savedHome = process.env.HOME; const home = nonTempScratch("relay-never-alias-"); process.env.HOME = home;
|
|
404
|
+
const f = fixture(nonTempScratch("relay-never-registry-"));
|
|
405
|
+
const parent = path.join(home, "aliases"); fs.mkdirSync(parent);
|
|
406
|
+
setNativeTempAliasParentForTests(parent);
|
|
407
|
+
try {
|
|
408
|
+
const oldRoot = path.join(home, "deleted-home", ".rn");
|
|
409
|
+
fs.symlinkSync(oldRoot, nativeTempAlias());
|
|
410
|
+
fs.mkdirSync(nativeTempRoot(), { mode: 0o700 });
|
|
411
|
+
assert.equal(checkNativeTempAlias(nativeTempRoot()).state, "stale", "exercise repair of an owned link through canonical, trusted ancestors");
|
|
412
|
+
const before = checkpointNever(f.run, "launch");
|
|
413
|
+
const checkDenied = () => {
|
|
414
|
+
for (const name of [parent, nativeTempAlias(), path.join(nativeTempAlias(), "Ab12Cd"), nativeTempRoot()]) {
|
|
415
|
+
assert.ok(neverPathProblem(before, name, "write", true), name);
|
|
416
|
+
assert.ok(neverGrantProblem(before, { write_paths: [name] }), name);
|
|
417
|
+
const admission = admitWork({ runId: f.run, node: null } as any, "claude", {
|
|
418
|
+
mode: "write", grant: { write_paths: [name] }, continues: false,
|
|
419
|
+
}, {}) as { reason: string };
|
|
420
|
+
assert.match(admission.reason, /short link|private temporary state|never relay.authority|not an existing directory/, name);
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
checkDenied();
|
|
424
|
+
ensureNativeTempAlias(nativeTempRoot());
|
|
425
|
+
assert.equal(fs.readlinkSync(nativeTempAlias()), nativeTempRoot());
|
|
426
|
+
assert.doesNotThrow(() => assertNeverCurrent(f.run, before.hash));
|
|
427
|
+
assert.equal(checkpointNever(f.run, "launch").hash, before.hash);
|
|
428
|
+
checkDenied();
|
|
429
|
+
assert.equal(fs.existsSync(oldRoot), false);
|
|
430
|
+
} finally {
|
|
431
|
+
setNativeTempAliasParentForTests(null); f.close();
|
|
432
|
+
if (savedHome === undefined) delete process.env.HOME; else process.env.HOME = savedHome;
|
|
433
|
+
fs.rmSync(home, { recursive: true, force: true });
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
test("missing protected names may be created while existing protected objects still detect replacement", () => {
|
|
438
|
+
const home = scratch();
|
|
439
|
+
try {
|
|
440
|
+
const file = path.join(home, "file"); const dir = path.join(home, "dir");
|
|
441
|
+
fs.writeFileSync(file, "decoy"); fs.mkdirSync(dir);
|
|
442
|
+
const p = policy({ paths: [{ path: file }, { path: dir }, { path: path.join(home, "new/secret") }] });
|
|
443
|
+
fs.mkdirSync(path.join(home, "new")); fs.writeFileSync(path.join(home, "new/secret"), "decoy");
|
|
444
|
+
assert.equal(neverIdentityProblem(p), null, "creation at a never name remains protected by name");
|
|
445
|
+
fs.renameSync(file, path.join(home, "old-file")); fs.writeFileSync(file, "replacement");
|
|
446
|
+
assert.match(neverIdentityProblem(p)!, /identity changed/);
|
|
447
|
+
const refreshed = policy({ paths: [{ path: file }, { path: dir }] });
|
|
448
|
+
fs.renameSync(dir, path.join(home, "old-dir")); fs.mkdirSync(dir);
|
|
449
|
+
assert.match(neverIdentityProblem(refreshed)!, /identity changed/);
|
|
450
|
+
} finally { fs.rmSync(home, { recursive: true, force: true }); }
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
for (const change of ["pin-store", "pin-store-child", "pin-store-parent", "replaced", "removed", "repointed"] as const) test(`protected package installation ${change}: checkpoints refresh ordinary installs but keep sealed pins`, (t) => {
|
|
454
|
+
// Exercise the synthetic installation independently of the host's CLIs and system keychain.
|
|
455
|
+
const savedPath = process.env.PATH;
|
|
456
|
+
const savedHome = process.env.HOME;
|
|
457
|
+
t.after(() => {
|
|
458
|
+
if (savedPath === undefined) delete process.env.PATH; else process.env.PATH = savedPath;
|
|
459
|
+
if (savedHome === undefined) delete process.env.HOME; else process.env.HOME = savedHome;
|
|
460
|
+
});
|
|
461
|
+
process.env.PATH = "/usr/bin:/bin";
|
|
462
|
+
const home = scratch(); process.env.HOME = home;
|
|
463
|
+
closeDbForTests();
|
|
464
|
+
const f = fixture(home, withDefaults({ ask_user: "never", allow_temp_home: true, never: { override_builtin: [{
|
|
465
|
+
id: "credentials.keychain", acknowledge: "REMOVE BUILT-IN NEVER credentials.keychain", reason: "installation identity fixture",
|
|
466
|
+
}] } }));
|
|
467
|
+
try {
|
|
468
|
+
// Model a stable CLI name pointing into a sealed pin or a versioned Caskroom installation.
|
|
469
|
+
const bin = path.join(f.home, "bin"); fs.mkdirSync(bin);
|
|
470
|
+
const store = path.join(f.home, ".local/share/relay-codex-pins");
|
|
471
|
+
const sealed = change === "pin-store" || change === "pin-store-child";
|
|
472
|
+
const install = change === "pin-store" ? store : change.startsWith("pin-store-") ? path.join(store, "versions/0.164.0") : path.join(f.home, "Caskroom/codex/0.164.0");
|
|
473
|
+
const cli = path.join(bin, "codex");
|
|
474
|
+
const putCLI = (dir: string) => {
|
|
475
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
476
|
+
fs.writeFileSync(path.join(dir, "codex"), "#!/bin/sh\nexit 0\n", { mode: 0o755 });
|
|
477
|
+
};
|
|
478
|
+
putCLI(install); fs.symlinkSync(path.join(install, "codex"), cli);
|
|
479
|
+
const config = withDefaults({ ...runConfig(f.run), targets: { codex: { bin: cli } } });
|
|
480
|
+
fs.writeFileSync(process.env.RELAY_CONFIG!, JSON.stringify(config));
|
|
481
|
+
const run = createRun(f.home, config, "before-upgrade");
|
|
482
|
+
const before = checkpointNever(run, "launch");
|
|
483
|
+
const original = before.paths.filter(p => p.id === "relay.install").flatMap(p => p.pins).find(p => p.path === install)!;
|
|
484
|
+
assert.ok(original, "the resolved CLI installation is identity-pinned");
|
|
485
|
+
assert.ok(before.paths.some(p => p.id === "relay.install" && p.path === store && p.what === "relay's pinned Codex installation"));
|
|
486
|
+
assert.ok(relayWriteProtected().some(p => p.path === cli));
|
|
487
|
+
assert.ok(relayWriteProtected().some(p => p.path === path.join(install, "codex")));
|
|
488
|
+
assert.equal(relayCodexProtected(config).stores.some(p => p.path === install), change === "pin-store");
|
|
489
|
+
assert.equal(relayPathDirs(bin).includes(install), false);
|
|
490
|
+
assert.equal(neverIdentityProblem(before), null);
|
|
491
|
+
|
|
492
|
+
const current = change === "removed" || change === "repointed" ? path.join(f.home, "Caskroom/codex/0.166.0") : install;
|
|
493
|
+
let changedPath = install;
|
|
494
|
+
if (change === "pin-store-parent") {
|
|
495
|
+
// Replace only an ancestor, preserving the store and every object underneath it.
|
|
496
|
+
changedPath = path.dirname(store);
|
|
497
|
+
const oldParent = path.join(f.home, "old-parent");
|
|
498
|
+
fs.renameSync(changedPath, oldParent); fs.mkdirSync(changedPath);
|
|
499
|
+
fs.renameSync(path.join(oldParent, path.basename(store)), store);
|
|
500
|
+
} else {
|
|
501
|
+
// Keep old inodes alive so the filesystem cannot reuse them for the replacement.
|
|
502
|
+
if (change !== "repointed") fs.renameSync(install, path.join(f.home, "old-install"));
|
|
503
|
+
putCLI(current);
|
|
504
|
+
}
|
|
505
|
+
if (change === "removed" || change === "repointed") {
|
|
506
|
+
fs.unlinkSync(cli); fs.symlinkSync(path.join(current, "codex"), cli);
|
|
507
|
+
if (change === "repointed") changedPath = cli;
|
|
508
|
+
}
|
|
509
|
+
const expected = `never relay.install: protected path identity ${change === "removed" ? "is unavailable" : "changed"} at ${changedPath}; it may have been replaced by a package-manager upgrade. Ask the person to start a fresh relay run (cancel this run, restart relay's MCP server for a per-session connection, or use a new session for a shared server), then start new work. Retrying, resuming or adopting this run does not create a fresh run.`;
|
|
510
|
+
assert.equal(neverIdentityProblem(before), expected);
|
|
511
|
+
assert.throws(() => assertNeverCurrent(run, before.hash), { message: expected });
|
|
512
|
+
const retried = checkpointNever(run, "launch");
|
|
513
|
+
const afterCheckpoint = sealed || change === "removed" ? expected : null;
|
|
514
|
+
assert.equal(neverIdentityProblem(retried), afterCheckpoint, "only sealed pins reject observed replacements; vanished ordinary paths still refuse");
|
|
515
|
+
if (afterCheckpoint) assert.throws(() => assertNeverCurrent(run, retried.hash), { message: expected });
|
|
516
|
+
else assert.doesNotThrow(() => assertNeverCurrent(run, retried.hash));
|
|
517
|
+
closeDbForTests();
|
|
518
|
+
assert.equal(neverIdentityProblem(readNeverFloor(run)!), afterCheckpoint, "reopening the registry preserves the checkpoint result");
|
|
519
|
+
|
|
520
|
+
const freshRun = createRun(f.home, config, "after-person-restart");
|
|
521
|
+
const fresh = checkpointNever(freshRun, "launch");
|
|
522
|
+
assert.equal(neverIdentityProblem(fresh), null);
|
|
523
|
+
const replacement = fresh.paths.filter(p => p.id === "relay.install").flatMap(p => p.pins).find(p => p.path === current)!;
|
|
524
|
+
assert.equal(replacement.ino, fs.lstatSync(current).ino);
|
|
525
|
+
if (change !== "pin-store-parent") assert.notEqual(replacement.ino, original.ino);
|
|
526
|
+
else assert.equal(replacement.ino, original.ino, "replacing the ancestor preserved the sealed installation");
|
|
527
|
+
assert.ok(neverPathProblem(fresh, path.join(current, "file"), "write"), "the fresh run still denies writes to the replacement");
|
|
528
|
+
assert.doesNotThrow(() => assertNeverCurrent(freshRun, fresh.hash));
|
|
529
|
+
assert.equal(neverIdentityProblem(readNeverFloor(run)!), afterCheckpoint, "the new run does not alter the old run's checkpoint");
|
|
530
|
+
} finally { f.close(); }
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
test("successive native temp launches pass the checkpoint and clean up their own directories", async () => {
|
|
534
|
+
const savedHome = process.env.HOME; const home = scratch(); process.env.HOME = home;
|
|
535
|
+
const f = fixture();
|
|
536
|
+
try {
|
|
537
|
+
const policy = checkpointNever(f.run, "launch");
|
|
538
|
+
const seen: string[] = [];
|
|
539
|
+
for (let turn = 0; turn < 3; turn++) {
|
|
540
|
+
const handle = await nativeTemp({ target: { id: "codex" } } as never, async (dir) => {
|
|
541
|
+
seen.push(dir);
|
|
542
|
+
assert.doesNotThrow(() => assertNeverCurrent(f.run, policy.hash));
|
|
543
|
+
return { done: Promise.resolve({ text: "decoy" }), cancel: async () => {} } as never;
|
|
544
|
+
});
|
|
545
|
+
await handle.done;
|
|
546
|
+
assert.equal(fs.existsSync(seen.at(-1)!), false);
|
|
547
|
+
}
|
|
548
|
+
assert.equal(new Set(seen).size, 3);
|
|
549
|
+
assert.equal(checkpointNever(f.run, "launch").hash, policy.hash);
|
|
550
|
+
} finally {
|
|
551
|
+
f.close(); if (savedHome === undefined) delete process.env.HOME; else process.env.HOME = savedHome;
|
|
552
|
+
fs.rmSync(home, { recursive: true, force: true });
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
test("X1 never refusals preserve the target identity, sandbox explanation and kept-grant recovery", () => {
|
|
557
|
+
const f = fixture(nonTempScratch("relay-never-x1-"));
|
|
558
|
+
try {
|
|
559
|
+
const kept = path.join(f.home, "kept"); fs.mkdirSync(kept);
|
|
560
|
+
const cli = path.join(kept, "gemini"); fs.writeFileSync(cli, "#!/bin/sh\nexit 0\n", { mode: 0o755 });
|
|
561
|
+
fs.writeFileSync(process.env.RELAY_CONFIG!, JSON.stringify({ targets: { gemini: { bin: cli } } }));
|
|
562
|
+
const policy = checkpointNever(f.run, "grant");
|
|
563
|
+
const why = neverPathProblem(policy, kept, "write", true)!;
|
|
564
|
+
assert.match(why, /the gemini target's CLI .*which relay runs outside any sandbox/);
|
|
565
|
+
assert.match(why, /never relay.install/);
|
|
566
|
+
const caller: any = { runId: f.run, node: null };
|
|
567
|
+
const fresh = admitWork(caller, "claude", { mode: "write", grant: { write_paths: [kept] }, continues: false }, {}) as { reason: string };
|
|
568
|
+
assert.match(fresh.reason, /the gemini target's CLI .*outside any sandbox/);
|
|
569
|
+
const checkKept = () => {
|
|
570
|
+
const result = admitWork(caller, "claude", { mode: "write", kept: { write_paths: [kept] }, continues: true }, {}) as { reason: string };
|
|
571
|
+
assert.match(result.reason, /can no longer be used: .*the gemini target's CLI .*outside any sandbox/);
|
|
572
|
+
assert.match(result.reason, /Continue it with a grant of its own .*that leaves that out/);
|
|
573
|
+
};
|
|
574
|
+
checkKept();
|
|
575
|
+
// The cumulative floor retains the explanation after this CLI leaves the live config.
|
|
576
|
+
fs.writeFileSync(process.env.RELAY_CONFIG!, "{}");
|
|
577
|
+
checkKept();
|
|
578
|
+
} finally {
|
|
579
|
+
f.close();
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
test("config never refusals explain protection through linked names and data-volume aliases", () => {
|
|
584
|
+
// /tmp is a symlink on macOS: only its physical /private/tmp name has a data-volume alias.
|
|
585
|
+
const f = fixture(fs.realpathSync(scratch()));
|
|
586
|
+
try {
|
|
587
|
+
const named = process.env.RELAY_CONFIG!;
|
|
588
|
+
// Sort the dedicated directory before the configured name so a broad directory deny cannot
|
|
589
|
+
// hide the specific file's explanation in the deterministically sorted policy.
|
|
590
|
+
const real = path.join(f.home, "a-synced/config.json");
|
|
591
|
+
fs.mkdirSync(path.dirname(real)); fs.renameSync(named, real); fs.symlinkSync(real, named);
|
|
592
|
+
const policy = checkpointNever(f.run, "approval");
|
|
593
|
+
for (const file of [named, real, path.join(f.home, "mcp.json")]) {
|
|
594
|
+
const names = [file, ...(process.platform === "darwin" ? [path.join("/System/Volumes/Data", file)] : [])];
|
|
595
|
+
for (const name of names) {
|
|
596
|
+
const reason = neverPathProblem(policy, name, "write")!;
|
|
597
|
+
assert.match(reason, /is relay's own config file .*\b(?:config|mcp)\.json, which no job may change/);
|
|
598
|
+
assert.match(reason, /\(never relay\.config\)/);
|
|
599
|
+
assert.equal(neverApprovalProblem(policy, "file", [name], f.home), reason);
|
|
600
|
+
assert.equal(neverPathProblem(policy, name, "read"), reason);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
assert.match(neverPathProblem(policy, path.dirname(real), "write", true)!, /relay's own config file .*which no job may change/);
|
|
604
|
+
} finally { f.close(); }
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
test("doctor discloses which agents the never floor binds, per stage-2 state, from the launch predicate (core/never-coverage.ts)", async () => {
|
|
608
|
+
const { neverFloorReport } = await import("../dist/core/never-coverage.js");
|
|
609
|
+
const { TARGETS, targetLabel } = await import("../dist/targets/index.js");
|
|
610
|
+
const rows = TARGETS.map((t) => ({ id: t.id, label: targetLabel(t, t.id), enabled: true }));
|
|
611
|
+
const report = (stage2: boolean, allow_dangerous: boolean) => neverFloorReport(rows, { targets: { codex: { stage2 } }, child_settings: "isolated", child_hooks: false, child_mcp: "relay-only", allow_dangerous }, {}).join("\n");
|
|
612
|
+
const off = report(false, false);
|
|
613
|
+
assert.match(off, /codex, enabled: path entries enforced in every sandboxed turn's profile; keychain IPC closed on network-off turns, open on network-on turns\n/);
|
|
614
|
+
assert.match(off, /claude, enabled: path entries enforced, whatever stage 2 says; keychain IPC open/);
|
|
615
|
+
assert.match(off, /copilot \(experimental\), enabled: not enforced; refused with stage 2 on/);
|
|
616
|
+
assert.match(off, /gemini, enabled: not enforced; enforced only with stage 2 on/);
|
|
617
|
+
assert.match(off, /relay's network proxy, where a turn uses one .* still screens never hosts and ports/);
|
|
618
|
+
assert.doesNotMatch(off, /allow_dangerous write turns/);
|
|
619
|
+
assert.match(report(false, true), /not in allow_dangerous write turns, which run without a sandbox/);
|
|
620
|
+
const on = report(true, true);
|
|
621
|
+
assert.match(on, /stage-2 executor/);
|
|
622
|
+
assert.match(on, /allow_dangerous write jobs refused outside the stage-2 route/);
|
|
623
|
+
assert.match(on, /gemini, enabled: path entries enforced, only while stage 2 is on; keychain IPC closed/);
|
|
624
|
+
assert.match(on, /copilot \(experimental\), enabled: refused/);
|
|
625
|
+
assert.match(on, /grok \(experimental\), enabled: refused/);
|
|
626
|
+
assert.doesNotMatch(on, /not enforced/);
|
|
627
|
+
assert.match(on, /stage-2 executor; keychain IPC closed/, "with stage 2 on, Codex network turns run in relay's executor");
|
|
628
|
+
assert.match(off, /keychain IPC open: .*reach the security daemons\. Items in file-based keychains .* still stay out of reach, since reading one also needs its keychain file, which the floor denies .*data-protection keychain items, is not covered, nor is a copy of a keychain file kept outside the denied directories\./, "the open keychain IPC is disclosed, with what the file deny still keeps out of reach and what it does not");
|
|
629
|
+
});
|