Skip to content

fix(auth): keep SRP server failures out of credential errors - #548

Closed
timlaing wants to merge 1 commit into
mainfrom
fix/srp-server-error-classification
Closed

timlaing wants to merge 1 commit into
mainfrom
fix/srp-server-error-classification

Conversation

@timlaing

Copy link
Copy Markdown
Owner

Proposed change

Apple HTTP 5xx responses during SRP sign-in were wrapped as PyiCloudFailedLoginException, making a temporary outage look like rejected credentials. This PR propagates them as PyiCloudAPIResponseException with the original status, response and exception cause, for both /signin/init and /signin/complete. This is the error-classification part of #544.

Type of change

  • Bugfix (non-breaking change which fixes an issue)

Breaking change

Consumers that catch only PyiCloudFailedLoginException around authentication will now also need to handle PyiCloudAPIResponseException for Apple-side 5xx failures. This is the intended change: those failures are not credential rejections. Connection failures, account locks, MFA challenges and confirmed credential rejection keep their existing exception types.

Example of code

try:
    service = PyiCloudService(account, password)
except PyiCloudAPIResponseException as error:
    if error.code and 500 <= error.code < 600:
        ...  # Apple outage: retry later, do not ask for a new password

Additional information

Checklist

  • The code change is tested and works locally.
  • prek run --all-files passes locally (lint, format, mypy, pylint).
  • Local tests pass. Your PR cannot be merged unless tests pass.
  • The pull request is editable by maintainers.

- Propagate HTTP 5xx from signin/init and signin/complete as PyiCloudAPIResponseException with original status, response and cause
- Keep connection, account-lock, MFA and 400/credential-rejection paths unchanged
- Add parameterized regression tests and a changelog entry
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added fix A pull request that fixes a bug component: authentication Sign-in, sessions, cookies and two-factor authentication component: ci GitHub Actions and development tooling service: account iCloud account service labels Nov 23, 2026
@timlaing

Copy link
Copy Markdown
Owner Author

Duplicate of #547, which already addresses #545 with the same fix. Keeping the existing PR.

@timlaing timlaing closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: authentication Sign-in, sessions, cookies and two-factor authentication component: ci GitHub Actions and development tooling fix A pull request that fixes a bug service: account iCloud account service

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve SRP server failures instead of reporting invalid credentials

1 participant