Skip to content

Treat production DOMAINS as a Worker secret and drop keep_vars - #63

Merged
stc93025mn merged 3 commits into
mainfrom
cursor/domains-worker-secret-5b50
Sep 29, 2026
Merged

stc93025mn merged 3 commits into
mainfrom
cursor/domains-worker-secret-5b50

Conversation

@stc93025mn

@stc93025mn stc93025mn commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Closed draft #62 committed production DOMAINS into wrangler.jsonc vars. That approach is forbidden in this public repository.

This PR takes the fleet direction (config owns plains; drop keep_vars) without putting the domain list in git:

  • Drop keep_vars from wrangler.jsonc and --keep-vars from pnpm deploy:cloudflare.
  • Treat production DOMAINS as a Cloudflare Worker secret, not a plain var.
  • Declare secrets.required: ["DOMAINS"] so Builds/wrangler deploy fails closed if the secret is missing.
  • Keep real domains out of git, wrangler vars, docs examples, and tests. Tests and .dev.vars.example stay on example.com / example.org / example.net.

Runtime is unchanged: src/index.ts still reads env.DOMAINS as a comma-separated string. Secrets bind the same way.

Security floor (unblocks merge)

The org Public Token-Free Security ruleset requires the Security workflow to pass. osv-scanner reported 2 high-severity (≥7.0) groups on fast-uri@3.1.6:

This matches prior security-floor PRs (#61 hono, #59 @humanfs/node, #58 adm-zip): raise the pnpm-workspace.yaml override to the official first-patched 3.x release (fast-uri@>=3.0.0 <3.1.7: 3.1.7) and refresh the lockfile so ajv's transitive fast-uri is 3.1.7. Secrets / keep_vars / README work is unchanged. No real domains. No deploy.

Local osv-scanner after the pin: 0 groups with max_severity >= 7.0. Remaining findings are below the ruleset floor (ip-address 6.9/6.3, qs 6.3, undici 5.9).

Primary user-facing guidance

README.md Production DOMAINS secret is the operator and fork guide:

  • Production DOMAINS is a Cloudflare Worker secret.
  • Set or rotate via dashboard Settings → Secrets or wrangler secret put DOMAINS.
  • Never commit the value. Real domains stay out of this public repo.
  • Tests and .dev.vars.example use only example.com / example.org / example.net.

Quick Start, local/dev, deploy, and add/remove-domain sections link to that section. AGENTS.md and CLAUDE.md defer to it.

Why a secret

The one "plain" that would have lived in config is sensitive inventory (which domains this Worker serves). Making it a secret lets us remove keep_vars (unsupported by the cf CLI) without committing the list.

Ops before first Builds deploy after merge

Convert the existing dashboard plain DOMAINS variable to a secret first (see README). Secrets survive deploys; leftover plains do not once keep_vars is gone.

Adding a domain is the same as before, except the list is a secret: update the Worker secret, then dashboard routes and openpgpkey DNS.

Do not set or rotate the secret from GitHub Actions or a Cloud Agent. This PR does not deploy, touch DNS, or use CLOUDFLARE_API_TOKEN.

Docs

No sibling MNPPI Workers used secrets.required; this follows the official Wrangler secrets configuration property so Builds fails closed instead of shipping a Worker that 500s on missing DOMAINS.

Verification

Local checks on this branch (example domains only; no deploy):

  • pnpm run format:check — pass
  • pnpm run typecheck — pass
  • pnpm run lint — pass
  • pnpm run coverage — 17/17 tests pass, 100% statements/branches/functions/lines
  • pnpm run knip — pass
  • pnpm cf:check (wrangler deploy --dry-run) — pass; dry-run reports no config bindings (the secret is not in vars) and does not deploy

Wrangler 4.123 warns that the secrets field is experimental. Tests bind example DOMAINS via vitest.config.ts, so the local-dev "missing required secrets" warning does not fail CI.

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 29, 2026 02:30
keep_vars is unsupported by the cf CLI and this public Worker has no
dashboard-only plains left. DOMAINS is sensitive inventory, so it is a
Worker secret rather than wrangler vars. secrets.required lists DOMAINS
so Builds fails closed when the secret is missing. Real domains stay
out of this public repository.

Co-authored-by: Mark Danielson <stc93025mn@users.noreply.github.com>
Add a dedicated Production DOMAINS secret section that tells operators
and forks how to set or rotate the secret (dashboard Secrets or
wrangler secret put DOMAINS), never commit the value, and keep
example.com / example.org / example.net only in tests and
.dev.vars.example. Agent docs point at that section.

Co-authored-by: Mark Danielson <stc93025mn@users.noreply.github.com>
@stc93025mn
stc93025mn marked this pull request as ready for review September 29, 2026 02:47
@stc93025mn
stc93025mn enabled auto-merge (squash) September 29, 2026 02:47
Raise the existing fast-uri 3.x floor from <3.1.5 to official 3.1.7 so
ajv's transitive fast-uri resolves the GHSA-58mr-gqgx-xq4g /
GHSA-qw65-cvwx-89v3 first_patched release. The prior ^3.1.5 override
still resolved 3.1.6, which osv-scanner scores as two 7.5 groups.

Co-authored-by: Mark Danielson <stc93025mn@users.noreply.github.com>
@stc93025mn
stc93025mn merged commit c9ace23 into main Sep 29, 2026
11 checks passed
@stc93025mn
stc93025mn deleted the cursor/domains-worker-secret-5b50 branch September 29, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants