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

Unsafe UTF-8 decoding of user input #37

Open
chris-martin opened this issue Dec 14, 2023 · 0 comments
Open

Unsafe UTF-8 decoding of user input #37

chris-martin opened this issue Dec 14, 2023 · 0 comments
Labels

Comments

@chris-martin
Copy link

The partial function decodeUtf8 is applied here to user input and will throw impurely if the cookie value is not UTF-8.

let maybeInputId = mcookieVal >>= fromPathPiece . TE.decodeUtf8

Since the output here is going into a Maybe context anyway, I think an easy improvement here could be

let maybeInputId =
      mcookieVal
      >>= (either (const Nothing) Just . TE.decodeUtf8')
      >>= fromPathPiece
@ncaq ncaq added the bug label Dec 20, 2023
@ncaq ncaq added this to @ncaq TODO Feb 10, 2024
@ncaq ncaq moved this to Should in @ncaq TODO Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants