activesupport 3.2.22 → 3.2.22.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/active_support/security_utils.rb +27 -0
- data/lib/active_support/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aa4131e5399a33514ac3a65716499454d69b3c1
|
4
|
+
data.tar.gz: 313c081fa4954981623e6e5cfa5f9ecd8e30ed5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d72b1331458064eb84814da1f2eb43827bb1b1697784edb4646a7fc2ef86cab5e759c087c6e8396b746391aea63ddde5d710cc7e25a655b44422145714dbc24
|
7
|
+
data.tar.gz: c30d3076e4445f889ffe0bf13f94c01b00bc6502521722f02482bb130edd150a6c4ad3f756aa35586280bcaba3c2b80f9057cb4a844e57bea0b53452751b108b
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'digest'
|
2
|
+
|
3
|
+
module ActiveSupport
|
4
|
+
module SecurityUtils
|
5
|
+
# Constant time string comparison.
|
6
|
+
#
|
7
|
+
# The values compared should be of fixed length, such as strings
|
8
|
+
# that have already been processed by HMAC. This should not be used
|
9
|
+
# on variable length plaintext strings because it could leak length info
|
10
|
+
# via timing attacks.
|
11
|
+
def secure_compare(a, b)
|
12
|
+
return false unless a.bytesize == b.bytesize
|
13
|
+
|
14
|
+
l = a.unpack "C#{a.bytesize}"
|
15
|
+
|
16
|
+
res = 0
|
17
|
+
b.each_byte { |byte| res |= byte ^ l.shift }
|
18
|
+
res == 0
|
19
|
+
end
|
20
|
+
module_function :secure_compare
|
21
|
+
|
22
|
+
def variable_size_secure_compare(a, b) # :nodoc:
|
23
|
+
secure_compare(::Digest::SHA256.hexdigest(a), ::Digest::SHA256.hexdigest(b))
|
24
|
+
end
|
25
|
+
module_function :variable_size_secure_compare
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.22
|
4
|
+
version: 3.2.22.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -235,6 +235,7 @@ files:
|
|
235
235
|
- lib/active_support/railtie.rb
|
236
236
|
- lib/active_support/rescuable.rb
|
237
237
|
- lib/active_support/ruby/shim.rb
|
238
|
+
- lib/active_support/security_utils.rb
|
238
239
|
- lib/active_support/string_inquirer.rb
|
239
240
|
- lib/active_support/tagged_logging.rb
|
240
241
|
- lib/active_support/test_case.rb
|
@@ -287,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
288
|
version: '0'
|
288
289
|
requirements: []
|
289
290
|
rubyforge_project:
|
290
|
-
rubygems_version: 2.
|
291
|
+
rubygems_version: 2.5.1
|
291
292
|
signing_key:
|
292
293
|
specification_version: 4
|
293
294
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|