miasma-aws 0.3.18 → 0.3.20

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: 80283cd6d47264eb9b6eaaf85f7b426ca1beb2e25d7edd00d7406f2dc9deb63e
4
- data.tar.gz: 0e8eef5ffc42b88daa751e0cf52ecd79122b94fe3c58dc4515957d06f09b9fd4
3
+ metadata.gz: 04a578bff18113ac8611dca8ce988c964e54c7ad28e9c5da32742bb07e4a5afd
4
+ data.tar.gz: f495f1066d0f3a42aac9485330799a3588e7e3144b5ae3b2b65950067a769b94
5
5
  SHA512:
6
- metadata.gz: 73a7cf2d4cf0b2f950be4c198d2c927396b3db36334cdd1fe66a77dea9f57f82e73a6b3110154481397665432d92287a2af033440dd94b38f7fee1a2d33d49d7
7
- data.tar.gz: 64d746a64035c4c95400fd5cb88dc9747c8e6780ca4c217c4fa27acd1d27270b638e0d23b82b8209c0dde7232bc2eeedf97ea5fb5ddaedc352a331f442597a51
6
+ metadata.gz: 04015f3c41bb33aaa3316411ae089b5dfa28f95f8798c78890c37c12d501760a84d3cdc04b9db5039eabde96a8861f9a433504d470647b8c126056007d2fc84e
7
+ data.tar.gz: f91b0f9d0c61803f21470b6a3e171ad682d91cbcd2b36da01e31cfc6e74c0b88a99b115bdd6d75b527f19c513e433ea135fdc322c206104c1e41e1a1e65b71a8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.3.20
2
+ * [fix] Properly calculate token expiry (#52)
3
+ * [enhancement] Generate custom exception when key is not provided to signer (#53)
4
+
1
5
  # v0.3.18
2
6
  * [fix] Prevent defaults overriding attribute values (#49)
3
7
 
@@ -1,4 +1,4 @@
1
1
  module MiasmaAws
2
2
  # Current library version
3
- VERSION = Gem::Version.new("0.3.18")
3
+ VERSION = Gem::Version.new("0.3.20")
4
4
  end
@@ -94,7 +94,11 @@ module Miasma
94
94
  # @param key_override [Object]
95
95
  # @return [Object] signature
96
96
  def sign(data, key_override = nil)
97
- result = OpenSSL::HMAC.digest(digest, key_override || key, data)
97
+ s_key = key_override || key
98
+ if s_key.nil?
99
+ raise ArgumentError.new("No key provided for signing data")
100
+ end
101
+ result = OpenSSL::HMAC.digest(digest, key_override || key, data.to_s)
98
102
  digest.reset
99
103
  result
100
104
  end
@@ -788,7 +792,7 @@ module Miasma
788
792
  def sts_assume_role_update_required?(args = {})
789
793
  if args.fetch(:aws_sts_role_arn, attributes[:aws_sts_role_arn])
790
794
  expiry = args.fetch(:aws_sts_token_expires, attributes[:aws_sts_token_expires])
791
- expiry.nil? || expiry <= Time.now - 15
795
+ expiry.nil? || expiry - 15 <= Time.now
792
796
  else
793
797
  false
794
798
  end
@@ -803,7 +807,7 @@ module Miasma
803
807
  :aws_sts_session_token_expires,
804
808
  attributes[:aws_sts_session_token_expires]
805
809
  )
806
- expiry.nil? || expiry <= Time.now - 15
810
+ expiry.nil? || expiry - 15 <= Time.now
807
811
  else
808
812
  false
809
813
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miasma-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.18
4
+ version: 0.3.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-08 00:00:00.000000000 Z
11
+ date: 2018-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: miasma