Security model for LedgerLine accounting infrastructure.
LedgerLine secures connected-app accounting workflows with server-side API keys, scoped connected apps, private storage posture, rate limits, auditability, and careful data boundaries. This page explains the current model and the remaining gates before production approval.
Connected apps authenticate with bearer API keys that must stay on the app server. Raw keys are shown once, hashed with a server-only pepper, and never intended for browsers or public clients.
Scoped connected apps
Public API scope is derived from the verified API key. Client-submitted organization, app, environment, or mode scope fields are rejected.
Private storage posture
Document and export buckets are intended to remain private, with file access routed through LedgerLine server checks rather than public object listing or direct URLs.
Auditable accounting
Posting and reversal workflows create balanced journal entries. Reversals add new reversing entries rather than rewriting original history.
API Key Security
Bearer keys stay on the server.
API keys are bearer credentials and must stay server-side.
Raw API keys are shown once only.
Stored API key material is hashed with a server-only pepper.
Key prefixes and suffixes can be shown for identification without revealing the full key.
Revoked keys are blocked.
Inactive connected app environments are blocked.
Invalid or missing API-key attempts are throttled.
Last-used metadata exists for safe operational visibility.
API keys must not be placed in browser code, mobile clients, public repositories, frontend environment variables, logs, or screenshots.
Scope Isolation
Tenant scope is derived, not trusted from clients.
Public API organization, connected app, environment, and API key context is derived server-side from the verified API key.
Trusted client-submitted scope fields such as organization_id, connected_app_id, app_environment_id, environment, and mode are rejected.
Module toggles provide setup guidance and soft warnings today; future hard module enforcement may use a standard module_disabled error after separate rollout work.
Dashboard routes use authenticated Supabase user sessions plus organization membership context.
Public share and portal routes use hashed token validation.
The current runtime relies on server-side organization scoping.
RLS and Storage policy drafts exist, but they still require disposable/staging dry-run, review, and deliberate application before production confidence.
Rate Limits
Abuse protection sits alongside authorization.
Broad public API per-key rate limiting protects normal API traffic.
Invalid API-key attempts are throttled separately.
Public token routes have throttling for share, portal, and document access surfaces.
Accounting mutation buckets protect posting and reversal workflows.
Document transfer controls protect upload and download surfaces.
Rate limits are abuse protection, not authorization. Permission, status, idempotency, and business-rule checks still matter.
Public Tokens
Share and portal routes resolve hashed tokens.
Share, portal, and payment-instruction routes resolve hashed tokens server-side.
Revoked tokens stop resolving.
Public token routes are throttled.
Public PDFs and logos are served through LedgerLine routes.
Raw tokens should not be logged or exposed in dashboards.
Token expiry policy remains a future hardening lane unless separately implemented.
Storage And Documents
Files are intended to be server-proxied.
Buckets are required to be private in target environments.
Storage access remains server-proxied through LedgerLine routes.
Direct public listing and direct public downloads are not intended.
The Supabase service role must stay server-side.
A Storage policy SQL draft exists as a guarded review artifact.
Storage policies still need disposable/staging testing and deliberate application later.
Document contents and storage paths should not be exposed publicly.
Accounting Integrity
Posting and reversal preserve auditability.
Posting and reversal operations run server-side.
Journal entries must balance.
Original journal entries remain immutable.
Reversals create new reversing journal entries.
Duplicate posting and duplicate reversal are guarded.
Documents and supporting files do not mutate accounting by themselves.
Deployment checklist and production readiness docs exist.
RLS and Storage dry-run plan/checklist exist.
Platform Admin Safety
Platform visibility is hidden, allowlisted, and minimized.
`/platform` is hidden and protected by the platform admin guard.
Access requires a real Supabase session plus server-side allowlist.
Organization roles do not grant platform admin access.
The development auth bypass does not grant platform admin access.
The platform dashboard is aggregate/minimized by default.
Platform admin audit logs and support notes exist.
No impersonation, tenant mutation, or accounting mutation exists in the platform admin surface.
Not Claimed
Security copy should not outrun the product.
Production certification
SOC 2 compliance
PCI compliance
Tax, legal, accounting, or CPA advice
IRS e-filing
Payroll or HR
Live external payment collection
Plaid or bank-feed security posture
OCR/AI document security posture
Live authenticated API Reference
Production Readiness Boundary
Ready for setup/testing is not production-approved.
Production confidence still requires real environment setup, migrations through the latest committed migration, private bucket creation, RLS/Storage dry-run, smoke/security QA, and rollout planning.
Product Boundaries
Deferred providers remain deferred.
The API Reference is read-only.
No public API route is broadly blocked by module state today.
Core accounting does not require Stripe, SendGrid, Plaid, OCR/AI, IRS e-filing, or payroll providers.
Real email sending remains deferred unless implemented later.