Security

How do you stop a new sign-up from making itself an owner of someone else's account?

In November 2026 a free sign-up made itself owner of a vendor's own org through one invitation check. Authorize every grant on the server.

3 min readDEV GroupProduct engineering · Security

Two breaches that began with a grant of access

Because the code that hands out access is rarely tested as hard as the code that uses it. Check every invitation, role change, and session against the account it lands in, on the server, and treat a new owner as not yet trusted. Two incident reports from November 2026 show the path. On 8 November Dosu published a post-mortem for 2 November. An attacker signed up for a free account, then used an incorrect row-level security check on organization invitations to invite themselves as owner of Dosu's own internal organization. As owner, they changed the server URL of that organization's integrations to a tunnel they controlled, and Dosu sent the integrations' credentials to it, including a read-only database token and a GitHub token for its bot account. With the bot token they opened a pull request, and CI, which ran an infrastructure preview on pull requests with production cloud credentials, sent those credentials out too. Dosu says the attacker went from a new account to its cloud project in under two hours, and that several penetration tests, one the week before, had missed the flaw. On 4 November the documentation platform GitBook published a post-mortem for an attack that also began on 2 November: a flaw in its SSO login flow let the attacker create sessions acting as GitBook staff, which led to a misconfigured GitHub App, internal repositories, a Cloudflare API key, and production secrets. GitBook took its app offline for about 16 hours to rotate everything.

Authorize every grant against the target account

Treat every path that grants access as an authorization decision about the target account. Creating an invitation, accepting one, changing a member's role, linking an SSO identity, and issuing a session should each check that the caller already holds the right role in the organization being changed, not only that the caller is signed in. Write these checks once, in the database policy or a single server function, and refuse by default. Keep an automated test for each grant path: a member of organization A cannot invite anyone into organization B, cannot raise their own role, and cannot accept an invitation addressed to another email. Let the first owner of an organization come only from creating it, and record who granted each role, when, and through which path, so an unexpected owner shows up in a query instead of a forensic review. Dosu's post-mortem says the attacker's tooling sent more than 80,000 requests in 90 minutes, so assume automated probing will reach every grant path you have.

Limit what a new owner can reach

Then limit what a fresh owner can do with the role. Changing where an integration sends its credentials, a webhook URL, or an SSO setting should require recent re-authentication and notify the existing owners, and stored secrets should not go to a new address until someone confirms the change. Keep production credentials out of any CI job a pull request can trigger, and deploy with short-lived credentials instead of stored keys, the two CI changes Dosu made after its incident. GitBook's lessons point the same way: least privilege, short-lived credentials, and secret scanning as the default. Server-side checks on every access grant, tests that try to cross from one customer account into another, re-authentication on sensitive settings, and CI that cannot see production secrets are product engineering work, the layer that decides whether a free sign-up stays a free sign-up, and that is where we fit.

Sources

Was this useful?

Get in touch

Seeing one of these in your system?

Describe what exists today and where it breaks. We will come back with a technical point of view and a scoped first step.