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
9 changes: 0 additions & 9 deletions src/agent/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,6 @@
const safeQuery = query.replace(/['"\\]/g, '\\$&');
const searchPaths = [
path.join(homeDir, '.claude', 'projects'),
path.join(homeDir, '.local', 'share', 'opencode', 'storage'),
path.join(homeDir, '.codex', 'sessions'),
path.join(homeDir, '.pi', 'agent', 'sessions'),
].filter((p) => {
Expand All @@ -1308,7 +1307,7 @@
const { execSync } = await import('child_process');
try {
const output = execSync(
`rg -l -i --no-messages "${safeQuery}" ${searchPaths.join(' ')} 2>/dev/null | head -100`,

Check failure on line 1310 in src/agent/router.ts

View workflow job for this annotation

GitHub Actions / warden: security-review

Command injection in session search via insufficient input sanitization

User input is passed to execSync with only quote/backslash escaping. Shell metacharacters like $() ` ; & | can execute arbitrary commands.
{
encoding: 'utf-8',
timeout: 30000,
Expand All @@ -1333,14 +1332,6 @@
sessionId = match[1];
agentType = 'claude-code';
}
} else if (file.includes('/.local/share/opencode/storage/')) {
if (file.includes('/session/') && file.endsWith('.json')) {
const match = file.match(/\/(ses_[^/]+)\.json$/);
if (match) {
sessionId = match[1];
agentType = 'opencode';
}
}
} else if (file.includes('/.codex/sessions/')) {
const match = file.match(/\/([^/]+)\.jsonl$/);
if (match) {
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1272,21 +1272,21 @@ workerCmd
await import('./sessions/agents/opencode-storage');

if (subcommand === 'list') {
const sessions = await listOpencodeSessions();
const sessions = listOpencodeSessions();
console.log(JSON.stringify(sessions));
} else if (subcommand === 'messages') {
if (!sessionId) {
console.error('Usage: perry worker sessions messages <session_id>');
process.exit(1);
}
const result = await getOpencodeSessionMessages(sessionId);
const result = getOpencodeSessionMessages(sessionId);
console.log(JSON.stringify(result));
} else if (subcommand === 'delete') {
if (!sessionId) {
console.error('Usage: perry worker sessions delete <session_id>');
process.exit(1);
}
const result = await deleteOpencodeSession(sessionId);
const result = deleteOpencodeSession(sessionId);
console.log(JSON.stringify(result));
} else {
console.error(`Unknown subcommand: ${subcommand}`);
Expand Down
11 changes: 0 additions & 11 deletions src/sessions/agents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export async function searchSessions(

const searchPaths = [
'/home/workspace/.claude/projects',
'/home/workspace/.local/share/opencode/storage',
'/home/workspace/.codex/sessions',
'/home/workspace/.pi/agent/sessions',
];
Expand Down Expand Up @@ -136,16 +135,6 @@ export async function searchSessions(
sessionId = match[1];
agentType = 'claude-code';
}
} else if (file.includes('/.local/share/opencode/storage/')) {
if (file.includes('/session/') && file.endsWith('.json')) {
const match = file.match(/\/(ses_[^/]+)\.json$/);
if (match) {
sessionId = match[1];
agentType = 'opencode';
}
} else if (file.includes('/part/') || file.includes('/message/')) {
continue;
}
} else if (file.includes('/.codex/sessions/')) {
const match = file.match(/\/([^/]+)\.jsonl$/);
if (match) {
Expand Down
Loading
Loading