Skip to content

Security: Ogrods/BAKLOG

SECURITY.md

Security model

BAKLOG is a local-first desktop tool. Library JSON, credentials, and personal data stay on the user's machine by default. The project hosts a marketing site and optional Pro APIs on baklog.app (Vercel + Supabase); those never receive store credentials. No telemetry by default. Opt-in anonymous aggregate metrics are available in Settings (Connections). This document is the threat model: what BAKLOG defends, what it explicitly does not, and the cryptography behind the claims. For the plain-language data inventory and network-host list, see PRIVACY.md.

Optional account sign-in: When BAKLOG_SUPABASE_* is set, Supabase hosts login only (email + JWT). Your library and Connections secrets still live under profiles/<user-id>/ on the machine running server.py. Configure BAKLOG_SUPABASE_URL and BAKLOG_SUPABASE_ANON_KEY in .env (prefer a publishable sb_publishable_… key; see .env.example). Access tokens verify via JWKS. Do not ship BAKLOG_SUPABASE_JWT_SECRET in release bundles.

Last updated: 2026-11-25.

Threat-model summary

  • Local-first posture: Store credentials and library JSON live under profiles/ on the machine running server.py. baklog.app never holds store secrets; optional Pro mirror uploads are allowlisted catalog/personal JSON only.
  • CDP / session gray area: Some stores are reached by replaying your headed browser session (your IP, your cookies). That is intentional and documented per store below; it is not a claim of ToS-clean access for every storefront.
  • Explicit non-claims: BAKLOG is not a multi-tenant credential vault, not malware-resistant, and not a guarantee that every fetcher is permitted under every storefront's terms. You run gray paths at your own risk.

TL;DR

  • Your store credentials are generated, used, and stored only on your machine. There is no central BAKLOG datastore of game libraries or store secrets to breach.
  • Storefront logins run from your own browser session and IP, not from a shared cloud — so they look like you, not like a bot farm hitting thousands of accounts from a datacenter.
  • The credential document is encrypted at rest (AES-256-GCM) with a key held in your OS keychain. An optional master password derives the key via scrypt instead.
  • Store credentials never leave your machine. Catalog traffic you initiate to storefronts stays yours; optional Pro Cloud sync and deal-alert background refreshes only move allowlisted catalog/personal JSON or call storefronts from your IP - never secrets.bin.

Trust boundary

flowchart LR
  subgraph machine [Your machine - trusted]
    browser["Browser tab (localhost UI)"]
    server["127.0.0.1 Python server"]
    fetchers["Fetchers + CDP browser"]
    secrets["cache/auth/secrets.bin (AES-256-GCM)"]
    keychain["OS keychain (master key)"]
    data["games_*.json / personal.json / localStorage"]
    browser <--> server
    server --> fetchers
    fetchers --> secrets
    secrets --> keychain
    server --> data
  end
  subgraph outside [Outside - untrusted]
    stores["Storefront + enrichment APIs"]
  end
  fetchers -->|"your credentials, your IP"| stores
Loading

Everything inside the machine boundary is assumed to run as your OS user. BAKLOG's security goal is that nothing crosses the boundary except the storefront calls you ask for and the files you explicitly export. Optional Supabase auth adds a small hosted login box (credentials stay on your machine). Pro users can optionally opt into a read-only cloud mirror of catalog JSON (games_*.json, prices, personal statuses) to a private Supabase Storage bucket for browsing at baklog.app/mirror and importing onto another PC. That viewer lives on baklog.app under web/mirror/ as an opt-in Pro surface: data appears there only after the signed-in Pro user enables Cloud sync and uploads. Credentials, cache/, and secrets never leave the machine. Mirror upload is off by default, gated behind Connections → Cloud sync with a blocking risk confirm. Individual objects are capped at 25 MiB in the app and the baklog-mirror bucket. Comp-Pro emails on BAKLOG_COMP_PRO_EMAILS pass the hosted Vercel gate, but Storage RLS still requires a Pro plan claim on the JWT - sign out/in once after a grant so app_metadata.plan refreshes. Do not weaken Storage RLS to an email allowlist without a separate security review. Pro users can Clear cloud library from Connections (confirm required) to delete synced catalog and personal files from their account storage; local files and credentials stay on the PC.

