iclouddrive: lowercase Apple ID for SRP authentication

Apple IDs are case-insensitive, but the SRP proof computation (M1)
hashes the username client-side. The old plaintext signin let the
server normalize the case, but with SRP the client must match.
Lowercase the Apple ID before use so mixed-case IDs authenticate
correctly.

Reported-by: ArturKlauser
This commit is contained in:
Mike GIllan
2026-03-23 17:43:10 -04:00
committed by Nick Craig-Wood
parent 2610beb18d
commit 4a00a4dc4b

View File

@@ -91,6 +91,11 @@ func (s *Session) Requires2FA() bool {
// SignIn performs SRP-based authentication against Apple's idmsa endpoint.
func (s *Session) SignIn(ctx context.Context, appleID, password string) error {
// Apple's SRP implementation expects a lowercase account name.
// The old plaintext flow didn't need this because the server normalized
// it, but SRP uses the username in client-side proof computation (M1).
appleID = strings.ToLower(appleID)
// Step 1: Initialize the auth session
if err := s.authStart(ctx); err != nil {
return fmt.Errorf("authStart: %w", err)