-
Notifications
You must be signed in to change notification settings - Fork 4k
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(cloudfront): load external pem keys for Trusted Key Groups #12851
Conversation
ec86e01
to
f1053d0
Compare
@njlynch I've been following your guidance from #12743 (comment) . Here are the few things that I'm trying to figure out:
Do you have any design guidance we should pursue instead? |
These are two bullet points are kinda obsolete now after 41c1a0a. I've borrowed heavily from //inline
new PublicKey(stack, 'MyPublicKey', {
encodedKey: Key.fromInline(''),
});
//from file
new PublicKey(stack, 'MyPublicKey', {
encodedKey: Key.fromFile(path.join(__dirname, 'pem/pubkey-good.test.pem')),
})
InlineKey class has a majority of these checks now. However, let me know what else we can check on. I'll gladly add more and update tests. On a side note... can you please explain what's the purpose of
-----BEGIN----- and -----END----- checks from Token check. Thoughts?
In addition to this... any guidelines on error handling when reading files? Should I put this in try/catch block? i.e. check if pem file is empty, check if it has
Let me know... If this makes sense from design perspective and if we need to go in different direction. P.S. I think we should merge this PR first and then merge #12847. That way we can update/rebase #12847 once this one lands on master and we won't have breaking API changes right off the bat. Thoughts? I'll convert #12847 to draft in the meantime. |
Hmm... my latest builds are failing... the only thing that changed is that
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@njlynch Do you happen to know why Edit: I saw explanation about zeroes here https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md#full-clean-build Still trying to figure out why builds are failing. |
The build is failing because we can't make backwards-incompatible changes to (non-experimental) classes (in non-experimental modules). As the PublicKey L2 was released, it now is a contract that we can't break subsequently by changing the type of one of the properties. If we want to add this functionality now, the options are:
Sure. https://docs.aws.amazon.com/cdk/latest/guide/tokens.html is a handy primer. Short version -- any string (or number, or list) in the CDK might actually be a Token which references some other value from some other construct/resource. So rather than the string being |
@njlynch Thanks again for explaining all this. I figured it was probably a breaking contract. Makes total sense. For the future reference, lesson learned on my part, maybe I should’ve created these two L2 constructs as experimental first and let the dust settle a bit... before changing the Implementation :) In our use case (multiple teams using same AWS acct) we wanted to create bunch of trusted key groups (and pub keys) using factory pattern from file system and that guided my design of this PR. But I like the ideas you mentioned in option 3 so let’s wait for it then. You can go ahead and review/merge #12847 so we can at least use new constructs in Distribution. I’ll leave this PR as draft and come back to it after we get some feedback from the community. |
@robertd - Would you be okay just closing out this PR until we've received some feedback and ready to implement something like this? I keep seeing this in my "queue" and thinking I need to review it. :) We can always re-open it later. |
@njlynch 👍 |
@njlynch Here is my first take on this... Constructive criticism is more than welcome. ✌️
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license