security 0.1.4 → 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 +4 -4
- data/Gemfile +8 -1
- data/Gemfile.lock +53 -4
- data/LICENSE.md +1 -1
- data/README.md +10 -6
- data/Rakefile +6 -6
- data/lib/security/certificate.rb +3 -0
- data/lib/security/keychain.rb +11 -8
- data/lib/security/password.rb +27 -12
- data/lib/security/version.rb +4 -1
- data/lib/security.rb +2 -0
- data/security.gemspec +14 -14
- metadata +11 -33
- data/security-0.1.3.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d010aca28c455caae65e0063ab5ee35336eace64fd8049012c66f77edc634f20
|
|
4
|
+
data.tar.gz: a46b316771d171579e241b7c875b99bdaaa0f0cc6e7f9312d1627767b90c3c9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 106ba3c86bc5254bd1d589d1de99ea992b4cb12731761ff79faeed1cbe48f495451520b6ebbf91c50f6fb41b838ecd01de11eec9ca08d97e39c853cc457844e5
|
|
7
|
+
data.tar.gz: 636bfaf6e7a5b88eb38112008d3a46ed13da71cd13e8e16bb9891a24b5fbd8fca85dd58017f505d1c0df45264a1be3773f9bf15e973b688f0069135463407cf6
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,19 +1,68 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
security (0.
|
|
4
|
+
security (0.2.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
|
|
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)
|
|
16
|
+
ast (~> 2.4.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)
|
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
31
|
+
rspec-support (~> 3.13.0)
|
|
32
|
+
rspec-mocks (3.13.8)
|
|
33
|
+
diff-lcs (>= 1.2.0, < 2.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)
|
|
42
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
43
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
44
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
45
|
+
ruby-progressbar (~> 1.7)
|
|
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)
|
|
10
55
|
|
|
11
56
|
PLATFORMS
|
|
12
57
|
ruby
|
|
58
|
+
x86_64-linux
|
|
13
59
|
|
|
14
60
|
DEPENDENCIES
|
|
15
|
-
rake (~>
|
|
61
|
+
rake (~> 13.4)
|
|
62
|
+
rspec
|
|
63
|
+
rubocop
|
|
16
64
|
security!
|
|
65
|
+
simplecov
|
|
17
66
|
|
|
18
67
|
BUNDLED WITH
|
|
19
|
-
2.
|
|
68
|
+
2.6.9
|
data/LICENSE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c) 2012 – 2021
|
|
1
|
+
Copyright (c) 2012 – 2021 The Fastlane Community Contributors
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
# Security
|
|
2
2
|
|
|
3
|
+
[![Build Status][build status badge]][build status]
|
|
4
|
+
[](https://rubygems.org/gems/security)
|
|
5
|
+
[](https://github.com/fastlane-community/security/blob/main/LICENSE.md)
|
|
6
|
+
|
|
3
7
|
**A library for interacting with the macOS Keychain**
|
|
4
8
|
|
|
5
|
-
> This library
|
|
6
|
-
>
|
|
7
|
-
> As such, some methods are stubbed out to raise `NotImplementedError`.
|
|
9
|
+
> This library provides only a subset of `security` subcommands,
|
|
10
|
+
> and is not intended for general use.
|
|
8
11
|
|
|
9
12
|
## Usage
|
|
10
13
|
|
|
11
14
|
```ruby
|
|
15
|
+
require 'security'
|
|
16
|
+
|
|
12
17
|
Security::Keychain::default_keychain.filename #=> "/Users/jappleseed/Library/Keychains/login.keychain"
|
|
13
18
|
|
|
14
19
|
Security::InternetPassword.find(server: "itunesconnect.apple.com").password #=> "p4ssw0rd"
|
|
@@ -18,6 +23,5 @@ Security::InternetPassword.find(server: "itunesconnect.apple.com").password #=>
|
|
|
18
23
|
|
|
19
24
|
MIT
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Mattt ([@mattt](https://twitter.com/mattt))
|
|
26
|
+
[build status]: https://github.com/mattt/Security/actions?query=workflow%3ACI
|
|
27
|
+
[build status badge]: https://github.com/mattt/Security/workflows/CI/badge.svg
|
data/Rakefile
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Bundler.setup
|
|
1
|
+
# frozen_string_literal: true
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
require 'bundler'
|
|
4
|
+
Bundler.setup
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
require 'bundler/gem_tasks'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
system
|
|
8
|
+
task :default do
|
|
9
|
+
system 'rake -T'
|
|
10
10
|
end
|
data/lib/security/certificate.rb
CHANGED
data/lib/security/keychain.rb
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'shellwords'
|
|
2
4
|
|
|
3
5
|
module Security
|
|
6
|
+
# :nodoc:
|
|
4
7
|
class Keychain
|
|
5
|
-
DOMAINS = [
|
|
8
|
+
DOMAINS = %i[user system common dynamic].freeze
|
|
6
9
|
|
|
7
10
|
attr_reader :filename
|
|
8
11
|
|
|
@@ -11,19 +14,19 @@ module Security
|
|
|
11
14
|
end
|
|
12
15
|
|
|
13
16
|
def info
|
|
14
|
-
system %
|
|
17
|
+
system %(security show-keychain-info #{@filename.shellescape})
|
|
15
18
|
end
|
|
16
19
|
|
|
17
20
|
def lock
|
|
18
|
-
system %
|
|
21
|
+
system %(security lock-keychain #{@filename.shellescape})
|
|
19
22
|
end
|
|
20
23
|
|
|
21
24
|
def unlock(password)
|
|
22
|
-
system %
|
|
25
|
+
system %(security unlock-keychain -p #{password.shellescape} #{@filename.shellescape})
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
def delete
|
|
26
|
-
system %
|
|
29
|
+
system %(security delete-keychain #{@filename.shellescape})
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
class << self
|
|
@@ -38,11 +41,11 @@ module Security
|
|
|
38
41
|
end
|
|
39
42
|
|
|
40
43
|
def lock
|
|
41
|
-
system %
|
|
44
|
+
system %(security lock-keychain -a)
|
|
42
45
|
end
|
|
43
46
|
|
|
44
47
|
def unlock(password)
|
|
45
|
-
system %
|
|
48
|
+
system %(security unlock-keychain -p #{password.shellescape})
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
def default_keychain
|
|
@@ -56,7 +59,7 @@ module Security
|
|
|
56
59
|
private
|
|
57
60
|
|
|
58
61
|
def keychains_from_output(output)
|
|
59
|
-
output.split(
|
|
62
|
+
output.split("\n").collect { |line| new(line.strip.gsub(/^"|"$/, '')) }
|
|
60
63
|
end
|
|
61
64
|
end
|
|
62
65
|
end
|
data/lib/security/password.rb
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'shellwords'
|
|
2
4
|
|
|
3
5
|
module Security
|
|
6
|
+
# :nodoc:
|
|
4
7
|
class Password
|
|
5
8
|
attr_reader :keychain, :attributes, :password
|
|
6
9
|
|
|
@@ -16,17 +19,23 @@ module Security
|
|
|
16
19
|
private
|
|
17
20
|
|
|
18
21
|
def password_from_output(output)
|
|
19
|
-
return nil if /^security
|
|
22
|
+
return nil if output.match?(/^security: /)
|
|
20
23
|
|
|
21
|
-
keychain
|
|
22
|
-
|
|
24
|
+
keychain = nil
|
|
25
|
+
attributes = {}
|
|
26
|
+
password = nil
|
|
27
|
+
output.split("\n").each do |line|
|
|
23
28
|
case line
|
|
24
|
-
when /^keychain
|
|
25
|
-
keychain =
|
|
26
|
-
when
|
|
27
|
-
attributes[
|
|
28
|
-
when
|
|
29
|
-
|
|
29
|
+
when /^keychain: "(.+)"/
|
|
30
|
+
keychain = Regexp.last_match(1)
|
|
31
|
+
when /"(\w{4})".+="(.+)"/
|
|
32
|
+
attributes[Regexp.last_match(1)] = Regexp.last_match(2)
|
|
33
|
+
when /"(\w{4})"<blob>=0x([[:xdigit:]]+)/
|
|
34
|
+
attributes[Regexp.last_match(1)] = decode_hex_blob(Regexp.last_match(2))
|
|
35
|
+
when /^password: "(.+)"/
|
|
36
|
+
password = Regexp.last_match(1)
|
|
37
|
+
when /^password: 0x([[:xdigit:]]+)/
|
|
38
|
+
password = decode_hex_blob(Regexp.last_match(1))
|
|
30
39
|
end
|
|
31
40
|
end
|
|
32
41
|
|
|
@@ -42,11 +51,16 @@ module Security
|
|
|
42
51
|
flags[:G] ||= flags.delete(:value)
|
|
43
52
|
flags[:j] ||= flags.delete(:comment)
|
|
44
53
|
|
|
45
|
-
flags.delete_if{|
|
|
54
|
+
flags.delete_if { |_k, v| v.nil? }.collect { |k, v| "-#{k} #{v.shellescape}".strip }.join(' ')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def decode_hex_blob(string)
|
|
58
|
+
[string].pack('H*').force_encoding('UTF-8')
|
|
46
59
|
end
|
|
47
60
|
end
|
|
48
61
|
end
|
|
49
62
|
|
|
63
|
+
# :nodoc:
|
|
50
64
|
class GenericPassword < Password
|
|
51
65
|
class << self
|
|
52
66
|
def add(service, account, password, options = {})
|
|
@@ -69,11 +83,12 @@ module Security
|
|
|
69
83
|
|
|
70
84
|
def flags_for_options(options = {})
|
|
71
85
|
options[:s] ||= options.delete(:service)
|
|
72
|
-
super
|
|
86
|
+
super
|
|
73
87
|
end
|
|
74
88
|
end
|
|
75
89
|
end
|
|
76
90
|
|
|
91
|
+
# :nodoc:
|
|
77
92
|
class InternetPassword < Password
|
|
78
93
|
class << self
|
|
79
94
|
def add(server, account, password, options = {})
|
|
@@ -99,7 +114,7 @@ module Security
|
|
|
99
114
|
options[:p] ||= options.delete(:path)
|
|
100
115
|
options[:P] ||= options.delete(:port)
|
|
101
116
|
options[:r] ||= options.delete(:protocol)
|
|
102
|
-
super
|
|
117
|
+
super
|
|
103
118
|
end
|
|
104
119
|
end
|
|
105
120
|
end
|
data/lib/security/version.rb
CHANGED
data/lib/security.rb
CHANGED
data/security.gemspec
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/security/version'
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |s|
|
|
6
|
-
s.name =
|
|
7
|
-
s.authors = [
|
|
8
|
-
s.email =
|
|
9
|
-
s.homepage =
|
|
6
|
+
s.name = 'security'
|
|
7
|
+
s.authors = ['Josh Holtz', 'Mattt', 'iBotPeaches']
|
|
8
|
+
s.email = 'me@joshholtz.com'
|
|
9
|
+
s.homepage = 'https://github.com/fastlane-community/security'
|
|
10
10
|
s.version = Security::VERSION
|
|
11
11
|
s.platform = Gem::Platform::RUBY
|
|
12
|
-
s.license =
|
|
13
|
-
s.summary =
|
|
12
|
+
s.license = 'MIT'
|
|
13
|
+
s.summary = 'Interact with the macOS Keychain'
|
|
14
14
|
|
|
15
|
-
s.
|
|
15
|
+
s.files = Dir['./**/*'].grep_v(%r{\./(bin|log|pkg|script|spec|test|vendor)})
|
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
17
|
+
s.require_paths = ['lib']
|
|
18
|
+
s.required_ruby_version = '>= 3.0.0'
|
|
16
19
|
|
|
17
|
-
s.
|
|
18
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
19
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
20
|
-
s.require_paths = ["lib"]
|
|
20
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
|
21
21
|
end
|
metadata
CHANGED
|
@@ -1,37 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: security
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
+
- Josh Holtz
|
|
7
8
|
- Mattt
|
|
8
|
-
|
|
9
|
+
- iBotPeaches
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
13
|
-
|
|
14
|
-
name: rake
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '12.3'
|
|
20
|
-
- - ">="
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: 12.3.3
|
|
23
|
-
type: :development
|
|
24
|
-
prerelease: false
|
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
-
requirements:
|
|
27
|
-
- - "~>"
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: '12.3'
|
|
30
|
-
- - ">="
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: 12.3.3
|
|
33
|
-
description:
|
|
34
|
-
email: mattt@me.com
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
email: me@joshholtz.com
|
|
35
15
|
executables: []
|
|
36
16
|
extensions: []
|
|
37
17
|
extra_rdoc_files: []
|
|
@@ -46,13 +26,12 @@ files:
|
|
|
46
26
|
- "./lib/security/keychain.rb"
|
|
47
27
|
- "./lib/security/password.rb"
|
|
48
28
|
- "./lib/security/version.rb"
|
|
49
|
-
- "./security-0.1.3.gem"
|
|
50
29
|
- "./security.gemspec"
|
|
51
|
-
homepage: https://
|
|
30
|
+
homepage: https://github.com/fastlane-community/security
|
|
52
31
|
licenses:
|
|
53
32
|
- MIT
|
|
54
|
-
metadata:
|
|
55
|
-
|
|
33
|
+
metadata:
|
|
34
|
+
rubygems_mfa_required: 'true'
|
|
56
35
|
rdoc_options: []
|
|
57
36
|
require_paths:
|
|
58
37
|
- lib
|
|
@@ -60,15 +39,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
60
39
|
requirements:
|
|
61
40
|
- - ">="
|
|
62
41
|
- !ruby/object:Gem::Version
|
|
63
|
-
version:
|
|
42
|
+
version: 3.0.0
|
|
64
43
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
44
|
requirements:
|
|
66
45
|
- - ">="
|
|
67
46
|
- !ruby/object:Gem::Version
|
|
68
47
|
version: '0'
|
|
69
48
|
requirements: []
|
|
70
|
-
rubygems_version: 3.
|
|
71
|
-
signing_key:
|
|
49
|
+
rubygems_version: 3.6.9
|
|
72
50
|
specification_version: 4
|
|
73
51
|
summary: Interact with the macOS Keychain
|
|
74
52
|
test_files: []
|
data/security-0.1.3.gem
DELETED
|
Binary file
|