Closed Bug 2050967 Opened 2 months ago Closed 2 months ago

[IPProtection] getAccessToken is getting called excessively

Categories

(Firefox for Android :: Privacy, defect)

All
Android
defect
Points:
5

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox153 --- fixed
firefox154 --- fixed

People

(Reporter: mavduevskiy, Assigned: mavduevskiy)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid])

Attachments

(4 files, 1 obsolete file)

Steps to reproduce

  1. Create a new account, without giving it authorization to use VPN.
  2. Log into that account.
  3. Add logs/put debugger around getToken call.

Expected behavior

we don't get getToken request for a user that can not use the feature

Actual behavior

we do get that request, and multiple times upon authentication

Device information

  • Firefox version:
  • Android device model:
  • Android OS version:

Any additional information?

Severity: -- → S1
Priority: -- → P1
Assignee: nobody → mavduevskiy

S1 is incident-level and required an immediate unplanned dot release, hence the tracking flags automatically set for releases in flight. Downgrading to S2 as I don't think you intended to do that.
https://wiki.mozilla.org/BMO/UserGuide/BugFields#bug_severity:~:text=S1,available

Severity: S1 → S2
Priority: P1 → --

... until user action or a successful authorization.

We introduce an accessor for reading our persisted account on disk by
consuming the JSON string first. This avoids having to know which
SharedPreference type is used (secure or regular).

The accessor acts as a weak implementation wrapper to a future API that
feeds in from the native fxa_client.

We always read the state from disk for every request to ensure
freshness. This uses a background Corountine context to avoid IO on
the FxaAccountManager that does not need to be synchronized with it's
own coroutineContext: this is a read-only check and reading may fail for
a variety of reasons, we do not need to block the account manager to
avoid these failures.

To avoid DDOS-ing our servers, we check our existing scopes to see if we
can fetch an access token. If we don't have one and we are
authenticated, we try to perform a token exchange if our
account does have the global scope.

This is similar to behaviour from before, except that we only attempt
the token exchange when we enter the VPN UI screen. If the account was
not entitled, we then perform an authorization as we previously did.

Co-authored-by: Mark Hammond <mhammond@skippinet.com.au>

Pushed by jonalmeida942@gmail.com: https://github.com/mozilla-firefox/firefox/commit/e5344cff13c8 https://hg.mozilla.org/integration/autoland/rev/d4e6916363d2 Part 1: Add AccountScopeAccessor to read AccountStorage persisted state r=gmalekpour,markh,android-reviewers,mavduevskiy https://github.com/mozilla-firefox/firefox/commit/e63cb7ea3102 https://hg.mozilla.org/integration/autoland/rev/a2d34562b7dd Part 2: Introduce account scope check to IPProtection r=markh
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch
Regressions: 2052599

We introduce an accessor for reading our persisted account on disk by
consuming the JSON string first. This avoids having to know which
SharedPreference type is used (secure or regular).

The accessor acts as a weak implementation wrapper to a future API that
feeds in from the native fxa_client.

We always read the state from disk for every request to ensure
freshness. This uses a background Corountine context to avoid IO on
the FxaAccountManager that does not need to be synchronized with it's
own coroutineContext: this is a read-only check and reading may fail for
a variety of reasons, we do not need to block the account manager to
avoid these failures.

Original Revision: https://phabricator.services.mozilla.com/D309749

Attachment #9604765 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: The VPN feature that is launching in 153 will make excessive requests to the FxA servers without these patches.
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: These patches will reduce the number of requests made to FxA as part of the VPN feature launch. The risk is low because if for some reason it doesn't do what it is intended, we are still in the same state of requests made.
  • String changes made/needed?: n/a
  • Is Android affected?: yes
Attachment #9604766 - Flags: approval-mozilla-beta?

To avoid DDOS-ing our servers, we check our existing scopes to see if we
can fetch an access token. If we don't have one and we are
authenticated, we try to perform a token exchange if our
account does have the global scope.

This is similar to behaviour from before, except that we only attempt
the token exchange when we enter the VPN UI screen. If the account was
not entitled, we then perform an authorization as we previously did.

Co-authored-by: Mark Hammond <mhammond@skippinet.com.au>

Original Revision: https://phabricator.services.mozilla.com/D309985

Attachment #9604766 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9604765 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Points: --- → 5
Whiteboard: [fxdroid]

Is there something that QA can verify here? Thank you!

Attachment #9603166 - Attachment is obsolete: true
See Also: → 2053650
Flags: needinfo?(jonalmeida942)

(In reply to Raluca Ilban [:rilban], Premium Services - VPN from comment #11)

Is there something that QA can verify here? Thank you!

Thanks for checking in. No, I don't believe so. Engineering will need to monitor this dashboard to see the rejection numbers for vpn reduce to something reasonable.

Flags: qe-verify-
Regressions: 2054812
Regressions: 2057032
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: