← Back to issue list

fix: catch credential decoding errors

View original Github issue

Metadata

Project
craft-store
Number
#287
Type
pull request
State
merged
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

PR #287 merged to main as commit a4a21e6: auth.decode_credentials now catches UnicodeDecodeError alongside binascii.Error and raises CredentialsNotParseable, giving a user-friendly error for corrupt credentials files. Fixes snapcraft#5161.

Resolution: closed resolved

Reason: Merged by maintainer mr-cal (2 approvals, all CI green) and landed as commit a4a21e6 'fix: catch credential decoding errors'. The change is visible in craft_store/auth.py, where decode_credentials catches (binascii.Error, UnicodeDecodeError) and raises errors.CredentialsNotParseable; it was picked up by canonical/snapcraft#5536.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [x] Have you followed the guidelines for contributing? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `make lint && make test`? ----- Invalid text in a credentials file could cause a `UnicodeDecodeError`, which wouldn't get caught by craft-store. ``` snapcraft internal error: UnicodeDecodeError('utf-8', b'\x9d\xfa(', 0, 1, 'invalid start byte') ``` Now, this is caught and raised as a user-friendly error. Related: https://github.com/canonical/snapcraft/pull/5536 Fixes https://github.com/canonical/snapcraft/issues/5161

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved PR #287 merged to main as commit a4a21e6: auth.decode_credentials now catches UnicodeDecodeError alongside binascii.Error and raises CredentialsNotParseable, giving a user-friendly error for corrupt credentials files. Fixes snapcraft#5161.
stealth/space-bunny-alpha — closed resolved Merged in canonical/craft-store#287 as commit a4a21e6, catching credentials-file UnicodeDecodeError and reporting a user-friendly error; integrated by snapcraft#5536.
qwen/qwen3.6-35b-a3b — — Merged fix catching UnicodeDecodeError during credentials file parsing, replacing the crash with a user-friendly error. Approved by two reviewers, passed all CI checks, and resolves issue #5161.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/snapcraft#5536 (confidence 88%)

    Referenced in the PR body as the downstream PR that integrated the fix; resolves snapcraft#5161 (the 'snapcraft internal error: UnicodeDecodeError' report).

  • Likely Fixed By: canonical/snapcraft#5161 (confidence 85%)

    Original snapcraft issue reporting the unhandled UnicodeDecodeError from the credentials file, fixed by this craft-store PR.

  • Related To: canonical/craft-store#45 (confidence 45%)

    Earlier PR whose commit f985651 'auth: raise error when credentials cannot be parsed' introduced CredentialsNotParseable, the error type now raised for decode failures.

Related issues

Issue Project State Summary Similarity
#5536 fix(store): catch credential decoding errors snapcraft merged Merged in canonical/snapcraft#5536 (commit 3784560f3), converting malformed store credential decoding failures into a user-friendly error and updating craft-store.
76%