Skip to content

fix(bridge): keep device photo file names inside the photo directory - #740

Merged
puritysb merged 3 commits into
masterfrom
claude/photo-board-filename
Nov 8, 2026
Merged

puritysb merged 3 commits into
masterfrom
claude/photo-board-filename

Conversation

@puritysb

@puritysb puritysb commented Nov 8, 2026

Copy link
Copy Markdown
Owner

The board id from POST /esp32/photo?board= (or a photo_begin frame) was put into the saved file name unchanged. A board id containing ../ placed the JPEG outside ~/.agentdeck/photos, anywhere the user can write, with a .jpg name.

Who could reach it: the route is behind the normal auth gate, so this needs the pairing token or a trusted same-machine program. A browser page on this machine is refused. A token holder can already send prompts to sessions, so this is hardening, not a new advisory.

Fix: photoPath() keeps only [A-Za-z0-9_-] (max 40, fallback esp32) in the file name. The board id reported to the session is unchanged. Voice uploads already use mkdtemp with a fixed file name, and the Swift daemon has no photo route.

Tests: three regression cases. The two hostile-input cases fail on current master and pass with the fix. pnpm verify:quick passes.

Found by a Snyk Code trial scan (javascript/PT, bridge/src/daemon-server.ts:2788). CodeQL did not report this path.

🤖 Generated with Claude Code

puritysb and others added 3 commits November 8, 2026 12:21
The board id from POST /esp32/photo (?board=) or a photo_begin frame went
into the file name unchanged, so a token holder could write the JPEG
outside ~/.agentdeck/photos with a board id containing ../. Only
[A-Za-z0-9_-] now reaches the name; the reported board id is unchanged.

Found by a Snyk Code trial scan (javascript/PT).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@puritysb
puritysb merged commit ff88526 into master Nov 8, 2026
26 checks passed
@puritysb
puritysb deleted the claude/photo-board-filename branch November 8, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant