You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't call #send in form object to build file inputs
Before this commit, Simple Form was calling `#send` in the form object
to check whether the resulting object was an attachment. That made the
library open to DOS, information disclousure and execution of unintended
action attacks if a form was built with user input.
```erb
<%= simple_form_for @user do |f| %>
<%= f.label @user_supplied_string %>
...
<% end %>
```
The solution is try to figure out if an input is of type file by
checking for methods present in the most popular Ruby Gems for file
uploads. The current supported Gems are: `activestorage`, `carrierwave`,
`paperclip`, `shrine` and `refile`.
The code is relying on public APIs so it should be fine for now.
It would be nice to have a single API to perform this check, so we'll
suggest one for those libraries.
Co-Authored-By: Felipe Renan <feelipe.renan@gmail.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,26 @@
1
1
## Unreleased
2
2
3
+
## 5.0.0
4
+
3
5
### Enhancements
4
6
* Set multiple attribute for grouped selects also. [@ollym](https://github.com/ollym)
5
7
* Removes or renames label classes. [Abduvakilov](https://github.com/Abduvakilov)
6
8
* Support to label custom classes for inline collections. [@feliperenan](https://github.com/feliperenan)
7
9
* Update bootstrap generator template to match v4.3.x. [@m5o](https://github.com/m5o)
8
10
* Allow "required" attribute in generated select elements of PriorityInput. [@mcountis](https://github.com/mcountis)
9
11
12
+
### Bug fix
13
+
* Do not call `#send` in form object to check whether the attribute is a file input. [@tegon](https://github.com/tegon)
14
+
15
+
## Deprecations
16
+
* The config `SimpleForm.file_methods` is deprecated and it has no effect. Simple Form now supports automatically discover of file inputs for the following Gems: activestorage, carrierwave, paperclip, refile and shrine. If you are using a custom method that is not from one of the supported Gems, please change your forms to pass the input type explicitly:
17
+
18
+
```erb
19
+
<%= form.input :avatar, as: :file %>
20
+
```
21
+
22
+
See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-form-cve-2019-16676 for more information.
Copy file name to clipboardExpand all lines: lib/simple_form.rb
+21-4Lines changed: 21 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,17 @@ def %{name}(wrapper_options)
38
38
See https://github.com/plataformatec/simple_form/pull/997 for more information.
39
39
WARN
40
40
41
+
FILE_METHODS_DEPRECATION_WARN=<<-WARN
42
+
[SIMPLE_FORM] SimpleForm.file_methods is deprecated and has no effect.
43
+
44
+
Since version 5, Simple Form now supports automatically discover of file inputs for the following Gems: activestorage, carrierwave, paperclip, refile and shrine.
45
+
If you are using a custom method that is not from one of the supported Gems, please change your forms to pass the input type explicitly:
46
+
47
+
<%= form.input :avatar, as: :file %>
48
+
49
+
See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-form-cve-2019-16676 for more information.
0 commit comments