Repository navigation
fix(bridge): keep device photo file names inside the photo directory - #740
Merged
Merged
Conversation
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>
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The board id from
POST /esp32/photo?board=(or aphoto_beginframe) 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.jpgname.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, fallbackesp32) in the file name. The board id reported to the session is unchanged. Voice uploads already usemkdtempwith 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:quickpasses.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