Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue # (if available):
None
Description of changes:
Adds
httpOnly
boolean property to Authenticator params.If
true
set cookies usingHttpOnly
.These cookies can still be read from the request in the @edge lambda but are no longer available to javascript Document.cookie API.
HttpOnly
Context
This issue discusses "Tokens exposed to users via cookies: security question" . It notes to avoid cookies you could follow the authorization code grant flow - requiring a request to cognito to ensure code is valid each time.
We'd like to avoid this extra call but also have additional security by setting the cookies using
HttpOnly
as a way to mitigate attacks involving cookies.For our use case we don't need to use amplify on the frontend and this PR assumes support isn't a requirement?
But it might be a bit confusing as the cookies are set with the prefix expected by amplify auth and the architecture diagram includes the amplify logo by the web app. Tried to avoid confusion by making it explicit in readme but happy for feedback on making this clearer if needed.
Thanks for reviewing.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.