Simplify `Session.sweep` method example in security doc [ci skip] by pocke · Pull Request #42116 · rails/rails · GitHub
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

Simplify Session.sweep method example in security doc [ci skip] #42116

Conversation

pocke
Copy link
Contributor

@pocke pocke commented May 1, 2021

This pull request simplifies Session.sweep method implementation example in the security guide.
I removed the String to Time conversion of Session.sweep method.

I think removing the conversion introduces two benefits.

First, the method will focus on the main feature, which is expiring old sessions, by this change.
The conversion is not required to understand how to expire sessions. And the implementation is a bit difficult. So it will be easy to understand by removing it, but it still describes the main feature.

Second, the conversion introduces security issues.
It uses Kernel.#send method, so any methods of Integer are callable via the argument. For example, Session.sweep('42 sleep') sleeps forever.
Actually, it doesn't become a problem rarely. But I think the potential problem is not appropriate for the "security" document.

@rails-bot rails-bot bot added the docs label May 1, 2021
@kamipo kamipo merged commit be630f7 into rails:main May 1, 2021
@pocke pocke deleted the Simplify__Session_sweep__method_example_in_security_doc__ci_skip_ branch May 1, 2021 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants