Living document for SnapQuote's security posture: what's at risk, what we do about
it, and how we verify it. Created 2026-07-03, while Phase 2 section 7 (auth) is
still open — several items below are blocked on those decisions
(docs/OPEN-QUESTIONS.md).
Status legend: ✅ in place · 🔜 planned/agreed · ❓ needs discussion
Update (2026-07-13, later the same day): migrated to Directus 11.13.4 — the hole does not exist on the new live instance. On v11 (port 8056) the App User policy has no
directus_usersaccess at all, andquotes/quote_itemsare server-scoped with$CURRENT_USERitem filters (free on v11's BSL license — the paywall that caused the "All Access" workaround is gone). Seedirectus-11-downgrade.md. Second update (same day): the v12 instance was emptied entirely — nothing left in it; public reads on its old collections return FORBIDDEN (verified by API probe). That removes the data exposure. Two residuals until the v12 container is stopped: its/users/registerendpoint is still enabled (verified — probe with invalid payload returned a validation error, not 403), so the empty instance remains a registerable foothold; and it was not verified whether the probe users / adminfirst_namewere part of the wipe.Third update (2026-07-21): public registration is now intentionally enabled on v11 as the app's in-app sign-up path (into the App User role). This is safe on v11 precisely because the App User policy has no
directus_usersaccess — the registration + All-Access-on-users combination that made it a hole on v12 does not exist here. Sign-up and sign-in verified on-device the same day.Fourth update (2026-07-26): the App User policy now has narrow
directus_usersaccess — self-scoped (id = $CURRENT_USER) Read/Update field-limited touser_type/full_name/company_name, for the sign-up profile. That is deliberately not the v12 shape: the field limit is what keeps registration safe. Probed the same day —PATCH /users/meonrole,passwordall 403,GET /usersself-filters to the caller only, and B's user record is unreachable from A.
Status: fixed on the live v11 instance (8056); v12 (8055) emptied of all data but still running with registration enabled — stop the container to close it out. Discovered by API probing while scoping the sign-up screen. Two settings combined into a full compromise:
- Public registration is enabled —
POST /users/register(204) lets anyone on the network create an App User account, no approval. - The App User policy has Read + Update on
directus_userswith "All Access" (no row filter) — because "Use Custom" (row-level filters) is paywalled on this Directus plan, the field was left as All Access.
Proven with two throwaway users (probe-a@example.com, probe-b@example.com,
password ProbeTest123! — delete these):
- A freshly-registered user read every user record, including the admin's
email (
rajaarshman12@gmail.com) and, critically, the admin's role UUID (c8b669ae-40b8-44e4-b79e-a18d270ca12c). - That user modified another user's record (set
probe-b.first_name, then reverted it) and modified the admin's record (changed the adminfirst_nametoPROBE_TEST—⚠️ original value not captured; admin should reset their own first name in the UI). - Self role-escalation to
adminreturned 500, not 403 — i.e. the write was attempted, not permission-denied; it only failed because the literal string"admin"isn't a valid role UUID. Since the user can read the real admin role UUID (above) and Update onroleisn't blocked, full privilege escalation to admin is near-certain. Not executed — doing so would leave a live admin backdoor with a known password.directus_rolesitself is 403 to App User, but that doesn't help: the UUID leaks through the readable user record.
This cannot be fixed in the frontend. Frontend SDK filters are advisory; an
attacker uses curl, not our app.
The proper fix may be unlocked for free (verified 2026-07-13): the reason
row-level filters are unavailable is that we're on Directus's free Core tier,
which gates custom/$CURRENT_USER permission filters (and SSO) behind paid
Team/Enterprise. Directus's Open Innovation Grant (orgs under $5M
revenue, <50 employees) grants fully permissive access at no software cost — if
eligible, that turns the items below from "impossible on our plan" into "just
configure the filter." Pursue the grant / tier decision first; it changes the
whole remediation from workaround to real row-level security. See
docs/questions-for-senior-dev.md.
Required server-side remediation regardless (do the lockdown now; the grant enables the clean version):
- Immediately: on the App User policy, remove Update on
directus_users(or at minimum strip every field exceptfirst_name/last_name/user_typefrom Update — field-level permissions appear to be available even though row filters aren't; verifyrole/status/password/token/providerare NOT updatable). Reduce Read to the minimum fields, ideally disable it. - Delete the two probe users and any unknown registrations.
- Reconsider whether public registration should be on at all until the above is locked down (it is the entry point that makes this reachable).
Design consequence for sign-up (blocks docs/tasks/auth.md §sign-up): the
planned "register → PATCH my own directus_users.user_type" flow depends on the
exact Update permission that is dangerous here, and on this plan we can't scope
that Update to "own record only." So storing user_type on the user record via
the client is not viable as-is. Options to decide (see auth.md): a server-side
Directus Flow/hook that sets user_type (no client write permission needed); a
separate collection with create-own semantics (same row-filter limitation —
probably no better); or drop the field and carry contractor/homeowner per-quote
or in app state. Needs a decision before the sign-up screen is built.
The starting point, so we know what we're fixing:
- API is HTTP, not HTTPS — live v11 Directus at
http://192.168.1.116:8056(LAN) /http://100.64.144.41:8056(Tailscale). Traffic is unencrypted; Tailscale encrypts the tunnel, the LAN address does not. - Public policy — on v11: Read on
room_typesonly. The legacy v12 instance at:8055was emptied 2026-07-13 (its old public surface now returns FORBIDDEN); its container still runs with registration enabled — pending shutdown. - Auth in the app (2026-07-21) — email/password login and sign-up with a
full login gate; refresh token in SecureStore, per-user sessions. Public
registration into the App User role is enabled on v11 (intentional — see §0).
Frontend points at v11 (
EXPO_PUBLIC_DIRECTUS_URL=:8056). - Row-level security in force (2026-07-13, verified 2026-07-21) — after the
downgrade to Directus 11,
$CURRENT_USERitem filters are free and applied:quotesRead/Update scoped touser_created equals $CURRENT_USER,quote_itemsviaquote.user_created. Server-enforced, not advisory; an API probe with a fresh App User confirmed it reads only its own quotes. (Wiring the app also exposed two v11-rebuild gaps — empty field-read perms and a missingdate_createdcolumn — both fixed 2026-07-21; seedirectus-11-downgrade.md.) - No rate limiting / cost controls — relevant once Phase 3 AI estimation exists (paid API per estimate).
- ❓ HTTPS for the Directus API. Options: Caddy/Traefik reverse proxy with a
real cert (needs a domain), Tailscale-only access with
tailscale cert, or accept HTTP on a trusted network for now. Decide before shipping to anyone else's phone. - ❓ Should the LAN address be retired in favour of Tailscale-only, so the API is never reachable from an untrusted network?
- ✅ Public policy — on the v11 rebuild it was already minimal: Read on
room_typesonly, noquotes/quote_itemsaccess (the v12 pre-auth widening was never carried over). Decision closed 2026-07-25 (OPEN-QUESTIONS #5):room_typesread stays public; everything else is App-User-only. - 🔜 App User role as the only path to data: read reference collections, CRU on quotes/items. No delete unless we decide quotes are deletable in-app.
- ✅ Server-side quote scoping (required 2026-07-13, done same day): resolved
by downgrading to Directus 11.13.4, where
$CURRENT_USERrow-level filters are free.quotesRead/Update scoped touser_created equals $CURRENT_USER(user_createdis M2O →directus_userswith On Create = "Save Current User ID");quote_itemsscoped via the relational pathquote.user_created equals $CURRENT_USER. Verified 2026-07-21 by API with a freshly registered App User — reads only its own quotes. (The App User Read permission must also grant the individual fields, not just the row filter; the rebuild left that empty and broke the app's list queries until fixed 2026-07-21.) - ✅
quote_itemscreate isn't owner-scoped in permissions — found and closed 2026-07-26. An authenticated App User couldPOST /items/quote_itemswithquoteset to another user's quote id and it succeeded (200), attaching fabricated line items to a quote they didn't own — an integrity/tampering hole, though not a read leak (cross-user reads of quotes and items were correctly denied throughout). Root cause: Directus create-time Field Validation / permission filters only see fields on the incoming payload and can't traverse the M2O toquote.user_created, so a same-collection rule can't express "the referenced quote must be mine." (A rule on the item's ownuser_createdwouldn't help anyway — the attacker's item legitimately has their id; the check must be on the quote's owner. Theuser_createdpreset possibly populating after validation is a secondary red herring.) Read-side scoping meant the victim would have seen the bogus items on their own quote. Closed by thequote-item-owner-guardhook extension (§2.2a) — deployed to the devbox and verified 2026-07-26: the cross-user attach probe now returns 403, and the own-quote attach still returns 200. - ✅
GET /usersreturns 200 for an App User and self-filters the body — confirmed 2026-07-26. The list endpoint responds 200 rather than 403, which is expected Directus behaviour given the self-scoped Read Item Permission (id = $CURRENT_USER); the probe asserts B's id is absent from A's/usersresponse, and it is. Status alone was never the meaningful check here. - ✅
quotesupdate field coverage — fixed 2026-07-26:job_typewas missing from thequotesUpdate allowed Field Permissions, so users couldn't edit it on their own quotes; added. - ✅
quote_itemsRead was scoped on the wrong field — found and fixed 2026-07-27. It filtered on the item's ownuser_createdrather than the relationalquote.user_createdthat BACKEND.md claimed. Never a confidentiality break — no user could read another user's data — but the inverse: items planted on your quote by someone else were invisible to you and stayed visible to their creator (residue from the pre-guard window). Now uses the relational path, matching the new Delete permission. Verified both directions. The §3.1 probe suite passed 35/35 the whole time this was wrong — it only tested that cross-user creation was blocked, never cross-user reading of a planted item. Covered since 2026-07-27 by the Group C isolation probes. - ✅
quotesDelete — granted 2026-07-27 and now deliberate. It was added unintentionally alongsidequote_itemsDelete, but the decision was then made to keep it and ship quote deletion in the app, so it is no longer a capability without a UI. Owner-scoped and verified: A cannot delete B's quote. This reverses the earlier "no delete unless quotes are deletable in-app" position — quotes are now deletable in-app. Two follow-on fixes were required:- The §3.1
DELETE own quoteprobe expected 403 and so failed while silently deleting one of A's real quotes on every run. It now expects 204 and runs against a quote created purely as a delete target. - The app deletes line items explicitly before the quote rather than trusting
the DB to cascade — see BACKEND.md. Whether
quote_items.quoteis CASCADE or SET NULL can't be read from the client, and under SET NULL the orphans would be permanently invisible (the read filter scopes throughquote.user_created) and so unrecoverable from the app.
- The §3.1
- ✅
estimate_requests/price_cacheaccess (Phase 3 section 1, 2026-10-14).- Users create estimate jobs with input fields only, so they can't forge
statusorresult. - They read only their own rows, without the cost log.
- They can't update or delete them.
price_cacheis closed to everyone but admin.- Verified by probe Group H (§3.1).
- Users create estimate jobs with input fields only, so they can't forge
- ❓ Photo file ownership on
estimate_requests(open, for section 2).photosis a JSON list of file ids, so Directus doesn't check that the files belong to the caller. This is the same kind of gap asquote_itemscreate (§2.2a). Section 2's filter hook must confirm each id is the caller's own upload before the AI ever sees it, or a user could get someone else's photo described back to them. - ❓ Foreign estimate link on
quotes(open, for section 2). OncequotesCreate/Update grantestimate_request, the payload validator must reject an estimate id the caller doesn't own. Not exploitable today because those fields are Read-only. - ❓ Admin account hygiene — strong unique password on the Directus admin, admin UI not exposed beyond LAN/Tailscale, static admin tokens avoided.
The check must load the referenced quote and confirm its user_created matches
the caller, which needs relation access at write time — impossible in the
permissions UI, so it has to be code.
Decided, built, deployed and verified 2026-07-26: a custom hook extension,
directus/extensions/quote-item-owner-guard — living on the devbox at
~/directus/extensions/ and mounted into the directus11 container via
docker-compose.yml; load confirmed in the container logs. See
directus/README.md for the deploy and verification steps.
It registers filter('quote_items.items.create', …) and the matching …update
event, and loads the referenced quote through ItemsService using the caller's
own accountability — so the existing, already-correct read scoping on quotes
remains the single definition of ownership, and the guard can't drift out of sync
with the permissions UI. If the caller can't read the quote, ItemsService throws
Directus's own ForbiddenError and the write is rejected 403. Notes:
- Guards update as well as create: App Users have no
quote_itemsUpdate permission today, but re-parenting an item (PATCH { quote: <foreign id> }) would be the same hole the day that permission is granted. - Also refuses a create with no
quote— an orphan item is unusable and would be re-parentable later. - Batch-safe (Directus fires the filter per item for
createItems; the handler normalises an array payload anyway) and fails closed — every failure mode, including the extension not loading, results in a blocked or errored write rather than a silent pass. Confirm the load in the Directus logs regardless. - Dependency-free hand-written ESM, so there is no build step or
npm installon the server and the file in git is the file that runs.
Rejected alternatives:
- Directus Flow — Filter (blocking) on
quote_items.items.create. No-code and admin-managed, but it lives in the Directus database: not in git, not reviewable, and lost on a rebuild (this schema has already been rebuilt by hand once). Also needs a separate Read-Data step (the sandboxed Run-Script op has no DB access) and fiddly handling of the batch payload. - Nested-only creation. Nest items under the quote create/update (O2M) so the
quote's own owner-scope governs. Directus still checks
quote_itemscreate permission on nested items and the standalonePOST /items/quote_itemsendpoint stays open, so it's defence in depth, not a fix. Also touches the frontend (useSaveQuote). Still available later as a hardening step. - Server-side save endpoint — revoke
quote_itemsCreate from App Users entirely and create quote + items in one custom endpoint. Closes the hole by construction but is a much bigger build; revisit if Phase 3's AI estimation work brings a custom endpoint anyway.
-
✅ Directus email/password login for the App User role, with in-app sign-up (OPEN-QUESTIONS #1–2 resolved). Built and verified on-device 2026-07-21.
-
✅ Token storage: refresh token in
expo-secure-store(Keychain/Keystore), access token in memory only. Never AsyncStorage, never logged. (src/lib/auth-storage.ts; web falls back to localStorage — dev target only.) -
✅ Auto-refresh on launch; failed refresh → back to the login gate. Confirmed on-device 2026-07-26 (deleted account → relaunch →
/login). -
✅ A failed launch refresh distinguishes "dead token" from "no server" (2026-08-16). Both still gate to
signedOut— without an access token there is nothing to fetch either way — but only a server rejection discards the stored refresh token. A network failure keeps it and setsofflineSession, so the login screen can offer a one-tap retry instead of demanding a password. Verified on-device by stopping the Directus container: the refresh token survives a failed refresh in SecureStore (the SDK does not clear storage on a network error), and retrying after restarting the container restored the session with no credentials typed. Security-relevant properties, both confirmed: the gate itself is unchanged — being offline never admits anyone to(tabs)/(quote)— and an explicit sign-out clears the flag along with the token, so a signed-out user offline gets a plain login form and no suggestion that a session is recoverable. -
✅ Mid-session dead session → login. Verified on-device 2026-07-27: with
ACCESS_TOKEN_TTL=60sand the user'sdirectus_sessionsrow deleted, a foregrounded pull-to-refresh bounced to/login. Note the bounce is reactive — the SDK swallows the failed refresh and re-sends the expired access token, so it takes an actual request to surface the 401. A user idling with no query activity keeps a dead session on screen until something fetches. Full mechanism and recipe indocs/tasks/auth.md. -
✅ An admin password change DOES invalidate existing sessions — opened and closed 2026-07-27. Directus 11.13.4 deletes the user's
directus_sessionsrows on a password change, so no compensating control is needed. Evidence: a refresh token captured before the change returned 401INVALID_CREDENTIALSafterwards, against a same-session 200 baseline taken minutes earlier on the unchanged password (the baseline used a second, independent session, since/auth/refreshrotates the token it consumes). The earlier "changed the password, app didn't redirect" observation was a measurement artefact, not a finding: it ran at the default 15-minuteACCESS_TOKEN_TTL, so the still-valid stateless access token kept every request succeeding and the app never had cause to touch its refresh token. The session had in fact been dead the whole time. The app would have bounced at the next access-token expiry, or immediately on the next foreground re-validation. Both client paths handle the resulting error:INVALID_CREDENTIALSis inisAuthError(src/lib/query.ts) and counts as a server rejection for theAppStatere-validation insrc/context/auth.tsx. Consequence: theusers.updatehook sketched here previously is unnecessary — dropped. Re-verify if Directus is ever upgraded. The test, for reuse (it bypasses the app and the TTL entirely):RT=$(curl -s -X POST -H 'Content-Type: application/json' \ -d '{"email":"userA@example.com","password":"…"}' \ http://100.64.144.41:8056/auth/login | jq -r .data.refresh_token) # …now change that user's password in Data Studio, then: curl -s -o /dev/null -w '%{http_code}\n' -X POST \ -H 'Content-Type: application/json' \ -d "{\"refresh_token\":\"$RT\",\"mode\":\"json\"}" \ http://100.64.144.41:8056/auth/refresh
401 (what we got) → sessions are invalidated; nothing to build. 200 would have meant sessions survive a password change — a real gap, since the standard reason to change a password is to evict someone who has your account. Note the app still ships no password-change or forgot-password UI (no
passwordRequest/passwordResetanywhere insrc/), so this currently only applies to admin-initiated changes in Data Studio. The server-side half of a future password-reset flow is now known to be sound. -
❓ Session lifetime — indefinite (refresh forever) vs. forced re-login after N days. OPEN-QUESTIONS #3 proposes indefinite on a personal phone.
-
✅ Logout — shipped 2026-07-13 (clears secure store + query cache).
- 🔜 No secrets in the repo. API URLs are fine in config; tokens, admin
credentials, and (Phase 3) AI/retailer API keys are not.
EXPO_PUBLIC_*env vars ship inside the app bundle — treat them as public. - 🔜 AI/retailer API keys live server-side only (Directus/companion service). Already decided: the frontend never calls the AI directly.
- ❓
.envconvention — add.env+.env.example, gitignore the former?
- ✅ Client-side validation via RHF + zod (
src/lib/quote-schema.ts) with unit-aware bounds. - ✅ Server-side validation — built 2026-09-18, deployed and verified live
2026-09-24 (probe run 69 passed / 0 failed, Group G all green).
directus/extensions/quote-payload-validatoris a hook extension onquotes/quote_itemscreate+update: unit-aware dimension bounds copied fromsrc/lib/quote-schema.ts, enum checks onunit/status/selected_tier/kind, money bounded to 0…100M, text caps on every free-text column, andgrand_total == materials_total + labour_total(±0.01). Rejects with a 400FAILED_VALIDATION.- Why a hook, not Directus field validation rules. Field rules are
per-field, so the cross-field invariants (unit-aware bounds, totals
agreeing) don't fit — and they live only in the database. This schema has
been hand-rebuilt once already and silently lost config both times it
happened (
date_created, then the empty field-read lists). Code in the repo survives a rebuild; admin-clicked rules don't. - The risk is over-blocking, not under-blocking. An earlier draft also
required
length/widthon create and would have rejected the minimal rowsprobe-permissions.shcreates for its own setup. Both verification layers (§3.1 Group G, §3.3) lead with accept cases for that reason. ⚠️ The container copy is what runs: after editing the extension in the repo, copy it to the devbox and restart Directus again, then re-run Group G.
- Why a hook, not Directus field validation rules. Field rules are
per-field, so the cross-field invariants (unit-aware bounds, totals
agreeing) don't fit — and they live only in the database. This schema has
been hand-rebuilt once already and silently lost config both times it
happened (
- ❓ Displayed-data hygiene — quote briefs / customer names are free text that comes back and renders in the app (and later maybe in a PDF/shareable link — OPEN-QUESTIONS #12, where injection starts to matter).
- ❓ Rate limiting on the AI estimation endpoint — per-user/per-day caps (OPEN-QUESTIONS #11). A stolen token shouldn't be able to run up the AI bill.
- ❓ Directus rate limiting (
RATE_LIMITER_*env) on the API generally.
- ❓ Photos (Phase 3) — stored where, and are uploads size/type-restricted?
- ❓ Anything sensitive in logs? Convention: never log tokens, credentials, or full quote payloads in production builds.
How we verify the measures above. No test suite exists yet; these start as manual checklists and graduate to automation where it pays.
Automated by scripts/probe-permissions.sh (Git Bash + curl). It logs in as
two App Users A and B, then runs the matrix below and prints PASS/FAIL vs the
expected HTTP status, ending with a tally (non-zero exit on any failure). Re-run
after each permissions change:
BASE_URL=http://100.64.144.41:8056 \
EMAIL_A=a@example.com PASS_A=… EMAIL_B=b@example.com PASS_B=… \
bash scripts/probe-permissions.shSet RUN_PROFILE_PROBES=true (the directus_users profile fields + App User self
Read/Update permissions now exist, so this should stay on). The script carries no
credentials (env-var driven; placeholder defaults only).
✅ Full run 2026-07-26 with profile probes on: 35 passed, 0 failed, 0 skipped.
✅ Re-run 2026-07-27 after the quotes.customer_name field + its Read/Create/
Update field permissions landed: 35 passed, 0 failed, 0 skipped — unchanged.
Re-run after every permissions change.
✅ Re-run 2026-07-27 after quote editing + deletion landed, with two new groups closing the suite's known blind spots: 55 passed, 0 failed, 0 skipped.
Both gaps had let a real defect sit at a green 35/35:
- Per-field permissions (Group F). The suite only probed operations with a
fixed payload, so a field missing from an allow-list passed here while breaking
the app —
job_type(2026-07-26) andcustomer_name(2026-07-27) both did exactly that. Now: two Read probes using the app's real field sets (useRecentQuotes,useQuote), plus one Update probe per field the wizard writes. Keep the field list in step withbuildQuotePayload(). - Payload validation (Group G, added 2026-09-18). Every probe before this
checked who may write where; none checked what values landed. Now: two
accept rows (a full wizard payload and a minimal
job_type+unitrow) that must stay 200, then twelve deny rows — bad enums, negative and disagreeing totals, out-of-range dimensions, oversized free text, a bad line amount — that must be 400. A 200 on a deny row means thequote-payload-validatorextension isn't loaded, not that the rule is wrong. The accept rows lead deliberately: a validator that only ever denies would pass all twelve and still break every save. - Cross-user item read (Group C isolation). Every earlier probe only checked
that cross-user creation was blocked, never cross-user reading — which is
how the
quote_itemsscoping bug survived. Now B plants an item on B's own quote and the suite asserts A can't see it by id or in a list, and that B can (the inverse half of the same bug).
Detection was negative-tested, not just assumed green: reading and patching a deliberately unpermitted field both return 403, so Group F genuinely fails when a permission is missing.
The suite is now non-destructive and self-cleaning. It previously deleted a
real quote on every run (the DELETE own quote probe pointed at an existing
quote) and accumulated a quote plus a line item each time. Both probe targets are
now purpose-created and removed in a cleanup step; a full run is net zero rows.
- Unauthenticated request to every collection — confirm only the intended
public surface responds. Verified:
room_typesonly; quotes/quote_items/ labour_rates/users all denied, unauthenticated creates rejected. - Unauthenticated create on
quotes/quote_items— expect rejection. - Authenticated App User: CRU works on own data (incl. the own-quote
quote_itemsattach path end-to-end), and privileged operations are denied — delete, other users' records,/roles/policies/permissions, and self-escalation viaPATCH /users/me(role/email/password). - Cross-user: every tested path denied — quote read/update/delete, attaching
quote_itemsto another user's quote, and reading/patching their user record. List isolation asserted on response content, not just status. - Garbage token — 401. (The app-side half of this — returning to login
rather than showing stale data — is tracked in §3.3 /
tasks/auth.md, and is the one piece still not exercised on a realistic path.) - Profile self-service (Group E) —
GET /users/meandPATCH /users/meonfull_name/user_typesucceed without opening any escalation path.company_nameis granted by the same field-limited permission but is not individually probed. - Oversized / out-of-range / wrong-type payloads direct to the API — Group G, verified live 2026-09-24 against the deployed validator (§2.5): 2 accept rows 200, 12 deny rows 400; full run 69 passed, 0 failed.
- Estimation job rows and price cache — Group H, added and passed 2026-10-14.
Unauthenticated create is 403. Create with inputs only is 200, but setting
statusorresultis 403. The own-row poll read is 200, an explicit cost-log read is 403, andfields=*leaves the cost log out. Update/delete on an own row is 403. B's row is invisible to A by id and in the list.price_cacheread/create is 403. The newquotesfields read back. Caveat: App Users can't delete estimate rows, so each run leaves 2job_type = "probe"rows. Once section 2's hooks exist, those rows will trigger real AI calls, so the probes need a way around that first.
-
git log -p | grep-style scan (orgitleaks) for committed secrets — candidate for a pre-commit hook or CI step. -
npm auditon dependencies — decide a cadence and a severity threshold. - Verify no
EXPO_PUBLIC_*var contains anything secret.
- Refresh token is in SecureStore, not AsyncStorage (inspect device / simulator storage).
- Logout (if built) clears secure store and the TanStack Query cache.
- App behaves sanely when the API is unreachable (existing offline fallbacks) and when it returns 401/403/500.
node scripts/test-payload-validator.mjsRegisters quote-payload-validator against a fake filter registry and runs
44 payloads through the real handlers — no Directus, no network, no
dependencies, non-zero exit on any failure. Roughly a third are "garbage that
must be rejected"; the rest are payloads that must still be accepted,
including the exact shapes buildQuotePayload() emits, the rename dialog's
partial PATCH, and the minimal rows probe-permissions.sh creates.
This is the fast inner loop. It proves the rules; it cannot prove the extension loaded, that field permissions allow the write, or anything about the running server — that's §3.1 Group G.
- ❓ Automated integration tests for the permission matrix (a script that runs §3.1 and fails loudly) — worth it once auth stabilises.
- ❓ Directus + Postgres backup/restore test — availability is part of security.
- ❓ Anything store-review-driven (privacy policy, data deletion) before an actual App Store / Play launch.
Settled security decisions get recorded here (date + decision), and folded into the sections above.
- 2026-07-03 — Document created; nothing decided yet beyond what Phase 2/3
planning already fixed (tokens in
expo-secure-store; AI keys server-side; frontend never calls AI directly). - 2026-07-13 — App opens to public homeowner sign-ups (PROJECT.md). Consequences: per-user accounts with in-app registration; server-side quote scoping becomes a hard requirement (§2.2); HTTPS (§2.1) moves from "decide eventually" to "required before public users" — a public app cannot ship pointing at plain HTTP on a LAN/Tailscale address.
- 2026-07-13 — Downgraded to Directus 11.13.4 (port 8056, separate DB) instead
of paying for / grant-licensing v12's row-level filters. Server-side quote
scoping is now in place (§2.2); §0's hole doesn't exist on v11 (App User has no
directus_usersaccess) but stays live on the legacy v12 instance at:8055until v12 is retired. - 2026-09-24 — Server-side payload validation live (§2.5).
quote-payload-validatordeployed to the devbox;probe-permissions.sh69 passed, 0 failed, closing the last open row in the §3.1 matrix.