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
A model/caller permitted to use memory_evidence can read arbitrary accessible .logfmt paths via its date argument. This is a plugin-tool boundary, not an unauthenticated network endpoint; the forced .logfmt suffix limits the primitive.
EvidenceArgs.date is an unrestricted string. The handler joins evidenceDir() with ${date}.logfmt without date validation or containment.
date: "../../outside"reads<memory-root>/../outside.logfmt.date: "../YYYY-MM-DD"reads a raw daily memory file, bypassing repo visibility, blocklist and supersession filtering.- Raw rows expose identifiers usable by the separate merge-review ownership gap.
The reproduction creates only a synthetic outside-store marker and verifies that the tool returns it.
Expected behavior / acceptance
- Accept only real calendar dates in
YYYY-MM-DDform; reject separators, absolute/path syntax, malformed and impossible dates before any read. - Enforce containment, including escaping symlinks, as defense in depth.
- Regression tests cover both separator forms, outside-store markers, raw daily-store traversal, and valid dates.
- Normal evidence-read session/repository authorization is a separate requirement: validating the path alone does not scope the records.
Related work
Separate from #24's export/import paths and the snapshot-restore containment already implemented. Related: #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: memory_evidence date traverses outside the evidence and memory roots', async () => {
plugin = await loadPlugin(a);
writeFileSync(join(root, 'outside.logfmt'), 'PRIVATE_OUTSIDE_STORE_MARKER\n');
const result = await plugin.tools.memory_evidence.execute({ date: '../../outside' });
expect(result.content).toBe('PRIVATE_OUTSIDE_STORE_MARKER');
});
Activity
WhollyMindless commentedon Oct 26, 2026
Follow-up review: the reproduced date-traversal bug appears addressed by #135 at
c9791ed.The regressions for forward-slash/backslash traversal, raw daily-store traversal, impossible dates, and valid implicit/explicit dates pass. The code also checks the resolved day-file path against the evidence directory.
Validation limit: the shipped escaping-symlink test returns early on Windows, so the local run did not exercise that case. Please ensure it executes on a supported CI platform before treating that acceptance item as verified. Evidence-read session/repository scoping is a separate remaining #128 requirement.
PR review, exact reviewed head, and validation context. This assesses the proposed fix; it does not mark the issue closed or claim the change has shipped.
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): date-shaped evidence reads, ownership-checked merges, …
Merge pull request #135 from WhollyMindless/fix/security-130-132
chore(release): 0.14.13 [skip ci]
abogartz-opencode-self-improvement commentedon Oct 28, 2026
🎉 This issue has been resolved in version 0.14.13 🎉
The release is available on:
Your semantic-release bot 📦🚀