01
one consent screen, one company
Vercel's April 2026 security bulletin describes a chain that started outside Vercel. Attackers first compromised Context.ai, a third-party AI tool used by a Vercel employee. With that access they took over the employee's Vercel Google Workspace account, used it to get into the employee's Vercel account, and from there moved into a Vercel environment where they enumerated and decrypted environment variables that weren't marked as sensitive. Vercel published an indicator of compromise on 19 April, followed up over the next days with additional affected accounts, and closed the incident on 16 October after completing remediation.
The detail that makes this a template comes from Context.ai's own statement: Vercel wasn't a customer, but at least one Vercel employee had signed up for Context.ai's consumer AI Office Suite with their corporate account and granted it "Allow All" permissions. When the Context.ai environment was breached, OAuth tokens for some of its users were compromised with it. How Context.ai got breached is less settled. Hudson Rock reported that a Context.ai employee's machine was infected with the Lumma infostealer in February 2026, likely through downloaded Roblox game exploits, and calls the link to the Vercel breach "highly probable". Vercel's bulletin doesn't name the malware, so treat that part as a researcher's assessment rather than a confirmed fact.
Nothing here required a clever exploit. It required one consent screen that nobody reviewed, a token stored by a vendor you've never assessed, and internal systems that trusted the Google identity behind it. Most companies on Google Workspace have the same setup, because by default any user can grant any third-party app access to their Workspace data. The rest of this post is about finding those grants, cutting them back and changing the default. If you're on Microsoft 365, the same ideas apply through Entra ID, covered briefly at the end of the consent section.
02
find out which apps hold tokens
The Admin console shows connected apps under Security, then Access and data control, then API controls, where Manage App Access opens the app access control list. It's a reasonable place to look at one app, and a poor place to review hundreds of grants across an organization. For that, use the Admin SDK Directory API: users.list to enumerate accounts and tokens.list for the OAuth tokens each user has issued. Each token comes back with clientId, displayText, scopes, nativeApp and anonymous.
The script below runs as a service account with domain-wide delegation, impersonating an admin, and writes one CSV row per user and app. The service account needs two scopes granted in the Admin console's domain-wide delegation settings: admin.directory.user.readonly to list users and admin.directory.user.security to read tokens.
Run it with node oauth-grants.mjs > grants.csv. It makes one request per user, so on a large domain it's a job to schedule rather than something to wait for. The service account key it uses is itself a powerful credential, so keep it out of laptops and CI variables that other jobs can read, and delete it when you're done if this is a one-off.
Start with Vercel's indicator. The bulletin lists the OAuth client ID 110671459871-30f1spbu0hptbs60cb4vsmv79i7bbvqj.apps.googleusercontent.com, and Google Workspace admins were asked to check for it; a grep over the CSV answers that in a second. Then sort by scope. Grants that include https://mail.google.com/, Gmail read or modify scopes, full Drive, the Admin SDK or cloud-platform deserve a named owner and a reason. Rows where suspended is true are grants on accounts of people who've left, and an app nobody on the team recognizes is a question to ask out loud: who approved it, is it still in use, and what could it read if the vendor were breached tomorrow.
03
revoke, block and keep watching
tokens.delete revokes all tokens a user has issued to one client ID. Revoking alone isn't enough for an app you don't want, because the user can simply grant access again the next day. Set the app's access to Blocked in app access control so the consent screen refuses it, then revoke the existing tokens. For apps that turn out to be legitimate, set them to Trusted or, better, Specific Google data with only the scopes they need, so the decision is recorded and the next review starts from a shorter list.
A one-off cleanup decays within months, so run the export on a schedule and diff it against the previous run, so new grants with sensitive scopes show up for someone to review. Google also records grants as they happen. The Admin SDK Reports API exposes them as token activity events (authorize, revoke and others) via activities.list with applicationName=token, and on editions that include the security center, the investigation tool can search OAuth log events by scope and revoke tokens from the results. Google's own guidance pairs that with activity rules that alert when someone grants a scope you've decided nobody should grant.
04
make consent an admin decision
Enumeration tells you where you are. Changing the default stops the list from growing again. Google Workspace has two separate controls for this under API controls, and they're easy to conflate.
The first is the setting for unconfigured third-party apps, meaning apps an admin hasn't assigned an access level. The default is "Allow users to access any third-party apps". The other options are "Allow users to access third-party apps that only request basic info needed for Sign in with Google" and "Don't allow users to access any third-party apps". The middle option keeps Sign in with Google working for ordinary SaaS logins while blocking any unreviewed app that asks for mail, Drive or calendar data, which is the right trade for most companies. Turn on "Allow users to request access to unconfigured third-party apps" as well, and blocked requests land in an Apps pending review list for an admin to allow or dismiss, instead of turning into shadow IT.
The second control is per Google service. Under Manage Google Services you can set services such as Gmail and Drive to Restricted, which means only apps an admin has set to Trusted or Specific Google data can reach them; apps set to Limited are blocked from restricted services. For Gmail and Drive you can also restrict a list of high-risk OAuth scopes. Together these mean an employee trying a new AI meeting assistant either gets basic sign-in only or files a request, and an admin sees exactly which scopes it wants before anything is granted.
This adds friction, and that's the point. The first weeks bring a pile of requests for tools people already use, which doubles as the inventory you didn't have. After that it settles into occasional requests, each one a small decision made with the scope list in front of someone who's paid to read it.
On Microsoft 365 the equivalent lives in the Entra admin center under Enterprise apps, Consent and permissions, User consent settings. Microsoft recommends "Allow user consent for apps from verified publishers, for selected permissions" over the permissive "Allow user consent for apps", or disabling user consent entirely, combined with the admin consent workflow so users can request review. Changing the setting only affects future consent; existing grants stay until you revoke them, so the same audit is needed there.
05
assume the environment variables get read
The other half of the Vercel story is what the attacker found: environment variables, decrypted in bulk because they weren't marked sensitive. Many teams treat only production database URLs and payment keys as secrets and leave analytics tokens, webhook secrets and third-party API keys readable. To an attacker, a write-scoped token for your email provider or CRM is just as useful, and the full variable list is a map of your integrations.
Vercel has changed the model since the incident. Since August 2026, every variable is either Config, readable by members with access, or Secret, write-only after saving, and existing Sensitive variables became Secrets automatically. A team policy can require a Secret's production value to differ from its values in other environments, which stops preview deployments from carrying production credentials. Build logs also redact sensitive values now. Vercel's own recommendations after the incident were to enable MFA, rotate every variable that wasn't marked sensitive, move secrets to the protected type, review activity logs and recent deployments, and set Deployment Protection to at least Standard.
Two habits hold up on any platform. Give preview and development environments their own credentials with limited scope, because preview builds run code from every branch and pull request, and a malicious dependency in one of them reads whatever that environment exposes. And keep a list of where each secret lives and how to rotate it, ideally in a secrets manager that syncs into the platform, so rotating everything after an incident like this one takes an afternoon rather than a week of hunting through dashboards.
