Skip to content

fix: use compatible device fingerprint for fresh Apple Music login - #24

Merged
glomatico merged 7 commits into
glomatico:mainfrom
TuPapaPendejo:fix/device-info-apple-auth-1109
Nov 26, 2026
Merged

glomatico merged 7 commits into
glomatico:mainfrom
TuPapaPendejo:fix/device-info-apple-auth-1109

Conversation

@TuPapaPendejo

@TuPapaPendejo TuPapaPendejo commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the fresh-install Apple Music authentication failure documented in issue #23.

The critical diagnostic lead came from @rocketguedes in comment 7162866962. That report identified a device fingerprint configuration that completed Apple login and 2FA in the reporter's environment.

Failure and diagnostic

The original generated value in src/device_info.rs used:

Music/4.9/Android/10/Samsung S9/7663313/en-US/en-US/<32 hex characters>

The successful override reported by @rocketguedes used:

Music/5.0.2/Android/10/Pixel 8/7663314/en-US/en-US/<16 lowercase hex characters>

The original failure produced response_type=Some(4), apple_error_code=None, and no HSA2 challenge despite the credential and known dialog callbacks being handled.

The report kept the image, network, DNS, account, and credentials unchanged and changed only WRAPPER_DEVICE_INFO; login progressed to 2FA and then authenticated. The experiment changed both the client tuple and suffix length together, so it did not isolate which field triggered Apple's rejection.

Code changes

In src/device_info.rs:

  • Use the combined fingerprint Music/5.0.2/Android/10/Pixel 8/7663314/en-US/en-US.
  • Generate the Android ID from 8 bytes of /dev/urandom, rendered as 16 lowercase hexadecimal characters (64 bits).
  • Retain independent 128-bit randomness for temporary identity-file names.
  • Preserve explicit WRAPPER_DEVICE_INFO overrides.
  • Do not rewrite an existing .wrapper-device-info, native .worker-device hash, or cached session.
  • Add regression tests for generated identity shape, persistence, concurrency, explicit overrides, and preservation of existing identities.

Independent successful reproduction

A separate clean installation completed with:

  • Host: Windows 10 IoT Enterprise LTSC 2021.
  • Linux: openSUSE Tumbleweed inside WSL.
  • Wrapper: Docker Compose, version 1.0.0, native worker x86_64.
  • Apple Music: 3.6.0-beta, build 1109.
  • Gamdl: clean Windows installation, separate from Wrapper.

The supplied Docker logs confirm:

  1. POST /session/login returned HTTP 202 for the pending 2FA challenge.
  2. Challenge submission returned HTTP 200 and session.authenticated was logged.
  3. GET /session and GET /session/credentials returned HTTP 200.
  4. After worker replacement, session.recovered was logged.
  5. Playback requests returned HTTP 200.
  6. /key requests returned HTTP 200.

The initial session.restore response was session_expired (HTTP 403), after which the fresh login completed successfully. This does not reproduce the original authentication_failed result.

Documentation and repository cleanup

  • Keep the README concise and make docs/clean-install-linux.md the single detailed installation runbook.
  • Remove Apple Music APK/APKM third-party download-source recommendations from the repository documentation.
  • Clarify that compatibility is validated through the selected profile's manifest, architecture, ELF, and extracted native-library hashes. The build helper's whole-input SHA-256 is an input-consistency/cache value, not a trusted archive checksum.
  • Remove unused archive-level checksum metadata that was not consumed by the staging code.
  • Keep the source audit, sanitized x86_64 reproduction, worker lifecycle reference, logging reference, and third-party notices.
  • Correct the Android application build target to API 21, matching the pinned profile and CMake configuration.

The detailed evidence and remaining limitations are in the source audit.

Validation scope and limitations

Verified in the reported environment: clean x86_64 deployment, fresh login, 2FA, credential retrieval, worker recycling/session recovery, playback, and successful /key HTTP responses.

Not verified: ARM64 build, live ARM64 login/2FA, ARM64 playback/context capture, every playback/media edge case, or the internal correctness of all returned context bytes. The changed identity code is shared Rust code and is expected to apply to ARM64, but that remains unverified.

The patch deliberately does not change native authentication logic, the session-validation request header, or proprietary ABI/capture code. The successful reproduction points to the generated device fingerprint; changing unrelated native paths without evidence would add risk and confound the fix.

No Apple Music package, proprietary Apple libraries, credentials, 2FA codes, cookies, tokens, or account/session data are included in this PR.

Copy link
Copy Markdown
Contributor Author

@glomatico — I have opened this contribution for review: PR #24.

The important point is that this is now backed by a second, clean x86_64 reproduction: fresh Wrapper setup under openSUSE Tumbleweed/WSL on Windows 10 IoT Enterprise LTSC 2021, Gamdl installed separately on Windows, successful 2FA, session recovery after worker recycle, and HTTP 200 responses from playback and /key.

The PR credits @rocketguedes for the original diagnostic lead and deliberately keeps the ARM64 result marked unverified. The first Actions run associated with the PR currently reports action_required and has no jobs, so it appears to be awaiting permission/approval for the fork-originated workflow rather than reporting a test failure. Please review the patch and approve the workflow run if appropriate.

TuPapaPendejo commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated the PR to the cleaned-up branch head 6918066e51926427c133230ececae6154d4d70dd.

The README is now a concise entry point; the complete installation procedure is maintained only in docs/clean-install-linux.md. I removed Apple Music APK/APKM download-source pointers from the project documentation, corrected the explanation of package validation (profile manifest and extracted-library hashes are checked; the whole-input digest is only a BuildKit consistency/cache value), and removed unused archive-level checksum metadata.

The latest upstream Actions run is 45752611282; it ended with action_required and currently has no jobs. No CI result is being represented as passing. Please approve the workflow from the repository maintainer side so the configured test suite can execute. ARM64 remains explicitly unverified by the live reproduction.

@glomatico

Copy link
Copy Markdown
Owner

Thanks.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants