6 SQL checks
Missing context, manager scope, auditor scope across both organizations, a direct foreign ID and an unknown role.
CASE STUDY · API SECURITY · OCTOBER 2026
A local financial API laboratory with synthetic data, automated authorization checks and correlated security events. Built as an independent portfolio project.
THE PROBLEM
Two organizations share branch numbers in a synthetic financial dataset. Checking the branch alone is insufficient: a manager must only read their organization's assigned branch, while an auditor may read all branches within their own organization.
THE CONTROL
The Express API verifies the JWT and resolves organization and role from a server-side identity map. Each read uses a database transaction with local context. A restrictive PostgreSQL policy enforces organization scope, combined with role and branch rules. The application role has no superuser or BYPASSRLS privileges.
THE DEMONSTRATION
The same manager can read transaction 101 in organization 1 but receives 404 for transaction 201 in organization 2. Neither the foreign record nor its data is returned. Each HTTP response is matched to its structured audit event using X-Request-ID. A 404 alone does not prove an attack; the controlled fixture identifies the foreign record.
AN ENGINEERING FINDING
Authentication rejection events were missing because the logger read the request path after mounted middleware had processed it. Capturing the original path fixed attribution. Automated checks now match fresh request IDs to the expected event, status, route and identity.
VERIFICATION
Missing context, manager scope, auditor scope across both organizations, a direct foreign ID and an unknown role.
Allowed and denied reads, invalid authentication, parameter manipulation, JWT tampering and sequential identity changes.
Fresh request IDs correlate responses with exactly one matching event, including route, status and identity fields.
Five batches of eight requests across four identities. CI runs the suites with pool limits of one and four connections.
Both CI jobs passed for commit 4126e85 on October 4, 2026. These counts describe checks and requests, not distinct vulnerabilities.
LIMITATIONS
Authentication uses fixed demo identities. The database credential is trusted: someone who can connect with it can change the organization context. These tests do not establish protection against stolen database credentials, SQL injection, write authorization or token revocation.
Concurrent HTTP responses are checked for isolation; simultaneous database query execution and load capacity are not measured. Audit correlation does not establish tamper-resistant logging. No production vulnerability or production readiness was established.
The separately published original API remains available. The laboratory described here runs locally and in disposable CI environments; it is not the public API deployment.