Enhance upload handling: add db-backed upload rate limiting and lease management, enforce stricter validation for deployment configurations, optimize test suite and retired functionality, and improve input handling and error recovery.
CI / check (22) (push) Failing after 4m52s
CI / check (24) (push) Successful in 9m43s

This commit is contained in:
2026-10-13 14:16:32 +02:00
parent dd23a19ed2
commit 5489e03138
10 changed files with 85 additions and 27 deletions
+6
View File
@@ -27,6 +27,12 @@ export function initializeAttachments(db) {
PRIMARY KEY (attachment_id, vision_model, prompt_version, question)
);
CREATE TABLE IF NOT EXISTS upload_deletions (storage_key TEXT PRIMARY KEY);
CREATE TABLE IF NOT EXISTS upload_leases (
token TEXT PRIMARY KEY,
username TEXT NOT NULL REFERENCES users(username) ON DELETE CASCADE,
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS upload_leases_user ON upload_leases(username);
CREATE TRIGGER IF NOT EXISTS release_message_attachment AFTER DELETE ON message_attachments
BEGIN
DELETE FROM attachments WHERE id = OLD.attachment_id AND status = 'attached'