Closed Bug 1696841 Opened 4 years ago Closed 4 years ago

can't click "Accept the risk and continue" on secure connection failed page

Categories

(Core :: Security: PSM, defect)

Unspecified
All
defect

Tracking

()

VERIFIED FIXED
Tracking Status
firefox92 --- verified

People

(Reporter: tnikkel, Assigned: m_kato)

References

Details

Connect to a site that gives you the secure connection failed error page (I don't have an example that is likely to work for everyone but someone must know an example page that does this). Click Advanced and then try to click "accept risk and continue", it does not work. Putting the page in desktop mode does not fix it but changes the layout.

To be clear is this in Geckoview example or Fenix? The error pages for Fenix are in the Android components project.

This is in Firefox for android, release and nightly. If this isn't the right place to file a bug could you please file a bug in the correct place and cc me? Thanks!

Flags: needinfo?(kbrosnan)
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → MOVED

Hey, I was unable to reproduce on current Nightly, Pixel 3xl (Android 10)
Could we get some more info on this, maybe some steps to reproduce?

Tested using self signed server.

https://github.com/mozilla-mobile/fenix/issues/18441#issuecomment-799437301

Flags: needinfo?(tnikkel)

I posted in the github issue.

Flags: needinfo?(tnikkel)
Flags: needinfo?(kbrosnan)

https://github.com/mozilla-mobile/fenix/issues/18441#issuecomment-800999693

After some more investigations, and some help from my colleagues, it turns out that the issue stems from lowMediumErrorPages.js, specifically the addCertException method:

async function acceptAndContinue(temporary) {
try {
    await document.addCertException(temporary);
    location.reload();
} catch (error) {
    console.error("Unexpected error: " + error);
}
};

This results in : Unexpected error: InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable.

After running document.addCertException(true) in GeckoViewExample, I got the same exception: <IMAGE>

As document.addCertException is a GeckoView method I will post this on the relevant Bugzilla issue.

Status: RESOLVED → REOPENED
Resolution: MOVED → ---
Severity: -- → S3
Priority: -- → P2
Whiteboard: [geckoview:m91]

More info from github: https://github.com/mozilla-mobile/fenix/issues/18441#issuecomment-801909286

"this bug has been driving me crazy for a lot of time today i tried to make some investigation i found that it happens only with sites that have old TLS versions e.g 1.0 and 1.1 here is an example to reproduce: http://tls-v1-0.badssl.com:1010/.
it happens on all firefox branches: stable, beta, nightly and even fennec."

Priority: P2 → P1
Rank: 6

I can reproduce this using revoked.badssl.com but interestingly not other kinds of certificate errors

On desktop I get an error page when trying to "continue", I suspect we don't handle this error case well.

Component: General → Security: PSM
Product: GeckoView → Core
Severity: S3 → --
Priority: P1 → --

Some error types are overrideable error, but this isn't all. (bug 991177, bug 1123671 and etc). So Firefox desktop hides "exceptionDialogButton". Ex. https://searchfox.org/mozilla-central/rev/192a45a34e9dd9d6760c55b6ca80fe598136be3c/security/manager/ssl/NSSErrorsService.cpp#127-131 and https://searchfox.org/mozilla-central/rev/ac36d76c7aea37a18afc9dd094d121f40f7c5441/browser/base/content/certerror/aboutNetError.js#802-812.

So I guess that Fenix (android-component) has to hide "add cert exception" / "Accept the Risk and Continue" button for some cases such as "nssFailure2" (In other word, nss error category isn't `nsINSSErrorsService::ERROR_CLASS_BAD_CERT).

Dana, is this right? Original case is https://github.com/mozilla-mobile/fenix/issues/18441 and I would like to clear this issue's detail.

Flags: needinfo?(dkeeler)

Yes - there are some errors that are not overridable, as you've identified. For errors that are overridable, if a host is HSTS, those errors are not overridable for that host. Let me know if you have any further questions.

Flags: needinfo?(dkeeler)

Thank you, Dana.

Assignee: nobody → m_kato
Whiteboard: [geckoview:m91] → [geckoview:m91][geckoview:m92]
Whiteboard: [geckoview:m91][geckoview:m92]
Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → MOVED

Sorry to reopen this, if some error pages are not overridable we need to provide an API for the embedder to know when an error can be overridden, we cannot expect apps to know which pages are overridable and which are not, especially if the API is still present but doesn't do anything / fails when used.

Status: RESOLVED → REOPENED
Resolution: MOVED → ---

Maybe Document::IsErrorOverridable or something like that?

The canonical function that determines if an error is overridable is ErrorIsOverridable: https://searchfox.org/mozilla-central/rev/42ae3bea104c37a9986c6f18d17bd9ddb387129c/security/manager/ssl/NSSErrorsService.cpp#136
Where/how should this function be exposed so embedders can use it?

Dana(In reply to Dana Keeler (she/her) (use needinfo) (:keeler for reviews) from comment #17)

Where/how should this function be exposed so embedders can use it?

We expose addCertException to the document object in error pages: https://searchfox.org/mozilla-central/rev/42ae3bea104c37a9986c6f18d17bd9ddb387129c/dom/webidl/Document.webidl#324-325

if we could have attribute boolean errorIsOverridable there too, it should work for us.

Verified as fixed on the 92.0a1 Firefox Nightly build from 7/21 with https://expired.badssl.com/ page with the following devices:

  • Google Pixel (Android 10),
  • Samsung Galaxy Tab A6 (Android 5.1.1), and
  • HTC 10 (Android 8).
Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED

I'm confused - given https://github.com/mozilla-mobile/android-components/commit/7bfbbb8c6d79e4b34c2edc5cb443c1643923c2c1, is what's described in comment 18 still necessary?

Actually, we can confirm this from error code. ERROR_SECURITY_BAD_CERT is override-able and other isn't. agi, does comment #15 means that we need Chrome-only WebIDL API for this instead of using error code?

Flags: needinfo?(m_kato) → needinfo?(agi)

I don't think every BAD_CERT is overridable, but that's besides the point. The app should not be in charge of deciding what's overridable or what isn't, GeckoView (and really, Gecko) should. It's a much better proposition to tell the app "call this method to figure out whether the error can be overidden or not" rather than "here's a list (which can potentially change over time) of the errors you can override and the ones that you can't".

Flags: needinfo?(agi)
Blocks: 1723875

I filed new issue as bug 1723875 for API.

(In reply to Agi Sferro | :agi | ni? for questions | ⏰ PST | he/him from comment #22)

I don't think every BAD_CERT is overridable, but that's besides the point. The app should not be in charge of deciding what's overridable or what isn't, GeckoView (and really, Gecko) should. It's a much better proposition to tell the app "call this method to figure out whether the error can be overidden or not" rather than "here's a list (which can potentially change over time) of the errors you can override and the ones that you can't".

The docshell already does this: https://searchfox.org/mozilla-central/rev/7b1de5e29d878cc163dec7beaf9b57a2f0f41aaa/docshell/base/nsDocShell.cpp#3515-3517
Is that information not available to GeckoView to pass to the app?

Flags: needinfo?(agi)

We do not have access to cssClass in GeckoView, no, but we're fixing that.

Flags: needinfo?(agi)

So it seems like bug 1723875 will be unnecessary when that's fixed, right? (also, is there a bug for fixing that?)

Flags: needinfo?(agi)

It's not, as I said before, we can't reasonably expect the front end to know which errors are overridable and which are not. Since the API that they use to override the error is addCertException it seems reasonable to have a isErrorOverridable API too, but it can be anything as long as it's not "read this doc".

Flags: needinfo?(agi)

But the front-end doesn't need to know - it just needs to check cssClass, like the front-end on desktop does now: https://searchfox.org/mozilla-central/rev/f71cb98fc35da418d2cb9ce31a0416d532dc9d69/browser/base/content/certerror/aboutNetError.js#201-202

You need to log in before you can comment on or make changes to this bug.