Repository navigation
Conversation
|
Open question for review: The backfill currently reads the client → service map from The alternative is to drop the flag and lean on the config alone, overriding per run with the |
| doc: "Bandaid (FXA-14724). OAuth client_id (hex) -> service for first-party clients that sign in without their service's canonical scope (Monitor web, the Mozilla VPN app); /oauth/authorization and the accountAuthorizations backfill attribute those sign-ins to the service. Entries for services missing from serviceScopes are ignored. Remove each entry once that client requests its canonical scope (FXA-14813).", | ||
| format: Object, | ||
| default: { | ||
| '802d56ef2a9af9fa': 'monitor', |
There was a problem hiding this comment.
The backfill currently reads the client → service map from oauthServer.exchange.serviceForClient and also accepts --client-service = to add to or override it per run. That's two sources of truth for what should be one mapping, and it means backfilled rows could differ from the rows sign-in writes.
I know you've already ran this on stage - do you plan to rerun it there again before prod? I guess this could just be a webservices-infra change across envs. If you don't plan to actually use --client-service I'd just remove it and rely on the config and make sure the dry run prints these out but 🤷♀️ I'm OK if you want to leave it for flexibility.
Also just a tiny nit, this key is a string and the other isn't? I might also call this serviceForClientBandaid to match the other "bandaids" but you also have that noted here in the docs so I think it's fine as is too.
There was a problem hiding this comment.
Dropped the flag in 61ca73b; the map now comes only from config and is logged in backfill.start, so the dry run prints it. On the quoting: prettier forces quotes on the key that starts with a digit and strips them from the one that doesn't, so the mismatch is tool-enforced. Left the name as is since the doc string already says bandaid.
| ) | ||
| .option( | ||
| '--omit-scope <scope>', | ||
| 'Do not write rows for this scope (e.g. profile). Repeatable. Service inference still sees the full token scope.', |
There was a problem hiding this comment.
To state here on the PR: for now we won't use this. If we choose to delete these rows we can do them all in a script later. Dan isn't too concerned about the oauth db memory and us adding rows.
There was a problem hiding this comment.
Understood, leaving it in but unused for the prod run.
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
|
Rolled in the deauthorization patch from Slack as |
LZoog
left a comment
There was a problem hiding this comment.
r+ with that de-authorization patch in here that we chatted about. Let's make sure to, in the follow up, mention it, as maybe we will just be OK with removing the config at that point and adding a "forward-fill" approach for that as well (e.g. we might reject the token exchange for these logins but that's OK given the alternative is to keep these around indefinitely etc.).
I tested the login patch and see it working. I did not run the script but did review it manually and asked Claude questions about output given certain inputs.
Because: - Monitor web and the Mozilla VPN app sign in without their service's canonical scope, so no consent row exists for the Firefox token exchange. - The accountAuthorizations backfill could not recognise those tokens and had no way to resume after a killed pod. - A disconnect of any allowlisted client deauthorized the fallback row while the app was still signed in. This commit: - Adds oauthServer.exchange.serviceForClient (client_id -> service), read by /oauth/authorization as a last-resort fallback and by the backfill script. - Writes the service's canonical scope row when the token lacks it, in both the sign-in path and the backfill. - Adds --omit-scope and --start-cursor to the backfill and logs the cursor per batch. - Treats a mapped client's tokens as covering its service's canonical scope in authorizationRowsToDeauthorize. - Ignores mappings for services absent from serviceScopes. Removal tracked in FXA-14813.
Because
This pull request
oauthServer.exchange.serviceForClient, a client_id → service map, defaulting Monitor web →monitorand the VPN app →vpn./oauth/authorizationfalls back to that map when no requested scope is canonical, so the existing writer records the canonical row. Grant and tokens are unchanged.--omit-scopeand--start-cursor. The map is logged inbackfill.start.backfill.batchlog line now carries the cursor for resume.serviceScopesare ignored in both paths.Issue that this pull request solves
Closes: FXA-14724
Checklist
Put an
xin the boxes that applyHow to review (Optional)
resolveServiceValueinlib/routes/oauth/authorization.js;inferServiceForTokenandresolveTargetRowsin the backfill script.allowedClientsForServicegate still applies.Screenshots (Optional)
Please attach the screenshots of the changes made in case of change in user interface.
Other information (Optional)
The
monitormapping relies on #21550 (FXA-14723), now merged. Removal is tracked in FXA-14813; it covers the sign-in fallback, the backfill map, and the deauthorization rule, gated on a count of pre-change tokens.