hero--:--:--push offline
← [BACK TO HOME]

System postmortems

[03 AUDITS] · ROOT CAUSE ANALYSIS · PROVEN RESOLUTIONS

[SEC_01] · SettledCRITICAL

Cross-Tenant Row-Level Security Permission Leakage

[SYMPTOM]

An authenticated user belonging to Group A could read expense records from Group B by supplying foreign record UUIDs directly to the query client.

[ROOT CAUSE]

The initial Supabase RLS SELECT policy only validated that the requesting user was authenticated (auth.role() = "authenticated"), neglecting to enforce group membership scoping on individual expense row reads.

[STRUCTURAL FIX]

Wrote a failing reproduction query, discarded the loose policy, and authored a scoped subquery constraint requiring auth.uid() IN (SELECT user_id FROM group_memberships WHERE group_id = expenses.group_id). Reverified with automated integration assertions.

[ENGINEERING TAKEAWAY]

Client-side UI scoping is purely cosmetic. Tenant isolation must be physically locked at the database query planner level.

[CONC_02] · VoteSecureHIGH

Client-Side Double-Submission Race Condition

[SYMPTOM]

Rapid double-taps on high-latency mobile networks could submit duplicate ballots before UI disabled states propagated.

[ROOT CAUSE]

The ballot submission handler checked voter status in React state rather than enforcing uniqueness at the database level.

[STRUCTURAL FIX]

Created a PostgreSQL composite unique constraint on (election_id, voter_id). Converted the ballot recording step into an atomic transaction that throws on constraint violation.

[ENGINEERING TAKEAWAY]

Never trust UI state to enforce business-critical uniqueness. The database is the only authoritative constraint barrier.

[PARS_03] · CalciMEDIUM

Subtractive Associativity Reversal in Expression Tree

[SYMPTOM]

Evaluating "8 - 4 - 2" produced 6 instead of the mathematically correct result 2.

[ROOT CAUSE]

The recursive descent parser mistakenly applied right-associative recursion to binary subtraction, grouping the AST as 8 - (4 - 2).

[STRUCTURAL FIX]

Refactored the binary operator grammar parser into a left-associative loop, properly binding earlier operands before consuming subsequent tokens.

[ENGINEERING TAKEAWAY]

Mathematical operators require rigorous grammar formalization; unit tests must explicitly assert non-commutative and non-associative operations.