sanitize_sql_like 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/sanitize_sql_like/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3fd8539403bc302758e3b635e47e51f48832fbb
|
4
|
+
data.tar.gz: f19a63473d0b51374786ce1c34441c795068f2d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf892e16268a73d8976e58e86c4362ae3bdfb733006a4457d6a593a6ce791b0f4678cffbb1690e8295cb7e12c9b6f4649aa19a0c709d8e4568fa60d47ddd6710
|
7
|
+
data.tar.gz: a37a98fb99065b0c0b8c9fcc7b48df3a3d43b8bf006d57700683ad92cf86e0f9e5504b6e3da5c6ada9798973d76f460ed5123e33aad8565f9d0ddbd18e952da6
|
data/README.md
CHANGED
@@ -30,6 +30,15 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
## Usage
|
32
32
|
|
33
|
+
Prevent SQL injection using LIKE operator in SQL query:
|
34
|
+
```rb
|
35
|
+
# Bad
|
36
|
+
User.where("nickname LIKE ?", "%#{params[:nickname]}%")
|
37
|
+
|
38
|
+
# Good
|
39
|
+
User.where("nickname LIKE ?", "%#{User.send(:sanitize_sql_like, params[:nickname])}%")
|
40
|
+
```
|
41
|
+
|
33
42
|
|
34
43
|
|
35
44
|
|