awskeyring 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e56bbd10b469c722c15eaca7729bf39eac3aa3bde760c6faa44fd891200c7e2d
4
- data.tar.gz: f1381f0d3e9c9f69c5404cae3a12499d94bfc003999fc96f3eabc2fe98218852
3
+ metadata.gz: c8bf8ca4f1b8acb13b25ac0c3a362afcf390e5e8e8d5f1e42b1c4c68748f0149
4
+ data.tar.gz: 3693e3e8d7a9fa30ab1430cea360cd32c85c98a22a9ae68a725f236c335afe2b
5
5
  SHA512:
6
- metadata.gz: b1fcf72a9fded0b2464f5f12bdcba598928400bb9b7c25bc586deb28f244d8044514433e596d758e1a54121c24c56972e2e137cc6803cca545dfb0486bc45a3e
7
- data.tar.gz: 46a6c39a038ca5258a84cda96f12a3e8c6b7cea655f918476aef5b0ecc70c032cf02162eefc47ed4ed498e5234a4eb2637ec958309d8b23461b3306013a8a6b0
6
+ metadata.gz: 7c786f1bf73ccbe18f3c259824dfbc60bcbcf70e611916b70b8349fd9a40350f045b7e5b8e676e71bbf7bb0feadba76f54da28816cf18c32dd7a2d7acdc1d3e0
7
+ data.tar.gz: 5a03251d5b09208802a0790b2d52dcfa3a581394e3cd041e79cf69fa39fbd298ec8e76ae47b237342f360402d85ea5b6512f7eea89163157dcff5fd7bbd946a5
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.6.0](https://github.com/servian/awskeyring/tree/v1.6.0) (2020-08-11)
4
+
5
+ [Full Changelog](https://github.com/servian/awskeyring/compare/v1.5.0...v1.6.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Warn about missing accounts/roles [\#69](https://github.com/servian/awskeyring/pull/69) ([tristanmorgan](https://github.com/tristanmorgan))
10
+ - RuboCop and Spec update [\#68](https://github.com/servian/awskeyring/pull/68) ([tristanmorgan](https://github.com/tristanmorgan))
11
+ - Add SimpleCov reports. [\#67](https://github.com/servian/awskeyring/pull/67) ([tristanmorgan](https://github.com/tristanmorgan))
12
+
3
13
  ## [v1.5.0](https://github.com/servian/awskeyring/tree/v1.5.0) (2020-07-08)
4
14
 
5
15
  [Full Changelog](https://github.com/servian/awskeyring/compare/v1.4.0...v1.5.0)
data/Gemfile CHANGED
@@ -15,5 +15,6 @@ group :development do
15
15
  gem 'rubocop-rake'
16
16
  gem 'rubocop-rspec'
17
17
  gem 'rubocop-rubycw'
18
+ gem 'simplecov'
18
19
  gem 'yard'
19
20
  end
@@ -0,0 +1,4 @@
1
+ # Security Policy
2
+
3
+ If you believe you have found a security issue in Awskeyring, please responsibly disclose by contacting me at
4
+ [tristan.morgan@servian.com](mailto:tristan.morgan@servian.com).
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
+ spec.required_ruby_version = '>= 2.6.0'
24
+
23
25
  spec.metadata = {
24
26
  'bug_tracker_uri' => "#{Awskeyring::HOMEPAGE}/issues",
25
27
  'changelog_uri' => "#{Awskeyring::HOMEPAGE}/blob/master/CHANGELOG.md",
@@ -75,6 +75,8 @@ en:
75
75
  delexpired: '# Removing expired session credentials'
76
76
  exec: '# COMMAND not provided'
77
77
  missing: '# Config missing, run `%{bin} initialise` to recreate.'
78
+ missing_account: '# No accounts added, run `%{bin} add` to add.'
79
+ missing_role: '# No roles added, run `%{bin} add-role` to add.'
78
80
  rotate: '# You have two access keys for account %{account}'
79
81
  temporary: '# Using temporary session credentials.'
80
82
  timeout: '# It is STRONGLY recommended to set your keychain to lock in 5 minutes or less.'
@@ -174,26 +174,26 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
174
174
 
175
175
  # Return a list account item names
176
176
  def self.list_account_names
177
- items = list_items.map { |elem| elem.attributes[:label][(ACCOUNT_PREFIX.length)..-1] }
177
+ items = list_items.map { |elem| elem.attributes[:label][(ACCOUNT_PREFIX.length)..] }
178
178
 
179
- tokens = list_tokens.map { |elem| elem.attributes[:label][(SESSION_KEY_PREFIX.length)..-1] }
179
+ tokens = list_tokens.map { |elem| elem.attributes[:label][(SESSION_KEY_PREFIX.length)..] }
180
180
 
181
181
  (items + tokens).uniq.sort
182
182
  end
183
183
 
184
184
  # Return a list role item names
185
185
  def self.list_role_names
186
- list_roles.map { |elem| elem.attributes[:label][(ROLE_PREFIX.length)..-1] }.sort
186
+ list_roles.map { |elem| elem.attributes[:label][(ROLE_PREFIX.length)..] }.sort
187
187
  end
188
188
 
189
189
  # Return a list token item names
190
190
  def self.list_token_names
191
- list_tokens.map { |elem| elem.attributes[:label][(SESSION_KEY_PREFIX.length)..-1] }.sort
191
+ list_tokens.map { |elem| elem.attributes[:label][(SESSION_KEY_PREFIX.length)..] }.sort
192
192
  end
193
193
 
194
194
  # Return a list role item names and arns
195
195
  def self.list_role_names_plus
196
- list_roles.map { |elem| "#{elem.attributes[:label][(ROLE_PREFIX.length)..-1]}\t#{elem.attributes[:account]}" }
196
+ list_roles.map { |elem| "#{elem.attributes[:label][(ROLE_PREFIX.length)..]}\t#{elem.attributes[:account]}" }
197
197
  end
198
198
 
199
199
  # Return a list of console paths
@@ -198,9 +198,9 @@ module Awskeyring
198
198
  sessionToken: token
199
199
  }.to_json
200
200
 
201
- destination_param = '&Destination=' + CGI.escape(console_url)
201
+ destination_param = "&Destination=#{CGI.escape(console_url)}"
202
202
 
203
- AWS_SIGNIN_URL + '?Action=login' + token_param(session_json: session_json) + destination_param
203
+ "#{AWS_SIGNIN_URL}?Action=login#{token_param(session_json: session_json)}#{destination_param}"
204
204
  end
205
205
 
206
206
  # Get the signin token param
@@ -214,7 +214,7 @@ module Awskeyring
214
214
  returned_content = request.get(uri).body
215
215
 
216
216
  signin_token = JSON.parse(returned_content)['SigninToken']
217
- '&SigninToken=' + CGI.escape(signin_token)
217
+ "&SigninToken=#{CGI.escape(signin_token)}"
218
218
  end
219
219
 
220
220
  # Get the current region
@@ -6,7 +6,7 @@ require 'json'
6
6
  # Version const and query of latest.
7
7
  module Awskeyring
8
8
  # The Gem's version number
9
- VERSION = '1.5.0'
9
+ VERSION = '1.6.0'
10
10
  # The Gem's homepage
11
11
  HOMEPAGE = 'https://github.com/servian/awskeyring'
12
12
 
@@ -72,6 +72,10 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
72
72
  desc 'list', I18n.t('list.desc')
73
73
  # list the accounts
74
74
  def list
75
+ if Awskeyring.list_account_names.empty?
76
+ warn I18n.t('message.missing_account', bin: File.basename($PROGRAM_NAME))
77
+ exit 1
78
+ end
75
79
  puts Awskeyring.list_account_names.join("\n")
76
80
  end
77
81
 
@@ -80,6 +84,10 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
80
84
  method_option 'detail', type: :boolean, aliases: '-d', desc: I18n.t('method_option.detail'), default: false
81
85
  # List roles
82
86
  def list_role
87
+ if Awskeyring.list_role_names.empty?
88
+ warn I18n.t('message.missing_role', bin: File.basename($PROGRAM_NAME))
89
+ exit 1
90
+ end
83
91
  if options['detail']
84
92
  puts Awskeyring.list_role_names_plus.join("\n")
85
93
  else
@@ -539,23 +547,23 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
539
547
 
540
548
  def ask(message:, secure: false, optional: false, limited_to: nil)
541
549
  if secure
542
- Awskeyring::Input.read_secret(message.rjust(20) + ': ')
550
+ Awskeyring::Input.read_secret("#{message.rjust(20)}: ")
543
551
  elsif optional
544
- Thor::LineEditor.readline((message + ' (optional)').rjust(20) + ': ')
552
+ Thor::LineEditor.readline("#{"#{message} (optional)".rjust(20)}: ")
545
553
  elsif limited_to
546
- Thor::LineEditor.readline(message.rjust(20) + ': ', limited_to: limited_to)
554
+ Thor::LineEditor.readline("#{message.rjust(20)}: ", limited_to: limited_to)
547
555
  else
548
- Thor::LineEditor.readline(message.rjust(20) + ': ')
556
+ Thor::LineEditor.readline("#{message.rjust(20)}: ")
549
557
  end
550
558
  end
551
559
 
552
560
  def unbundle
553
561
  to_delete = ENV.keys.select { |elem| elem.start_with?('BUNDLER_ORIG_') }
554
- bundled_env = to_delete.map { |elem| elem[('BUNDLER_ORIG_'.length)..-1] }
562
+ bundled_env = to_delete.map { |elem| elem[('BUNDLER_ORIG_'.length)..] }
555
563
  to_delete << 'BUNDLE_GEMFILE'
556
564
  bundled_env.each do |env_name|
557
- ENV[env_name] = ENV['BUNDLER_ORIG_' + env_name]
558
- to_delete << env_name if ENV['BUNDLER_ORIG_' + env_name].start_with? 'BUNDLER_'
565
+ ENV[env_name] = ENV["BUNDLER_ORIG_#{env_name}"]
566
+ to_delete << env_name if ENV["BUNDLER_ORIG_#{env_name}"].start_with? 'BUNDLER_'
559
567
  end
560
568
  to_delete.each do |env_name|
561
569
  ENV.delete(env_name)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awskeyring
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Morgan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-08 00:00:00.000000000 Z
11
+ date: 2020-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-iam
@@ -80,6 +80,7 @@ files:
80
80
  - LICENSE.txt
81
81
  - README.md
82
82
  - Rakefile
83
+ - SECURITY.md
83
84
  - awskeyring.gemspec
84
85
  - exe/awskeyring
85
86
  - i18n/en.yml
@@ -97,8 +98,8 @@ licenses:
97
98
  metadata:
98
99
  bug_tracker_uri: https://github.com/servian/awskeyring/issues
99
100
  changelog_uri: https://github.com/servian/awskeyring/blob/master/CHANGELOG.md
100
- documentation_uri: https://rubydoc.info/gems/awskeyring/1.5.0
101
- source_code_uri: https://github.com/servian/awskeyring/tree/v1.5.0
101
+ documentation_uri: https://rubydoc.info/gems/awskeyring/1.6.0
102
+ source_code_uri: https://github.com/servian/awskeyring/tree/v1.6.0
102
103
  wiki_uri: https://github.com/servian/awskeyring/wiki
103
104
  post_install_message:
104
105
  rdoc_options: []
@@ -108,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
109
  requirements:
109
110
  - - ">="
110
111
  - !ruby/object:Gem::Version
111
- version: '0'
112
+ version: 2.6.0
112
113
  required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  requirements:
114
115
  - - ">="