Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

test(privacy): a check keeps owner quotes and machine names out [C7]

Corey Olson6f02abe80e78
diff --git a/src/board.js b/src/board.js
index 927af01f..46a59865 100644
--- a/src/board.js
+++ b/src/board.js
@@ -1678,7 +1678,7 @@ export function reopen(board, id, { agentId, note = '', conflict, cause }) {
});
}
-/** Read test and merge-commit evidence from a Studio/manual landing note without checking Git. */
+/** Read test and merge-commit evidence from a hand-written landing note without checking Git. */
function manualLandingFailure(note) {
const generatedPrefix = /^Landing batch [a-z0-9_-]{1,80} failed /iu.exec(note);
const body = generatedPrefix ? note.slice(generatedPrefix[0].length) : note;
diff --git a/test/health-sentinel.test.js b/test/health-sentinel.test.js
index d7915ec2..3dabff98 100644
--- a/test/health-sentinel.test.js
+++ b/test/health-sentinel.test.js
@@ -29,8 +29,8 @@ function fixture(t) {
GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' };
const original = Object.fromEntries(Object.keys(overrides).map(key => [key, process.env[key]]));
Object.assign(process.env, overrides);
- const env = { ...process.env, GIT_AUTHOR_NAME: 'Corey Olson', GIT_AUTHOR_EMAIL: '[email protected]',
- GIT_COMMITTER_NAME: 'Corey Olson', GIT_COMMITTER_EMAIL: '[email protected]' };
+ const env = { ...process.env, GIT_AUTHOR_NAME: 'Sentinel Fixture', GIT_AUTHOR_EMAIL: '[email protected]',
+ GIT_COMMITTER_NAME: 'Sentinel Fixture', GIT_COMMITTER_EMAIL: '[email protected]' };
runFixtureGit(['init', '-q', '-b', 'main'], { cwd: root, env });
writeFileSync(join(root, 'pullboard.json'), JSON.stringify({ gate: 'true', lanes: { core: { owns: ['src/'] } } }));
writeFileSync(join(root, 'SPEC.md'), '# Fixture\n\n## A\n- A6 [approved, must] Report stuck work. | gate: review\n');
diff --git a/test/privacy-words.test.js b/test/privacy-words.test.js
new file mode 100644
index 00000000..91038fc6
--- /dev/null
+++ b/test/privacy-words.test.js
@@ -0,0 +1,136 @@
+/** @pullboard-test-input source-tree */
+/**
+ * Tracked files and pushed commit bodies never quote the owner or name private infrastructure (#895): the owner's
+ * machines by name, this machine's host name, its private network addresses, or this user's home folder. Published
+ * history is not rewritten; the commit check reads only the range a push would send.
+ */
+import assert from 'node:assert/strict';
+import { execFileSync } from 'node:child_process';
+import { mkdtempSync } from 'node:fs';
+import { readFileSync } from 'node:fs';
+import { realpathSync } from 'node:fs';
+import { rmSync } from 'node:fs';
+import { writeFileSync } from 'node:fs';
+import { homedir } from 'node:os';
+import { hostname } from 'node:os';
+import { networkInterfaces } from 'node:os';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { resolve } from 'node:path';
+import { test } from 'node:test';
+
+const ROOT = resolve(import.meta.dirname, '..');
+/** The files that hold these patterns to test them; every other tracked file is scanned. */
+const PATTERN_HOLDERS = new Set(['test/privacy-words.test.js', 'docs/privacy.test.js', 'test/cockpit/privacy-scan.test.js']);
+/** Placeholder home folders that tests plant on purpose to prove redaction. */
+const PLACEHOLDER_HOMES = new Set(['private', 'example', 'person', 'user', 'me', 'you', 'name']);
+const MACHINES = ['Stu' + 'dio', 'Mac' + 'Book', 'M' + 'BP'];
+
+/** Escape text for a regular expression. */
+function literal(text) {
+ return text.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
+}
+
+/**
+ * The rules, built for this machine: what counts as a quote of the owner, a machine name, this host's name, one of
+ * its private network addresses, or this user's home folder.
+ *
+ * @param {{ host?: string, addresses?: string[], home?: string }} [machine] - stand-ins for tests
+ */
+function rules({ host = hostname(), addresses = privateAddresses(), home = homedir() } = {}) {
+ const short = host.split('.')[0];
+ return [
+ { name: 'an owner quote', pattern: /\b[Tt]he person, \d{1,2} [A-Z][a-z]{2}\b/u },
+ { name: 'a private machine name', pattern: new RegExp(`\\b(?:${MACHINES.join('|')})\\b`, 'u') },
+ ...(short.length >= 3 && !/^localhost$/iu.test(short) ? [{ name: 'this host name', pattern: new RegExp(`\\b${literal(short)}\\b`, 'iu') }] : []),
+ ...addresses.map((address) => ({ name: 'a private network address of this machine', pattern: new RegExp(`(?<![\\d.])${literal(address)}(?![\\d])`, 'u') })),
+ { name: 'a home folder', pattern: new RegExp(`(?:${literal(home)}|/(?:Users|home)/(?!(?:${[...PLACEHOLDER_HOMES].join('|')})\\b)[A-Za-z][\\w.-]*)(?=/|\\b)`, 'u') },
+ ];
+}
+
+/** This machine's addresses in the private ranges (10/8, 172.16/12, 192.168/16). */
+function privateAddresses() {
+ return Object.values(networkInterfaces()).flat().filter(Boolean).map((entry) => entry.address)
+ .filter((address) => /^(?:10\.|192\.168\.|172\.(?:1[6-9]|2\d|3[01])\.)/u.test(address));
+}
+
+/** Every rule a text breaks, as "<where>: <rule>". */
+function problemsIn(text, where, active) {
+ return active.filter((rule) => rule.pattern.test(text)).map((rule) => `${where}: ${rule.name}`);
+}
+
+/**
+ * The privacy problems in a repository: each tracked text file, and each commit body in the range a push would send.
+ *
+ * @param {string} root
+ * @param {{ range?: string|null, machine?: object }} [options] - the commit range; null skips commits
+ * @returns {string[]}
+ */
+function privacyProblems(root, { range = pushedRange(root), machine } = {}) {
+ const active = rules(machine);
+ const git = (...args) => execFileSync('git', args, { cwd: root, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 });
+ const problems = [];
+ for (const path of git('ls-files', '-z').split('\0').filter(Boolean)) {
+ if (PATTERN_HOLDERS.has(path) || /\.(?:png|jpe?g|gif|ico|woff2?|ttf|mp4|webm|sqlite|pdf)$/iu.test(path)) continue;
+ let text;
+ try { text = readFileSync(join(root, path), 'utf8'); } catch { continue; }
+ text.split('\n').forEach((line, index) => problems.push(...problemsIn(line, `${path}:${index + 1}`, active)));
+ }
+ if (range) {
+ for (const record of git('log', '--format=%H%x00%b%x1e', range).split('\x1e').map((entry) => entry.trim()).filter(Boolean)) {
+ const [sha, body] = record.split('\0');
+ problems.push(...problemsIn(body ?? '', `commit ${sha.slice(0, 12)} body`, active));
+ }
+ }
+ return problems;
+}
+
+/** The commits a push would send: those not yet on the upstream branch, or none when there is no upstream. */
+function pushedRange(root) {
+ try {
+ execFileSync('git', ['rev-parse', '--verify', '-q', '@{upstream}'], { cwd: root, stdio: 'ignore' });
+ return '@{upstream}..HEAD';
+ } catch { return null; }
+}
+
+/** A disposable repository with one committed file and one commit body. */
+function planted(t, { file = 'clean text\n', body = 'Pullboard-Item: #1' } = {}) {
+ const root = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-privacy-')));
+ t.after(() => rmSync(root, { recursive: true, force: true }));
+ const env = { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1',
+ GIT_AUTHOR_NAME: 'Privacy Fixture', GIT_AUTHOR_EMAIL: '[email protected]', GIT_COMMITTER_NAME: 'Privacy Fixture', GIT_COMMITTER_EMAIL: '[email protected]' };
+ const git = (...args) => execFileSync('git', args, { cwd: root, env, encoding: 'utf8' });
+ git('init', '-q', '-b', 'main');
+ git('commit', '-q', '--allow-empty', '-m', 'chore: start');
+ const base = git('rev-parse', 'HEAD').trim();
+ writeFileSync(join(root, 'notes.md'), file);
+ git('add', 'notes.md');
+ git('commit', '-q', '-m', 'docs: add notes', '-m', body);
+ return { root, range: `${base}..HEAD` };
+}
+
+const STAND_IN = { host: 'workbench-7.lan', addresses: ['10.11.12.13'], home: '/Users/fixture-owner' };
+
+test('tracked files and pushed commit bodies carry no owner quote or private infrastructure [C7]', () => {
+ assert.deepEqual(privacyProblems(ROOT), [], 'every finding names the file and line, or the commit, to fix');
+});
+
+test('each privacy rule refuses a planted case in a tracked file and in a commit body [C7]', (t) => {
+ const cases = [
+ ['an owner quote', 'as decided (the person, 18 Oct), ship it'],
+ ['a private machine name', `the gate ran on the ${MACHINES[0]} overnight`],
+ ['this host name', 'logs from workbench-7 show the stall'],
+ ['a private network address of this machine', 'ssh to 10.11.12.13 and rerun'],
+ ['a home folder', 'see /Users/fixture-owner/Code/repo for the log'],
+ ];
+ for (const [rule, text] of cases) {
+ const inFile = planted(t, { file: `${text}\n` });
+ assert.deepEqual(privacyProblems(inFile.root, { range: inFile.range, machine: STAND_IN }), [`notes.md:1: ${rule}`], `a tracked file with ${rule}`);
+ const inBody = planted(t, { body: `${text}\n\nPullboard-Item: #1` });
+ const found = privacyProblems(inBody.root, { range: inBody.range, machine: STAND_IN });
+ assert.equal(found.length, 1, `a commit body with ${rule}: ${found.join('; ')}`);
+ assert.match(found[0], new RegExp(`^commit [0-9a-f]{12} body: ${literal(rule)}$`, 'u'));
+ }
+ const clean = planted(t, { file: 'SSH_CONNECTION=10.0.0.1 22 and /Users/private/project are placeholders\n' });
+ assert.deepEqual(privacyProblems(clean.root, { range: clean.range, machine: STAND_IN }), [], 'placeholders and addresses of no machine pass');
+});
diff --git a/test/relay-client.test.js b/test/relay-client.test.js
index cc535774..54f42e80 100644
--- a/test/relay-client.test.js
+++ b/test/relay-client.test.js
@@ -1202,7 +1202,7 @@ async function finalReplicaOrder(fixture, timing) {
assert.deepEqual(replicaFiles.map(localEvents), beforeFuture, 'neither clone applies a future engine or its own later move');
}
-test('[H3,H16,V1,V17] three cloned linked replicas order competing claims', { timeout: 240_000 }, async (t) => { // 20 paired rounds (60 CLI spawns), six sync/registration spawns and three local API calls took 170s on Studio; setup fits the remaining ceiling.
+test('[H3,H16,V1,V17] three cloned linked replicas order competing claims', { timeout: 240_000 }, async (t) => { // 20 paired rounds (60 CLI spawns), six sync/registration spawns and three local API calls took 170s under load; setup fits the remaining ceiling.
const timing = threeReplicaPhaseCapture(t);
return timing.run(async () => {
const fixture = await threeReplicaFixture(t, timing);
diff --git a/test/reopen.test.js b/test/reopen.test.js
index 70517ca7..7981aca1 100644
--- a/test/reopen.test.js
+++ b/test/reopen.test.js
@@ -347,7 +347,7 @@ test('a red landing gate returns a verified item to its builder [B3,V4]', async
assert.equal(JSON.parse(noNamedTest.out).error.code, 'LANDING_FAILURE_REQUIRED');
for (const invalidNote of [
`Landing failed: gate red; merge commit ${'d'.repeat(40)}`,
- `Studio landing gate red: see the log; merge commit ${'d'.repeat(40)}`,
+ `Landing gate red on the runner: see the log; merge commit ${'d'.repeat(40)}`,
`Reopening #12: the gate was red; merge commit ${'d'.repeat(40)}`,
]) {
const refused = manualBox.run(manualBox.repo, 'reopen', String(manualItem.id), '--note', invalidNote, '--json');
diff --git a/test/runner-source-setup-fixture.js b/test/runner-source-setup-fixture.js
index eee102d6..1f37c53d 100644
--- a/test/runner-source-setup-fixture.js
+++ b/test/runner-source-setup-fixture.js
@@ -50,7 +50,7 @@ childProcess.spawn = (command, args, options) => {
writeFileSync(${JSON.stringify(injected)}, 'checkout lock injected\\n');
if (${JSON.stringify(mode)} === 'index') return spawn(command, [...args, '--fixture-invalid-option'], options);
if (${JSON.stringify(mode)} === 'missing') return spawn(${JSON.stringify(join(dir, 'missing-git'))}, args, options);
- if (${JSON.stringify(mode)} === 'large') return spawn(process.execPath, ['-e', ${JSON.stringify(`process.stderr.write('x'.repeat(20_000) + ${JSON.stringify(`\nfatal: fixture tail token=${SECRET} https://user:[email protected]/repo?token=${SECRET} ${remoteHome}/private.txt 192.168.1.99\nAuthorization: Bearer fixture-bearer-secret\nCookie: session=fixture-cookie-secret\n`)}); process.exit(23);`)}], options);
+ if (${JSON.stringify(mode)} === 'large') return spawn(process.execPath, ['-e', ${JSON.stringify(`process.stderr.write('x'.repeat(20_000) + ${JSON.stringify(`\nfatal: fixture tail token=${SECRET} https://user:[email protected]/repo?token=${SECRET} ${remoteHome}/private.txt 10.20.30.40\nAuthorization: Bearer fixture-bearer-secret\nCookie: session=fixture-cookie-secret\n`)}); process.exit(23);`)}], options);
writeFileSync(join(options.cwd, '.git', 'index.lock'), 'held by this fixture\\n');
}
return spawn(command, args, options);
@@ -83,7 +83,7 @@ syncBuiltinESMExports();\n`);
assert.match(result.stdout, /exit 23[\s\S]*fixture tail/u, 'bounded stderr retains the concrete failure tail');
assert.ok(!result.stdout.includes(SECRET) && !result.stdout.includes('fake-password'), 'credential assignments and URL credentials stay private');
assert.ok(!result.stdout.includes('fixture-bearer-secret') && !result.stdout.includes('fixture-cookie-secret'), 'spaced bearer and cookie credentials stay private');
- assert.ok(!result.stdout.includes('192.168.1.99'), 'private network addresses stay private');
+ assert.ok(!result.stdout.includes('10.20.30.40'), 'private network addresses stay private');
assert.ok(Buffer.byteLength(result.stdout.split('PULLBOARD_RUN_RESULT ')[0]) < 2_400, 'the diagnostic is bounded in bytes');
}
assert.ok(!result.stdout.includes(remoteHome), 'runner-private paths never reach the controller');