pull/1489/merge
Mahmoud Al-Qudsi 2024-08-24 10:39:30 -07:00 committed by GitHub
commit dbf66fed19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 8 deletions

View File

@ -59,13 +59,19 @@ Sqlite3ChromiumCookieParser::~Sqlite3ChromiumCookieParser() = default;
const char* Sqlite3ChromiumCookieParser::getQuery() const const char* Sqlite3ChromiumCookieParser::getQuery() const
{ {
// chrome's time is microsecond resolution, and its epoc is Jan 1 // Chrome stores time in microsecond resolution, and its epoch is Jan 1
// 00:00:00 +0000 1601, so we have to convert it to second from UNIX // 00:00:00 +0000 1601, so we have to convert it to seconds from UNIX epoch.
// epoc. 11644473600 is the second between chrome's epoc and UNIX // 11644473600 is the number of seconds between Chrome's epoch and the UNIX
// epoc. e.g., date +%s -d 'Jan 1 00:00:00 +0000 1601' // epoch, e.g. `date +%s -d 'Jan 1 00:00:00 +0000 1601'`
return "SELECT host_key, path, secure, expires_utc / 1000000 - 11644473600 "
"as expires_utc, name, value, " // Ideally, the SQLite3 cookie parser API would first run an identification
"last_access_utc / 1000000 - 11644473600 as last_access_utc" // process to determine the format and version of the cookie store, but it's
// not currently designed that way. The following query is specifically for
// Chromium cookie stores with latest_compatible_db_version = 11.
return ""
" SELECT host_key, path, is_secure, expires_utc / 1000000 - 11644473600 "
" as expires_utc, name, value, "
" last_access_utc / 1000000 - 11644473600 as last_access_utc "
" FROM cookies"; " FROM cookies";
} }