Skip to content

AI Prompt: Post-quantum readiness checkup

How to use

Paste the prompt into your agent's chat, or save it to your project's instructions file (such as AGENTS.md) so your agent follows it every time.

Prompt

# Post-quantum readiness checkup
Check this project against Supabase's guidance for the move to post-quantum cryptography, and write a short report.
## Ground rules
- **Read-only.** Don't change code, config, keys or project settings during the checkup. At the end, offer fixes and wait for the user to approve each one.
- **Never rotate signing keys or turn on SSL enforcement for the user.** Both can break clients. Point to the guide instead.
- **Never print secrets.** When you find a key or secret, report the file and line and at most the first 6 characters.
- If a check can't run (no database access, no network, no project ref found), finish the other checks first. Then list what couldn't run in the report, explain what each one needs, and offer to work through it with the user, for example by connecting the Supabase MCP or running a query themselves (via dashboard, CLI, etc).
## 1. Find the project
If the Supabase MCP server is connected, use it to identify the project and its URL; if the user has several projects, ask which ones to check. Otherwise, look for the project URL or ref in `.env*` files (`SUPABASE_URL`, `NEXT_PUBLIC_SUPABASE_URL`, `VITE_SUPABASE_URL` and similar), `supabase/config.toml`, or client setup code. The ref is the subdomain in `https://<ref>.supabase.co`. If several projects turn up, check each one. If none turns up, ask the user.
## 2. Signing keys
Fetch the public JWKS (no credentials needed):
```sh
curl -s https://<ref>.supabase.co/auth/v1/.well-known/jwks.json
```
Report the `alg` and `kid` of each key.
- Empty `keys` array: the project only has the legacy shared secret (HS256), which is never published here. Recommend migrating to asymmetric signing keys: https://supabase.com/docs/guides/auth/signing-keys
- `ES256` or `RS256` keys listed: the project has asymmetric keys. But this list includes standby and previously used keys and doesn't say which one signs tokens, so a listed key doesn't prove the project has stopped signing with the legacy secret. To confirm, check the signing keys page in the dashboard, or decode only the header of a current access token and read its `alg` and `kid` (never print the token). An `alg` of `HS256` means the legacy secret is still in use.
## 3. How the app verifies tokens
Find everywhere the app checks a Supabase access token, in any language: backend routes, middleware, serverless or edge functions, and other services. The goal is that verification keeps working through a key rotation and only accepts algorithms the user chose.
Good: keys fetched from the project's JWKS URL and chosen by `kid`, with an explicit list of allowed algorithms, or a Supabase client helper that handles this (such as `supabase.auth.getClaims()` in supabase-js).
Flag: verification with the shared JWT secret; a public key copied into code or an env var, which breaks on rotation; no explicit list of allowed algorithms.
If verification passes these checks, recommend practicing a key rotation in staging before one is needed: https://supabase.com/docs/guides/auth/signing-keys
## 4. API keys
Look for API keys in code and env files: legacy keys are long strings starting with `eyJ`, and secret keys start with `sb_secret_`. For a legacy key, decode only the middle (payload) part and read the `role` claim. Never print a key.
- A `service_role` key or an `sb_secret_` key anywhere a browser or mobile app can reach it: **critical**, report it first, whatever else you find.
- `anon` or `service_role` keys in general: recommend moving to publishable and secret keys: https://supabase.com/docs/guides/getting-started/migrating-to-new-api-keys
## 5. Postgres SSL
Find every place that connects to Postgres, directly or through a pooler: app code, ORM and driver config, env vars, scripts, migrations and CI. The goal is that every connection is encrypted and checks the server's certificate: `sslmode=verify-full` with the Supabase CA certificate, or the driver's equivalent.
Flag anything that turns encryption or certificate checks off, such as `sslmode=disable`, `sslmode=no-verify`, `ssl: false` or `rejectUnauthorized: false`. For `require`, `prefer`, `verify-ca` or no setting at all, check how that driver and version treat it before judging. Under libpq rules, `require` skips the certificate check and `prefer` can fall back to no encryption. Current node-postgres (pg-connection-string v2) treats all three as `verify-full`, but its next major version switches to libpq rules. Either way, recommend setting `verify-full` explicitly so the connection stays strict whatever the driver or version.
If you have database access (Supabase MCP, `psql`, or the user's permission to run a query), check which live connections actually use SSL:
```sql
select a.usename, a.application_name, s.ssl, s.version
from pg_stat_ssl s
join pg_stat_activity a using (pid)
where a.backend_type = 'client backend';
```
Read the results with these limits in mind, and say them in the report:
- `ssl = true` means the connection is encrypted. It doesn't show whether the client checked the server's certificate (`require` and `verify-full` look the same here), so the connection-string check above still matters.
- Connections that come through a connection pooler show the pooler's own link to the database, not the client's connection to the pooler. `ssl = false` on those rows is not evidence that the client connects unencrypted.
- Your own query session appears in the results too; leave it out of the findings.
The fix is described here: https://supabase.com/docs/guides/platform/ssl-enforcement. Tell the user to test their clients with `verify-full` before turning on enforcement.
When you recommend `verify-full`, tell the user it trusts the CA file they download, so if Supabase rotates that CA in the future, they'll need to update it. Supabase will announce any change in the changelog before it takes effect.
Check whether the project limits which IP addresses can connect to Postgres (network restrictions). If you can't read the project's settings, list it as a recommendation: https://supabase.com/docs/guides/platform/network-restrictions
## 6. Keep the stack current
A connection to Supabase only uses post-quantum key exchange when both ends support it, and the client end belongs to the user. The goal is that everything connecting to Supabase runs on current, supported software.
List every place this codebase connects to Supabase: the app, background jobs, scripts, CI, serverless or edge functions, mobile apps, and the Supabase CLI. For each one, find the Supabase client library, the Postgres driver, the runtime, and the TLS library that runtime actually uses (some runtimes bundle their own). Check versions where the code runs (deploy config, container images, runtime settings), not only on this machine; if you can only check locally, say so.
Known reference points: Node.js 22.20+ or 24.5+, Go 1.24+ and OpenSSL 3.5+ offer hybrid key exchange by default. For anything else, compare against the latest stable release, and report it as unknown rather than guessing a minimum.
End users' browsers can't be checked from the codebase. Note in the report that keeping browsers current is up to users.
## Report
Start with a one-line verdict, then a table:
| Check | Status | What we found | Recommended fix |
| ----- | ------ | ------------- | --------------- |
Use statuses **Critical**, **Fix soon**, **Good**, **Couldn't check**. Put critical items first. End by offering to make each fix, one at a time, with the user's approval.
## Staying current
If you can run scheduled or recurring tasks, offer to re-run this checkup regularly (weekly is a good default; let the user choose). Each run should also check the Supabase changelog (https://supabase.com/changelog) for security-relevant entries. Compare against the previous run and tell the user only what changed: a new finding, a fixed one, a new Supabase release or recommendation that affects their project. If nothing changed, say so in one line. Set it up only if the user agrees. Recurring runs are report-only: they never apply updates, change settings or rotate keys.