Policy: no personal library data is hosted unless the signed-in Pro user opted into Cloud sync. Default remains local-only.

Assets we protect

Asset Where it lives Sensitivity
API keys (Steam, OpenXBL, ITAD, HLTB) .env, encrypted secrets doc High
Session cookies / NPSSO (GOG, PSN, Xbox, Ubisoft, itch, Epic storefront) .env, CDP browser profiles (cache/auth/profiles/), encrypted secrets doc High
OAuth refresh tokens (Epic, Battle.net, Nintendo) cache/<store>/session.json, OS keychain, encrypted secrets doc High
Library / wishlist data games_*.json, itad_prices.json Low
Personal annotations (status, notes, priority) data/personal.json, localStorage Low–medium

The design treats credentials as high-value and catalog data as low-value, and keeps them separable — that split is what makes any future opt-in catalog sync possible without ever moving a credential.

Cryptography

Credential document at rest (cache/auth/secrets.bin)

  • Cipher: AES-256-GCM (cryptography AEAD), fresh random 12-byte nonce on every write, authentication tag verified on read.
  • Key, default: 32 random bytes from a CSPRNG, stored in the OS keychain via keyring (Windows Credential Manager / DPAPI, macOS Keychain, Linux Secret Service).
  • Key, master-password mode: derived from your passphrase with scrypt (N=2¹⁴, r=8, p=1, 32-byte key) over a random 16-byte salt; the derived key is never written to disk.
  • Fallback: if no keyring backend is available, the random key is written to cache/auth/.master_key. This is weaker (a plaintext key file protected only by OS file permissions) — see residual risks.

Source: auth/secrets.py.

Portable secrets bundle (export/import)

  • Format: magic BAKLOGSB, version byte, scrypt parameters, 16-byte salt, 12-byte nonce, then AES-256-GCM ciphertext.
  • Always passphrase-encrypted (minimum 8 characters) with scrypt (N=2¹⁴) + AES-256-GCM, independent of the local keychain/master key, so a bundle is safe to carry on a USB stick or email to yourself.
  • Losing the bundle passphrase is unrecoverable by design — there is no reset path and no escrow.

Source: auth/bundle.py.

Containment guarantees

  • Credentials are never written into games_*.json, never logged in plaintext to stdout, and never included in the "Copy bug bundle" payload (which is a strict field whitelist — see PRIVACY.md).
  • The local server binds to 127.0.0.1, so it is not reachable from other machines on your network by default.
  • Mutating localhost API routes require X-BAKLOG-Local: 1 (or a verified Supabase bearer when auth is on). Origin/Referer alone is never enough.

Polar billing (hosted)

Pro checkout runs through Polar. The Vercel route web/api/polar-webhook.js verifies Standard Webhooks HMAC signatures (constant-time compare, timestamp tolerance), rejects oversized bodies, and writes plan into Supabase app_metadata only (never user_metadata, which clients can edit). Unmatched checkouts land in a pending-entitlements table and apply on confirmed signup with the same email. past_due keeps Pro during Polar's payment retry window; refund/revoke clears it. Secrets (POLAR_WEBHOOK_SECRET, service role key) live in Vercel env only.

Deal alerts (local)

Opt-in Pro deal alerts use localhost routes (GET /api/deal-alerts/pending, POST /api/deal-alerts/ack) gated by Host localhost + X-BAKLOG-Local: 1. The tray polls those routes; they must not be exposed beyond the machine. Wishlist price and free-claims refreshes still run as your local fetchers.

Cloud mirror allowlist

Uploads and hosted /api/mirror reads are limited to games_*.json, itad_prices.json, and data/personal.json (shared regex in Python, desktop JS, and web/api/_mirror-helpers.js). Paths under cache/, auth/, or secrets.bin are denied. Supabase Storage RLS requires a Pro JWT and isolates objects under auth.uid().

How BAKLOG reaches each store

Every fetch runs locally, authenticated as you, against your own account — never a shared server or pooled credential. What differs per store is how the request is authorized. The posture below, weakest-to-strongest from a terms-of-service standpoint:

