← Back to issue list

fix(store): catch credential decoding errors

View original Github issue

Metadata

Project
snapcraft
Number
#5536
Type
pull request
State
merged
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

Merged in canonical/snapcraft#5536 (commit 3784560f3), converting malformed store credential decoding failures into a user-friendly error and updating craft-store.

Resolution: closed resolved

Reason: The approved PR was merged as commit 3784560f3, catching base64 and Unicode decoding failures and raising LegacyCredentialsParseError. It explicitly fixes canonical/snapcraft#5161 and incorporates the upstream behavior from canonical/craft-store#287 (a4a21e6).

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] Have you successfully run `make lint`? - [x] Have you successfully run `make test`? --- Invalid text in `SNAPCRAFT_STORE_CREDENTIALS` could cause a `UnicodeDecodeError`, which would be raised as an internal error: ``` 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/craft-store/pull/287 Fixes #5161

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#5536 (commit 3784560f3), converting malformed store credential decoding failures into a user-friendly error and updating craft-store.
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#5536 (3784560f3), updating craft-store to 3.2.2 (d914d6bb2) to replace invalid-credential UnicodeDecodeError crashes with a user-friendly error; fixes #5161.
stealth/space-bunny-alpha — closed resolved Merged PR #5536 fixes invalid SNAPCRAFT_STORE_CREDENTIALS handling: UnicodeDecodeError is now surfaced as a user-friendly error. Commit 3784560f3 updates craft-store to 3.2.2 and incorporates upstream #287.
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#5536 (3784560f3): invalid SNAPCRAFT_STORE_CREDENTIALS now produces a user-friendly decoding error. Updating to craft-store 3.2.2 brought the fix for #5161.
qwen/qwen3.6-35b-a3b — — Merged fix that catches invalid SNAPCRAFT_STORE_CREDENTIALS decoding errors, replacing internal crashes with user-friendly messages. Updated craft-store dependency to 3.2.2 and resolved issue #5161.
qwen3.6-35b-a3b-mtp-q6 — — Merged PR resolves issue #5161 by catching UnicodeDecodeError from invalid SNAPCRAFT_STORE_CREDENTIALS and replacing it with a user-friendly message. Updates craft-store to 3.2.2 to include upstream fixes.

Update history

No update history recorded yet.

Related work

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

    The PR explicitly states that it fixes the UnicodeDecodeError caused by malformed SNAPCRAFT_STORE_CREDENTIALS.

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

    Merged upstream commit a4a21e6 implemented equivalent credential decoding error handling.

Related issues

Issue Project State Summary Similarity
#45 auth: raise error when credentials cannot be parsed (CRAFT-812) craft-store merged Merged in canonical/craft-store#45 (commit f985651), replacing raw base64 decoding errors with CredentialsNotParseable; shipped in craft-store 2.0.1.
79%
#6417 feat(store): error on candid creds snapcraft closed Merged as 7ed8b939e: adds user-friendly errors and recovery advice for obsolete Candid store credentials, closing #6414 (SNAPCRAFT-1381). Lint failure was an unrelated 403 fetching an external KDE link.
77%
#4863 fix(cli): properly capture store errors snapcraft merged Merged #4863 in commit 426df7ec3, restoring legacy-style store-error capture so store failures are no longer reported as Snapcraft internal errors.
77%
#287 fix: catch credential decoding errors craft-store merged 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.
76%
#6098 fix: Tweak error message about SNAPCRAFT_STORE_CREDENTIALS snapcraft merged Merged in commit ee69b79b1, clarifying that login cannot be used while SNAPCRAFT_STORE_CREDENTIALS is set and removing ambiguous wording.
74%
#585 Improve the store errors returning exceptions snapcraft merged Merged in canonical/snapcraft#585 via commit ddbbdbd06, refactoring store error handling to raise exceptions and addressing LP #1594636.
73%
#3955 onprem store: support new credentials format snapcraft merged Merged in canonical/snapcraft#3955 as commit 44e7644f7, adding support for the new on-prem store credentials format.
73%
#1765671 Strange technical error message when querying store snapcraft (launchpad) closed Fixed by snapcore/snapcraft#2094, merged as 0d8602cc5, improving handling and presentation of Store API network errors and retries.
72%
#1622635 Cryptic error message for store access failure. snapcraft (launchpad) closed Request for a clearer 401 error suggesting 'snapcraft login' was closed as unnecessary after PR canonical/snapcraft#903 (commit 603948e1d) removed the login requirement for Store part downloads, fixing LP #1606903.
72%
#3744 cli: enable craft-store logging snapcraft merged Merged PR #3744 (commit 6f7e26e6a) enabled craft-store logging in the Snapcraft CLI; merge commit b5d3e916d.
71%