-
Notifications
You must be signed in to change notification settings - Fork 85
Decrypt oracle #87
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
Decrypt oracle #87
Conversation
* add documentation describing the API
if arn.startswith("arn:") and ":alias/" not in arn: | ||
return arn | ||
|
||
raise ValueError("KMS CMK ARN provided for integration tests must be a key not an alias") |
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.
Can we raise a custom exception type here?
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.
Would that add value? The problem that this exception is identifying is that a user-provided value is incorrect. That seems to me to be the definition of ValueError
.
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.
If you expect something to catch this exception, then yes. Its cheap to provide a custom exception, and we aren't giving up anything that ValueError provides.
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 only place this error will manifest is in pytest error logs.
* remove import safeguards to allow 3.5.0 and 3.5.1 to not fail * convert from comment-style typehints to inline
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.
IANAPD
] | ||
}, | ||
{ | ||
"Effect": "Deny", |
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.
For this statement, I think you need to split it into two, because the NotAction and the NotResource are joined by an AND. So the statement as written says "DENY if and only if it is NOT an approved action AND it is NOT an approved resource." That means you won't get an explicit DENY if it is an unapproved action for an approved resource (or vice-versa).
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'm not 100% on the policy combination, but splitting them into two (Action * with NotResource specifics and NotAction specifics with Resource *) made everything fail, including the CloudWatch logging. Reverted back to the (NotAction specifics with NotResource specifics) for now.
Description of changes:
This provides the initial iteration of the decrypt oracle.
Not addressed in this PR is how we plan to handle CD for this API. I'll tackle that separately.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.