Repository navigation
Description
Verified against upstream main at cf9b73c4f352bdc1fbd3c1332fca4183a63e3fb8 (0.14.9) during the 2026-10-26 security review, using Windows and Bun 1.3.10. Severity is a review priority, not a calculated CVSS score. The reproduction invokes actual plugin hooks/tools through the repository's fake-host harness; it is not a real-host end-to-end exploit.
Impact and cause
Two sessions sharing one process can receive each other's private repository memories in their system prompts. No malicious import or successful prompt injection is required. This can disclose project A's confidential information to project B's session and configured provider.
The context hook calls setCurrent({ sessionID }), then awaits the store read. injectableRows filters afterward using isVisibleHere, which reads the mutable global current session. If B's hook executes while A's read is pending, A filters with B's scope and injects B's frontier. The reproduction drives the real A context hook and B before-tool hook without sleeps or source mocks.
A separate fail-open case is included: isVisibleHere returns true for every stamped row when repository identity is unknown. An unbound plugin session therefore receives other repositories' private frontier rows.
Expected behavior / acceptance
- A's context contains A/global rows only, even when B dispatches during any awaited read; exercise both directions.
- Thread immutable caller identity through injection, recall, contextual pull, compaction and write/gate paths, or use correctly scoped async context. Do not re-read a shared global after an await.
- Unknown plugin-session identity exposes only explicit/legacy global rows or defers injection. The standalone viewer's administrative all-repositories access must be explicit and separate.
- Commit regression tests that fail on this revision and pass with the fix; keep normal single-session and global-row behavior covered.
Related work
Related to #121 (the same ambient-identity root cause in tool writes) and the earlier scoping work in #8. This issue covers the independently reproduced automatic read/system-prompt leak and unbound-session behavior. The capture/evidence threading fixes already in 0.14.9 do not close it. Security tracking: #83.
Reproduction
Save the following as security-review-repro.test.ts at the repository root of the reviewed revision and run bun test ./security-review-repro.test.ts --timeout 20000. All files are temporary fixtures and any model API is fake. These assertions deliberately confirm the current vulnerable behavior; passing means the bug reproduced, not that it is fixed. The fixtures are retained in the OS temp directory for inspection.
Self-contained Bun reproduction
// Review-only proofs against upstream cf9b73c (0.14.9). No real stores, keys, or model calls.
import { beforeEach, afterEach, expect, test } from 'bun:test';
import { mkdirSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { loadPlugin, type LoadedPlugin } from './test/harness.ts';
import { appendMemory, loadAll, isActive, isVisibleHere } from './src/memory.ts';
import { rememberSessionDir, resetSessionScopes, resolveRepo, setRepoScope } from './src/repokey.ts';
import { resetState, setCurrent } from './src/state.ts';
import { dateStr, evidenceDir } from './src/config.ts';
import { redactSecrets } from './src/secrets.ts';
import { resetCaptureCooldowns } from './src/index.ts';
import { startViewer, type ViewerServer } from './src/viewer/server.ts';
let root: string;
let a: string;
let b: string;
let plugin: LoadedPlugin | undefined;
let viewer: ViewerServer | undefined;
beforeEach(() => {
root = mkdtempSync(join(tmpdir(), 'osi-security-proof-'));
a = join(root, 'repo-a'); b = join(root, 'repo-b');
mkdirSync(a); mkdirSync(b);
process.env.OPENCODE_MEMORY_DIR = join(root, 'memory');
process.env.OPENCODE_COMMANDS_DIR = join(root, 'commands');
process.env.OPENCODE_CBM_BIN = join(root, 'no-graph-binary');
resetState(); resetSessionScopes(); resetCaptureCooldowns(); setRepoScope(null);
});
afterEach(async () => {
viewer?.server.stop(true); viewer = undefined;
await plugin?.cleanup(); plugin = undefined;
resetState(); resetSessionScopes(); setRepoScope(null);
delete process.env.OPENCODE_MEMORY_DIR;
delete process.env.OPENCODE_COMMANDS_DIR;
delete process.env.OPENCODE_CBM_BIN;
// Keep only synthetic temp fixtures for inspection; never touch user state.
});
test('confirmed: concurrent session context reads inject repo B data into session A', async () => {
plugin = await loadPlugin(a);
rememberSessionDir('ses-a', a); rememberSessionDir('ses-b', b);
for (const [dir, marker] of [[a, 'A_PRIVATE_FRONTIER'], [b, 'B_PRIVATE_FRONTIER']]) {
const scope = resolveRepo(dir);
await appendMemory({ type: 'context', scope: 'planning', content: marker,
status: 'open', repo: scope.key, repoPath: scope.path });
}
const eventA = { sessionID: 'ses-a', system: [] as { type: string; text: string }[] };
const pendingA = plugin.sessionHooks.context(eventA);
// Both are real registered hooks. A is suspended on filesystem I/O when B starts.
await plugin.toolHooks['execute.before']({ sessionID: 'ses-b', callID: 'b1', tool: 'read' });
await pendingA;
const injectedIntoA = eventA.system.map(p => p.text).join('\n');
expect(injectedIntoA).toContain('B_PRIVATE_FRONTIER');
expect(injectedIntoA).not.toContain('A_PRIVATE_FRONTIER');
});
test('confirmed: an unbound session sees private rows from every repository', async () => {
plugin = await loadPlugin(null);
const scopeB = resolveRepo(b);
await appendMemory({ type: 'context', scope: 'planning', content: 'B_PRIVATE_UNBOUND_FRONTIER',
status: 'open', repo: scopeB.key, repoPath: scopeB.path });
const event = { sessionID: 'ses-unbound', system: [] as { type: string; text: string }[] };
await plugin.sessionHooks.context(event);
expect(event.system.map(p => p.text).join('\n')).toContain('B_PRIVATE_UNBOUND_FRONTIER');
});
Activity
WhollyMindless commentedon Oct 26, 2026
Follow-up review: partially addressed; please keep this issue open.
#133 fixes the reproduced bound-session interleaving, but its
readerForSession()still falls back to the module-wide repository. Loading plugin A, then plugin B, and invoking A's context hook for an unbound A session injects B's private frontier row. The existing unbound test only exercises a null setup scope.Please make unresolved caller identity global-only or defer injection, bind the caller's own repository explicitly when possible, and add the multiple-setup/non-null-fallback regression. The same identity gap also affects #131's merge authorization.
Detailed #133 review · Runnable probes on the combined #135 head. Reviewed #133 at
a8c5b7aand reproduced against combined headc9791edusing the fake-host harness on Windows / Bun 1.3.10. Please adjust the PR's automatic closure claim until this remaining acceptance case passes.fix(security): date-shaped evidence reads, ownership-checked merges, …
fix(security): date-shaped evidence reads, ownership-checked merges, …
fix(security): date-shaped evidence reads, ownership-checked merges, …
fix(security): an immutable Reader resolved at flow entry (abogartz#127)
test(security): regression suites for abogartz#127 abogartz#128 aboga…
docs(security): README on the entry-resolved reader and audit scrubbing
fix(security): date-shaped evidence reads, ownership-checked merges, …
Merge pull request #133 from WhollyMindless/fix/security-127-129
chore(release): 0.14.12 [skip ci]
abogartz-opencode-self-improvement commentedon Oct 28, 2026
🎉 This issue has been resolved in version 0.14.12 🎉
The release is available on:
Your semantic-release bot 📦🚀
test: release session identity between tests (abogartz#149)
chore(release): 0.14.13 [skip ci]