File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -55,15 +55,8 @@ def validate_samesite_hash_config!
5555
5656 if is_hash? ( config [ :samesite ] [ :strict ] )
5757 validate_exclusive_use_of_hash_constraints! ( config [ :samesite ] [ :strict ] , 'samesite strict' )
58-
59- # validate exclusivity of only and except members within strict and lax
60- if ( intersection = ( config [ :samesite ] [ :lax ] . fetch ( :only , [ ] ) & config [ :samesite ] [ :strict ] . fetch ( :only , [ ] ) ) ) . any?
61- raise CookiesConfigError . new ( "samesite cookie config is invalid, cookie(s) #{ intersection . join ( ', ' ) } cannot be enforced as lax and strict" )
62- end
63-
64- if ( intersection = ( config [ :samesite ] [ :lax ] . fetch ( :except , [ ] ) & config [ :samesite ] [ :strict ] . fetch ( :except , [ ] ) ) ) . any?
65- raise CookiesConfigError . new ( "samesite cookie config is invalid, cookie(s) #{ intersection . join ( ', ' ) } cannot be enforced as lax and strict" )
66- end
58+ validate_exclusive_use_of_samesite_enforcement! ( :only )
59+ validate_exclusive_use_of_samesite_enforcement! ( :except )
6760 end
6861 end
6962 end
@@ -83,6 +76,13 @@ def validate_exclusive_use_of_hash_constraints!(conf, attribute)
8376 end
8477 end
8578
79+ # validate exclusivity of only and except members within strict and lax
80+ def validate_exclusive_use_of_samesite_enforcement! ( attribute )
81+ if ( intersection = ( config [ :samesite ] [ :lax ] . fetch ( attribute , [ ] ) & config [ :samesite ] [ :strict ] . fetch ( attribute , [ ] ) ) ) . any?
82+ raise CookiesConfigError . new ( "samesite cookie config is invalid, cookie(s) #{ intersection . join ( ', ' ) } cannot be enforced as lax and strict" )
83+ end
84+ end
85+
8686 def is_hash? ( obj )
8787 obj && obj . is_a? ( Hash )
8888 end
You can’t perform that action at this time.
0 commit comments