Store Method ToS posture
Steam Official Steam Web API key (yours) Sanctioned — documented public API
Xbox OpenXBL API key (yours) Sanctioned — third-party API you authorize
ITAD / HLTB Official/public API Sanctioned
Epic Official OAuth (community launcher client) + your auth code Tolerated — official OAuth, well-known client id
GOG (web), PSN, Ubisoft, Amazon (web) Replay your own web session cookie/token Gray — same calls your browser makes; automated locally
itch (API key) Official itch.io API with your key Gray — sanctioned API, your credentials
Amazon Games, GOG Galaxy, itch butler Read your own launcher SQLite on disk (read-only, no network) Local read — Amazon launcher DB is DPAPI-encrypted (Windows launcher only); Galaxy and butler are plain SQLite from your install. On macOS/Linux use Prime Gaming web for Amazon.
Nintendo, Humble, Epic wishlist, Xbox wishlist Headless replay of your own saved browser profile Gray — your session, your data, your IP
Battle.net Unofficial endpoint with your own session Gray
EA App Replays your own ea.com web-session Bearer token (sniffed from your saved profile) and calls the same GraphQL endpoint ea.com itself uses Gray — your session, your data; no desktop-client impersonation and no baked-in EA secret

Design rule for the gray rows: BAKLOG only ever replays a session you established yourself and only reads your own account's data. It does not ship stolen/first-party client secrets, does not solve CAPTCHAs for you, does not pool requests across users, and does not redistribute fetched catalogs.

EA specifically: an earlier draft authenticated by impersonating EA's desktop app (a hardcoded client secret + pc_sign token). That was replaced with the web-session-replay approach above so the "this is just me, automated" framing stays literally true. The token BAKLOG uses is the exact one ea.com hands your browser when you log in.

This is automation of your own access, not third-party scraping. It still runs at your own risk under each store's terms — see the out-of-scope note below.

What is explicitly out of scope

BAKLOG is not trying to defend against these, and you should not assume it does:

  • A local attacker or malware running as your OS user. Anything with your user privileges can read the OS keychain and decrypt the secrets doc, exactly like any other app you have logged into. Full-disk encryption and a secure OS account are your responsibility.
  • Plaintext .env and browser profile cookie jars. Some credentials live in .env and cache/auth/profiles/<store>/ as the storefronts' own cookie files. These are protected by OS file permissions, not by BAKLOG encryption.
  • The .master_key fallback when no keychain exists — a key file on disk. Prefer a real keychain or enable the master password.
  • Browser localStorage. Anything that can read the served origin can read your annotations and UI prefs there. It holds no credentials.
  • Shared-family profile switching without a PIN. Optional per-profile PINs (Manage profiles) gate switching when BAKLOG_LOCAL_PROFILES=1 is set alongside Supabase auth. Without a PIN, anyone at the keyboard can switch profiles while the app is open.
  • Cross-profile secrets if the OS keyring master key is compromised. Each profile's secrets.bin uses a derived subkey (HKDF from the shared keyring master + profile id). Sibling profiles cannot decrypt each other's blob from disk alone, but a full keyring compromise still unlocks all profiles.
  • Storefront terms of service and account flagging. Automated fetches run under your account at your own risk. Replaying only your own session from your own IP (see How BAKLOG reaches each store) is a mitigation, not a guarantee — several stores' terms restrict any automated access regardless of whose data it is.
  • Supply-chain / dependency compromise. Standard for any local app; pin and review what you install.
  • Exposing the server yourself (binding to 0.0.0.0, port-forwarding, or sharing the port) moves the trust boundary and is on you.

Why local-first is the security posture, not just a preference

A hosted version would have to hold every user's live storefront sessions — sessions tied to payment methods — in one place. That central store is the single most valuable thing an attacker could target, and it would not exist if the product were not hosted. By keeping auth and fetching on each user's machine:

  • there is no honeypot: a breach of the project compromises no user secrets, because the project holds none;
  • storefront fraud systems see a normal user from a residential IP, not one server logging into thousands of accounts;
  • the blast radius of any single mistake is one machine, not the user base.

Reporting a security issue

Email the author at the address in pyproject.toml for issues that could expose someone else's data or credentials. Issues that only affect your own local files are fine as regular GitHub issues. Please do not open public issues for anything that could put another user's storefront accounts at risk.

There aren't any published security advisories