This page describes what Pinakes protects, how, and what it does not protect against. To report a vulnerability, contact the repository owner privately; don't open a public issue.
| Asset | Protection |
|---|---|
| File contents | Encrypted on the server before upload: 64 MiB chunks of 1 MiB AES-256-GCM segments under a random per-file key. Google only stores .pnk objects it cannot read. Tampering, truncation, reordering or swapping chunks between files fails authentication on download, and a download never returns unverified bytes |
| Per-file keys, OAuth tokens, saved sign-ins, share unlocks | Sealed with AES-256-GCM under keys derived (HKDF-SHA-256) from the master key, with a separate key per purpose and each item bound to its ID |
| Master key | A file in PINAKES_DATA_DIR (mode 0600, directory 0700, uid 65532). It is not stored in MongoDB, and the database records its fingerprint so the app refuses to start with a different key |
| Passwords | Argon2id (19 MiB, 2 iterations, 1 lane), compared in constant time; minimum 6 characters |
| Recovery bundles | Argon2id-derived key + AES-256-GCM, with a passphrase of at least 12 characters, separate from the login password |
Google sees encrypted objects, their sizes and creation times, and when they are read. It does not see file names, folder structure, users or contents.
Someone with the server's disk (the database and the master key) can decrypt everything. Keep the host physically secure and its disk encrypted if that matters to you.
-
First account. On an empty database, the first registered account becomes the Owner. This happens in a transaction guarded by a unique index, so two simultaneous registrations can't both become Owner. A database that can't be reached is never treated as empty. Registration is then closed until the Owner opens it.
-
Sessions.
- Random 256-bit tokens in an
HttpOnly,SameSite=Laxcookie (SecureunlessPINAKES_COOKIE_SECURE=false). - Only a SHA-256 of the token is stored.
- Sessions last 14 days. Each user can list their signed-in devices and sign them out (Settings → Signed-in devices). Changing the password ends all other sessions.
- Random 256-bit tokens in an
-
Fresh confirmation. Re-entering the password opens a 5-minute window, for the current session only, for sensitive actions:
- the credential vault,
- the recovery bundle export,
- deleting orphaned chunks.
-
Rate limits. Each counter allows 10 attempts per 15 minutes:
- sign-in, counted per IP address and per username,
- registration, per IP address,
- password changes and confirmations, per user,
- share-link passwords, per IP address and link.
All public share requests also share a limit of 300 per minute per IP address.
-
Disabled accounts. They are rejected on every request, not only at login.
-
Password reset. The Owner can reset other users. A forgotten Owner password is reset from the server shell (
reset-password), which requires host access.
http.CrossOriginProtectionrejects cross-origin state-changing requests, based onSec-Fetch-SiteandOrigin.- Content-Security-Policy:
default-src 'self'andscript-src 'self', with no inline scripts or styles,object-src 'none',base-uri 'none',form-action 'self',frame-ancestors 'none'.
- Also set:
X-Frame-Options: DENY,X-Content-Type-Options: nosniff,Referrer-Policy: no-referrer,Cross-Origin-Opener-Policy: same-origin,- a restrictive
Permissions-Policy.
- File previews and downloads get
Content-Security-Policy: sandbox; default-src 'none'. A stored HTML or SVG file can't run script in Pinakes' origin. - Client IP headers (
PINAKES_CLIENT_IP_HEADER) are honored only fromPINAKES_TRUSTED_PROXIES.
- Scope. Pinakes uses OAuth with the
drive.filescope, so it can only see files it created. - Consent flow.
- PKCE (S256).
- A single-use state, stored server-side, expiring, and bound to the browser by a cookie and to the Owner who started it.
- Reconnecting. Reconnecting identifies the Google account by its stable ID. Signing in with a different account is refused, and the grant that account just gave is revoked at once.
- Classifying failures. An account is marked sign-in required only after a forced token refresh is rejected by Google. Network failures and outages never trigger that.
- Behaving within Google's limits. Pinakes:
- stays at half of Google's per-minute quota units, per account and per project,
- retries only idempotent calls, with jittered backoff,
- stops downloads at a daily egress cap (900 GiB by default),
- never rotates accounts or spreads traffic to evade provider limits.
- Removing an account. The grant is revoked at Google.
The vault is optional and off by default. Saved details are sealed with a master-key-derived key and never stored in plain text. Revealing them needs the Owner's password again and is logged. Pinakes never uses them to sign in to Google and never sends them anywhere: the UI only shows and copies them, and opens Google's sign-in page for you to paste them. Don't store server or Pi administrator passwords there.
By default nothing is exposed to the internet:
- MongoDB isn't published,
- the app listens on the LAN,
- share links are off.
HTTPS can be added with Tailscale Serve (tailnet only) without a domain; see DEPLOYMENT.md. Exposing the app publicly, with a reverse proxy or Cloudflare, is your decision and is not needed for OAuth.
Both containers have memory limits and rotating logs.
- App:
- read-only root filesystem, with
tmpfsat/tmp, - no Linux capabilities and
no-new-privileges, - non-root distroless image.
- read-only root filesystem, with
- MongoDB:
no-new-privileges,- authentication with a keyFile and a least-privilege app user (
readWriteonpinakesonly).
Sign-ins, failed sign-ins to existing accounts, failed password confirmations, session sign-outs, the Owner registration and password changes and resets are recorded. So are vault reveals, recovery exports and backups, Drive connections, reconnections and wrong-account refusals, share activity, orphan deletions and storage jobs. Entries are kept for 180 days. Secrets, tokens and Google's raw error messages are never logged.
- File and folder names, sizes and the folder tree are stored unencrypted in MongoDB on your server.
- The master key lives on the same host as the database; the protection is against Google and network attackers, not against someone who controls the server.
- There is no two-factor authentication yet.
- Share links with a password protect the link, not the file at rest. Anyone with the link and password can download until it expires or is revoked.