Skip to content

Commit 26ec5e5

Browse files
authored
Merge pull request rails#50301 from p8/guides/ror-security-links
Remove some outdated security advice from Security guide [ci-skip]
2 parents 0b72868 + f30c097 commit 26ec5e5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

guides/source/security.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ SELECT * FROM projects WHERE (name = '') UNION
661661

662662
The result won't be a list of projects (because there is no project with an empty name), but a list of usernames and their password. So hopefully you [securely hashed the passwords](#user-management) in the database! The only problem for the attacker is, that the number of columns has to be the same in both queries. That's why the second query includes a list of ones (1), which will be always the value 1, in order to match the number of columns in the first query.
663663

664-
Also, the second query renames some columns with the AS statement so that the web application displays the values from the user table. Be sure to update your Rails [to at least 2.1.1](https://rorsecurity.info/journal/2008/09/08/sql-injection-issue-in-limit-and-offset-parameter.html).
664+
Also, the second query renames some columns with the AS statement so that the
665+
Web application displays the values from the user table.
665666

666667
#### Countermeasures
667668

@@ -865,7 +866,8 @@ This example, again, showed that a restricted list filter is never complete. How
865866

866867
If you want to provide text formatting other than HTML (due to security), use a mark-up language which is converted to HTML on the server-side. [RedCloth](https://github.com/jgarber/redcloth) is such a language for Ruby, but without precautions, it is also vulnerable to XSS.
867868

868-
For example, RedCloth translates `_test_` to `<em>test<em>`, which makes the text italic. However, up to the current version 3.0.4, it is still vulnerable to XSS. Get the [all-new version 4](https://github.com/jgarber/redcloth) that removed serious bugs. However, even that version has [some security bugs](https://rorsecurity.info/journal/2008/10/13/new-redcloth-security.html), so the countermeasures still apply. Here is an example for version 3.0.4:
869+
For example, RedCloth translates `_test_` to `<em>test<em>`, which makes the
870+
text italic. However, RedCloth doesn’t filter unsafe html tags by default:
869871

870872
```ruby
871873
RedCloth.new('<script>alert(1)</script>').to_html

0 commit comments

Comments
 (0)