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

Handle badly formatted cookie value #64

Open
mikemonteith opened this issue Mar 29, 2019 · 0 comments
Open

Handle badly formatted cookie value #64

mikemonteith opened this issue Mar 29, 2019 · 0 comments

Comments

@mikemonteith
Copy link
Contributor

mikemonteith commented Mar 29, 2019

We should be handling malformed cookie values. This is unlikely to happen in the wild, but there is a possibility that some bad host code or browser bug could set the value of our nhsuk-cookie-consent cookie to something that can't be JSON parsed.

JSON.parse will throw an exception if the input is badly formed.

We should catch any JSON.parse exceptions and reset the cookie value to something sensible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant