Files
OwnCord/Server/migrations/010_attachment_uploader.sql
jevb 57d87bb439 fix: require auth + channel ACL on file serving (BUG-092)
Private attachments were accessible without authentication if the UUID
was known. Added AuthMiddleware to the GET /api/v1/files/{id} route,
uploader_id tracking on uploads, and channel-level permission checks
(guild READ_MESSAGES, DM participant, admin bypass) in handleServeFile.

Migration 010 adds uploader_id column to attachments table.
8 new access-control tests covering all authorization paths.
2026-04-02 11:16:16 +02:00

4 lines
239 B
SQL

-- Migration 010: Add uploader_id to attachments for ownership checks (BUG-092).
ALTER TABLE attachments ADD COLUMN uploader_id INTEGER REFERENCES users(id);
CREATE INDEX IF NOT EXISTS idx_attachments_uploader ON attachments(uploader_id);