-
Notifications
You must be signed in to change notification settings - Fork 23
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
logs with redacted password in URL #379
logs with redacted password in URL #379
Conversation
Signed-off-by: Eguzki Astiz Lezaun <[email protected]>
@@ -139,7 +140,8 @@ impl Limiter { | |||
.response_timeout(Duration::from_millis(cache_cfg.response_timeout)); | |||
|
|||
cached_redis_storage.build().await.unwrap_or_else(|err| { | |||
eprintln!("Failed to connect to Redis at {redis_url}: {err}"); | |||
let redacted_redis_url = redacted_url(String::from(redis_url)); | |||
eprintln!("Failed to connect to Redis at {redacted_redis_url}: {err}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The down side is that if err
ever contains that password, we'd "reintroduce" the bug. Or do we know that is guarantee provided by the crate?
E.g. what if redis is restarted with a new password and the reconnect path fails? That might be worth a quick (even manual) test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added verification steps with a manual test.
I would never expect the crate to return the url of the connection serialized in the error string, but who knows maybe one day. Today, according to my tests, it is not doing so. Would you suggest to apply some regex replace to the string before writing it to stderr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I would have possibly dealt with that error differently... but if this is fine, well... it's fine 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me know how you would dealt with the error otherwise. Happy to consider it
What
Fixes #360 and also configuration dump on boot stage is also redacted.
Verification steps for starting with a wrong password
The verification steps will be using existing sandbox with limitador configured to connect to redis using pass.
then prepare and boot the environment
The logs will show some loglines from limitador with the configuration redacted
And the error is also redacted
Verification steps for re-connections with a wrong password
The verification steps will be using existing sandbox with limitador configured to connect to redis using pass. The main idea is that, initially, limitador connects correctly with the right password. Then, Redis changes it's own password, so limitador no longer can access redis. The limitador logs should never show the password being used.
It should return 200 OK, and after few more request, it should return
429 Too Many Requests
. That would mean that limitador can connect to redis successfully.then restart only the redis service
The logs will show some loglines from limitador reporting about connection errors
Logs should not reveal any URL or password.