Files

172 lines
4.8 KiB
Markdown

# Netlify signup — reverse engineering notes
Captured 2026-11-11 from a live Chrome session on `app.netlify.com`.
## 1. Front-end page
- `https://app.netlify.com/signup` — provider chooser (Google / GitHub / email / SSO)
- `https://app.netlify.com/signup/email` — the real form (email + password)
The page loads webpack chunks (`actions.*.js`, `app.*.js`, `lib.*.js`,
`helpers.*.js`). The captcha wrapper lives in `helpers`, the API client in `lib`
(`apiBase`, `captcha_source`, `authLink`, `async authenticate()`).
## 2. reCAPTCHA Enterprise
```html
<iframe src="https://www.google.com/recaptcha/enterprise/anchor
?k=6Lfj2-EtAAAAAABMy0F1oAGRPQOCTZhnt1KQ7Xat
&co=aHR0cHM6Ly9hcHAubmV0bGlmeS5jb206NDQz
&size=invisible&sa=SIGNUP">
```
- sitekey: `6Lfj2-EtAAAAAABMy0F1oAGRPQOCTZhnt1KQ7Xat`
- action: **`SIGNUP`** (visible as `sa=SIGNUP` on the anchor iframe)
- size: `invisible`, render args include `anchor-ms=20000&execute-ms=30000`
Token acquisition inside the page:
```js
await new Promise(res => grecaptcha.enterprise.ready(async () => {
res(await grecaptcha.enterprise.execute(SITEKEY, {action: 'SIGNUP'}));
}));
// → 2400-2500 char token
```
### Solver tokens are rejected
| attempt | token | result |
|---|---|---|
| no captcha | `""` | `Please complete the security check` |
| fake | `test_token` | same |
| 2captcha, `RecaptchaV2EnterpriseTaskProxyless`, action SIGNUP | 2425 chars | same |
| in-page `enterprise.execute` | 2510 chars | **`success`** |
## 3. Signup endpoint
```
POST https://api.netlify.com/auth/signup
?provider=email
&site_id=app.netlify.com
&tracking_session_id=
&login=true
&entry_point=direct
&redirect=https%3A%2F%2Fapp.netlify.com%2F
```
Headers: `Content-Type: application/json`, `Origin: https://app.netlify.com`,
`Referer: https://app.netlify.com/signup/email`.
Body:
```json
{
"email": "…",
"password": "…",
"invite_code": null,
"no_autosignup": false,
"redirect": "https://app.netlify.com",
"entry_point": "direct",
"captcha_response": "<token>",
"captcha_source": "google",
"browser_fingerprint": "<32 hex>",
"device_fingerprint": "<32 hex>"
}
```
`browser_fingerprint` / `device_fingerprint` are optional — the real form sends
them, but the request succeeds without them. They come from a fingerprint
module loaded lazily (`l.u$.getFingerprints()` in `lib.js`).
Success:
```json
{"state":"success","verify":true,"code_id":"6af4928ee9f2819062b957cb"}
```
Failure variants seen:
```json
{"state":"error","message":"Please complete the security check and try again."}
{"state":"error","message":"Email address is invalid"}
```
The second one fires for gmail `+alias` addresses — Netlify validates the mailbox
format and rejects plus-addressing.
## 4. Email verification
Subject: `[Netlify] Let's verify your email` from `team@netlify.com`.
The link is:
```
https://app.netlify.com/signup?redirect=…#verify_token=<code_id>-<8 digits>&new_user=true
```
Both halves matter: `code_id` is the 24-hex string returned by signup, the second
part is the secret.
## 5. Verify endpoint
```
POST https://api.netlify.com/auth/verify
Content-Type: application/json
{"code_id":"6af4928ee9f2819062b957cb","code":"79923092"}
```
Success returns the full user object including `access_token` (`nfu_…`),
`account_id`, `id`, `login_providers: ["password"]`, `has_pending_email_verification: false`.
In the bundle this is `verifyUserByToken()`: it splits the token on `-` into
`code_id` + `code` and POSTs `/auth/verify` with `noPrefix: true`.
There is also `PUT /users/{id}/confirm_email {secret}` (`verifyUser`) used by the
in-app flow.
## 6. Sites
### New accounts are SSO-locked
`POST /api/v1/sites` succeeds, deployment succeeds, and the public URL returns
**401 Unauthorized** with a `Login Redirect` body. The site object has:
```json
{"sso_login": true, "sso_login_context": "all",
"account_sso_login": true, "account_sso_login_context": "all"}
```
Fix:
```
PATCH /api/v1/sites/{site_id}
{"sso_login": false, "account_sso_login": false}
```
After that the same URL returns 200.
### Deploy
```
POST /api/v1/sites/{site_id}/deploys
Authorization: Bearer nfu_…
Content-Type: application/zip
<body: raw zip bytes>
```
Response: `{"id":"…","state":"uploaded", …}`; the deploy transitions
`uploaded → ready` within ~10-15s (`published_deploy` points at it).
### Build settings
A site created via API may inherit `build_settings.cmd = "hugo"` from the
project template, which breaks CLI deploys. Reset with
`PATCH /api/v1/sites/{id} {"build_settings":{"cmd":"","dir":"","publish":""}}`
or always pass `--no-build`.
## 7. Account creation counters
Nothing rate-limited us at 15 accounts from a single residential IP. Every
account: signup → verify → site → deploy → 200. The wall is the mailbox pool, not
the API.