fastlane-plugin-cryptex 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 19b7da7f87da959bbe1ad86774aedf5d3ac0e85f
4
- data.tar.gz: 5e5ce005d472a170bd0af367767fe8f05394acfc
3
+ metadata.gz: 9e7e52be1d3bf837c665852e86e4dce1dfaaf4aa
4
+ data.tar.gz: 8efee788f405cccd7b5e10489417aa74c2cd0d56
5
5
  SHA512:
6
- metadata.gz: df4193e9cc83064d4d118eb4552406682b39ce481943007c82fb32fba40ed4651985adad3ce0622c80369f698ae1c440e3a0147054a4b32c06f2cea2f7bb2abf
7
- data.tar.gz: 504cc4e6cb6e326997222f0a83a51ebfdde0b05ebbaf1a62083703ef49a4113602112ee80d81e96f3ff4f0fb4109317d1a45137f0ee4f97c31d86b3d3f7e8ae4
6
+ metadata.gz: 5f8e4e6fc4492c29add0fd73b1a4d779cb4cddad4af97d5f9c8a305d4f41624ed9948090fd1b9d36f018745b437112d719bfc48546f29c237da04371877022be
7
+ data.tar.gz: 693215239f21ce0c622924f9efbd43a176157dbb9ea4e7d3b8d1b1988a9cdad86524aa28c994cae4628e1636750a0c0a243a11f739e9d221fc58ed7793b9154d
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- $:.push File.expand_path("../../lib", __FILE__)
2
+ $:.push File.expand_path('../lib', __dir__)
3
3
 
4
4
  require 'fastlane'
5
5
  require 'fastlane/plugin/cryptex'
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Fastlane
3
3
  module Cryptex
4
- ROOT = Pathname.new(File.expand_path('../cryptex', __FILE__))
4
+ ROOT = Pathname.new(File.expand_path('cryptex', __dir__))
5
5
  # Return all .rb files inside the "actions" and "helper" directory
6
6
  def self.all_classes
7
7
  Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
@@ -3,7 +3,7 @@ module Fastlane
3
3
  class CryptexGenerateKeystoreAction < Action
4
4
  def self.run(params)
5
5
  require "fileutils"
6
- cmd = "keytool -genkey -v -keystore #{File.expand_path(params[:destination])} -storepass #{params[:password]} -keypass #{params[:password]} -alias #{params[:alias]} -dname 'CN=#{params[:fullname]},L=#{params[:city]}' -validity 1000"
6
+ cmd = "keytool -genkey -v -keystore #{File.expand_path(params[:destination])} -storepass #{params[:password]} -keypass #{params[:password]} -alias #{params[:alias]} -dname 'CN=#{params[:fullname]},L=#{params[:city]}' -validity 10000"
7
7
  FastlaneCore::CommandExecutor.execute(command: cmd,
8
8
  print_all: true,
9
9
  print_command: true)
@@ -5,12 +5,12 @@ module Fastlane
5
5
  to ||= ChangePassword.ask_password(message: "New passphrase for Git Repo: ", confirm: false)
6
6
  from ||= ChangePassword.ask_password(message: "Old passphrase for Git Repo: ", confirm: true)
7
7
  GitHelper.clear_changes
8
- workspace = GitHelper.clone(params[:git_url], params[:shallow_clone], manual_password: from, skip_docs: params[:skip_docs], branch: params[:git_branch])
8
+ workspace = GitHelper.clone(params[:git_url], params[:shallow_clone], manual_password: from, skip_docs: params[:skip_docs], branch: params[:git_branch], digest: params[:digest])
9
9
  Encrypt.new.clear_password(params[:git_url])
10
10
  Encrypt.new.store_password(params[:git_url], to)
11
11
 
12
12
  message = "[fastlane] Changed passphrase"
13
- GitHelper.commit_changes(workspace, message, params[:git_url], params[:git_branch])
13
+ GitHelper.commit_changes(workspace, message, params[:git_url], params[:git_branch], digest: params[:digest])
14
14
  end
15
15
 
16
16
  def self.ask_password(message: "Passphrase for Git Repo: ", confirm: true)
@@ -11,7 +11,6 @@ module Fastlane
11
11
  FastlaneCore::UpdateChecker.start_looking_for_update('cryptex')
12
12
  self.new.run
13
13
  ensure
14
-
15
14
  FastlaneCore::UpdateChecker.show_update_status('cryptex', Cryptex::VERSION)
