Update Basilisk FE code with HTTP Auth DoS protection.

This commit is contained in:
wolfbeast 2019-02-28 14:16:09 +01:00 • committed by Roy Tam
commit 7b71e22bee
4 changed files with 20 additions and 1 deletions

View file

@ -1438,3 +1438,11 @@ pref("browser.crashReports.unsubmittedCheck.autoSubmit2", false);
// controlling validation are located in /services/sync/services-sync.js // controlling validation are located in /services/sync/services-sync.js
pref("services.sync.validation.enabled", true); pref("services.sync.validation.enabled", true);
#endif #endif
// When a user cancels this number of authentication dialogs coming from
// a single web page (eTLD+1) in a row, all following authentication dialogs
// will be blocked (automatically canceled) for that page.
// This counter is per-tab and per-domain to minimize false positives.
// The counter resets when the page is reloaded from the UI
// (content-reloads do NOT clear this to mitigate reloading tricks).
pref("prompts.authentication_dialog_abuse_limit", 3);

View file

@ -3099,6 +3099,11 @@ function getWebNavigation()
} }
function BrowserReloadWithFlags(reloadFlags) { function BrowserReloadWithFlags(reloadFlags) {
// Reset DOS mitigation for auth prompts when user initiates a reload.
let browser = gBrowser.selectedBrowser;
delete browser.authPromptCounter;
let url = gBrowser.currentURI.spec; let url = gBrowser.currentURI.spec;
if (gBrowser.updateBrowserRemotenessByURL(gBrowser.selectedBrowser, url)) { if (gBrowser.updateBrowserRemotenessByURL(gBrowser.selectedBrowser, url)) {
// If the remoteness has changed, the new browser doesn't have any // If the remoteness has changed, the new browser doesn't have any

View file

@ -3007,7 +3007,10 @@
<parameter name="aTab"/> <parameter name="aTab"/>
<body> <body>
<![CDATA[ <![CDATA[
this.getBrowserForTab(aTab).reload(); let browser = this.getBrowserForTab(aTab);
// Reset DOS mitigation for basic auth prompt
delete browser.authPromptCounter;
browser.reload();
]]> ]]>
</body> </body>
</method> </method>

View file

@ -554,6 +554,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
Cu.reportError(ex); Cu.reportError(ex);
} }
// Reset DOS mitigations for the basic auth prompt.
delete browser.authPromptCounter;
let params = { let params = {
postData, postData,
allowThirdPartyFixup: true, allowThirdPartyFixup: true,