-
Notifications
You must be signed in to change notification settings - Fork 14
feat: scope Lambda origin to CloudFront domain #371
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
base: main
Are you sure you want to change the base?
feat: scope Lambda origin to CloudFront domain #371
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #371 +/- ##
=======================================
Coverage 91.80% 91.80%
=======================================
Files 80 80
Lines 2697 2697
Branches 590 590
=======================================
Hits 2476 2476
Misses 85 85
Partials 136 136 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cogwirrel
left a comment
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.
Thanks for this - will definitely be nice to configure CORS properly! :)
Please could we also do the same for FastAPI and Smithy to keep our API generators consistent? :)
packages/nx-plugin/src/trpc/backend/files/src/router.ts.template
Outdated
Show resolved
Hide resolved
packages/nx-plugin/src/trpc/backend/files/src/router.ts.template
Outdated
Show resolved
Hide resolved
packages/nx-plugin/src/trpc/backend/files/src/router.ts.template
Outdated
Show resolved
Hide resolved
packages/nx-plugin/src/py/fast-api/__snapshots__/generator.spec.ts.snap
Outdated
Show resolved
Hide resolved
cogwirrel
left a comment
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.
Great stuff, thanks so much Justin! 🚀
4e7f672 to
820c646
Compare
Reason for this change
This change enhances the default security of the API handler by scoping Lambda access down to the deployed CloudFront domain or local host.
Description of changes
Added an optional
ALLOWED_ORIGINenvironment variable to Lambdas. If set then requests are restricted to this origin or localhost. Also updated a unit test impacted by this changeUpdated the quick start guide
ALLOWED_ORIGINenvironment variableDescription of how you validated changes
Built the AWS nx plugin and docs
Ran the tests:
Ran the doc server:
ALLOWED_ORIGINenvironment variable correctly blocked requests by temporarily changing this to an alternative URL and verifying that echo API calls from the deployed application failedChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license