> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tuturuuu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Shared secret write

> Dispatch-only workflows that generate one secret value and write it to every consumer without a human, a file or a log ever holding it.

Some secrets are verified by more than one runtime: the web project on Vercel
signs, and Cloudflare Workers verify. Both sides must hold the same value, and
no person, file or log should ever see it. Two workflows generate or create the
value inside one job step, hand it to every destination over stdin, and read the
result back by name and type.

| Workflow | Writes | Environment |
| - | - | - |
| `shared-secret-write.yaml` | One of the listed secrets to Vercel and to the Workers that verify it | `shared-secret-staging`, `shared-secret-production` |
| `supabase-family-key.yaml` | A new `cf-web-families` Supabase secret key to `SUPABASE_SECRET_KEY` on opted-in web route family Workers | `supabase-family-key` |

## Shared secret write

Inputs are two choices: `secret` and `environment`. There is no free-text input.

| `secret` | Vercel (web project `prj_RlDllxkTSo5mjpzycCRQY4tGONYu`) | Worker binding |
| - | - | - |
| `ABUSE_GUARD_SECRET` | `ABUSE_GUARD_SECRET` | `ABUSE_GUARD_SECRETS` on `tuturuuu-abuse-guard` |
| `WEB_MULTI_ACCOUNT_SESSION_SECRET` | `WEB_MULTI_ACCOUNT_SESSION_SECRET` | The same name on each web family Worker with auth |

Vercel variables are written `sensitive` on the `production` target, or on
`preview` for `staging`. Worker names for `staging` carry a `-staging` suffix.
The web family Workers are the `worker` entries of
`apps/web/cloudflare/opennext/families.json` at the checked-out commit (skipping
`enabled: false`, and `auth: false` for this secret). While that file does not
exist the list is `tuturuuu-web-api-identity`.

The job refuses to run unless it is dispatched on `main` from a commit that
descends from `018eecf2` (the abuse-guard `ratelimit` family). In order, one
step:

1. `preflight`: every target Worker exists and the Cloudflare and Vercel
   credentials are present. Nothing is written if a Worker is missing.
2. Generates the value with `openssl rand -base64 48`, masks it with
   `::add-mask::`, and keeps it in one shell variable.
3. Pipes it on stdin to the Vercel write, then to every Worker write.
4. Unsets the variable.
5. `verify`: Vercel has exactly one `sensitive` entry for the key on the target,
   and each Worker has exactly one `secret_text` binding of that name. Output is
   names and types only; any mismatch fails the job.

Re-running the job rotates the value everywhere. For `ABUSE_GUARD_SECRET` that
means the Worker accepts only the new value as soon as the Worker write lands,
so run it with the web deploy ready to pick up the Vercel value.

The writes use the Cloudflare and Vercel REST APIs from
`scripts/ci/shared-secret-api.mjs`, with the value only in a request body. No
command line, URL, header, environment file, step output, artifact or cache holds
it, and error messages carry the HTTP status and numeric provider codes only.

Credentials, by name, from the protected environment: `COLAB_CLOUDFLARE_API_TOKEN`
(a Cloudflare token that can edit the Workers in account
`e8912e2867beecc673d171907bf09649`), `VERCEL_TOKEN` and `VERCEL_ORG_ID`.

## Supabase family key

`supabase-family-key.yaml` takes `action: create` or `action: revoke`.
For `create` it
runs `preflight` (every selected Worker exists, and no key named
`cf-web-families` exists), creates the key (`type: secret`) in the production Supabase project, masks
the returned value, pipes it to `SUPABASE_SECRET_KEY` on each selected Worker, and
reads back the key name, id and type plus each Worker secret name and type. A
second run stops at `preflight`; it never creates a second key. If a Worker write
fails after key creation, use `revoke` before attempting `create` again.

Under the same protected job, `revoke` resolves the unique secret key by its
exact mint name, `cf-web-families`, deletes it by ID and confirms it is absent.
A missing key is already revoked. Revocation invalidates the key on every
recipient immediately. Worker binding names remain in place until they are
overwritten by a subsequent create. Both actions require the environment's
dedicated credential to be present. The revoke branch unsets it before calling
Supabase and can run when family configs are missing.

A family is selected only if `supabaseSecret: true` is set in
`apps/web/cloudflare/opennext/families.json`. Routing's `enabled` flag is
independent. Each opted-in family config must declare its exact Worker name,
the reviewed Cloudflare account and `SUPABASE_SECRET_KEY` as required.
All family Worker configs set `APP_COORDINATION_TOKEN_DISABLE_SUPABASE_FALLBACK=1`
so a database key cannot sign or verify app coordination tokens. Required
coordination secrets must be provisioned independently before activation.
A missing or mismatched config blocks key creation for the entire set.
The `public-docs` family stays outside this key's recipient set.

Provision the `supabase-family-key` GitHub environment with required reviewers,
admin bypass disabled and a single custom deployment policy for the branch
`main`. Place `SUPABASE_FAMILY_KEY_CLOUDFLARE_API_TOKEN` in that environment
with Workers Scripts:Edit only for account `e8912e2867beecc673d171907bf09649`.
The workflow uses the existing repository secret `SUPABASE_ACCESS_TOKEN`.
Both credentials stay in the operator step, with shell tracing disabled and
masking configured before the provider scripts run.

## Operator token

The abuse-guard operator token (`ABUSE_GUARD_OPERATOR_TOKEN`, used for
`/control/stop`, `/control/resume` and `/control/state`) is not written by these
workflows. Whoever needs a copy regenerates it through the Cloudflare deploy path
and keeps it in a mode `0600` file.

## Regression coverage

`scripts/ci/shared-secret-write.test.mjs` pins the workflow contract (dispatch
only, choice inputs, `main` guard, the commit floor, protected environments,
read-only token, existing full-SHA action pins, credentials by name, mask before
first use, the value only on stdin, no `--value`, no `echo`, no Wrangler) and
exercises the scripts with a provider double: the value appears only in write
bodies, never in URLs, headers, output or error text, and every readback fails
closed on a missing, duplicate or wrongly typed entry.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.