Repository navigation
make MAX_REMEMBERED_SIGN_INS & MAX_REMEMBERED_PARAMS_BYTESIZE configurable - #1185
Conversation
ba40f70 to
8265baa
Compare
sferik
left a comment
There was a problem hiding this comment.
Thanks for this, Nov. I think making these configurable makes sense. 512 bytes was a guess about what fits comfortably in a cookie session, and apps that use a different session store shouldn't be stuck with it.
I'd like a few changes before merging. The biggest one is keeping the constants. They shipped in 2.4.0 and they're in the RBS signatures, so removing them would break anyone who references them in a minor release. I'd rather keep them and use them as the defaults. I'd also like the setters to reject bad values up front, plus a spec for each setting that actually changes it. A short README note would help too, warning people that raising both limits can overflow a 4 KB cookie session. Details are inline.
sferik
left a comment
There was a problem hiding this comment.
Marking this as changes requested so it's clear where things stand. The details are in my review above.
sferik
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround, Nov. Keeping the constants as the defaults looks good, and so does moving the checks into the setters. There are still a few things I'd like before merging, though.
The mutant job is failing on this commit: https://github.com/omniauth/omniauth/actions/runs/44306980646/job/134816145125?pr=1185. Nine mutants survive in the two new setters. For example, changing value < 1 to value < 2 in max_remembered_sign_ins= doesn't fail any spec, and neither does dropping the message from the bytesize raise. Specs that set the lowest allowed values (1 and 0) and check the error messages should kill them.
The spec I asked for last time is still missing. The new ones in configuration_spec.rb check that the setters store the value, but nothing in sign_ins_spec.rb changes a setting and checks that OmniAuth then remembers a different number of sign-ins or larger params. Without that, no spec would fail if sign_ins.rb went back to reading the constants.
The setters don't check for an Integer yet either. nil raises NoMethodError instead of ArgumentError, and 2.5 and Float::INFINITY are both accepted. Infinity then fails in the middle of a sign-in with a RangeError from Array#last, which is exactly the late failure the check is meant to prevent.
The README note is still missing too. The "Several Sign-Ins at Once" section still talks about the latest 3 sign-ins and 512 bytes without mentioning the settings, and it should warn that raising both can overflow a 4 KB cookie session. A CHANGELOG entry under Unreleased would be nice as well.
The rest are smaller things, inline.
sferik
left a comment
There was a problem hiding this comment.
Thanks, Nov, this is nearly there. The Integer check, the specs that change each setting, and moving the specs and duels back to the constants all look good.
The mutant job is still failing, though: https://github.com/omniauth/omniauth/actions/runs/44317377467/job/134856533598. 10 mutants survive, and the ones in the log both remove the Integer check from the setters (unless value >= 0 and unless value && value >= 1). That's because no spec passes anything that isn't an Integer. I've suggested specs inline.
I've also suggested some rewording for the README and CHANGELOG. Once those are in and mutant passes, I'm happy to merge.
Co-authored-by: Erik Berlin <[email protected]>
Co-authored-by: Erik Berlin <[email protected]>
Co-authored-by: Erik Berlin <[email protected]>
Co-authored-by: Erik Berlin <[email protected]>
This reverts commit e74cc7a.
sferik
left a comment
There was a problem hiding this comment.
Thanks for applying those, Nov. One last thing: mutant still leaves two mutants that turn is_a?(Integer) into instance_of?(Integer). No spec can kill them, because nothing can create an instance of an Integer subclass. Using instance_of? here, like sign_ins.rb does for String, gets mutant to zero survivors. With that change I'm happy to merge.
Co-authored-by: Erik Berlin <[email protected]>
Co-authored-by: Erik Berlin <[email protected]>
sferik
left a comment
There was a problem hiding this comment.
Thanks, Nov! This all looks good to me now. I hope you had a positive experience collaborating on this patch. 😄
|
thanks! |
|
Shipped in v2.4.2. |
fixes #1184
introduce 2 configurable variables, and keep the default as is.
so that, applications utilize 512+ byte params can modify the numbers balancing with their session storage.