Credential provider protocol fails with strings containing escaped characters
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Problem
The structures defined in the credential provider protocol use borrowed string (&'a str) types that can only be deserialized if they don't contain any characters that need to be escaped by JSON. If escaping is required then the deserialization fails with:
invalid type: string "test\ning", expected a borrowed string
This can occur if, for example, the user attempts to use a " in a registry auth token. This is not a bug in the JSON protocol itself.
Steps
- Set up a credential provider
- Run
cargo login - Use a token that contains a
"
Possible Solution(s)
- Switch to using
Cow<'a, str>in the credential struct definitions. - Switch to using
Stringin the struct definitions.
Any solution seems to require a breaking change to the credential struct definitions.
Notes
No response
Version
cargo 1.78.0-nightly (fc1d58fd0 2024-02-09)
release: 1.78.0-nightly
commit-hash: fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3
commit-date: 2024-02-09
host: x86_64-pc-windows-msvc
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.6.0-DEV (sys:0.4.71+curl-8.6.0 vendored ssl:Schannel)
os: Windows 10.0.26085 (Windows 11 Enterprise) [64-bit]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the credential provider protocol definitions and the deserialization path exercised by cargo login. Reproduce the failure with a token containing an escaped character, then determine whether the protocol types should use Cow<'a, str> or String and add coverage for escaped credentials.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100