Security

Vela's security rules are few, explicit and enforced in one place each. This page describes what Vela guarantees, what it leaves to you, and how to check a deployment before trusting it with real data.

The access model in one table

MechanismIs it access control?Use it for
private visibilityYesAnything that must not be public. Readable only with an API key or a signed link.
Signed linksYes, time-limited bearer credentialTemporary access to a single file for someone without a key.
API key scope and prefixYesLimiting what automation and people can change.
Web sign-in sessionYes, read-only bearer cookie tied to a keyLetting a key holder browse what the key can see. Ends with the key.
unlisted visibilityNoFiles that may be public but should not be browsable or indexed.
Hidden directories, disabled indexesNoControlling navigation and crawler hints.

Unlisted and hidden are not protectionAnyone who knows, guesses or is forwarded the URL of an unlisted file or a hidden directory can open it. Use private files with signed links for anything sensitive.

Guarantees

Existence is never disclosed

On the public side, private, expired, trashed and missing objects all answer 404 — never 403. Disabled directory indexes and absent directories return the same themed 404 with the same headers, and rejection happens before any subtree is examined. Signed-link failures are also 404, with one exception: an exp already in the past returns 410 Gone, decided before the database is consulted.

Credentials stay out of URLs and logs

  • API keys are accepted only from Authorization: Bearer — and, with the optional web sign-in, once in the body of its same-origin sign-in form. There is no query parameter, so keys never reach URLs, proxy logs or browser history.
  • The sign-in cookie holds a random 256-bit session ID, never the key; the server stores only its SHA-256. Session cookies are bearer credentials, too: they are never logged.
  • The CLI has no --key flag; keys come from the protected config file or VELA_KEY.
  • velad logs one structured line per request with method, route, path, status, bytes, duration, request ID, IP and key ID — never the key, the Authorization header, a signature or any query string.
  • The supplied nginx and Caddy configurations log without queries and disable error logs where nginx would record full signed URLs. An end-to-end test inspects the real logs.
  • The Go client strips Authorization and Referer when following redirects, and its network errors omit raw URLs.

Secrets are compared in constant time

API key hashes, signed-link HMACs and upload checksums are all verified with constant-time comparisons. Keys have 256-bit random secrets and the server stores only their SHA-256 hash; a wrong key always yields the same 401 unauthorized, whether the ID or the secret was wrong.

A link's signature covers its ID and expiry, and the exp in the URL must equal the stored expiry. Editing exp produces a 404. Links are never permanent; the maximum lifetime is VELA_LINK_MAX_TTL.

Key prefixes are checked on every operation

List, stat, download, create, upload, patch, delete, both the source and target of a move, the restore target, trash listing, link creation/listing/revocation and directory policies all check the key's prefix. A symlink is checked twice: its own path and its file's current path must both be inside the prefix, when it is created and on every read, so a symlink can never publish or reveal a file outside the key's reach; content is never written through one. Listing an ancestor directory narrows to the key's subtree; unrelated paths get 403; trash entries outside the prefix are 404.

No key management over HTTP

API keys are created, listed and revoked only with velad key on the server. There is no endpoint that could be abused to escalate privileges.

Writes are atomic and verified

Uploads are size-limited and hashed while streaming, checked against X-Vela-SHA256, fsynced and published under a fresh ID before the database row is written. A failed transaction removes the new blob; replaced content is collected only after a grace period and a durability barrier. See Storage Internals.

Resource limits

  • VELA_MAX_UPLOAD is enforced from Content-Length before reading and while streaming chunked bodies; VELA_MAX_CREATE limits inline content; JSON bodies are capped.
  • Request headers have a 10-second deadline and a 128 KiB limit; request bodies have a one-minute per-read idle deadline.
  • Failed authentication is rate-limited per client IP: a bucket of 10 failures, refilled at 10 per minute. Beyond that, 429 rate_limited with Retry-After. Successful requests never consume the budget.
  • Failed web sign-ins have their own budget of five per minute per client IP.

File permissions are explicit

Vela never relies on the umask: database 0600, tmp/ 0700, blob directories 0755 and files 0644 (so nginx accel can read them), backups 0700. The CLI config is 0600 in a 0700 directory — on Windows, a protected DACL for the user and SYSTEM — and the CLI refuses to load a config others can read.

Paths are validated in one place

Every path goes through the same validation: NFC normalization, length limits, no empty or dot segments, no control characters or backslashes, and reserved first segments (api, s, _vela, _blobs, healthz, robots.txt, favicon.ico). Non-canonical API paths are rejected rather than redirected.

