All jobs

Add a Password Policy to a Supabase App

Yes. An agent sets a password policy in your Supabase config, mirrors it in every form that takes a password, proves Auth refuses a weak one, and opens a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads where passwords are accepted and where the rule lives, because in a Supabase app those are two different places. In a project laid out like Razikus/supabase-nextjs-template, supabase/config.toml has minimum_password_length = 6 under [auth], with the file's own comment recommending eight or more, and password_requirements = "", which the comment says may be letters_digits, lower_upper_letters_digits or lower_upper_letters_digits_symbols. Under [auth.email], secure_password_change = false lets a signed-in user change their password without proving it is them. The Next.js app under nextjs/ takes a password in three places: src/app/auth/register/page.tsx checks only that the two fields match before calling registerEmail, which is auth.signUp in src/lib/supabase/unified.ts; src/app/auth/reset-password/page.tsx checks the match and a length of six; and src/app/app/user-settings/page.tsx checks the match alone before auth.updateUser.

The rule goes into config.toml first: a higher minimum_password_length, password_requirements set to one of the values the file lists, and secure_password_change = true. That is what Supabase Auth enforces, locally with supabase start and on the linked project after npx supabase config push, which the README's setup steps already run; the pull request says plainly that the hosted project does not change until that push.

Then the forms. Rather than three copies of the check, the agent adds nextjs/src/lib/password.ts with the minimum length and a function that returns the reasons a candidate fails, written to match the password_requirements value chosen, and calls it from the three pages before their Supabase call, showing the rule under the field so a user sees it before submitting. The pages keep their existing match check and error state. When the server still refuses, as it will for a client that bypasses the form, the pages surface the message from the error Supabase returns instead of a generic one. The Expo app in supabase-expo-template/ has register and reset screens of its own; the prompt scopes this change to the Next.js app and the pull request names those screens as the follow-up.

Proof comes from the local stack. The sandbox has no Docker, so the agent installs it first with sudo apt-get install -y docker.io and starts dockerd, then runs npx supabase start to bring up Auth with the edited config.toml, and calls the local sign-up endpoint with a password shorter than the new minimum and one without the required characters to quote both refusals. It runs next build and next lint in nextjs/, since the template uses eslint-config-next and a type error in the new module would fail the build.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Add a password policy to this Supabase app. Read supabase/config.toml, README.md, nextjs/src/lib/supabase/unified.ts, nextjs/src/app/auth/register/page.tsx, nextjs/src/app/auth/reset-password/page.tsx and nextjs/src/app/app/user-settings/page.tsx first. In config.toml raise minimum_password_length to at least the value the file's comment recommends, set password_requirements to one of the values the comment lists, and set secure_password_change to true. Add nextjs/src/lib/password.ts with the same rule and use it in the three pages before their Supabase call, showing the rule under the field and surfacing the server's error message when it refuses anyway. Leave the Expo app alone and say so. Install Docker, run npx supabase start, and call the local sign-up endpoint with a short password and one missing the required characters to quote both refusals. Run next build and next lint in nextjs. Open a pull request.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

What comes back is a pull request changing supabase/config.toml, adding nextjs/src/lib/password.ts, and editing the three pages that take a password. The description quotes the two refusals from the local Auth server, one for length and one for the missing character classes, and the next build and next lint runs. It states which password_requirements value was chosen and that the hosted project picks it up on the next npx supabase config push.

The run's record keeps the supabase start output and the sign-up calls, so a reviewer can see the policy was enforced by Auth and not only by the form. The diff shows the rule in one module and three call sites rather than three hand-written checks.

Before merging, a reviewer confirms the minimum length and character set match what the team wants to ask of users, and plans the config push and the Expo screens, which the pull request leaves for a second change.

Run it on every Linear issue labelled agent

Add an automation in the Project with this prompt and a linear trigger on linear.issue.labeled, filtered to the agent label. When someone files "sign-up accepts six-character passwords" and labels it, the trigger puts the issue after the prompt and starts a run in the app's repository; the pull request links back to the issue. Only label changes made by a person in your Rush org fire it, never changes made by an app integration.

The same body goes to POST /o/{org}/sessions from a script, with the issue's URL in resources beside the repository so the agent reads it through your Linear connection. Send a request_id, a UUID, so a retried call returns the run it already started.

The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.

Why run it on Rush?

A password policy is a config line and a UI change that have to agree, and the usual failure is a form that allows what the server refuses or a server that still allows what the form forbids. The agent changes both from one rule, then starts the real Auth server in its own sandbox and makes it refuse, which is the part nobody does by hand before opening the pull request.

The refusals and the build output stay with the run and the pull request quotes them, so the reviewer sees the server's answer rather than a description of a check. A team with several Supabase apps sends the same request to each, in parallel, and reads the pull requests that came back.

Frequently asked questions

Does editing config.toml change the hosted project?

Not by itself. The file configures the local stack that supabase start runs, and the linked project only after npx supabase config push, which the README's setup already includes. The pull request says this so nobody assumes production changed on merge.

Why check the password in the form if Auth enforces it?

So the user sees the rule before submitting and gets a specific reason rather than a round trip. Auth remains the enforcement, which is why the agent proves the refusal against the local server and the pages show its message when it refuses.

What does secure_password_change do?

With it on, Supabase Auth requires a recent sign-in or a reauthentication before a password change goes through, which closes the gap where a left-open session could set a new password from the settings page.

Why does the run need Docker?

supabase start runs Auth, Postgres and the rest as containers. Rush's sandbox has no Docker installed, so the agent installs docker.io and starts the daemon first; the pull request does not depend on that step, only the proof does.

More Supabase jobs

More jobs like this: Turn a Linear label into a PR

Keep reading