[cookies] Get chrome session cookies with --cookies-from-browser (#9747)

Partially addresses #5534
Authored by: StefanLobbenmeier
This commit is contained in:
Stefan Lobbenmeier 2024-05-11 19:25:39 +02:00 committed by GitHub
parent 31b417e1d1
commit f1f158976e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -347,6 +347,11 @@ def _process_chrome_cookie(decryptor, host_key, name, value, encrypted_value, pa
if value is None: if value is None:
return is_encrypted, None return is_encrypted, None
# In chrome, session cookies have expires_utc set to 0
# In our cookie-store, cookies that do not expire should have expires set to None
if not expires_utc:
expires_utc = None
return is_encrypted, http.cookiejar.Cookie( return is_encrypted, http.cookiejar.Cookie(
version=0, name=name, value=value, port=None, port_specified=False, version=0, name=name, value=value, port=None, port_specified=False,
domain=host_key, domain_specified=bool(host_key), domain_initial_dot=host_key.startswith('.'), domain=host_key, domain_specified=bool(host_key), domain_initial_dot=host_key.startswith('.'),