The index is locked down

Index and error pages are rendered with Go's html/template escaping and served with a strict Content Security Policy: default-src 'self'; style-src 'self'; img-src 'self' data:; base-uri 'none'; form-action 'none'; frame-ancestors 'none'. Object names and metadata are treated as untrusted text. The sign-in page and pages rendered for a session relax exactly one directive, to form-action 'self', which the sign-in and sign-out forms need.

User-uploaded HTML and SVG

Uploaded files are served with their own content type, so an uploaded HTML page renders as a page and its scripts run. Without web sign-in this is safe by design: the Vela origin has no cookies and no browser session, and the API authenticates only with the Authorization header, so CSRF and session theft are not possible through it. Every response carries X-Content-Type-Options: nosniff.

With VELA_WEB_AUTH=on the origin does hold a session cookie, so Vela sandboxes uploads. Everything except raster images, audio, video, PDF and plain text — HTML, SVG and any XML included — is served with Content-Security-Policy: sandbox allow-scripts allow-forms allow-popups allow-modals allow-downloads in every delivery mode. Pages still render and scripts still run, but in an opaque origin without cookies, storage or same-origin reads, and cross-site posts to the sign-in routes are refused by their origin check. The exemptions are a list of passive types rather than a list of dangerous ones, so unusual types a browser might render as a document are sandboxed too.

If you serve untrusted uploads on a domain that shares cookies with other applications (for example a subdomain of your main site with cookies scoped to the parent domain), those scripts could read them. Give Vela its own domain or make sure no parent-domain cookies exist. Set --disposition attachment on files that should always download.

Your responsibilities

  • TLS termination, certificates and HSTS at the proxy.
  • Trusting exactly your proxy's address in VELA_TRUSTED_PROXIES.
  • Keeping the R2 bucket private and its token scoped to that bucket.
  • Protecting /srv/vela, the env file and backups — they contain signing keys, key hashes and private data.
  • Applying updates and keeping backups independent of live data.

Incident response

SituationAction
A key leakedvelad key revoke <id> — requests fail immediately and its browser sessions end. Create a replacement with the same scope.
A session cookie may have leakedvelad session revoke-all ends every web session at once. Keys keep working.
One signed link leakedvela links revoke <id>. Under R2 redirect, an already issued bucket grant lives until its short TTL.
Many links or the database leakedvelad signing rotate --revoke-all destroys old signing keys and invalidates every existing link.
A file was published by mistakevela vis PATH private takes effect on the next request. Shared caches may hold a public copy for up to five minutes.
R2 credentials leakedRotate the token in Cloudflare, update the env file and recreate the container.

Production checklist

  1. TLS works and HTTP redirects to HTTPS preserving the query: curl -I "http://store.example.com/s/x/y?exp=1&sig=z" shows a Location that still has the query.
  2. curl -fsS https://store.example.com/healthz returns {"status":"ok"}.
  3. A private file's direct URL returns 404 without a key; an unlisted file carries X-Robots-Tag: noindex, nofollow.
  4. Signed-link downloads carry Cache-Control: private, no-store and Referrer-Policy: no-referrer.
  5. Every security header appears exactly once: curl -sI https://store.example.com/ | sort | uniq -d prints nothing.
  6. Access and error logs contain no sig=: grep -r 'sig=' /var/log/nginx/ /var/log/caddy/ finds nothing.
  7. velad logs show your real client IP, not the proxy's.
  8. For accel: curl -I https://store.example.com/_blobs/aa/bb/x is 404 and no X-Vela-* header reaches clients.
  9. The proxy body limit equals VELA_MAX_UPLOAD.
  10. With web sign-in: a private file opened while signed in carries Cache-Control: private, no-store and is 404 in a private window; uploaded HTML carries Content-Security-Policy: sandbox; a CDN in front bypasses its cache for the __Host-vela_session cookie.
  11. Only ports 80/443 are reachable from outside; the container port is bound to loopback.
  12. /etc/vela/vela.env is 0600 in a 0700 directory and not in version control.
  13. Automation uses narrow keys (rw + prefix), not the admin key.
  14. A backup has been taken and restored on a scratch host.

Reporting a vulnerability

Report suspected vulnerabilities privately through GitHub's vulnerability reporting. Include the affected version, deployment mode, impact and a minimal reproduction with synthetic data. Never send production keys, storage credentials or signed URLs. Security fixes target the latest release.