Skip to content

feat(safari): support Safari profiles (macOS Sonoma+) cookie stores #560

Description

@mherod

Problem

Safari (macOS Sonoma 14+) supports multiple profiles, each with isolated cookies. get-cookie explicitly ignores --profile for Safari and reads only the single default container path, so profile cookies are unreachable. Notably, yt-dlp does not support this either — implementing it would put get-cookie ahead of the reference.

Location:

  • src/core/browsers/safari/SafariCookieQueryStrategy.ts:44-55 (single hardcoded path)
  • src/core/browsers/safari/SafariCookieQueryStrategy.ts:500-503 (warns the profile is ignored)

Found in: yt-dlp cross-reference + WebSearch (codebase scan)
Type: enhancement (investigation required)

Context

// single path only
return join(home, "Library", "Containers", "com.apple.Safari", "Data", "Library", "Cookies", "Cookies.binarycookies");
// profile explicitly ignored at query time
this.logger.warn(`Safari does not support profile filtering. --profile "${this.profileName}" will be ignored; all Safari cookies will be returned.`);

Research Findings

  • Safari cookies are known to live at ~/Library/Cookies/Cookies.binarycookies and ~/Library/Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies.
  • The per-profile storage layout (Sonoma+) is under-documented publicly; an investigation step is required (enumerate container subpaths; identify per-profile *.binarycookies).
  • References:
  • Complexity: Medium–Complex (discovery first).

Recommended Approach

  1. Investigate the on-disk layout of Safari profile cookies on Sonoma/Sequoia (enumerate Safari container subdirectories; locate per-profile *.binarycookies).
  2. Add Safari to --list-profiles enumeration once the layout is known.
  3. Map --profile <name|uuid> to the corresponding binarycookies file; default to the current container path.
  4. Replace the "not supported" warning with real filtering when a profile is supplied.
  5. Tests/fixtures for ≥2 Safari profiles.

Acceptance Criteria

  • Safari profile cookie store(s) located and documented in the issue/PR.
  • --profile selects the matching profile's cookies for Safari.
  • No-profile behavior unchanged (default container path).
  • --list-profiles includes Safari profiles (if discoverable).
  • Tests pass; no new lint errors.

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

    enhancementNew feature or requesthelp wantedExtra attention is neededjavascriptPull requests that update javascript codepriority-mediumMedium priority

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions