Secrets Management
How secrets are stored, scoped, and kept safe
Bound’s secrets model is designed so that secret values exist in exactly one place, are readable by exactly no one, and reach exactly the workers you choose.
Where secrets live
Your secrets are stored as secret_text bindings on your shop’s own dispatch Worker, set through the Cloudflare API. That has three important properties:
- Write-only. The Cloudflare API never returns secret values — only names. After saving, a value cannot be read back through the API, the app, or the dashboard. Editing a secret means overwriting it.
- Never in Bound’s database. Secret values are never written to Bound’s D1 database or KV storage. The only thing Bound’s database records about a secret is which workers have it enabled.
- Per-shop by construction. The bindings sit on your shop’s dispatcher, inside your shop’s slice of the platform — the same isolation boundary as your workers.
When the dispatcher itself is redeployed (for example, to pick up platform updates), its secret bindings are explicitly preserved, so updates never wipe your secrets.
How secrets reach a worker
A worker receives a secret only when you explicitly enable it on that worker’s page. The allowlist is stored on the worker’s database row and read by the dispatcher on every request:
- The dispatcher resolves the worker’s allowlist from the platform database.
- It copies only those secrets — and only real, existing secret bindings — into the worker’s
this.ctx.props.secretsfor that single invocation. - Everything else on the dispatcher, including every other secret your shop has, is invisible to that worker.
Because the allowlist is resolved per request, enabling or disabling a secret takes effect immediately — no redeploy. Deleting a secret also takes effect immediately: it stops being a binding, so workers stop receiving it on their next request (stale allowlist entries resolve to nothing and are pruned the next time the worker is saved).
Platform secrets
Bound keeps three platform-managed secrets on each dispatcher — SHOPIFY_SHOP_DOMAIN, SHOPIFY_APP_PRIVATE_KEY, and SHOPIFY_STOREFRONT_ACCESS_TOKEN — to authenticate the Admin and Storefront API clients it hands your workers. These are firewalled at every layer:
- Reserved as names — you cannot create or overwrite them.
- Hidden from the Secrets page and the worker’s secret picker.
- Filtered out server-side if ever submitted in a worker’s allowlist.
- Withheld by the dispatcher at runtime — merchant code can neither read nor shadow them, and only ever sees the authenticated RPC clients (
this.ctx.props.admin/this.ctx.props.storefront), never the underlying credentials.
The Admin path deserves special mention: SHOPIFY_APP_PRIVATE_KEY is an ECDSA P-256 key whose public half is registered with Shopify. The dispatcher signs 60-second JWT client assertions with it and exchanges them for short-lived Admin API access tokens, cached briefly per shop and re-minted on rejection. No long-lived admin token is ever stored for this path, and no credential material ever crosses into worker code.
The Storefront token
The Storefront API token is a non-expiring public token, created via Shopify’s Admin API at install time and stored as the SHOPIFY_STOREFRONT_ACCESS_TOKEN platform secret. Its capabilities are deliberately catalog-level — the app’s Storefront scopes cover product listings, tags, inventory, metaobjects, and carts, with no access to orders, customers, or store content. Rotating it from Settings creates a new token, overwrites the secret, and deletes the previous token.
What this means for you
- Treat the Secrets page as the only place values go in — and remember they can’t come out. Keep your own record of any value you might need later.
- Use per-worker enablement as least-privilege scoping: a worker should hold only the keys it uses.
- Deleting the app deletes the dispatcher, and with it every secret binding — values don’t outlive your store’s infrastructure.