-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Rescue RuntimeError
when trying to use SecureRandom
#1888
Conversation
Hmm From the stack trace above, we can see that it is the call to Lines 1837 to 1844 in 186106d
Ruby, from 3.2.0, does check for, and accounts for, the It looks like your user then manages to load Not 100% we should be rescuing the |
That has actually been reported in Ruby: https://bugs.ruby-lang.org/issues/19230 |
Yeah, same here, did not find a way. I saw this Dockerfile linked from another Ruby bug, just doing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should merge this. Would appreciate input from someone more from @sinatra/sinatras-helpers
@dentarg I think this is ok to merge as well. Normally it would be good to let the Runtime exception be raised to indicate a system error, but this is very specific to generating a secret token which has a fallback. |
RuntimeError when trying to use
SecureRandom`
RuntimeError when trying to use
SecureRandom`RuntimeError
when trying to use SecureRandom
Hello,
I got a report from a user that he couldn't run my app on his Synology. Turns out it doesn't have urandom. stefansundin/rssbox#67
Relevant part of the log:
Where the exception is raised in the Ruby code: https://github.com/ruby/ruby/blob/381a373ab92e2a5869e75f43815993cef39d32cf/random.c#L767
I can't find anything that supports that
NotImplementedError
is raised, but perhaps that is if both random and urandom is missing?Maybe it would be better to just rescue all errors instead?
I have not tested this fix myself since I don't know if it is simple to get rid of urandom in a way that accurately represents the issue. I'll check with the user if he's willing to try out the change.. Maybe I'll build a special docker image for him to test.
Please let me know if you want me to change anything, or feel free to make changes on this branch directly. Thanks!