mirror of https://github.com/garrytan/gstack.git
fix(browse): log decrypt failures behind GSTACK_DEBUG in cookie-import
cookie-import-browser silently drops cookies that fail to decrypt, leaving users unable to tell which cookies failed or why. The Keychain entry behind Arc's Safe Storage can rotate, invalidating older encrypted_value blobs while newer ones still decrypt, producing the partial-import symptom reported. Keep the existing failed counter, but surface per-row detail when GSTACK_DEBUG=1 or DEBUG=1 is set. Log host_key and cookie name plus the error code and message to stderr. Never log cookie values. Closes #1057
This commit is contained in:
parent
e23ff280a1
commit
26e9d8be8b
|
|
@ -279,8 +279,14 @@ export async function importCookies(
|
||||||
const cookie = toPlaywrightCookie(row, value);
|
const cookie = toPlaywrightCookie(row, value);
|
||||||
cookies.push(cookie);
|
cookies.push(cookie);
|
||||||
domainCounts[row.host_key] = (domainCounts[row.host_key] || 0) + 1;
|
domainCounts[row.host_key] = (domainCounts[row.host_key] || 0) + 1;
|
||||||
} catch {
|
} catch (err: any) {
|
||||||
failed++;
|
failed++;
|
||||||
|
if (process.env.GSTACK_DEBUG === '1' || process.env.DEBUG === '1') {
|
||||||
|
const code = err?.code ? ` [${err.code}]` : '';
|
||||||
|
console.error(
|
||||||
|
`[cookie-import] decrypt failed for ${row.host_key}/${row.name}${code}: ${err?.message ?? String(err)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue