Skip to content

Unsafe UTF-8 decoding of user inputΒ #37

@chris-martin

Description

@chris-martin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions