Files

18 lines
1.5 KiB
Markdown

---
paths: ["docs/development/STORAGE.md", "crates/worker/**", "supabase/migrations/**"]
---
# Files and Storage (migration 20261013100000, docs/development/STORAGE.md)
- `public.assets` is the authority over every user file: status, owner, keys, lease. Every write is an RPC; the browser
reads its own rows through an explicit column list (`select=*` is refused: lease columns are not granted).
- Object keys are server-built from uuids (`profiles/<owner>/<id>/avatar.webp`, `quarantine/<owner>/<id>/upload`);
policies on `storage.objects` compare whole strings through `assets` and pin one bucket literal each (census test).
A quarantine object is never readable by an API role; a final key is never writable by the browser.
- New buckets stay closed (row only, no policy) until their step writes the rules; `anatomical-sheet-assets` keeps its own policy.
- The worker holds the service key; the decode child has an empty environment, no file, no network, and is the only
process that decodes untrusted bytes. The parent checks the container header only. Rejections are closed codes.
- Deletions are row-driven: terminal rows enqueue their keys (48 h / 1 h grace), the sweeper serves the queue and the
quarantine leftovers; a clean row's object is never deleted. Backups: dump first, files within 48 h.
- Avatar UI follows the validated mockup: photo in Mon compte (Informations personnelles), sidebar, drawer and top bar
link to Mon compte; JPEG / PNG / WebP only, never SVG; no signed URL for the owner-only avatar (download under RLS).