asherah 0.5.2-x86_64-darwin → 0.7.0-x86_64-darwin

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: f5d3b1f9b8f1f8051e5b7ee0f805d61273c8804a7d056e31d1ac570f06486b73
4
- data.tar.gz: bee529ad2fa3da6b426e08cb831c91780d755c5b837bb26aa1026fd4ed3a318b
3
+ metadata.gz: 67d0ddf5cdcdb3832e11c7fd8e179b42942559d816ef025999fa04a34d2dc29b
4
+ data.tar.gz: 91bec2d92493b084819fe22a3593e0a5fcf1b9c876679227e7cbbe70c21de859
5
5
  SHA512:
6
- metadata.gz: aae9133b9d00ad4016ddeec260a3d44319dc31026a8572c0cbbdc2a9cb8dcaf199024de2c2de47d7a317aaf959efc911a5b68150ee0e2aa2501b87b8d66b99ce
7
- data.tar.gz: 2caa417a48458a30d164899b61e44a43acbcdbb21c8dfca6fed9bbf0f6ac1bfd8a0fb8dca72fba3a5e6444311aafae2a9a45c426fe5b4d6304a1ab8eb6510ab6
6
+ metadata.gz: 804fcc3aef5504bae82fa29e3a793e320b28393c76d8dff7844bf5d96205abc2f2f130859a2ffb98840fb2066ca62af9641985aab340802aa736b3d13dc38fd8
7
+ data.tar.gz: 6dc7162a35f715b88a6573ac4e6f64e5554123bb9f5ec878033ab03445f5c2fabf53a28d5f8d9d2d755d3bfdb73d0839b20b1a22d2bd9124bab2a94d48b30b18
@@ -0,0 +1,9 @@
1
+ # Example secrets file for KMS integration tests
2
+ # Copy this file to .env.secrets and fill in actual values
3
+ #
4
+ # IMPORTANT: Never commit .env.secrets to version control
5
+ # The .env.secrets file is already in .gitignore
6
+
7
+ # AWS KMS Key ARN for integration tests (optional)
8
+ # Only needed if running spec/kms_spec.rb
9
+ # KMS_KEY_ARN=arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-123456789012
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.5
2
+ TargetRubyVersion: 2.7
3
3
  NewCops: enable
4
4
  SuggestExtensions: false
5
5
  Exclude:
@@ -9,29 +9,101 @@ AllCops:
9
9
  Layout/LineLength:
10
10
  Max: 120
11
11
 
12
+ # Metrics cops with reasonable limits
12
13
  Metrics/BlockLength:
13
- Enabled: false
14
+ Max: 25
15
+ Exclude:
16
+ - 'spec/**/*'
17
+ - '*.gemspec'
18
+ - 'Rakefile'
14
19
 
15
20
  Metrics/MethodLength:
16
- Enabled: false
21
+ Max: 15
22
+ Exclude:
23
+ - 'spec/**/*'
24
+ - 'tasks/**/*'
25
+
26
+ Metrics/AbcSize:
27
+ Max: 20
28
+ Exclude:
29
+ - 'spec/**/*'
30
+ - 'tasks/**/*'
31
+
32
+ Metrics/CyclomaticComplexity:
33
+ Max: 10
34
+ Exclude:
35
+ - 'spec/**/*'
36
+
37
+ Metrics/PerceivedComplexity:
38
+ Max: 10
39
+ Exclude:
40
+ - 'spec/**/*'
41
+
42
+ Metrics/ClassLength:
43
+ Max: 150
44
+ Exclude:
45
+ - 'spec/**/*'
46
+
47
+ Metrics/ModuleLength:
48
+ Max: 150
49
+ Exclude:
50
+ - 'spec/**/*'
17
51
 
52
+ # Style cops that were disabled but should be enabled
18
53
  Style/WordArray:
19
- Enabled: false
54
+ MinSize: 3
55
+ EnforcedStyle: brackets
20
56
 
21
57
  Style/SymbolArray:
22
- Enabled: false
58
+ MinSize: 3
59
+ EnforcedStyle: brackets
23
60
 
24
61
  Style/MultilineBlockChain:
25
- Enabled: false
62
+ Enabled: true
63
+ Exclude:
64
+ - 'spec/**/*'
26
65
 
27
66
  Style/BlockDelimiters:
28
- Enabled: false
29
-
30
- Metrics/AbcSize:
31
- Enabled: false
67
+ EnforcedStyle: semantic
68
+ FunctionalMethods:
69
+ - let
70
+ - let!
71
+ - subject
72
+ - before
73
+ - after
74
+ Exclude:
75
+ - 'asherah.gemspec'
76
+ - 'ext/asherah/native_file.rb'
32
77
 
33
78
  Style/GuardClause:
34
- Enabled: false
79
+ MinBodyLength: 3
80
+ Exclude:
81
+ - 'ext/asherah/native_file.rb'
35
82
 
83
+ # Naming cop adjustment
36
84
  Naming/AccessorMethodName:
37
- Enabled: false
85
+ Exclude:
86
+ - 'lib/asherah.rb' # set_env is intentionally named
87
+
88
+ # Documentation cops
89
+ Style/Documentation:
90
+ Enabled: true
91
+ Exclude:
92
+ - 'spec/**/*'
93
+ - 'features/**/*'
94
+
95
+ Style/DocumentationMethod:
96
+ Enabled: false # YARD comments are optional
97
+
98
+ # Additional cops for code quality
99
+ Lint/UnusedMethodArgument:
100
+ Enabled: true
101
+
102
+ Lint/UnusedBlockArgument:
103
+ Enabled: true
104
+
105
+ Security/Eval:
106
+ Enabled: true
107
+
108
+ Security/JSONLoad:
109
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.7.0] - 2025-08-15
4
+
5
+ - Fix memory leak risks in buffer management
6
+ - Fix inconsistent NotInitialized error handling across all methods
7
+ - Fix overly permissive RuboCop configuration
8
+ - Add Dependabot configuration for automated dependency updates
9
+ - Update dependencies and Github actions
10
+ - Update Go version to 1.24 for cross-language tests
11
+
12
+ ## [0.6.0] - 2025-03-19
13
+
14
+ - Upgrade to use asherah-cobhan v0.4.35
15
+ - Requires minimum GLIBC 2.32 version
16
+
3
17
  ## [0.5.2] - 2024-01-15
4
18
 
5
19
  - Upgrade to use asherah-cobhan v0.4.32
data/Gemfile CHANGED
@@ -5,10 +5,10 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in asherah.gemspec
6
6
  gemspec
7
7
 
8
- gem 'cucumber', '~> 7.1.0'
9
- gem 'dotenv', '~> 2.7.6'
8
+ gem 'cucumber', '~> 9.2.1'
9
+ gem 'dotenv', '~> 2.8.1'
10
10
  gem 'rake', '~> 13.0'
11
- gem 'rspec', '~> 3.10.0'
11
+ gem 'rspec', '~> 3.13.1'
12
12
  gem 'rubocop', '~> 1.7'
13
- gem 'simplecov', '~> 0.21.2'
13
+ gem 'simplecov', '~> 0.22.0'
14
14
  gem 'simplecov-console', '~> 0.9.1'
data/README.md CHANGED
@@ -67,6 +67,8 @@ puts decrypted_data
67
67
 
68
68
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
69
69
 
70
+ For tests requiring secrets (AWS KMS, database credentials), copy `.env.secrets.example` to `.env.secrets` and fill in the required values. The `.env.secrets` file is already in `.gitignore` to prevent accidental commits.
71
+
70
72
  To install this gem onto your local machine, run `rake install`.
71
73
 
72
74
  To release a new version, update the version number in `version.rb`, create and push a version tag:
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ task :download do
18
18
  end
19
19
  end
20
20
 
21
- task default: %i[spec rubocop]
21
+ task default: [:spec, :rubocop]
22
22
  task spec: :download
23
23
 
24
24
  desc 'Print current version'
data/asherah.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.homepage = 'https://github.com/godaddy/asherah-ruby'
18
18
  spec.license = 'MIT'
19
- spec.required_ruby_version = '>= 2.5.0'
19
+ spec.required_ruby_version = '>= 2.7.0'
20
20
 
21
21
  spec.metadata['homepage_uri'] = spec.homepage
22
22
  spec.metadata['source_code_uri'] = 'https://github.com/godaddy/asherah-ruby'
@@ -1,5 +1,5 @@
1
- version: v0.4.32
2
- libasherah-arm64.so: 0008a114d60c9b6c0e7fbc19a2e34e3527f761074bd3fe99595d7676c707f7e4
3
- libasherah-x64.so: cf8bd61f76ca93457745e3c5ca28de385030e34d0d47893b870166605cf39306
4
- libasherah-arm64.dylib: bef8cb18177dc8b49c58a12263df0c1e3584791af212a79000f5b72344969bfd
5
- libasherah-x64.dylib: b43e69d18351a59abecf3457d0e451ffd816f1f111f1c0cfd1217075fe4a8b9d
1
+ version: v0.4.35
2
+ libasherah-arm64.so: fad23a38e68e126374075adf197f0f431720aea9852deebe5f62d9240c935a66
3
+ libasherah-x64.so: 8c52fc000df2c02fb2d1430afc3cd68e997f47f04b60d61481f8c4b201958ef8
4
+ libasherah-arm64.dylib: 315bc41c85177a2b0c97f32e0af8e2694f393928678cbe648fdd8c16b8fe062a
5
+ libasherah-x64.dylib: 848d3635713373e0482223087f454ff8464e36e7695e0ed19f830737288adaa9
@@ -105,11 +105,10 @@ module Asherah
105
105
  end
