Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ regexes = [
# A test-only JWT secret an earlier #3477 commit carried in
# install-outsider-grant-narrowing.test.js (the scan reads every commit).
'''^test-jwt-secret-f164-narrowing$''',
# A fake per-turn proxy token in cli/__tests__/adapters.claude.state-symlinks.test.mjs.
'''^per-turn-f153-bw$''',
]

paths = [
Expand Down
12 changes: 7 additions & 5 deletions cli/__tests__/adapters.claude.environment.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1661,9 +1661,10 @@ describe('claude adapter — a workspace seat on Linux', () => {
.toEqual(['--setenv', 'HOME', state]);
expect(opts.env.HOME).toBe(state);
expect(opts.env.CLAUDE_CONFIG_DIR).toBeUndefined();
// The state folder is the only writable bind; with no write grant the
// The state folder is the only writable bind (.claude and tmp bound again
// inside it, F153, so the jail cannot swap them); with no write grant the
// project is read-only.
expect(flagTriples(outer, '--bind')).toEqual([[state, state]]);
expect(flagTriples(outer, '--bind')).toEqual([[state, state], [path.join(state, '.claude'), path.join(state, '.claude')], [path.join(state, 'tmp'), path.join(state, 'tmp')]]);
expect(flagTriples(outer, '--ro-bind')).toContainEqual([cwd, cwd]);

expect(foundLogin).toBe(login);
Expand Down Expand Up @@ -1711,7 +1712,7 @@ describe('claude adapter — a workspace seat on Linux', () => {
await linuxSpawn(impl, { trust: 'workspace', allow: ['write'] });

const outer = calls[0].args.slice(0, calls[0].args.indexOf('--'));
expect(flagTriples(outer, '--bind')).toEqual([[state, state], [cwd, cwd]]);
expect(flagTriples(outer, '--bind')).toEqual([[state, state], [path.join(state, '.claude'), path.join(state, '.claude')], [path.join(state, 'tmp'), path.join(state, 'tmp')], [cwd, cwd]]);
// Strict, not -try: a .git that vanished must stop bwrap, not go unbound.
expect(flagTriples(outer, '--ro-bind')).toContainEqual([gitDir, gitDir]);
// .git is bound after the project, so it lands on top of it.
Expand Down Expand Up @@ -1842,8 +1843,9 @@ describe('claude adapter — a workspace seat on Linux', () => {
const outer = args.slice(0, args.indexOf('--'));
expect(outer.slice(outer.indexOf('HOME') - 1, outer.indexOf('HOME') + 2))
.toEqual(['--setenv', 'HOME', state]);
// The state folder is the only writable bind; the project is read-only.
expect(flagTriples(outer, '--bind')).toEqual([[state, state]]);
// The state folder is the only writable bind (.claude and tmp bound
// again inside it, F153); the project is read-only.
expect(flagTriples(outer, '--bind')).toEqual([[state, state], [path.join(state, '.claude'), path.join(state, '.claude')], [path.join(state, 'tmp'), path.join(state, 'tmp')]]);
expect(flagTriples(outer, '--ro-bind')).toContainEqual([cwd, cwd]);
const readOnly = outer.flatMap((arg, i) => (/^--ro-bind/.test(arg) ? [outer[i + 1]] : []));
expect(readOnly).toContain(fs.realpathSync(claudeInstall));
Expand Down
Loading
Loading