Skip to content
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

feat: AwsKmsMrkAwareSymmetricKeyring #383

Merged
merged 26 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ test/**/Output/*

# Duvet output
specification_compliance_report.html

# VS Code local history
/.history
2 changes: 1 addition & 1 deletion aws-encryption-sdk-specification
2 changes: 1 addition & 1 deletion libraries
1 change: 1 addition & 0 deletions src/KMS/AmazonKeyManagementService.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ module {:extern "Amazon.KeyManagementService"} AmazonKeyManagementService {
// TODO: https://github.com/awslabs/aws-encryption-sdk-dafny/issues/284
class {:extern "IAmazonKeyManagementService"} IAmazonKeyManagementService {}
}

11 changes: 11 additions & 0 deletions src/KMS/AwsKmsArnParsing.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

include "../StandardLibrary/StandardLibrary.dfy"
include "../../libraries/src/Collections/Sequences/Seq.dfy"
include "../Util/UTF8.dfy"

module AwsKmsArnParsing {
import opened StandardLibrary
import opened Wrappers
import opened Seq
import UTF8

const MAX_AWS_KMS_IDENTIFIER_LENGTH := 2048

datatype AwsResource = AwsResource(
resourceType: string,
Expand Down Expand Up @@ -325,4 +329,11 @@ module AwsKmsArnParsing {
case AwsKmsRawResourceIdentifier(_) => None()
}
}

type AwsKmsIdentifierString = s: string |
&& ParseAwsKmsIdentifier(s).Success?
&& UTF8.IsASCIIString(s)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't actually realize this, is it explicitly documented in the ARN and/or KMS documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but it is required for how we did Dafny. Because UTF8 is not "built in" :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is why it is here, and NOT in ParseAwsKmsIdentifier

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What part of the Dafny requires ASCII (I'm assuming it's probably UTF8Valid requires later on)? And what is the consequence if there is some ID out there that uses some non-ASCII UTF8 character?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lavaleri your intuition is correct

&& 0 < |s| <= MAX_AWS_KMS_IDENTIFIER_LENGTH
witness *

}
Loading