106
106
 
107
107
  def validate_kms_attributes
108
- if kms == 'aws'
109
- raise Error::ConfigError, 'config.region_map not set' if region_map.nil?
110
- raise Error::ConfigError, 'config.region_map must be a Hash' unless region_map.is_a?(Hash)
111
- raise Error::ConfigError, 'config.preferred_region not set' if preferred_region.nil?
112
- end
108
+ return unless kms == 'aws'
109
+ raise Error::ConfigError, 'config.region_map not set' if region_map.nil?
110
+ raise Error::ConfigError, 'config.region_map must be a Hash' unless region_map.is_a?(Hash)
111
+ raise Error::ConfigError, 'config.preferred_region not set' if preferred_region.nil?
113
112
  end
114
113
  end
115
114
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Asherah
4
- VERSION = '0.5.2'
4
+ VERSION = '0.7.0'
5
5
  end
data/lib/asherah.rb CHANGED
@@ -37,6 +37,8 @@ module Asherah
37
37
 
38
38
  result = SetEnv(env_buffer)
39
39
  Error.check_result!(result, 'SetEnv failed')
40
+ ensure
41
+ env_buffer&.free
40
42
  end
41
43
 
42
44
  # Configures Asherah
@@ -56,6 +58,8 @@ module Asherah
56
58
  result = SetupJson(config_buffer)
57
59
  Error.check_result!(result, 'SetupJson failed')
58
60
  @initialized = true
61
+ ensure
62
+ config_buffer&.free
59
63
  end
60
64
 
61
65
  # Encrypts data for a given partition_id and returns DataRowRecord in JSON format.
@@ -74,6 +78,8 @@ module Asherah
74
78
  # @param data [String]
75
79
  # @return [String], DataRowRecord in JSON format
76
80
  def encrypt(partition_id, data)
81
+ raise Asherah::Error::NotInitialized unless @initialized
82
+
77
83
  partition_id_buffer = string_to_cbuffer(partition_id)
78
84
  data_buffer = string_to_cbuffer(data)
79
85
  estimated_buffer_bytesize = estimate_buffer(data.bytesize, partition_id.bytesize)
@@ -84,7 +90,7 @@ module Asherah
84
90
 
85
91
  cbuffer_to_string(output_buffer)
86
92
  ensure
87
- [partition_id_buffer, data_buffer, output_buffer].map(&:free)
93
+ [partition_id_buffer, data_buffer, output_buffer].compact.each(&:free)
88
94
  end
89
95
 
90
96
  # Decrypts a DataRowRecord in JSON format for a partition_id and returns decrypted data.
@@ -93,6 +99,8 @@ module Asherah
93
99
  # @param json [String], DataRowRecord in JSON format
94
100
  # @return [String], Decrypted data
95
101
  def decrypt(partition_id, json)
102
+ raise Asherah::Error::NotInitialized unless @initialized
103
+
96
104
  partition_id_buffer = string_to_cbuffer(partition_id)
97
105
  data_buffer = string_to_cbuffer(json)
98
106
  output_buffer = allocate_cbuffer(json.bytesize)
@@ -102,7 +110,7 @@ module Asherah
102
110
 
103
111
  cbuffer_to_string(output_buffer)
104
112
  ensure
105
- [partition_id_buffer, data_buffer, output_buffer].map(&:free)
113
+ [partition_id_buffer, data_buffer, output_buffer].compact.each(&:free)
106
114
  end
107
115
 
108
116
  # Stop the Asherah instance
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asherah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.7.0
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - GoDaddy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-15 00:00:00.000000000 Z
11
+ date: 2025-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cobhan
@@ -35,6 +35,7 @@ extensions:
35
35
  - ext/asherah/extconf.rb
36
36
  extra_rdoc_files: []
37
37
  files:
38
+ - ".env.secrets.example"
38
39
  - ".rspec"
39
40
  - ".rubocop.yml"
40
41
  - ".ruby-version"
@@ -71,14 +72,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
72
  requirements:
72
73
  - - ">="
73
74
  - !ruby/object:Gem::Version
74
- version: 2.5.0
75
+ version: 2.7.0
75
76
  required_rubygems_version: !ruby/object:Gem::Requirement
76
77
  requirements:
77
78
  - - ">="
78
79
  - !ruby/object:Gem::Version
79
80
  version: '0'
80
81
  requirements: []
81
- rubygems_version: 3.4.10
82
+ rubygems_version: 3.4.19
82
83
  signing_key:
83
84
  specification_version: 4
84
85
  summary: Application Layer Encryption SDK