Skip to content

fix(cookies): every 'Copy as cURL' format fails to parse; only a raw header string works #72

Description

@rtunazzz

load_cookie_context (main.py:136) can't parse any of the "Copy as cURL" formats that COOKIE_HELP.md tells users to produce. Only a raw Cookie: header string works.

The failure is silent — an unparseable file falls back to returning its first line verbatim — so the user hits Missing X-APPLE-WEBAUTH-USER from Apple and reads it as "my cookies are bad" rather than "the file didn't parse".

Input format Result
Raw Cookie: header string OK — 101 chars, exact
curl … -b '…' (single quotes) BAD — returns the curl command line
curl … -b "…" (double quotes) BAD — truncated to X-APPLE-WEBAUTH-USER=
curl … -H "cookie: …" BAD — same truncation
Cookie-Editor JSON export BAD — returns the raw JSON
printf 'curl "https://p68-maildomainws.icloud.com/v2/hme/list" \\\n  -b '"'"'X-APPLE-WEBAUTH-USER="v=1:s=0:d=111111111"; x-apple-group=false'"'"'\n' > cookies.txt
uv run hidemyemail whoami --cookie-file cookies.txt
# -> Missing X-APPLE-WEBAUTH-USER cookie

Why

Two causes, neither platform-specific:

  1. Single quotes are never handled — only Windows cmd (^"…"^) and double-quoted forms are. Chrome, Safari and Firefox on macOS and Linux all emit single quotes.
  2. Apple's cookie values are themselves double-quoted (X-APPLE-WEBAUTH-USER="v=1:s=0:d=…"), and the quoted matchers stop at the first inner quote — so the double-quote and cookie: header paths return one truncated key.

Scope

  • All five formats round-trip exactly, inner quotes intact.
  • Accept Cookie-Editor's JSON export — same extension README.md already recommends. Only name/value matter.
  • An unparseable file is an explicit error naming the file and the accepted formats, never a silent fallback to line 1.
  • One regression test per format, dummy values.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions