Chrome.cookies.getAll seems to be incorrect when handling partitionkey.

313 views
Skip to first unread message

tom mak

unread,
Jan 25, 2024, 2:31:12 AM1/25/24
to Chromium Extensions

When an extension calls chrome.cookies.getAll, it will enter the CookiesGetAllFunction::Run function. Inside the function, depending on whether a URL is set, it will either call GetAllCookiesFromManager or GetCookieListFromManager. When the API is called with the parameters chrome.cookies.getAll({url: "https://havanalogin.taobao.com", partitionKey: {}}), because the URL is not null, it ultimately calls GetCookieListFromManager. After being processed through mojom, it calls CookieMonster::GetCookieListWithOptions, and the execution flow is then passed to CookiesGetAllFunction::GetCookieListCallback. Up to this point, everything is as expected.

However, the error occurs afterward.

Within AppendMatchingCookiesFromCookieAccessResultListToVector, when calling AppendCookieToVectorIfMatchAndHasHostPermission, the object constructed with the partitionkey parameter passed when calling this API is not used. Instead, the default constructor for CookiePartitionKeyCollection is utilized! This is the root cause of the erroneous behavior!

p1.pngp2.png

Oliver Dunk

unread,
Feb 2, 2024, 7:29:23 AM2/2/24
to tom mak, Chromium Extensions
Hi Tom,

I just wanted to say that I passed this on to the developer who worked on supporting partitioning in the API. That said, it was a little unclear from your email what the implications of this issue are.

It would be great if you could open a Chrome bug with some more information: https://crbug.com/

Thanks,
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/ec4c07b3-5310-409a-9d13-08cb8b66ed72n%40chromium.org.

Pavel Aronovich

unread,
Feb 6, 2024, 12:14:40 PM2/6/24
to Chromium Extensions, Oliver Dunk, Chromium Extensions, tom mak
chrome.cookies.getAll({ url: url }) does not return cookies with partitionKey set, is that correct?

пятница, 2 февраля 2024 г. в 15:29:23 UTC+3, Oliver Dunk:

Pavel Aronovich

unread,
Feb 6, 2024, 12:29:45 PM2/6/24
to Chromium Extensions, Pavel Aronovich, Oliver Dunk, Chromium Extensions, tom mak

"Because chrome.cookies doesn't support partitioning, all of its methods read and write cookies from all partitions. The cookies.set() method stores cookies in the default partition."


"partitionKey

The partition key for reading or modifying cookies with the Partitioned attribute."

Please explain how to understand this?

вторник, 6 февраля 2024 г. в 20:14:40 UTC+3, Pavel Aronovich:

Oliver Dunk

unread,
Feb 7, 2024, 6:05:52 AM2/7/24
to Pavel Aronovich, Chromium Extensions, tom mak

Thanks,
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

tom mak

unread,
Feb 20, 2024, 4:36:21 AM2/20/24
to Chromium Extensions, Oliver Dunk, Chromium Extensions, tom mak
Hi, Does this MR seem to have fixed the issue I found, right?
https://chromium-review.googlesource.com/c/chromium/src/+/5269008

Oliver Dunk

unread,
Feb 20, 2024, 5:19:38 AM2/20/24
to tom mak, Chromium Extensions
Hi Tom,

It sounds like it might have - if you're able to confirm, though, that would be great.

Thanks,
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

Reply all
Reply to author
Forward
0 new messages