fix(supabase): confirmed uploads gate asset reads (hash claim), seeds-listed test, Dockerfile workspace manifests; importer declares every authored label, real in=out control
This commit is contained in:
1 parent
bbfb8d6203
commit
dee4ce43d9
28 files changed
+511
-87
No files matched your search
@@ -315,5 +315,9 @@ Rules of the import:
|
||||
|
||||
Storage: bucket `anatomical-sheet-assets` (private, SVG only, 20 MiB cap),
|
||||
objects `<sha256>.svg`, read policy `anatomical_sheet_assets_read` through
|
||||
`private.can_read_sheet_asset_object` (published reference of a usable
|
||||
sheet, or editor); no API writes (operator upload, `SUPABASE.md` §3.1).
|
||||
`private.can_read_sheet_asset_object`: the asset row must be **confirmed**
|
||||
(`uploaded_at`, set only by `confirm_sheet_asset_upload` with the service
|
||||
role once the bytes are in the bucket) and either edited by the caller or
|
||||
referenced by a non-draft version of a usable sheet. A hash a user registers
|
||||
on their own sheet therefore opens nothing. No API writes (operator upload,
|
||||
`SUPABASE.md` §3.1).
|
||||
@@ -68,14 +68,17 @@ ever reaches the browser.
|
||||
|
||||
Two kinds of seed (`config.toml [db.seed] sql_paths`):
|
||||
|
||||
| File | Scope | Content |
|
||||
| --------------- | ----------------- | ---------------------------------------------------------------------------------- |
|
||||
| `seed.sql` | local only | dev accounts + first owner |
|
||||
| `seed/**/*.sql` | every environment | versioned reference data, idempotent (today: the official equine sheet as a draft) |
|
||||
| File | Scope | Content |
|
||||
| -------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `seed.sql` | local only | dev accounts + first owner |
|
||||
| `seed/…/*.sql` | every environment | versioned reference data, idempotent (today: the official equine sheet as a draft); each file listed explicitly in `sql_paths` |
|
||||
|
||||
The PGlite harness applies `seed/**` after the migrations, `seed.sql` never
|
||||
(it needs the real auth schema). On another environment, apply a versioned
|
||||
The PGlite harness applies every `.sql` under `seed/` after the migrations,
|
||||
`seed.sql` never (it needs the real auth schema); a test fails when a seed
|
||||
file is missing from `sql_paths`. On another environment, apply a versioned
|
||||
seed with `psql -f` from a privileged session, then upload its assets (§3.1).
|
||||
Never run `supabase db push --include-seed` against a shared database: the
|
||||
list also contains `seed.sql` and its known local password.
|
||||
|
||||
### 3.1 Sheet assets (Storage)
|
||||
|
||||
@@ -86,12 +89,16 @@ any version for its editors. No API role uploads; the operator does, with
|
||||
the service key, from the generated seed folder:
|
||||
|
||||
```bash
|
||||
SUPABASE_URL=http://127.0.0.1:54321 SUPABASE_SERVICE_ROLE_KEY=<service key> \
|
||||
pnpm assets:upload supabase/seed/anatomical-sheets/equine/v1
|
||||
export SUPABASE_URL=http://127.0.0.1:54321
|
||||
read -rs SUPABASE_SERVICE_ROLE_KEY && export SUPABASE_SERVICE_ROLE_KEY # typed, not in shell history
|
||||
pnpm assets:upload supabase/seed/anatomical-sheets/equine/v1
|
||||
```
|
||||
|
||||
The script verifies each file against `assets.json` (sha256, size) before
|
||||
uploading and skips objects already present.
|
||||
uploading, keeps objects already present, and calls
|
||||
`confirm_sheet_asset_upload` (service role only) for each asset row: the
|
||||
read policy ignores a row whose upload was never confirmed, so a user who
|
||||
registers a known hash on their own sheet opens nothing.
|
||||
|
||||
Seed accounts (local only, password `LocalDev-only-password-1`):
|
||||
|
||||
|
||||
Reference in new issue
Block a user