Skip to content

feat(auth,settings): support service=monitor for Firefox Monitor - #21550

Open
LZoog wants to merge 1 commit into
mainfrom
FXA-14746
Open

LZoog wants to merge 1 commit into
mainfrom
FXA-14746

Conversation

@LZoog

@LZoog LZoog commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Because

  • Monitor is integrating into Firefox Desktop and needs its own service= value, like Relay, SmartWindow and VPN.
  • Monitor's silent token exchange must check accountAuthorizations rather than fall through to the Firefox client's allowedScopes.

This pull request

  • Adds monitor to OAuthNativeServices; fxa-settings treats it as a non-Sync browser service, sends { monitor: {} } in the web channel services and names it "Mozilla Monitor".
  • Maps monitor to apps/monitor in oauthServer.exchange.serviceScopes, and to apps/monitor + profile in oauthServer.authorization.serviceScopes.
  • Lets Firefox Desktop and Monitor web (stage 946bfd23df91404c, prod 802d56ef2a9af9fa) write Monitor authorization rows.
  • Adds unit tests, exchange integration tests (403 without a row, success with one) and a Monitor desktop sign-in functional test.

Issue that this pull request solves

Closes: FXA-14723
Closes: FXA-14746

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

Other information (Optional)

  • Stage/prod override oauth_exchange_allowed_clients_for_service, so the matching change is in mozilla/webservices-infra#13160.
  • FXA-14804 / FXA-14805 move this config to the DB and admin-panel.

Draft because I'd like to test locally. Tested locally. Try to run yarn firefox and go through a Firefox service flow but change it to service=monitor. It says "Firefox Monitor" and follows the same flows as Smart Window, VPN etc.

'profile:uid',
],
vpn: ['https://identity.mozilla.com/apps/vpn', 'profile'],
monitor: ['https://identity.mozilla.com/apps/monitor', 'profile'],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'9ebfe2c2f9ea3c58',
],
smartwindow: ['5882386c6d801776'],
monitor: ['5882386c6d801776', '946bfd23df91404c', '802d56ef2a9af9fa'],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config has an override on the webservices-infra side: https://github.com/mozilla/webservices-infra/pull/13160

And will be moved to the DB here: https://mozilla-hub.atlassian.net/browse/FXA-14804

relay: 'https://identity.mozilla.com/apps/relay',
smartwindow: 'https://identity.mozilla.com/apps/smartwindow',
vpn: 'https://identity.mozilla.com/apps/vpn',
monitor: 'https://identity.mozilla.com/apps/monitor',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config will be moved to the DB here: https://mozilla-hub.atlassian.net/browse/FXA-14804

@LZoog
LZoog marked this pull request as ready for review October 20, 2026 18:15
@LZoog
LZoog requested a review from a team as a code owner October 20, 2026 18:15
Copilot AI lite review requested due to automatic review settings October 20, 2026 18:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Address the four unresolved findings covering authorization allowlist tests, exchange-gate isolation, shared integration typing, and positive Monitor resolution coverage.

2 open issues
What changed in this PR

Adds service=monitor support across Firefox OAuth settings, authorization, token exchange, and functional tests.

Changes:

  • Registers Monitor as a native OAuth service and WebChannel service.
  • Configures Monitor scopes and authorized clients.
  • Adds unit, integration, and functional coverage.
File Description
packages/​fxa-settings/​src/​models/​integrations/​utils.test.ts Updates service-resolution tests.
packages/​fxa-settings/​src/​models/​integrations/​oauth-native-integration.ts Adds Monitor integration behavior.
packages/​fxa-settings/​src/​models/​integrations/​oauth-native-integration.test.ts Tests Monitor integration behavior.
packages/​fxa-settings/​src/​lib/​constants.ts Adds the Monitor display name.
packages/​fxa-settings/​src/​lib/​channels/​firefox.ts Adds the Monitor WebChannel type.
packages/​fxa-auth-server/​test/​remote/​account_consents_exchange.in.spec.ts Tests consent-gated Monitor exchange.
packages/​fxa-auth-server/​config/​index.ts Configures Monitor scopes and clients.
packages/​functional-tests/​tests/​misc/​monitorIntegration.spec.ts Adds Monitor sign-in coverage.
packages/​functional-tests/​lib/​scopes.ts Adds the Monitor scope constant.
packages/​functional-tests/​lib/​query-params.ts Adds Monitor OAuth parameters.
libs/​accounts/​oauth/​src/​lib/​oauth.ts Adds the Monitor enum value.
libs/​accounts/​oauth/​src/​lib/​oauth.spec.ts Tests the new enum value.

Review effort: Lite

'9ebfe2c2f9ea3c58',
],
smartwindow: ['5882386c6d801776'],
monitor: ['5882386c6d801776', '946bfd23df91404c', '802d56ef2a9af9fa'],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we already have good coverage for this In authorization.spec.ts and the "consents" integration tests. We don't need to add new tests every time to cover new client IDs.

Comment on lines +99 to +104
isFirefoxClientServiceMonitor() {
return (
this.isFirefoxClient() &&
this.data.service === OAuthNativeServices.Monitor
);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the false default to the base Integration so it can be called on any integration. I left it out of the Pick<> lists: no page or component calls the per-service predicates directly, only isFirefoxNonSync(), getWebChannelServices() and getServiceName(), which are already in those contracts. Adding it there would only mean stubbing it in about ten mocks.

Because:

- Monitor is integrating into Firefox and needs its own browser service.
- Monitor's silent token exchange must be gated on accountAuthorizations.

This commit:

- Adds monitor to OAuthNativeServices and treats it as a non-Sync service.
- Sends monitor in the web channel services and names it on sign-in.
- Maps monitor to apps/monitor in exchange and authorization serviceScopes.
- Allows Firefox Desktop and Monitor web (stage, prod) to write Monitor rows.
- Adds unit, exchange integration and Monitor desktop sign-in tests.

Fixes FXA-14723
Fixes FXA-14746

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants