security 0.1.5 → 0.2.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: f878a3070c6bc072f8bf7e0dfe17a8db85dec7b32685353498a642ea76c95176
4
- data.tar.gz: '02093024c12b425b231eadbe56963433929e1844870dedeab1fda5f31b1c4a2b'
3
+ metadata.gz: d010aca28c455caae65e0063ab5ee35336eace64fd8049012c66f77edc634f20
4
+ data.tar.gz: a46b316771d171579e241b7c875b99bdaaa0f0cc6e7f9312d1627767b90c3c9e
5
5
  SHA512:
6
- metadata.gz: 7afe1f89bd8fda3701c8f31bb80b669107debea3ed191250a19d091fca665bc7b4572311f42b99a744b9a9c3a86657ca1d813420016fe07059bc4643a163c3de
7
- data.tar.gz: eacec975d67c63faef11e7b20d4bd2c361d2daa5607ff7852fb2410bb0e71ba8e0926d75d2b158f733f423290648ca33ca91f522022ef987de64e41b2e16eea5
6
+ metadata.gz: 106ba3c86bc5254bd1d589d1de99ea992b4cb12731761ff79faeed1cbe48f495451520b6ebbf91c50f6fb41b838ecd01de11eec9ca08d97e39c853cc457844e5
7
+ data.tar.gz: 636bfaf6e7a5b88eb38112008d3a46ed13da71cd13e8e16bb9891a24b5fbd8fca85dd58017f505d1c0df45264a1be3773f9bf15e973b688f0069135463407cf6
data/Gemfile CHANGED
@@ -2,4 +2,9 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
+ gem 'rake', '~> 13.4'
6
+ gem 'rspec'
7
+ gem 'rubocop'
8
+ gem 'simplecov'
9
+
5
10
  gemspec
data/Gemfile.lock CHANGED
@@ -1,58 +1,68 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- security (0.1.5)
4
+ security (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.2)
10
- diff-lcs (1.4.4)
11
- parallel (1.20.1)
12
- parser (3.0.0.0)
9
+ ast (2.4.3)
10
+ diff-lcs (1.6.2)
11
+ json (2.21.2)
12
+ language_server-protocol (3.17.0.6)
13
+ lint_roller (1.1.0)
14
+ parallel (2.1.0)
15
+ parser (3.3.12.0)
13
16
  ast (~> 2.4.1)
14
- rainbow (3.0.0)
15
- rake (12.3.3)
16
- regexp_parser (2.1.1)
17
- rexml (3.2.4)
18
- rspec (3.10.0)
19
- rspec-core (~> 3.10.0)
20
- rspec-expectations (~> 3.10.0)
21
- rspec-mocks (~> 3.10.0)
22
- rspec-core (3.10.1)
23
- rspec-support (~> 3.10.0)
24
- rspec-expectations (3.10.1)
17
+ racc
18
+ prism (1.9.0)
19
+ racc (1.8.1)
20
+ rainbow (3.1.1)
21
+ rake (13.4.2)
22
+ regexp_parser (2.12.0)
23
+ rspec (3.13.2)
24
+ rspec-core (~> 3.13.0)
25
+ rspec-expectations (~> 3.13.0)
26
+ rspec-mocks (~> 3.13.0)
27
+ rspec-core (3.13.6)
28
+ rspec-support (~> 3.13.0)
29
+ rspec-expectations (3.13.5)
25
30
  diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.10.0)
27
- rspec-github (2.3.1)
28
- rspec-core (~> 3.0)
29
- rspec-mocks (3.10.2)
31
+ rspec-support (~> 3.13.0)
32
+ rspec-mocks (3.13.8)
30
33
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.10.0)
32
- rspec-support (3.10.2)
33
- rubocop (1.12.0)
34
- parallel (~> 1.10)
35
- parser (>= 3.0.0.0)
34
+ rspec-support (~> 3.13.0)
35
+ rspec-support (3.13.7)
36
+ rubocop (1.89.0)
37
+ json (~> 2.3)
38
+ language_server-protocol (~> 3.17.0.2)
39
+ lint_roller (~> 1.1.0)
40
+ parallel (>= 1.10)
41
+ parser (>= 3.3.0.2)
36
42
  rainbow (>= 2.2.2, < 4.0)
37
- regexp_parser (>= 1.8, < 3.0)
38
- rexml
39
- rubocop-ast (>= 1.2.0, < 2.0)
43
+ regexp_parser (>= 2.9.3, < 3.0)
44
+ rubocop-ast (>= 1.49.0, < 2.0)
40
45
  ruby-progressbar (~> 1.7)
41
- unicode-display_width (>= 1.4.0, < 3.0)
42
- rubocop-ast (1.4.1)
43
- parser (>= 2.7.1.5)
44
- ruby-progressbar (1.11.0)
45
- unicode-display_width (2.0.0)
46
+ unicode-display_width (>= 2.4.0, < 4.0)
47
+ rubocop-ast (1.50.0)
48
+ parser (>= 3.3.7.2)
49
+ prism (~> 1.7)
50
+ ruby-progressbar (1.13.0)
51
+ simplecov (1.1.1)
52
+ unicode-display_width (3.2.0)
53
+ unicode-emoji (~> 4.1)
54
+ unicode-emoji (4.2.0)
46
55
 
47
56
  PLATFORMS
48
- x86_64-darwin-19
57
+ ruby
58
+ x86_64-linux
49
59
 
50
60
  DEPENDENCIES
51
- rake (~> 12.3, >= 12.3.3)
61
+ rake (~> 13.4)
52
62
  rspec
53
- rspec-github
54
63
  rubocop
55
64
  security!
65
+ simplecov
56
66
 
57
67
  BUNDLED WITH
58
- 2.2.8
68
+ 2.6.9
@@ -59,7 +59,7 @@ module Security
59
59
  private
60
60
 
61
61
  def keychains_from_output(output)
62
- output.split(/\n/).collect { |line| new(line.strip.gsub(/^"|"$/, '')) }
62
+ output.split("\n").collect { |line| new(line.strip.gsub(/^"|"$/, '')) }
63
63
  end
64
64
  end
65
65
  end
@@ -24,7 +24,7 @@ module Security
24
24
  keychain = nil
25
25
  attributes = {}
26
26
  password = nil
27
- output.split(/\n/).each do |line|
27
+ output.split("\n").each do |line|
28
28
  case line
29
29
  when /^keychain: "(.+)"/
30
30
  keychain = Regexp.last_match(1)
@@ -83,7 +83,7 @@ module Security
83
83
 
84
84
  def flags_for_options(options = {})
85
85
  options[:s] ||= options.delete(:service)
86
- super(options)
86
+ super
87
87
  end
88
88
  end
89
89
  end
@@ -114,7 +114,7 @@ module Security
114
114
  options[:p] ||= options.delete(:path)
115
115
  options[:P] ||= options.delete(:port)
116
116
  options[:r] ||= options.delete(:protocol)
117
- super(options)
117
+ super
118
118
  end
119
119
  end
120
120
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # :nodoc:
4
4
  module Security
5
- VERSION = '0.1.5'
5
+ VERSION = '0.2.0'
6
6
  end
data/security.gemspec CHANGED
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.push File.expand_path('lib', __dir__)
4
- require 'security'
3
+ require_relative 'lib/security/version'
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.name = 'security'
8
- s.authors = ['Josh Holtz', 'Mattt']
7
+ s.authors = ['Josh Holtz', 'Mattt', 'iBotPeaches']
9
8
  s.email = 'me@joshholtz.com'
10
9
  s.homepage = 'https://github.com/fastlane-community/security'
11
10
  s.version = Security::VERSION
@@ -13,14 +12,10 @@ Gem::Specification.new do |s|
13
12
  s.license = 'MIT'
14
13
  s.summary = 'Interact with the macOS Keychain'
15
14
 
16
- s.files = Dir['./**/*'].reject { |file| file =~ %r{\./(bin|log|pkg|script|spec|test|vendor)} }
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.files = Dir['./**/*'].grep_v(%r{\./(bin|log|pkg|script|spec|test|vendor)})
18
16
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
17
  s.require_paths = ['lib']
20
- s.required_ruby_version = '>= 2.4.0'
18
+ s.required_ruby_version = '>= 3.0.0'
21
19
 
22
- s.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
23
- s.add_development_dependency 'rspec'
24
- s.add_development_dependency 'rspec-github'
25
- s.add_development_dependency 'rubocop'
20
+ s.metadata['rubygems_mfa_required'] = 'true'
26
21
  end
metadata CHANGED
@@ -1,79 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: security
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Holtz
8
8
  - Mattt
9
- autorequire:
9
+ - iBotPeaches
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-25 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rake
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '12.3'
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 12.3.3
24
- type: :development
25
- prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
27
- requirements:
28
- - - "~>"
29
- - !ruby/object:Gem::Version
30
- version: '12.3'
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 12.3.3
34
- - !ruby/object:Gem::Dependency
35
- name: rspec
36
- requirement: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- type: :development
42
- prerelease: false
43
- version_requirements: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- - !ruby/object:Gem::Dependency
49
- name: rspec-github
50
- requirement: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: rubocop
64
- requirement: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- type: :development
70
- prerelease: false
71
- version_requirements: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- description:
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
+ dependencies: []
77
14
  email: me@joshholtz.com
78
15
  executables: []
79
16
  extensions: []
@@ -90,15 +27,11 @@ files:
90
27
  - "./lib/security/password.rb"
91
28
  - "./lib/security/version.rb"
92
29
  - "./security.gemspec"
93
- - spec/certificate_spec.rb
94
- - spec/keychain_spec.rb
95
- - spec/password_spec.rb
96
- - spec/spec_helper.rb
97
30
  homepage: https://github.com/fastlane-community/security
98
31
  licenses:
99
32
  - MIT
100
- metadata: {}
101
- post_install_message:
33
+ metadata:
34
+ rubygems_mfa_required: 'true'
102
35
  rdoc_options: []
103
36
  require_paths:
104
37
  - lib
@@ -106,19 +39,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
39
  requirements:
107
40
  - - ">="
108
41
  - !ruby/object:Gem::Version
109
- version: 2.4.0
42
+ version: 3.0.0
110
43
  required_rubygems_version: !ruby/object:Gem::Requirement
111
44
  requirements:
112
45
  - - ">="
113
46
  - !ruby/object:Gem::Version
114
47
  version: '0'
115
48
  requirements: []
116
- rubygems_version: 3.0.3
117
- signing_key:
49
+ rubygems_version: 3.6.9
118
50
  specification_version: 4
119
51
  summary: Interact with the macOS Keychain
120
- test_files:
121
- - spec/certificate_spec.rb
122
- - spec/keychain_spec.rb
123
- - spec/password_spec.rb
124
- - spec/spec_helper.rb
52
+ test_files: []
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Certificate do
4
- describe '#find' do
5
- it 'should raise NotImplementedError' do
6
- expect { Certificate.find }.to raise_error(NotImplementedError)
7
- end
8
- end
9
-
10
- describe '#initialize' do
11
- it 'should raise NoMethodError' do
12
- expect { Certificate.new }.to raise_error(NoMethodError, /private method/)
13
- end
14
- end
15
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'tempfile'
4
-
5
- describe Keychain do
6
- describe '#login_keychain' do
7
- subject { Keychain.login_keychain }
8
-
9
- it 'should be located in the user home directory' do
10
- expect(subject.filename).to be == File.expand_path('~/Library/Keychains/login.keychain-db')
11
- end
12
- end
13
-
14
- describe '#create' do
15
- let(:password) { 'p4ssw0rd!' }
16
-
17
- it 'should raise NotImplementedError' do
18
- Tempfile.open('example.keychain-db') do |tmp|
19
- expect { Keychain.create(tmp.path, password) }.to raise_error(NotImplementedError)
20
- end
21
- end
22
- end
23
-
24
- describe '#list' do
25
- describe 'when passing no arguments' do
26
- it 'should list keychains in user domain' do
27
- expect(Keychain.list).to satisfy { |keychains|
28
- keychains.map(&:filename) == Keychain.list(:user).map(&:filename)
29
- }
30
- end
31
- end
32
-
33
- describe 'when passing a valid domain' do
34
- it 'should not raise an error' do
35
- expect { Keychain.list(:user) }.not_to raise_error
36
- expect { Keychain.list(:system) }.not_to raise_error
37
- expect { Keychain.list(:common) }.not_to raise_error
38
- expect { Keychain.list(:dynamic) }.not_to raise_error
39
- end
40
- end
41
-
42
- describe 'when passing an invalid domain' do
43
- it 'should raise an error' do
44
- expect { Keychain.list(:invalid) }.to raise_error(NoMethodError) # FIXME
45
- end
46
- end
47
- end
48
- end
@@ -1,102 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GenericPassword do
4
- let(:keychain) { Keychain.login_keychain } # FIXME: we should create a temporary keychain for tests
5
-
6
- describe '#add' do
7
- let(:service) { 'com.example.service' }
8
- let(:account) { 'jappleseed' }
9
- let(:password) { 'p4ssw0rd!' }
10
- let(:comment) { 'Some comment' }
11
-
12
- around(:example) do |example|
13
- GenericPassword.add(service, account, password, comment: comment)
14
- example.run
15
- GenericPassword.delete({ service: service, account: account })
16
- end
17
-
18
- it 'should be added to the keychain' do
19
- entry = GenericPassword.find({ account: account })
20
- expect(entry.keychain.filename).to be == keychain.filename
21
- expect(entry.attributes).to include({
22
- 'acct' => account,
23
- 'svce' => service,
24
- 'icmt' => comment
25
- })
26
- expect(entry.password).to be == password
27
- end
28
- end
29
- end
30
-
31
- describe InternetPassword do
32
- let(:keychain) { Keychain.login_keychain } # FIXME: we should create a temporary keychain for tests
33
-
34
- describe '#add' do
35
- let(:server) { 'example.com' }
36
- let(:account) { 'jappleseed@example.com' }
37
-
38
- describe 'ascii password' do
39
- let(:password) { 'p4ssw0rd!' }
40
- let(:comment) { 'Some comment' }
41
-
42
- around(:example) do |example|
43
- InternetPassword.add(server, account, password, comment: comment)
44
- example.run
45
- InternetPassword.delete({ server: server, account: account })
46
- end
47
-
48
- it 'should be added to the keychain' do
49
- entry = InternetPassword.find({ account: account })
50
- expect(entry.keychain.filename).to be == keychain.filename
51
- expect(entry.attributes).to include({
52
- 'acct' => account,
53
- 'srvr' => server,
54
- 'icmt' => comment
55
- })
56
- expect(entry.password).to be == password
57
- end
58
- end
59
-
60
- describe 'ascii password with backslash' do
61
- let(:password) { 'p4ssw\0rd!' }
62
-
63
- around(:example) do |example|
64
- InternetPassword.add(server, account, password)
65
- example.run
66
- InternetPassword.delete({ server: server, account: account })
67
- end
68
-
69
- it 'should be added to the keychain' do
70
- entry = InternetPassword.find({ account: account })
71
- expect(entry.keychain.filename).to be == keychain.filename
72
- expect(entry.attributes).to include({
73
- 'acct' => account,
74
- 'srvr' => server
75
- })
76
- expect(entry.password).to be == password
77
- end
78
- end
79
-
80
- describe 'non-ascii password' do
81
- let(:password) { '•••p4ssw0rd!••' }
82
- let(:comment) { '•••Some comment•••' }
83
-
84
- around(:example) do |example|
85
- InternetPassword.add(server, account, password, comment: comment)
86
- example.run
87
- InternetPassword.delete({ server: server, account: account })
88
- end
89
-
90
- it 'should be added to the keychain' do
91
- entry = InternetPassword.find({ account: account })
92
- expect(entry.keychain.filename).to be == keychain.filename
93
- expect(entry.attributes).to include({
94
- 'acct' => account,
95
- 'srvr' => server,
96
- 'icmt' => comment
97
- })
98
- expect(entry.password).to be == password
99
- end
100
- end
101
- end
102
- end
data/spec/spec_helper.rb DELETED
@@ -1,106 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../lib/security'
4
-
5
- # rubocop:disable Style/MixinUsage
6
- include Security
7
- # rubocop:enable Style/MixinUsage
8
-
9
- # This file was generated by the `rspec --init` command. Conventionally, all
10
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
11
- # The generated `.rspec` file contains `--require spec_helper` which will cause
12
- # this file to always be loaded, without a need to explicitly require it in any
13
- # files.
14
- #
15
- # Given that it is always loaded, you are encouraged to keep this file as
16
- # light-weight as possible. Requiring heavyweight dependencies from this file
17
- # will add to the boot time of your test suite on EVERY test run, even for an
18
- # individual file that may not need all of that loaded. Instead, consider making
19
- # a separate helper file that requires the additional dependencies and performs
20
- # the additional setup, and require it from the spec files that actually need
21
- # it.
22
- #
23
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
24
- RSpec.configure do |config|
25
- # rspec-expectations config goes here. You can use an alternate
26
- # assertion/expectation library such as wrong or the stdlib/minitest
27
- # assertions if you prefer.
28
- config.expect_with :rspec do |expectations|
29
- # This option will default to `true` in RSpec 4. It makes the `description`
30
- # and `failure_message` of custom matchers include text for helper methods
31
- # defined using `chain`, e.g.:
32
- # be_bigger_than(2).and_smaller_than(4).description
33
- # # => "be bigger than 2 and smaller than 4"
34
- # ...rather than:
35
- # # => "be bigger than 2"
36
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
37
- end
38
-
39
- # rspec-mocks config goes here. You can use an alternate test double
40
- # library (such as bogus or mocha) by changing the `mock_with` option here.
41
- config.mock_with :rspec do |mocks|
42
- # Prevents you from mocking or stubbing a method that does not exist on
43
- # a real object. This is generally recommended, and will default to
44
- # `true` in RSpec 4.
45
- mocks.verify_partial_doubles = true
46
- end
47
-
48
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
49
- # have no way to turn it off -- the option exists only for backwards
50
- # compatibility in RSpec 3). It causes shared context metadata to be
51
- # inherited by the metadata hash of host groups and examples, rather than
52
- # triggering implicit auto-inclusion in groups with matching metadata.
53
- config.shared_context_metadata_behavior = :apply_to_host_groups
54
-
55
- # The settings below are suggested to provide a good initial experience
56
- # with RSpec, but feel free to customize to your heart's content.
57
- # # This allows you to limit a spec run to individual examples or groups
58
- # # you care about by tagging them with `:focus` metadata. When nothing
59
- # # is tagged with `:focus`, all examples get run. RSpec also provides
60
- # # aliases for `it`, `describe`, and `context` that include `:focus`
61
- # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
62
- # config.filter_run_when_matching :focus
63
- #
64
- # # Allows RSpec to persist some state between runs in order to support
65
- # # the `--only-failures` and `--next-failure` CLI options. We recommend
66
- # # you configure your source control system to ignore this file.
67
- # config.example_status_persistence_file_path = "spec/examples.txt"
68
- #
69
- # # Limits the available syntax to the non-monkey patched syntax that is
70
- # # recommended. For more details, see:
71
- # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
72
- # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
73
- # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
74
- # config.disable_monkey_patching!
75
- #
76
- # # This setting enables warnings. It's recommended, but in some cases may
77
- # # be too noisy due to issues in dependencies.
78
- # config.warnings = true
79
- #
80
- # # Many RSpec users commonly either run the entire suite or an individual
81
- # # file, and it's useful to allow more verbose output when running an
82
- # # individual spec file.
83
- # if config.files_to_run.one?
84
- # # Use the documentation formatter for detailed output,
85
- # # unless a formatter has already been configured
86
- # # (e.g. via a command-line flag).
87
- # config.default_formatter = "doc"
88
- # end
89
- #
90
- # # Print the 10 slowest examples and example groups at the
91
- # # end of the spec run, to help surface which specs are running
92
- # # particularly slow.
93
- # config.profile_examples = 10
94
- #
95
- # # Run specs in random order to surface order dependencies. If you find an
96
- # # order dependency and want to debug it, you can fix the order by providing
97
- # # the seed, which is printed after each run.
98
- # # --seed 1234
99
- # config.order = :random
100
- #
101
- # # Seed global randomization in this process using the `--seed` CLI option.
102
- # # Setting this allows you to use `--seed` to deterministically reproduce
103
- # # test failures related to randomization by passing the same `--seed` value
104
- # # as the one that triggered the failure.
105
- # Kernel.srand config.seed
106
- end