-
Notifications
You must be signed in to change notification settings - Fork 196
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
Integration with secrecy crate for sensitive data #2580
Comments
It sounds like this might already be the case if using the |
So, for example, the following model: @http(uri: "/operation", method: "POST")
operation Operation {
input: OperationInputOutput
output: OperationInputOutput
}
structure OperationInputOutput {
secretStructure: SecretStructure
secretString: SecretString
regularString: String
}
@sensitive
structure SecretStructure {
password: String
}
@sensitive
string SecretString Generates: impl std::fmt::Debug for SecretStructure {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("SecretStructure");
formatter.field("password", &"*** Sensitive Data Redacted ***");
formatter.finish()
}
} impl std::fmt::Debug for OperationInput {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("OperationInput");
formatter.field("secret_structure", &"*** Sensitive Data Redacted ***");
formatter.field("secret_string", &"*** Sensitive Data Redacted ***");
formatter.field("regular_string", &self.regular_string);
formatter.finish()
}
} An important thing to note here is that the |
(I added the |
Ah ok, I see, thanks for the clarification! It looks like #1833 is what we're looking for. Happy to have this ticket closed as a duplicate of that one |
When handling sensitive data that we don't want to have accidentally logged it is helpful to have them wrapped in some sort of
Secret<T>
type (such as theSecret<T>
type from the secrecy crate) which will print something like[REDACTED]
instead of the data. As of right now we have to manually do the mapping from the Smithy-rs input types to the wrappedSecret<T>
types, which means we have a layer with the sensitive data not wrapped in a redacting type.If the Smithy-rs input and output generated types provided the sensitive data pre-wrapped in
Secret<T>
it would remove this layer where we could accidentally log the raw data and make it easier to audit for the.expose_secret()
call.The text was updated successfully, but these errors were encountered: