diffcrypt 0.6.1 → 0.8.0.rc1
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/.github/workflows/test.yml +38 -7
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -5
- data/Appraisals +14 -0
- data/CHANGELOG.md +36 -1
- data/Gemfile +3 -4
- data/Rakefile +1 -1
- data/SECURITY.md +2 -2
- data/diffcrypt.gemspec +2 -2
- data/gemfiles/rails_6.1.gemfile +15 -0
- data/gemfiles/rails_7.2.gemfile +14 -0
- data/gemfiles/rails_8.0.gemfile +14 -0
- data/lib/diffcrypt/encryptor.rb +15 -5
- data/lib/diffcrypt/rails/encrypted_configuration.rb +8 -0
- data/lib/diffcrypt/version.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f92de64774d20c0589ef9e2ae8e3734cf406638fdc60473b35afe5c6630c9253
|
4
|
+
data.tar.gz: eba4811ebbeeb12fa15f092f3a5a5b439747816df025e66b3e0558a605152fdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9765122e959807815c3a658a64cff0f4395b1fc79772a6a59949a60e16f8952c1982a0f61f73f922753e349773238b42f98ffa35b76b4659737ae4ae74f022ef
|
7
|
+
data.tar.gz: a953814419b665b42ec5e079a4d9ca2671f3681533fb715259497c3555a431ac176a1566242bf8d4350c6d83c6837ab8b3729608f542ecab9546c210370af224
|
data/.github/workflows/test.yml
CHANGED
@@ -7,15 +7,39 @@ on:
|
|
7
7
|
pull_request:
|
8
8
|
|
9
9
|
jobs:
|
10
|
-
|
10
|
+
tests:
|
11
|
+
name: "RSpec @ Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}"
|
11
12
|
runs-on: ubuntu-latest
|
13
|
+
continue-on-error: true
|
14
|
+
env:
|
15
|
+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
|
12
16
|
strategy:
|
13
17
|
matrix:
|
14
18
|
ruby:
|
15
|
-
- "
|
16
|
-
- "3.
|
19
|
+
- "3.1"
|
20
|
+
- "3.2"
|
21
|
+
- "3.3"
|
22
|
+
- "3.4"
|
23
|
+
- "head"
|
24
|
+
rails:
|
25
|
+
- "6.1"
|
26
|
+
- "7.2"
|
27
|
+
- "8.0"
|
28
|
+
exclude:
|
29
|
+
- ruby: "3.2"
|
30
|
+
rails: "6.1"
|
31
|
+
- ruby: "3.3"
|
32
|
+
rails: "6.1"
|
33
|
+
- ruby: "3.4"
|
34
|
+
rails: "6.1"
|
35
|
+
- ruby: "head"
|
36
|
+
rails: "6.1"
|
37
|
+
- ruby: "3.1"
|
38
|
+
rails: "7.2"
|
39
|
+
- ruby: "3.1"
|
40
|
+
rails: "8.0"
|
17
41
|
steps:
|
18
|
-
- uses: actions/checkout@
|
42
|
+
- uses: actions/checkout@v4
|
19
43
|
- name: Set up Ruby
|
20
44
|
uses: ruby/setup-ruby@v1
|
21
45
|
with:
|
@@ -23,14 +47,21 @@ jobs:
|
|
23
47
|
bundler-cache: true
|
24
48
|
- name: Run rspec
|
25
49
|
run: bundle exec rake test
|
26
|
-
|
50
|
+
|
51
|
+
linters:
|
52
|
+
name: "Rubocop @ Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}"
|
27
53
|
runs-on: ubuntu-latest
|
54
|
+
continue-on-error: true
|
55
|
+
env:
|
56
|
+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
|
28
57
|
strategy:
|
29
58
|
matrix:
|
30
59
|
ruby:
|
31
|
-
- "
|
60
|
+
- "3.4"
|
61
|
+
rails:
|
62
|
+
- "7.2"
|
32
63
|
steps:
|
33
|
-
- uses: actions/checkout@
|
64
|
+
- uses: actions/checkout@v4
|
34
65
|
- name: Set up Ruby
|
35
66
|
uses: ruby/setup-ruby@v1
|
36
67
|
with:
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
AllCops:
|
2
2
|
NewCops: enable
|
3
|
-
TargetRubyVersion:
|
3
|
+
TargetRubyVersion: 3.0
|
4
4
|
|
5
5
|
Style/ClassAndModuleChildren:
|
6
6
|
Exclude:
|
@@ -23,10 +23,6 @@ Style/TrailingCommaInHashLiteral:
|
|
23
23
|
EnforcedStyleForMultiline: consistent_comma
|
24
24
|
Style/AccessorGrouping:
|
25
25
|
EnforcedStyle: separated
|
26
|
-
Style/OpenStructUse:
|
27
|
-
Exclude:
|
28
|
-
- test/*_test.rb
|
29
|
-
- test/**/*_test.rb
|
30
26
|
|
31
27
|
Layout/LineLength:
|
32
28
|
Exclude:
|
data/Appraisals
ADDED
data/CHANGELOG.md
CHANGED
@@ -7,7 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
|
9
9
|
|
10
|
-
##
|
10
|
+
## [0.8.0.rc1]
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Extended ruby 3.x support
|
15
|
+
- Added Rails 8 support
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Improved testing against multiple ruby/rails versions
|
20
|
+
- Improved support for nested arrays and hashes in YAML files
|
21
|
+
|
22
|
+
### Removed
|
23
|
+
|
24
|
+
- Removed code coverage reporting
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
## [0.7.0] - 2024-05-26
|
29
|
+
|
30
|
+
### Added
|
31
|
+
|
32
|
+
- Added ruby 3.1. support
|
33
|
+
- Added rails 7.1 support
|
34
|
+
|
35
|
+
### Changed
|
36
|
+
|
37
|
+
- Updated all dependencies
|
38
|
+
|
39
|
+
### Removed
|
40
|
+
|
41
|
+
- Dropped ruby 2.x support
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
## [0.6.1] - 2022-02-06
|
11
46
|
|
12
47
|
### Fixed
|
13
48
|
|
data/Gemfile
CHANGED
@@ -5,9 +5,8 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in diffcrypt.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
+
gem 'appraisal'
|
8
9
|
gem 'minitest', '~> 5.0'
|
9
|
-
gem 'minitest-reporters', '~> 1.
|
10
|
-
gem 'rake', '~> 13.
|
10
|
+
gem 'minitest-reporters', '~> 1.6.0'
|
11
|
+
gem 'rake', '~> 13.2'
|
11
12
|
gem 'rubocop', '~> 1.25.1'
|
12
|
-
gem 'simplecov', '~> 0.21.2', require: false # CodeClimate not compatible with 0.18+ yet - https://github.com/codeclimate/test-reporter/issues/413
|
13
|
-
gem 'simplecov-lcov', '< 0.9'
|
data/Rakefile
CHANGED
data/SECURITY.md
CHANGED
@@ -8,8 +8,8 @@ Since the internal APIs may change dramatically until v1.0, here is a list of th
|
|
8
8
|
|
9
9
|
| Version | Supported |
|
10
10
|
| ------- | ------------------ |
|
11
|
-
| 0.
|
12
|
-
| 0.
|
11
|
+
| 0.7.0 | :x: |
|
12
|
+
| 0.8.x | :white_check_mark: |
|
13
13
|
|
14
14
|
|
15
15
|
|
data/diffcrypt.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = 'Diffable encrypted configuration files that can be safely committed into a git repository'
|
13
13
|
spec.homepage = 'https://github.com/diffcrypt/diffcrypt-ruby'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new('>=
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
18
18
|
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = %w[diffcrypt]
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.add_runtime_dependency 'activesupport', '>= 6.0', '<
|
32
|
+
spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 9.0'
|
33
33
|
spec.add_runtime_dependency 'thor', '>= 0.20', '< 2'
|
34
34
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
35
35
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file was generated by Appraisal
|
4
|
+
|
5
|
+
source 'https://rubygems.org'
|
6
|
+
|
7
|
+
gem 'appraisal'
|
8
|
+
gem 'concurrent-ruby', '1.3.4' # 1.3.5. breaks with Rails < 7, see https://github.com/ruby-concurrency/concurrent-ruby/commit/d7ce956dacd0b772273d39b8ed31a30cff7ecf38
|
9
|
+
gem 'minitest', '~> 5.0'
|
10
|
+
gem 'minitest-reporters', '~> 1.6.0'
|
11
|
+
gem 'rails', '~> 6.1'
|
12
|
+
gem 'rake', '~> 13.2'
|
13
|
+
gem 'rubocop', '~> 1.25.1'
|
14
|
+
|
15
|
+
gemspec path: '../'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file was generated by Appraisal
|
4
|
+
|
5
|
+
source 'https://rubygems.org'
|
6
|
+
|
7
|
+
gem 'appraisal'
|
8
|
+
gem 'minitest', '~> 5.0'
|
9
|
+
gem 'minitest-reporters', '~> 1.6.0'
|
10
|
+
gem 'rails', '~> 7.2'
|
11
|
+
gem 'rake', '~> 13.2'
|
12
|
+
gem 'rubocop', '~> 1.25.1'
|
13
|
+
|
14
|
+
gemspec path: '../'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file was generated by Appraisal
|
4
|
+
|
5
|
+
source 'https://rubygems.org'
|
6
|
+
|
7
|
+
gem 'appraisal'
|
8
|
+
gem 'minitest', '~> 5.0'
|
9
|
+
gem 'minitest-reporters', '~> 1.6.0'
|
10
|
+
gem 'rails', '~> 8.0'
|
11
|
+
gem 'rake', '~> 13.2'
|
12
|
+
gem 'rubocop', '~> 1.25.1'
|
13
|
+
|
14
|
+
gemspec path: '../'
|
data/lib/diffcrypt/encryptor.rb
CHANGED
@@ -6,6 +6,7 @@ require 'tmpdir'
|
|
6
6
|
require 'securerandom'
|
7
7
|
require 'yaml'
|
8
8
|
|
9
|
+
require 'active_support' # NOTE: This is required because of a bug in 7.1 which needs deprecation libs
|
9
10
|
require 'active_support/message_encryptor'
|
10
11
|
|
11
12
|
require_relative './version'
|
@@ -33,16 +34,21 @@ module Diffcrypt
|
|
33
34
|
|
34
35
|
# @param [Hash] data
|
35
36
|
# @return [Hash]
|
37
|
+
# rubocop:disable Metrics/MethodLength
|
36
38
|
def decrypt_hash(data)
|
37
39
|
data.each do |key, value|
|
38
|
-
data[key] =
|
40
|
+
data[key] = case value
|
41
|
+
when Hash
|
39
42
|
decrypt_hash(value)
|
43
|
+
when Array
|
44
|
+
value.map { |v| decrypt_hash(v) }
|
40
45
|
else
|
41
46
|
decrypt_string value
|
42
47
|
end
|
43
48
|
end
|
44
49
|
data
|
45
50
|
end
|
51
|
+
# rubocop:enable Metrics/MethodLength
|
46
52
|
|
47
53
|
# @param [String] contents The raw YAML string to be encrypted
|
48
54
|
# @param [String, nil] original_encrypted_contents The original (encrypted) content to determine which keys have changed
|
@@ -72,14 +78,18 @@ module Diffcrypt
|
|
72
78
|
end
|
73
79
|
|
74
80
|
# TODO: Fix the complexity of this method
|
75
|
-
# rubocop:disable Metrics/
|
81
|
+
# rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
|
76
82
|
# @param [Hash] keys
|
77
83
|
# @return [Hash]
|
78
84
|
def encrypt_values(data, original_data = nil)
|
79
85
|
data.each do |key, value|
|
80
|
-
original_encrypted_value = original_data
|
81
|
-
|
86
|
+
original_encrypted_value = original_data&.dig(key)
|
87
|
+
|
88
|
+
data[key] = case value
|
89
|
+
when Hash
|
82
90
|
encrypt_values(value, original_encrypted_value)
|
91
|
+
when Array
|
92
|
+
value.map.with_index { |v, i| encrypt_values(v, original_encrypted_value&.dig(i)) }
|
83
93
|
else
|
84
94
|
original_decrypted_value = original_encrypted_value ? decrypt_string(original_encrypted_value) : nil
|
85
95
|
key_changed = original_decrypted_value.nil? || original_decrypted_value != value
|
@@ -88,7 +98,7 @@ module Diffcrypt
|
|
88
98
|
end
|
89
99
|
data.sort.to_h
|
90
100
|
end
|
91
|
-
# rubocop:enable Metrics/
|
101
|
+
# rubocop:enable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
|
92
102
|
|
93
103
|
# @param [String] value The encrypted value that needs decrypting
|
94
104
|
# @return [String]
|
@@ -68,6 +68,14 @@ module Diffcrypt
|
|
68
68
|
read_env_key || read_key_file || handle_missing_key
|
69
69
|
end
|
70
70
|
|
71
|
+
# It's required since the commit https://github.com/rails/rails/commit/1740b1f2cb8104435b6041ec6bfaabe58a6d74e6
|
72
|
+
# Returns truthy if #key is truthy. Returns falsy otherwise. Unlike #key,
|
73
|
+
# does not raise MissingKeyError when +raise_if_missing_key+ is true.
|
74
|
+
# @return [Boolean]
|
75
|
+
def key?
|
76
|
+
!!(read_env_key || read_key_file)
|
77
|
+
end
|
78
|
+
|
71
79
|
def change(&block)
|
72
80
|
writing read, &block
|
73
81
|
end
|
data/lib/diffcrypt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffcrypt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Qualie
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activesupport
|
@@ -19,7 +18,7 @@ dependencies:
|
|
19
18
|
version: '6.0'
|
20
19
|
- - "<"
|
21
20
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
21
|
+
version: '9.0'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +28,7 @@ dependencies:
|
|
29
28
|
version: '6.0'
|
30
29
|
- - "<"
|
31
30
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
31
|
+
version: '9.0'
|
33
32
|
- !ruby/object:Gem::Dependency
|
34
33
|
name: thor
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,6 +62,7 @@ files:
|
|
63
62
|
- ".github/workflows/test.yml"
|
64
63
|
- ".gitignore"
|
65
64
|
- ".rubocop.yml"
|
65
|
+
- Appraisals
|
66
66
|
- CHANGELOG.md
|
67
67
|
- Gemfile
|
68
68
|
- LICENSE.txt
|
@@ -73,6 +73,9 @@ files:
|
|
73
73
|
- bin/diffcrypt
|
74
74
|
- bin/setup
|
75
75
|
- diffcrypt.gemspec
|
76
|
+
- gemfiles/rails_6.1.gemfile
|
77
|
+
- gemfiles/rails_7.2.gemfile
|
78
|
+
- gemfiles/rails_8.0.gemfile
|
76
79
|
- lib/diffcrypt.rb
|
77
80
|
- lib/diffcrypt/cli.rb
|
78
81
|
- lib/diffcrypt/encryptor.rb
|
@@ -90,7 +93,6 @@ metadata:
|
|
90
93
|
homepage_uri: https://github.com/diffcrypt/diffcrypt-ruby
|
91
94
|
source_code_uri: https://github.com/diffcrypt/diffcrypt-ruby
|
92
95
|
rubygems_mfa_required: 'true'
|
93
|
-
post_install_message:
|
94
96
|
rdoc_options: []
|
95
97
|
require_paths:
|
96
98
|
- lib
|
@@ -98,15 +100,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
100
|
requirements:
|
99
101
|
- - ">="
|
100
102
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
103
|
+
version: 3.0.0
|
102
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
105
|
requirements:
|
104
106
|
- - ">="
|
105
107
|
- !ruby/object:Gem::Version
|
106
108
|
version: '0'
|
107
109
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
109
|
-
signing_key:
|
110
|
+
rubygems_version: 3.6.5
|
110
111
|
specification_version: 4
|
111
112
|
summary: Diffable encrypted configuration files
|
112
113
|
test_files: []
|