mysql-binuuid-rails 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e816b78ae0f3deafefbbbe31a8afd9b2fb3871666ff726743d3a5e73c041d908
4
- data.tar.gz: e616712f16e6560b0f6588081d641d7f6fa058f5b3ffd4b122f3d71374048529
3
+ metadata.gz: 310c74261238918fa745014e63fc25691fd7f6d31baa27a53d7977a079e37bc5
4
+ data.tar.gz: b6c545315222b4ec9ef21ee38ade3e2044dbe0327955b8673215f05a0904885e
5
5
  SHA512:
6
- metadata.gz: 6765b2da70182aeb6aa1066d63d609056ecafea9d6fbaecd2249a43d693b8c573c8833f0e1609449903d1d4f14d7386e9df86bd0cc4fbf7cbd72dd17c894d9dc
7
- data.tar.gz: 4cd1ff1cd8528da16c662eff37d65e1c7327dcd18f5486d037824f2c4eaf31793b24963fe86f3faf8cc0a07c6e6219bed4876a13a0378c0177fae9445d46001c
6
+ metadata.gz: 457ab7be14fefda336a4db3e0a20b1d8f2cfe6e0d814337943664a1104fe4d67e13eb0d4a1e4d413fd81b38334cd49980067c5ed4c6556bb8bf7d1fb1f7c58e1
7
+ data.tar.gz: 74ff493fb8f777c586b6df3810c9cfd125fd71cbbe1fede598ee6feb47380831dc97b418ea0e14c90453bf036c86258f0bb813bab68d2f82c1ae1ad629d732ff
@@ -1,14 +1,15 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.3.7
5
- - 2.4.4
6
- - 2.5.1
4
+ - 2.3.8
5
+ - 2.4.5
6
+ - 2.5.3
7
7
  env:
8
8
  matrix:
9
9
  - RAILS_VERSION=5.0.5
10
10
  - RAILS_VERSION=5.1.6
11
11
  - RAILS_VERSION=5.2.0
12
+ - RAILS_VERSION=5.2.1
12
13
  before_install:
13
14
  - gem install bundler
14
15
  - gem update bundler
@@ -1,3 +1,10 @@
1
+ # 1.1.1
2
+
3
+ * Fixes possible SQL injection for ActiveRecord columns typed with
4
+ MySQLBinUUID::Type.
5
+ Thank you @ejoubaud, @geoffevason and @viraptor.
6
+
7
+
1
8
  # 1.1.0
2
9
 
3
10
  * Set minimum Ruby version from 2.2 to 2.3
@@ -1,49 +1,49 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mysql-binuuid-rails (1.0.0)
4
+ mysql-binuuid-rails (1.1.0)
5
5
  rails (>= 5)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (5.2.0)
11
- actionpack (= 5.2.0)
10
+ actioncable (5.2.1)
11
+ actionpack (= 5.2.1)
12
12
  nio4r (~> 2.0)
13
13
  websocket-driver (>= 0.6.1)
14
- actionmailer (5.2.0)
15
- actionpack (= 5.2.0)
16
- actionview (= 5.2.0)
17
- activejob (= 5.2.0)
14
+ actionmailer (5.2.1)
15
+ actionpack (= 5.2.1)
16
+ actionview (= 5.2.1)
17
+ activejob (= 5.2.1)
18
18
  mail (~> 2.5, >= 2.5.4)
19
19
  rails-dom-testing (~> 2.0)
20
- actionpack (5.2.0)
21
- actionview (= 5.2.0)
22
- activesupport (= 5.2.0)
20
+ actionpack (5.2.1)
21
+ actionview (= 5.2.1)
22
+ activesupport (= 5.2.1)
23
23
  rack (~> 2.0)
24
24
  rack-test (>= 0.6.3)
25
25
  rails-dom-testing (~> 2.0)
26
26
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
- actionview (5.2.0)
28
- activesupport (= 5.2.0)
27
+ actionview (5.2.1)
28
+ activesupport (= 5.2.1)
29
29
  builder (~> 3.1)
30
30
  erubi (~> 1.4)
31
31
  rails-dom-testing (~> 2.0)
32
32
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
- activejob (5.2.0)
34
- activesupport (= 5.2.0)
33
+ activejob (5.2.1)
34
+ activesupport (= 5.2.1)
35
35
  globalid (>= 0.3.6)
36
- activemodel (5.2.0)
37
- activesupport (= 5.2.0)
38
- activerecord (5.2.0)
39
- activemodel (= 5.2.0)
40
- activesupport (= 5.2.0)
36
+ activemodel (5.2.1)
37
+ activesupport (= 5.2.1)
38
+ activerecord (5.2.1)
39
+ activemodel (= 5.2.1)
40
+ activesupport (= 5.2.1)
41
41
  arel (>= 9.0)
42
- activestorage (5.2.0)
43
- actionpack (= 5.2.0)
44
- activerecord (= 5.2.0)
42
+ activestorage (5.2.1)
43
+ actionpack (= 5.2.1)
44
+ activerecord (= 5.2.1)
45
45
  marcel (~> 0.3.1)
46
- activesupport (5.2.0)
46
+ activesupport (5.2.1)
47
47
  concurrent-ruby (~> 1.0, >= 1.0.2)
48
48
  i18n (>= 0.7, < 2)
49
49
  minitest (~> 5.1)
@@ -55,7 +55,7 @@ GEM
55
55
  erubi (1.7.1)
56
56
  globalid (0.4.1)
57
57
  activesupport (>= 4.2.0)
58
- i18n (1.0.0)
58
+ i18n (1.1.0)
59
59
  concurrent-ruby (~> 1.0)
