Skip to content

Secrets

Name Location Purpose
CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID GitHub Actions environment or repository configuration Authorize deployment and identify the Cloudflare account
GITHUB_APP_PRIVATE_KEY pipeline Worker secret Obtain GitHub App installation tokens
GITHUB_OAUTH_CLIENT_SECRET, BETTER_AUTH_SECRET API Worker secrets GitHub sign-in and session signing

GITHUB_APP_ID and GITHUB_INSTALLATION_ID are environment variables. Local development uses Git-ignored .dev.vars files. Record only secret names and operation results in logs, tickets, and rotation records.

If the Access API reports Access is not enabled, have an account administrator open Zero Trust in the Cloudflare dashboard, create the organization, and choose its team name and plan. The team domain looks like https://<team>.cloudflareaccess.com. To create an organization through the API, the token needs Access: Organizations, Identity Providers, and Groups Write. Cloudflare Zero Trust setup · API permissions for creating an organization

  1. Create a Cloudflare Access application that protects the entire admin HTTPS host, and bind that host to dshu-preview-admin. Record the Zero Trust team URL, including https://, and the application’s audience.
  2. Register a GitHub OAuth App for Preview. Set its callback to <ADMIN_ORIGIN>/admin/auth/callback/github, using the HTTPS origin of the admin host.
  3. Run the following commands and enter each value at the prompt. The bindings persist across later Wrangler deployments. Reuse the existing session signing key if the environment already has one.
终端窗口
pnpm --filter @dshu/admin exec wrangler secret put ACCESS_TEAM_DOMAIN --env preview --config wrangler.jsonc
pnpm --filter @dshu/admin exec wrangler secret put ACCESS_AUD --env preview --config wrangler.jsonc
pnpm --filter @dshu/api exec wrangler secret put ADMIN_ORIGIN --env preview
pnpm --filter @dshu/api exec wrangler secret put GITHUB_OAUTH_CLIENT_ID --env preview
pnpm --filter @dshu/api exec wrangler secret put GITHUB_OAUTH_CLIENT_SECRET --env preview
pnpm --filter @dshu/api exec wrangler secret put BETTER_AUTH_SECRET --env preview # first-time setup
  1. Open the admin host in a signed-out browser and verify that Cloudflare Access prompts for sign-in. Sign in to GitHub as the provisioned owner, then use a test listing to verify permissions, takedown timing, and the audit record.

Generate a replacement, install it in the target environment, verify the affected integration, and revoke the old value. Revoke a suspected leaked credential immediately. Keep deployment and sync credentials scoped to the intended environment and record the date, scope, and result. See environments.