16
15
  end
17
16
 
@@ -67,7 +66,7 @@ module Fastlane
67
66
  c.action do |args, options|
68
67
  params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
69
68
  params.load_configuration_file("Cryptexfile")
70
- decrypted_repo = Cryptex::GitHelper.clone(params[:git_url], params[:shallow_clone], branch: params[:git_branch])
69
+ decrypted_repo = Cryptex::GitHelper.clone(params[:git_url], params[:shallow_clone], branch: params[:git_branch], digest: params[:digest])
71
70
  UI.success "Repo is at: '#{decrypted_repo}'"
72
71
  end
73
72
  end
@@ -35,27 +35,29 @@ module Fastlane
35
35
  Security::InternetPassword.delete(server: server_name(git_url))
36
36
  end
37
37
 
38
- def encrypt_repo(path: nil, git_url: nil)
38
+ def encrypt_repo(path: nil, git_url: nil, digest: nil)
39
39
  iterate(path) do |current|
40
40
  crypt(path: current,
41
41
  password: password(git_url),
42
- encrypt: true)
42
+ encrypt: true,
43
+ digest: digest)
43
44
  UI.success "🔒 Encrypted '#{File.basename(current)}'" if $verbose
44
45
  end
45
46
  UI.success "🔒 Successfully encrypted certificates repo"
46
47
  end
47
48
 
48
- def decrypt_repo(path: nil, git_url: nil, manual_password: nil)
49
+ def decrypt_repo(path: nil, git_url: nil, manual_password: nil, digest: nil)
49
50
  iterate(path) do |current|
50
51
  begin
51
52
  crypt(path: current,
52
53
  password: manual_password || password(git_url),
53
- encrypt: false)
54
- rescue
54
+ encrypt: false,
55
+ digest: digest)
56
+ rescue StandardError
55
57
  UI.error "Couldn't decrypt the repo, please make sure you enter the right password!"
56
58
  UI.user_error!("Invalid password passed via 'CRYPTEX_PASSWORD'") if ENV["CRYPTEX_PASSWORD"]
57
59
  clear_password(git_url)
58
- decrypt_repo(path: path, git_url: git_url)
60
+ decrypt_repo(path: path, git_url: git_url, digest: digest)
59
61
  return
60
62
  end
61
63
  UI.success "🔓 Decrypted '#{File.basename(current)}'" if $verbose
@@ -72,7 +74,7 @@ module Fastlane
72
74
 
73
75
  private
74
76
 
75
- def crypt(path: nil, password: nil, encrypt: true)
77
+ def crypt(path: nil, password: nil, encrypt: true, digest: 'sha256')
76
78
  if password.to_s.strip.length.zero? && encrypt
77
79
  UI.user_error!("No password supplied")
78
80
  end
@@ -80,6 +82,7 @@ module Fastlane
80
82
  tmpfile = File.join(Dir.mktmpdir, "temporary")
81
83
  command = ["openssl aes-256-cbc"]
82
84
  command << "-k #{password.shellescape}"
85
+ command << "-md #{digest}"
83
86
  command << "-in #{path.shellescape}"
84
87
  command << "-out #{tmpfile.shellescape}"
85
88
  command << "-a"
@@ -1,7 +1,7 @@
1
1
  module Fastlane
2
2
  module Cryptex
3
3
  class GitHelper
4
- def self.clone(git_url, shallow_clone, manual_password: nil, skip_docs: false, branch: "master")
4
+ def self.clone(git_url, shallow_clone, manual_password: nil, skip_docs: false, branch: "master", digest: nil)
5
5
  return @dir if @dir
6
6
 
7
7
  @dir = Dir.mktmpdir
@@ -14,7 +14,7 @@ module Fastlane
14
14
  FastlaneCore::CommandExecutor.execute(command: "GIT_TERMINAL_PROMPT=0 #{command}",
15
15
  print_all: $verbose,
16
16
  print_command: $verbose)
17
- rescue
17
+ rescue StandardError
18
18
  UI.error("Error cloning Repo")
19
19
  UI.error("Run the following command manually to make sure you're properly authenticated:")
20
20
  UI.command(command)
@@ -26,7 +26,7 @@ module Fastlane
26
26
  checkout_branch(branch) unless branch == "master"
27
27
 
28
28
  copy_readme(@dir) unless skip_docs
