Closed Bug 1819899 Opened 2 years ago Closed 2 years ago

siteDataTestUtils.hasCookies() is wrong if the host is a substring of an existing cookies host

Categories

(Toolkit :: Data Sanitization, defect, P3)

defect

Tracking

()

RESOLVED FIXED
118 Branch
Tracking Status
firefox118 --- fixed

People

(Reporter: h.sofie.p, Assigned: abhishekmadan, Mentored)

Details

Attachments

(1 file)

I encountered the issue that I set a cookies for "https://1hour10minutes.com" and for "https://10minutes.com", via siteDataTestUtils.addToCookie, and after I removed the cookie for "https://10minutes.com", siteDataTestUtils.hasCookies still stated that there is a cookie for "https://10minutes.com". I am quite sure that this is due to this includes statement here, "10minutes.com" is included in the string "1hour10minutes.com"

@pbz do you think we could just check for equality of the hosts here or would that be too strict?

Flags: needinfo?(pbz)

That would be too strict. There may be cookies set for the entire base domain. We could call getCookiesFromHost instead: https://searchfox.org/mozilla-central/rev/dcf64fc565e3749119bd57202e2ab06533155d16/netwerk/cookie/nsICookieManager.idl#282

Flags: needinfo?(pbz)
Severity: -- → S4
Priority: -- → P3
Mentor: hpeuckmann
Assignee: nobody → amadan
Status: NEW → ASSIGNED
Attachment #9340728 - Attachment description: Bug 1819899 - Added a check to see if the cookie exists within the domain itself. r=hpeuckmann → Bug 1819899 - Added a check to see if the cookie exists within the domain itself. r=pbz
Attachment #9340728 - Attachment description: Bug 1819899 - Added a check to see if the cookie exists within the domain itself. r=pbz → Bug 1819899 - Avoid host substring matching in SiteDataTestUtils.hasCookies. r=pbz
Pushed by amadan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2b1c52a243d0 Avoid host substring matching in SiteDataTestUtils.hasCookies. r=anti-tracking-reviewers,pbz
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 118 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: