More screenshots
Works with the AI Agents you already use
Railway + Supabase Secrets Audit & Key Rotation
If your backends run on Railway, the migration touches every service's variables, so the same pass can find the secrets you forgot about.
$24
Railway + Supabase Secrets Audit & Key Rotation
Example session with this skill installed
Audit the secrets in my Railway project acme-demo (production only) and plan how to get our services onto the new Supabase keys. Start with the read-only part.
- Read your context and instructions
- Compiled the railway + supabase
(Excerpt from a longer session. Fictional demo data.)
Before I run anything, here is how I'll work:
- I will never print a full secret value. Every variable listing is piped through scripts/mask_vars.py, which shows only the first 4 characters, the length, a shape label and a session fingerprint.
- Anything else that could hold a secret (cron jobs, policies, logs, API responses) is reported as names, counts and yes/no flags only.
- I won't write secrets to disk or send them anywhere. Only Railway (your CLI) and your own Supabase project are contacted.
- Nothing changes without your explicit "yes" for that one step, and each step comes with its rollback.
Scope confirmed: acme-demo / production (api, worker, dash) and Supabase project acme-demo-db. Quiet window 09:00-10:00. Rollback targets recorded: api d-51be07, worker d-7c41e2, dash d-0a9f33.
PHASE 1: MASKED INVENTORY
| scope | variable | secret? | shape | masked | fp |
|---|---|---|---|---|---|
| production/api | SUPABASE_SERVICE_KEY | YES | supabase-legacy-jwt:service_role | eyJh…(len=219) | 3f9a1c07 |
| production/worker | SUPABASE_SERVICE_ROLE_KEY | YES | supabase-legacy-jwt:service_role | eyJh…(len=219) | 3f9a1c07 |
| production/api | SUPABASE_ANON_KEY | public-ish (legacy anon) | supabase-legacy-jwt:anon | eyJh…(len=208) | 81d0e2b4 |
| production/api | STRIPE_KEY | YES | opaque-token | rk_t…(len=107) | 9b02d4e6 |
| production/worker | STRIPE_KEY | YES | opaque-token | rk_t…(len=107) | c71e55a0 |
| production/dash | SUPABASE_KEY | YES | text | demo…(len=20) | 77ac0f13 |
PHASE 2: FINDINGS
- Duplicate: fp 3f9a1c07 is the same service_role key in api and worker under two names. You confirmed in the Variables tabs that both are literal copies, not references. Plan: one sealed shared variable SUPABASE_SECRET_KEY, referenced as ${{shared.SUPABASE_SECRET_KEY}}.
- Drift: STRIPE_KEY differs between api and worker. Please tell me which one is current; I won't guess.
- Dead: api/SUPABASE_ANON_KEY has 0 references in the api repo (searched by name; .env files listed by name only).
- Suspicious: dash/SUPABASE_KEY is 20 characters, too short for any Supabase key. The dashboard may already be failing.
- Client readiness: worker has supabase-py 2.18.1 installed (accepts sb_secret keys); api has 2.9.0 and must be upgraded first.
PHASE 5a: SUPABASE AUDIT (read-only)
- B: 12 tables have RLS off and anon INSERT/UPDATE/DELETE. CRITICAL.
- G: 3 RPCs anon can execute, 1 is SECURITY DEFINER.
- H: default privileges make every new table in public anon-writable.
- J: auth.users = 0, so authenticated can be locked down with anon.
PROPOSED PLAN (nothing has changed yet)
- You create a secret key "backend-2026-10-14" in Supabase and paste it into a sealed Railway shared variable. Rollback: delete the shared variable.
- worker: SUPABASE_SERVICE_ROLE_KEY=${{shared.SUPABASE_SECRET_KEY}}, redeploy. Rollback: dashboard Rollback to d-7c41e2; legacy keys stay enabled.
- api: upgrade supabase-py, then the same swap. Rollback: d-51be07.
- Save the grants snapshot, then DB batch L1-1: revoke anon writes on 6 low-traffic tables, keep SELECT. Rollback: restore from the saved snapshot, or run the L1 undo block (one or the other, never both).
- After a 48 h soak and an API-log check for legacy-key traffic, you disable the legacy keys. Rollback: re-enable.
Please answer the STRIPE_KEY question and reply "yes" to item 1 when you're ready.
Connects securely to your tools. The creator never sees your data.
About this skill
Supabase is deprecating the legacy JWT anon and service_role keys by the end of 2026, in favor of publishable and secret (sb_secret_…) keys. If your backends run on Railway, the migration touches every service's variables, so the same pass can find the secrets you forgot about.
This skill gives your agent a phased, confirm-before-every-change procedure, built from a real multi-service production audit. Every change comes with a rollback, and secret values stay masked in the chat.
What your agent does
- Masked inventory of every Railway variable per project, environment and service, plus shared variables. The agent only sees
first 4 chars + length(length only for short values), a value-shape label (legacy JWT and its role, new secret key, DB URL with password, PEM, opaque token…), and a session-salted fingerprint that spots the same secret stored in several places without revealing it. The salt sits in a private temp file, is never shown, and is deleted at the end. - Classification and plan: secrets vs config, duplicates, drift (same name, different value), dead variables checked against your code, unsealed secrets, legacy-key holders, and "keys" that are empty or the wrong length.
- Seal and consolidate into sealed shared variables referenced as
${{shared.NAME}}. You paste values in the dashboard; the agent writes only references, so secret values never pass through a tool call. - One-service-at-a-time cutover to Supabase secret keys (one per backend group, or one shared key): installed-client readiness checks, header-mode tests, a rollback target recorded before each change, and API-log proof that the new key is in use.
- Read-only Supabase audit: tables with RLS off that anon can write to, wide-open policies, views that bypass RLS, sequences anon can
setval, RPCs anon can execute (SECURITY DEFINERflagged), default privileges that make new tables public (on projects that still auto-expose new tables), role membership, and Auth usage. - Undo-ready lockdown batches (revoke writes, close default privileges, sequences, function EXECUTE) with verification after each batch and non-destructive negative tests.
- Soak, then disable legacy keys, with an API-log usage check (Supabase shows no "last used" indicator for legacy keys) and a re-enable rollback.
Safety contract (the agent states it before running anything)
- Never prints a full secret value. Every listing goes through the included offline masker.
- Names, counts and flags only for any text that could hold a secret: cron job commands, policy expressions, function sources, API responses, start commands and logs. No pattern-based redaction, so an odd key format can't slip through. The masker's names-only mode accepts only JSON names (the Railway CLI or tool output) and refuses pasted text rather than guess which words are names.
- Never writes a secret to disk. The report holds names, masks and fingerprints only; the other files are a grants snapshot of plain GRANT statements and a temporary fingerprint salt file that is deleted at the end.
- Never sends a secret anywhere. Apart from installing the Railway CLI if it's missing, network traffic goes only to Railway (your CLI/connector) and your own Supabase project. No telemetry.
- Every state-changing step (set/delete variable, redeploy, REVOKE/GRANT, RLS, disabling legacy keys) is shown with its rollback and waits for your explicit "yes". Approval never carries over to the next step.
- Out of scope by design: rotating the legacy JWT secret, deleting Supabase keys, changing row data, billing.
What's in the pack
| File | Purpose |
|---|---|
SKILL.md | The core: safety contract, scope, overview of the 8 phases, Phases 0-2, and which phase file to read when |
phases/ | One file per later step (salt setup, names-only inventory, code scans, Phases 3-7) with checklists, verification and rollback, read only when the agent reaches that phase |
gotchas.md | 36 real-world failure modes (staged shared vars that resolve empty, connectors that redact secrets into placeholders, old clients that reject non-JWT keys, the PATCH {} test that proves nothing…) |
supabase-audit.sql | Read-only audit queries (sections A to K, incl. column-level grants) with a rollback-snapshot generator |
supabase-lockdown-templates.sql | Apply/undo templates for approved batches, plus verification queries |
audit-report-template.md | The value-free report your agent fills in |
scripts/mask_vars.py | Offline masker/classifier for Railway variable JSON, plus a names-only mode that takes only JSON names and refuses pasted text (stdin only, no network, no files) |
scripts/supabase_probe.sh | Optional non-destructive PostgREST probes against your own project URL |
What you get at the end
A masked variable table with findings, a list of Supabase exposure issues each paired with a fix and its undo, services moved to the new keys one at a time with verification results, and a filled-in audit report with no secret values in it.
Who it's for
Indie developers and small teams running Supabase-backed apps on Railway who need to migrate keys, clean up secrets, or harden RLS and grants before going public. Railway-only and Supabase-only setups are covered by a subset of the phases, and it should work on Windows (PowerShell or Git Bash); not yet tested on Windows hardware. The optional probe script needs WSL or Git Bash.
By Mausoft Skills. Railway and Supabase are trademarks of their respective owners; this skill is not affiliated with or endorsed by them.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.
Version 1.0 by Mausoft Skills.
Pack contents: SKILL.md (safety contract, scope, overview of the 8 phases, Phases 0-2), phases/ (salt setup, names-only inventory, code scans, Phases 3-7 with checklists, verification and rollback), gotchas.md (36 documented failure modes), supabase-audit.sql (read-only sections A-K), supabase-lockdown-templates.sql (apply/undo/verify), audit-report-template.md, scripts/mask_vars.py, scripts/supabase_probe.sh, README.md.
No packages to install. No API keys of ours, no telemetry, no hosted service.
Install: the zip has no top folder (SKILL.md is at its root). Run mkdir -p ~/.claude/skills/railway-supabase-secrets-audit && unzip railway-supabase-secrets-audit.zip -d ~/.claude/skills/railway-supabase-secrets-audit (Cursor: ~/.cursor/skills/railway-supabase-secrets-audit; other agents: their skills folder, often .agents/skills/railway-supabase-secrets-audit). Double-click unzip on Mac or Windows creates the folder for you; it must be named exactly railway-supabase-secrets-audit.
Typical run: Phases 1-2 and the read-only Supabase audit fit in one session; changes are applied one service or batch at a time in quiet windows you choose.
Railway and Supabase are trademarks of their respective owners. This skill is not affiliated with or endorsed by them.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 21 days ago
- Accounts
Supabase MCP
orSQL editororpsql- Software
- Railway CLIor
Railway MCP
Python 3
- Optional
- Bashcurlripgrep
Log in to the Railway CLI. Python uses only the standard library. Bash and curl are only for the probe script; ripgrep scans your code for variable names.
Permissions
Allowed Hosts
File Scopes
Security disclosure: this skill handles secrets by design, so it is built to never expose them. All variable listings pass through scripts/mask_vars.py, which reads stdin only, imports no network modules, opens and writes no files, and outputs only the first 4 characters plus length (length only for values under 20 characters), a shape label and an HMAC fingerprint keyed with a random per-audit salt kept in a private temp file, never shown, and deleted at the end (no fingerprint for values under 20 characters, with low variety, or holding an embedded credential such as a URL with a password, so they can't be guessed from it). Its names-only mode accepts only JSON names and refuses pasted text. The agent never carries a new secret value through a tool call: you paste values in the Railway/Supabase dashboards and the agent writes only ${{shared.NAME}} references. The optional supabase_probe.sh calls only the SUPABASE_URL you set, keeps the key off the command line, prints only the HTTP status, body size, top-level JSON key names from a fixed allowlist (other keys are only counted) and the error code when it is exactly 42501 or PGRST plus three digits (never the response text), and uses non-destructive requests (GET limit 1, POST with an empty array). Its optional rpc mode really runs the named function, so it works only in an interactive terminal after you retype the function name. The skill does not read .env contents, shell history, credential stores, cookies, or other services' tokens. Every state-changing step requires your explicit confirmation, one step at a time, with a rollback shown first. Security scan notes: automated scanners may flag a few things here, and they are expected. The skill reads environment variable names and masks values by design. The probe script's curl sends your own key only to your own Supabase URL, in headers fed to curl through stdin, so the key never appears on a command line. Strings such as sk_live_, AKIA and ghp_ in the files are detection patterns used to classify values, not keys.