60
60
  loofah (2.2.2)
61
61
  crass (~> 1.0.2)
@@ -66,44 +66,44 @@ GEM
66
66
  mimemagic (~> 0.3.2)
67
67
  method_source (0.9.0)
68
68
  mimemagic (0.3.2)
69
- mini_mime (1.0.0)
69
+ mini_mime (1.0.1)
70
70
  mini_portile2 (2.3.0)
71
71
  minitest (5.11.3)
72
72
  minitest-hooks (1.4.2)
73
73
  minitest-spec-context (0.0.3)
74
74
  mysql2 (0.4.10)
75
- nio4r (2.3.0)
76
- nokogiri (1.8.2)
75
+ nio4r (2.3.1)
76
+ nokogiri (1.8.4)
77
77
  mini_portile2 (~> 2.3.0)
78
- rack (2.0.4)
79
- rack-test (1.0.0)
78
+ rack (2.0.5)
79
+ rack-test (1.1.0)
80
80
  rack (>= 1.0, < 3)
81
- rails (5.2.0)
82
- actioncable (= 5.2.0)
83
- actionmailer (= 5.2.0)
84
- actionpack (= 5.2.0)
85
- actionview (= 5.2.0)
86
- activejob (= 5.2.0)
87
- activemodel (= 5.2.0)
88
- activerecord (= 5.2.0)
89
- activestorage (= 5.2.0)
90
- activesupport (= 5.2.0)
81
+ rails (5.2.1)
82
+ actioncable (= 5.2.1)
83
+ actionmailer (= 5.2.1)
84
+ actionpack (= 5.2.1)
85
+ actionview (= 5.2.1)
86
+ activejob (= 5.2.1)
87
+ activemodel (= 5.2.1)
88
+ activerecord (= 5.2.1)
89
+ activestorage (= 5.2.1)
90
+ activesupport (= 5.2.1)
91
91
  bundler (>= 1.3.0)
92
- railties (= 5.2.0)
92
+ railties (= 5.2.1)
93
93
  sprockets-rails (>= 2.0.0)
94
94
  rails-dom-testing (2.0.3)
95
95
  activesupport (>= 4.2.0)
96
96
  nokogiri (>= 1.6)
97
97
  rails-html-sanitizer (1.0.4)
98
98
  loofah (~> 2.2, >= 2.2.2)
99
- railties (5.2.0)
100
- actionpack (= 5.2.0)
101
- activesupport (= 5.2.0)
99
+ railties (5.2.1)
100
+ actionpack (= 5.2.1)
101
+ activesupport (= 5.2.1)
102
102
  method_source
103
103
  rake (>= 0.8.7)
104
- thor (>= 0.18.1, < 2.0)
104
+ thor (>= 0.19.0, < 2.0)
105
105
  rake (12.3.1)
106
- sprockets (3.7.1)
106
+ sprockets (3.7.2)
107
107
  concurrent-ruby (~> 1.0)
108
108
  rack (> 1, < 3)
109
109
  sprockets-rails (3.2.1)
@@ -131,4 +131,4 @@ DEPENDENCIES
131
131
  rake
132
132
 
133
133
  BUNDLED WITH
134
- 1.16.1
134
+ 1.16.2
data/README.md CHANGED
@@ -152,6 +152,14 @@ a console with the changes you made, run `bin/console`.
152
152
  Bug reports and pull requests are welcome on GitHub at
153
153
  https://github.com/nedap/mysql-binuuid-rails
154
154
 
155
+ ## Contributors
156
+
157
+ Thank you:
158
+
159
+ * Emmanuel Joubaud ([@ejoubaud](https://github.com/ejoubaud))
160
+ * Geoff Evason ([@geoffevason](https://github.com/geoffevason))
161
+ * Stanisław Pitucha ([@viraptor](https://github.com/viraptor))
162
+
155
163
 
156
164
  # License
157
165
 
@@ -1,6 +1,7 @@
1
1
  module MySQLBinUUID
2
- class Type < ActiveModel::Type::Binary
2
+ class InvalidUUID < StandardError; end
3
3
 
4
+ class Type < ActiveModel::Type::Binary
4
5
  def type
5
6
  :uuid
6
7
  end
@@ -27,7 +28,16 @@ module MySQLBinUUID
27
28
  # it to the database.
28
29
  def serialize(value)
29
30
  return if value.nil?
30
- Data.new(strip_dashes(value))
31
+ undashed_uuid = strip_dashes(value)
32
+
33
+ # To avoid SQL injection, verify that it looks like a UUID. ActiveRecord
34
+ # does not explicity escape the Binary data type. escaping is implicit as
35
+ # the Binary data type always converts its value to a hex string.
36
+ unless valid_undashed_uuid?(undashed_uuid)
37
+ raise MySQLBinUUID::InvalidUUID, "#{value} is not a valid UUID"
38
+ end
39
+
40
+ Data.new(undashed_uuid)
31
41
  end
32
42
 
33
43
  # We're inheriting from the Binary type since ActiveRecord in that case
@@ -73,5 +83,10 @@ module MySQLBinUUID
73
83
  uuid.delete("-")
74
84
  end
75
85
 
86
+ # Verify that the undashed version of a UUID only contains characters that
87
+ # represent a hexadecimal value.
88
+ def valid_undashed_uuid?(value)
89
+ value =~ /\A[[:xdigit:]]{32}\z/
90
+ end
76
91
  end
77
92
  end
@@ -1,3 +1,3 @@
1
1
  module MySQLBinUUID
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql-binuuid-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Oude Veldhuis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-17 00:00:00.000000000 Z
11
+ date: 2018-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails