-
Notifications
You must be signed in to change notification settings - Fork 218
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
Questions on @sensitive
#1605
Comments
No. It only applies to the direct shape and it's members.
It is backward compatible to add/remove the sensitive trait, yes. Changing the output of Debug shouldn't be an issue and is actually desirable IMO if something truly is sensitive and a team adds the sensitive trait. Changing the type signature based on sensitive traits would be something to avoid though since it would break previously generated code, and we don't want to discourage service teams from retroactively fixing their models by applying missing sensitive traits. re: Evolving models page: This page doesn't contain every possible backward or forward compatible change, and I don't think it ever could. Maybe we need to make that more clear. The best place to look for trait compatibility is the spec for the trait and the prelude model. Trait defintions describe their backward compatibility constraints, so you can find them in the prelude. We need to better publish the prelude somehow too.
The problems I can think of here are:
|
Thanks for answering my questions.
Ah, I didn't know that. It'd be neat if we parsed the backwards compatibility info and surfaced it in the docs. re: the problems on newtyping you call out, it's clear we can't do this on generated clients. Our doubt is whether to do it in server SDKs, which are authoritative model consumers, and where it might even be a good thing to break the build, since allowing the application author to inadvertently log these may be seen as a security risk. We already newtype constrained shapes (with a codegen option to disable such behavior), so newtyping on |
Closing as I believe the main question is answered and the note for checking compatibility has been added to the spec. |
Suppose we have:
I have a few questions on the
@sensitive
trait; let me know if you'd like me to create separate issues for any of them.1. Transitivity of
@sensitive
Is
@sensitive
transitive? IsList
to be considered sensitive in the same respects asStruct
andPassword
(i.e. redacted from logs)? Or only when it is being hosted in the programming language type represented byStruct
? Note that:List
were@sensitive
, it would be logged as"*** Sensitive Data Redacted ***"
.List
were not@sensitive
and had two members, it would be logged as["*** Sensitive Data Redacted ***", "*** Sensitive Data Redacted ***"]
.2. Backwards compatibility of
@sensitive
Currently, in smithy-rs we implement the
Debug
trait on structs so that if the structure shape is@sensitive
, we redact it; likewise, if any of the structure members targets a shape that is@sensitive
, we redact them too.Is this behavior compliant with the spec? I assume, from the lack of a mention in the Evolving models page, that it is backwards-compatible to add or remove
@sensitive
in the model. However, in smithy-rs it might not be, because the actual implementation ofDebug
would change.3. On newtyping
@sensitive
shapesIn smithy-rs,
Password
is currently rendered as a regularstd::string::String
type from the standard library. So when a user writes:They'd be printing out the contents. In this particular example it might be OK to go ahead and log the string, since the user's intention is clear. However, consider that:
Password
may be very nested in a (non-@sensitive
) shape hierarchy. When the user logs the root shape, they might be inadvertently loggingPassword
.@sensitive
trait may be added to a shape at any time. Things that are currently being logged might become sensitive in the future and the user's application would then be inadvertently logging them!I doubt this problem is solvable in all programming languages, but in Rust newtypes are a widespread pattern that may offer a solution. Instead of rendering the
Password
shape as a standard libraryString
type, we'd render it as a code-generatedPassword
unit struct type we have control over. We'd be able to implementDebug
andDisplay
on said type to redact its contents if the shape is@sensitive
. We're considering implementing such a thing over in smithy-lang/smithy-rs#1833 for server SDKs. As experts in the spec, do you have any thoughts about whether we should or shouldn't do this?The text was updated successfully, but these errors were encountered: