Security
Security is a feature, not a layer.
DBlob assumes clients will send requests they shouldn't, that bugs happen, and that backups leak. The model below is built around those assumptions.
-- verified users comment on published posts, as themselves
GRANT INSERT ON comments TO verified
CHECK (@new.author = @auth.id AND post.status = 'published');
-- phone numbers are visible only to their owner
DENY SELECT (phone) ON users TO everyone
WHERE id != @auth.id;
-- editors manage posts
GRANT SELECT, INSERT, UPDATE, DELETE
ON posts TO HAS_ROLE('editor');Permissions: grants on rows, columns and values
- Default deny. A new collection has no grants. Without a matching grant, the answer is no.
- DENY wins. An explicit deny overrides any allow, including allows inherited through roles.
- Column by column. A write touching two columns needs a passing grant for each one, and the error names the column that failed. Values are never silently dropped.
- Conditions on old and new values.
WHEREpicks the rows,CHECKlimits what a row may become, andWHENcontrols transitions, such as "the slug can be set once" or "drafts can be published, archived posts stay archived". - Roles are yours. Define
editor,supportorbilling-admin, add members, and grant each role exactly what it needs. Superusers can check the result with “View as” a guest or any user. - API keys will be principals too Planned. A server key will get its own roles and grants, and is never implicitly a superuser.
Enforced in the query, not after it
Grants are compiled into the SQL of every request: row filters, per-row column masks and write checks run inside the same statement and transaction as your query. DBlob never fetches data and then decides whether you may see it.
Defense in depth is the goal: on databases that support it, grants will also be installed in the database itself, as Postgres row-level security and SQLite triggers, so even a bug in DBlob's query builder can't read past them. The admin will show the enforcement level of every grant.
No probing through the side door
- Filters and sorts may only reference fields the caller can read, at every relation hop.
- A record you may not view returns 404, not 403, and errors never echo values from other rows.
- Sign-in gives the same answer, in the same time, whether or not the account exists, and secrets are compared in constant time.
Credentials live in a separate vault
User profiles live in your data, so your tables can reference users with real foreign keys. Password hashes, refresh-session hashes and signing keys live in a separate auth vault that normal DBlob connections can't read. A leaked app backup or a misused SQL console doesn't leak credentials. Backups only include the vault in encrypted archives.
Tokens built for theft
- Short-lived access tokens: Ed25519-signed JWTs, valid for 15 minutes. Public keys are published at
/.well-known/jwks.json, so your own services can verify them. - Rotating refresh tokens: every refresh issues a new one. If an old refresh token is replayed, DBlob revokes the whole session family, which catches stolen tokens.
- Refresh tokens are stored only as hashes. Sessions are per device and can be revoked instantly.
- The admin uses
HttpOnly,SameSite=Strictcookie sessions with CSRF protection, not tokens inlocalStorage. - Sign-in is rate limited per IP and per account.
Safe file handling
Downloads are served with a sandboxing Content Security Policy, and anything that isn't an image is sent as an attachment, so an uploaded HTML or SVG file can't run scripts on your domain. Stored names are sanitized and randomized.
The platform
- Written in Rust with
unsafecode forbidden in DBlob's own crates. - Dependencies are checked for licenses, bans and advisories in CI.
- Secrets at rest (such as database credentials and S3 keys) are encrypted under the instance key.
- An external penetration test is planned before 1.0.