Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OHR Support
Manage
Activity
Members
Labels
Plan
Issues
97
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
OHR Support
Commits
c3d3bec4
Commit
c3d3bec4
authored
12 years ago
by
Holger Just
Browse files
Options
Downloads
Patches
Plain Diff
Fix SQL injection via nested hashes in conditions (CVE-2012-2694) #1036
parent
8d56d327
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
config/initializers/10-patches.rb
+11
-4
11 additions, 4 deletions
config/initializers/10-patches.rb
with
11 additions
and
4 deletions
config/initializers/10-patches.rb
+
11
−
4
View file @
c3d3bec4
...
...
@@ -116,26 +116,33 @@ module ActionController
end
end
# Backported fix for CVE-2012-2660
# Backported fix for
# CVE-2012-2660
# https://groups.google.com/group/rubyonrails-security/browse_thread/thread/f1203e3376acec0f
# TODO: Remove this once we are on Rails >= 3.2.4
#
# CVE-2012-2694
# https://groups.google.com/group/rubyonrails-security/browse_thread/thread/8c82d9df8b401c5e
#
# TODO: Remove this once we are on Rails >= 3.2.6
require
'action_controller/request'
class
Request
protected
# Remove nils from the params hash
def
deep_munge
(
hash
)
keys
=
hash
.
keys
.
find_all
{
|
k
|
hash
[
k
]
==
[
nil
]
}
keys
.
each
{
|
k
|
hash
[
k
]
=
nil
}
hash
.
each_value
do
|
v
|
case
v
when
Array
v
.
grep
(
Hash
)
{
|
x
|
deep_munge
(
x
)
}
v
.
compact!
when
Hash
deep_munge
(
v
)
end
end
keys
=
hash
.
keys
.
find_all
{
|
k
|
hash
[
k
]
==
[
nil
]
}
keys
.
each
{
|
k
|
hash
[
k
]
=
nil
}
hash
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment