awslabs / cognito-at-edge

Serverless authentication solution to protect your website or Amplify application
Apache License 2.0
168 stars 54 forks source link

fix: update regex to account for idToken being last key value pair in cookie string #33

Closed timbakkum closed 2 years ago

timbakkum commented 2 years ago

Issue # (if available): n/a

Description of changes:

We found that the cookie's key-value pairs order matters for this class to work properly. If the idToken is the last cookie in the cookie string, then a ; won't be added at the end of it. However, the Regex for extracting the idToken value currently expect this to always be there.

This PR updates the RegEx to account for both matching a final ; and for matching the end of the string value.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

jeandek commented 2 years ago

Hi Tim, Nice work spotting this and thanks for submitting a PR. I've merged it and expect to release a new version of the package by the end of the week. Cheers, Jean