Skip to content

Conversation

@majewsky
Copy link

@majewsky majewsky commented Nov 8, 2023

This is a bugfix; make verify and make test are passing.

The requirement to check for nil returns from GenerateRandomKey is so unexpected that even other Gorilla libraries get it wrong:

https://github.com/gorilla/sessions/blob/3eed1c4ffcde6f23b6f88068c63c1ef6190df331/store.go#L225

Since a malfunction of the system random number generator is pretty unrecoverable for most security-sensitive applications, I consider it fine to use a panic here. #84 suggests to fix this by changing the interface, but most callers will have no better option than to just die anyway. If callers need a more specific behavior, they can implement these three lines of code themselves with application-specific error handling.

The requirement to check for nil returns is so unexpected that even
other Gorilla libraries get it wrong:

<https://github.com/gorilla/sessions/blob/3eed1c4ffcde6f23b6f88068c63c1ef6190df331/store.go#L225>

Since a malfunction of the system random number generator is pretty
unrecoverable for most security-sensitive applications, I consider it
fine to use a panic here. Most callers will have no better option than
to just die anyway. If callers need a more specific behavior, they can
implement these three lines of code themselves with application-specific
error handling.
@AlexVulaj
Copy link
Member

I'm okay with this change, @coreydaley can you give a second look please?

@AlexVulaj AlexVulaj self-assigned this Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants