Only presign and accept images in the caller's own conversations #81
Reference in New Issue
Block a user
Delete Branch "fix/image-ownership"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Security fix.
GET /api/conversation/image/<key>returned a presigned S3 URL for any key to any logged-in user. Image keys are guessable once seen, and #79's run payloads expose them.POST /api/conversation/upload-imagewrote into whateverconversation_idthe form named, including other users' conversations.Every stored object lives under
conversations/<conversation id>/…. Both routes now require that conversation to belong to the caller and return 404 otherwise. Keys that try to escape with.., or that aren't conversation keys, are rejected too._get_owned_conversationnow treats a malformed id as not found instead of raising.Tests cover owned versus foreign keys, path traversal, non-UUID ids, non-conversation keys, and uploads to a foreign conversation. The new tests fail without the fix. 373 unit tests pass on main.
🤖 Generated with Claude Code