Skip to content

Commit 33b24bb

Browse files
author
Zelda Hessler
authored
fix: signing params debug impl (#2562)
* fix: redact credentials when debug logging signing params * update: CHANGELOG.next.toml * yuki makes a good point
1 parent ee324f2 commit 33b24bb

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

CHANGELOG.next.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,9 @@ message = "Fix but where an incorrect endpoint was produced for WriteGetObjectRe
8686
references = ["smithy-rs#781", "aws-sdk-rust#781"]
8787
meta = { "breaking" = false, "tada" = false, "bug" = true }
8888
author = "rcoh"
89+
90+
[[aws-sdk-rust]]
91+
message = "Update the `std::fmt::Debug` implementation for `aws-sigv4::SigningParams` so that it will no longer print sensitive information."
92+
references = ["smithy-rs#2562"]
93+
meta = { "breaking" = false, "tada" = true, "bug" = true }
94+
author = "Velfi"

aws/rust-runtime/aws-sigv4/src/lib.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
unreachable_pub
1616
)]
1717

18+
use std::fmt;
1819
use std::time::SystemTime;
1920

2021
pub mod sign;
@@ -29,7 +30,6 @@ pub mod http_request;
2930

3031
/// Parameters to use when signing.
3132
#[non_exhaustive]
32-
#[derive(Debug)]
3333
pub struct SigningParams<'a, S> {
3434
/// Access Key ID to use.
3535
pub(crate) access_key: &'a str,
@@ -49,6 +49,20 @@ pub struct SigningParams<'a, S> {
4949
pub(crate) settings: S,
5050
}
5151

52+
impl<'a, S: fmt::Debug> fmt::Debug for SigningParams<'a, S> {
53+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
54+
f.debug_struct("SigningParams")
55+
.field("access_key", &"** redacted **")
56+
.field("secret_key", &"** redacted **")
57+
.field("security_token", &"** redacted **")
58+
.field("region", &self.region)
59+
.field("service_name", &self.service_name)
60+
.field("time", &self.time)
61+
.field("settings", &self.settings)
62+
.finish()
63+
}
64+
}
65+
5266
impl<'a, S: Default> SigningParams<'a, S> {
5367
/// Returns a builder that can create new `SigningParams`.
5468
pub fn builder() -> signing_params::Builder<'a, S> {

0 commit comments

Comments
 (0)