Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The NATS url needs to manually percent decode the username and the password #1193

Open
paolobarbolini opened this issue Jan 11, 2024 · 1 comment
Labels
defect Suspected defect such as a bug or regression

Comments

@paolobarbolini
Copy link
Contributor

paolobarbolini commented Jan 11, 2024

We've had this issue reported for lettre and I believe nats.rs has it too
lettre/lettre#931

The url crate doesn't percent decode the username and the password, so credentials containing characters like # don't work. Here the credentials should be percent decoded:

nats.rs/async-nats/src/lib.rs

Lines 1415 to 1427 in 8c783e0

pub fn username(&self) -> Option<&str> {
let user = self.0.username();
if user.is_empty() {
None
} else {
Some(user)
}
}
/// Returns the optional password in the url.
pub fn password(&self) -> Option<&str> {
self.0.password()
}

@paolobarbolini paolobarbolini added the defect Suspected defect such as a bug or regression label Jan 11, 2024
@paolobarbolini paolobarbolini changed the title The URL format of the NATS url needs to manually percent decode the username and the password The NATS url needs to manually percent decode the username and the password Jan 11, 2024
@Jarema
Copy link
Member

Jarema commented Jan 12, 2024

Thanks for letting us know.

The impact should be really small, as if you're using ConnectOptions with username and password, we are not passing credentials in URL, but in Connect protocol message.

Only case that affects Rust NATS client is when someone manually passes username and password in the NATS url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

2 participants