bettersight-statement-extra.../pocketbase/pb_migrations
JasonFraser d76d335d9b Add PocketBase schema for the layout mapper (L.3)
New layoutMappings/layoutMappingVersions collections plus documents fields
(layoutMappingUsed/layoutMappingVersionUsed/layoutApplied/layoutFingerprintHash) and
a promote_shared_layout_mapping.pb.js hook that flips a mapping to "shared" once a
second, different user independently creates one with the same fingerprintHash.

Found and fixed a real security gap by testing the live rule rather than trusting the
rule text: the original updateRule only gated WHO could update a layoutMappings
record, not WHICH fields - letting an owner trivially self-promote their own mapping
to "shared" via a plain PATCH, defeating the whole confirmation requirement. Fixed in
a follow-up migration (6_fix_layout_mapping_update_rule.js) that blocks setting status
to "shared" directly while leaving ordinary edits and self-retiring untouched.

Verified against the real rebuilt PocketBase container: both collections and all four
new documents fields confirmed via the REST API; two real signed-up users with a
matching fingerprintHash both correctly flip to shared via the hook, visible to a
third user; a still-private mapping 404s for every other user; the self-promotion
gap reproduced before the fix and confirmed blocked after it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-14 15:34:43 -04:00
..
1_create_collections.js Add PocketBase: accounts (password + Google) + schema for R2-backed docs 2026-10-13 00:26:41 -04:00
2_add_timestamps.js Move document persistence from localStorage to PocketBase (Stage B.2) 2026-10-13 06:41:51 -04:00
3_add_export_file.js Move Excel exports to R2; remove dead per-extraction workbook generation 2026-10-13 07:13:20 -04:00
4_add_layout_mapper_schema.js Add PocketBase schema for the layout mapper (L.3) 2026-10-14 15:34:43 -04:00
5_add_layout_mapping_fields.js Add PocketBase schema for the layout mapper (L.3) 2026-10-14 15:34:43 -04:00
6_fix_layout_mapping_update_rule.js Add PocketBase schema for the layout mapper (L.3) 2026-10-14 15:34:43 -04:00