29
- Cryptex::Encrypt.new.decrypt_repo(path: @dir, git_url: git_url, manual_password: manual_password)
29
+ Cryptex::Encrypt.new.decrypt_repo(path: @dir, git_url: git_url, manual_password: manual_password, digest: digest)
30
30
 
31
31
  return @dir
32
32
  end
@@ -46,11 +46,11 @@ module Fastlane
46
46
  end
47
47
  end
48
48
 
49
- def self.commit_changes(path, message, git_url, branch = "master")
49
+ def self.commit_changes(path, message, git_url, branch = "master", digest: nil)
50
50
  Dir.chdir(path) do
51
51
  return if `git status`.include?("nothing to commit")
52
52
 
53
- Cryptex::Encrypt.new.encrypt_repo(path: path, git_url: git_url)
53
+ Cryptex::Encrypt.new.encrypt_repo(path: path, git_url: git_url, digest: digest)
54
54
  File.write("cryptex_version.txt", Cryptex::VERSION) # unencrypted
55
55
 
56
56
  commands = []
@@ -68,7 +68,7 @@ module Fastlane
68
68
  end
69
69
  FileUtils.rm_rf(path)
70
70
  @dir = nil
71
- rescue => ex
71
+ rescue StandardError => ex
72
72
  UI.error("Couldn't commit or push changes back to git...")
73
73
  UI.error(ex)
74
74
  end
@@ -77,7 +77,13 @@ module Fastlane
77
77
  env_name: "CRYPTEX_SKIP_DOCS",
78
78
  description: "Skip generation of a README.md for the created git repository",
79
79
  is_string: false,
80
- default_value: false)
80
+ default_value: false),
81
+ FastlaneCore::ConfigItem.new(key: :digest,
82
+ short_option: "-m",
83
+ env_name: "CRYPTEX_DIGEST",
84
+ description: "Specify the Message Digest to use for crypt routines",
85
+ is_string: true,
86
+ default_value: "md5")
81
87
  ]
82
88
  end
83
89
  end
@@ -11,7 +11,7 @@ module Fastlane
11
11
  if params[:hash].kind_of?(String)
12
12
  begin
13
13
  params[:hash] = JSON.parse(params[:hash])
14
- rescue
14
+ rescue StandardError
15
15
  # might contain sensitive informatio
16
16
  UI.user_error!("Supplied :hash isn't in json format")
17
17
  end
@@ -86,7 +86,7 @@ module Fastlane
86
86
  hide_keys: [],
87
87
  title: "Summary for cryptex #{Cryptex::VERSION}")
88
88
  @git_changed = false
89
- params[:workspace] = GitHelper.clone(params[:git_url], params[:shallow_clone], skip_docs: params[:skip_docs], branch: params[:git_branch])
89
+ params[:workspace] = GitHelper.clone(params[:git_url], params[:shallow_clone], skip_docs: params[:skip_docs], branch: params[:git_branch], digest: params[:digest])
90
90
  @params = params
91
91
  if params[:type] == "import_env"
92
92
  return import_env(params)
@@ -113,7 +113,7 @@ module Fastlane
113
113
  ensure
114
114
  if git_changed
115
115
  message = GitHelper.generate_commit_message(params)
116
- GitHelper.commit_changes(params[:workspace], message, params[:git_url], params[:git_branch])
116
+ GitHelper.commit_changes(params[:workspace], message, params[:git_url], params[:git_branch], digest: params[:digest])
117
117
  end
118
118
  GitHelper.clear_changes
119
119
  end
@@ -1,6 +1,6 @@
1
1
  module Fastlane
2
2
  module Cryptex
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  DESCRIPTION = "cryptex"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-cryptex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Helmut Januschka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-22 00:00:00.000000000 Z
11
+ date: 2018-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.3.5
27
27
  - !ruby/object:Gem::Dependency
28
- name: pry
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,35 +39,35 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: fastlane
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 1.105.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 1.105.2
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: match
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.8.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.8.1
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rubocop
84
+ name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,33 +95,33 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: fastlane
98
+ name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.105.2
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.105.2
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: match
112
+ name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 0.8.1
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 0.8.1
124
+ version: '0'
125
125
  description:
126
126
  email: h.januschka@krone.at
127
127
  executables:
@@ -171,3 +171,4 @@ signing_key:
171
171
  specification_version: 4
172
172
  summary: fastlane Crypt Store Git repo
173
173
  test_files: []
174
+ has_rdoc: