Closed Bug 1976197 Opened 2 months ago Closed 2 months ago

Reject invalid cookies in the webExt cookie API - nightly only

Categories

(WebExtensions :: General, task)

task

Tracking

(firefox142 fixed)

RESOLVED FIXED
142 Branch
Tracking Status
firefox142 --- fixed

People

(Reporter: baku, Assigned: baku)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [addons-jira])

Attachments

(1 file)

The webExt.cookies API is currently the only entry point where we allow invalid cookies, as nsICookieValidation is not enforced.
This bug aims to enable cookie validation in Nightly only, to monitor the level of breakage it may cause.
If the level of breakage is acceptable, in a few cycles, we will enable the validation in all the channels.

Whiteboard: [addons-jira]

The validation landed in 141, off-by-default in https://hg-edge.mozilla.org/mozilla-central/rev/aa54edb433a0
back then the use of invalid cookie values resulted in the following message being logged in the console:

Extension [extension id] tried to create an invalid cookie: [error message]

With the patch here, this validation becomes enabled by default, and browser.cookies.set() will reject when an invalid value is encountered.

Ideally, we should only enable this by default if all cookies that an extension can observe through the cookies API are also valid. Bug 1974987 is still open, which suggests that it is possible for the cookies DB to return invalid cookies. Are there other unaccounted cases that still need a migration?

Ideally, we should only enable this by default if all cookies that an extension can observe through the cookies API are also valid. Bug 1974987 is still open, which suggests that it is possible for the cookies DB to return invalid cookies. Are there other unaccounted cases that still need a migration?

Telemetry says that the majority of cookie errors from DB are:

  • eRejectedNoneRequiresSecure: 1.21% - Migration done (bug 1973651)
  • eRejectedAttributeExpiryOversize: 0.00% - Migration in review (Bug 1974987)
  • eRejectedEmptyNameAndValue: 0.00% - Migration in review (Bug 1974987)
  • eRejectedInvalidCharValue: 0.00% - Migration in review (Bug 1974987)
  • eRejectedInvalidCharName: 0.00% - Migration in review (Bug 1974987)
  • eRejectedNameValueOversize: 0.00% - not included. Too low.

Query: https://sql.telemetry.mozilla.org/queries/109167/source

As soon as we land bug 1974987, we will be ready to proceed.

Flags: needinfo?(amarchesini)
Keywords: dev-doc-needed
Blocks: 1976509

(moving to WebExtensions::General since this change only affects extension API behavior)

Component: Networking: Cookies → General
Product: Core → WebExtensions
Pushed by amarchesini@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/488b54fd9df7 https://hg.mozilla.org/integration/autoland/rev/8e83b3296c86 Reject invalid cookies in the webExt cookie API - nightly only, r=robwu,cookie-reviewers,edgul
Pushed by amarc@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/6cb2ee6b7a4b https://hg.mozilla.org/integration/autoland/rev/34b03e551372 Revert "Bug 1976197 - Reject invalid cookies in the webExt cookie API - nightly only, r=robwu,cookie-reviewers,edgul" for causing mochitest failures @ test_ext_cookies.html

Backed out for causing mochitest failures @ test_ext_cookies.html

Flags: needinfo?(amarchesini)
Flags: needinfo?(amarchesini)
Pushed by amarchesini@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/82d6f931d58c https://hg.mozilla.org/integration/autoland/rev/a0dcff3b0556 Reject invalid cookies in the webExt cookie API - nightly only, r=robwu,cookie-reviewers,edgul
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: