asherah 0.3.0-aarch64-linux → 0.4.1-aarch64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +16 -13
- data/Rakefile +11 -103
- data/asherah.gemspec +2 -1
- data/ext/asherah/checksums.yml +5 -0
- data/ext/asherah/extconf.rb +7 -0
- data/ext/asherah/native_file.rb +64 -0
- data/lib/asherah/native/libasherah-arm64.so +0 -0
- data/lib/asherah/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 552ed1c9e334c3f83bab7b90e0c522e00218a690d3e67bf59347e0065aa7a6d5
|
4
|
+
data.tar.gz: 98dcb37bc214640dec990ecaff49bea688d0966bc77f6182b43b19fe3fc686a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3248250cf38f0ffb145c1e3d99a530d1167a903f4907216f010b77a1a5168a4ca8c54ee979853630035efa1f6f495f1aeea7d2ab82b66fd513ad9ecbfcdaed55
|
7
|
+
data.tar.gz: e9531283d182efb3c47f8234c4cd1b8e7dbb505a987a407d57847a07eb57b1994ba6d0fb2ce6c42d62e572e9a7031728ab718a3d53c657e8c35f11c908de8c47
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.4.1] - 2022-03-25
|
4
|
+
|
5
|
+
- Build and release platform gems
|
6
|
+
|
7
|
+
## [0.4.0] - 2022-03-25
|
8
|
+
|
9
|
+
- Download native file during gem install and verify checksum
|
10
|
+
- Upgrade to use asherah-cobhan v0.4.11
|
11
|
+
|
3
12
|
## [0.3.0] - 2022-03-22
|
4
13
|
|
5
14
|
- Free up cobhan buffers after encrypt/decrypt to prevent growing heap memory
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Asherah
|
2
2
|
|
3
|
-
Asherah is a Ruby wrapper around [Asherah
|
3
|
+
Asherah is a Ruby FFI wrapper around Go version of [Asherah](https://github.com/godaddy/asherah) application-layer encryption SDK. Asherah provides advanced encryption features and defense in depth against compromise. It uses a technique known as "envelope encryption" and supports cloud-agnostic data storage and key management.
|
4
4
|
|
5
|
-
Check out the following documentation to get more familiar with
|
5
|
+
Check out the following documentation to get more familiar with the concepts and configuration options:
|
6
6
|
|
7
7
|
- [Design and Architecture](https://github.com/godaddy/asherah/blob/master/docs/DesignAndArchitecture.md)
|
8
8
|
- [Key Caching](https://github.com/godaddy/asherah/blob/master/docs/KeyCaching.md)
|
@@ -10,6 +10,10 @@ Check out the following documentation to get more familiar with its concepts:
|
|
10
10
|
- [Metastore](https://github.com/godaddy/asherah/blob/master/docs/Metastore.md)
|
11
11
|
- [System Requirements](https://github.com/godaddy/asherah/blob/master/docs/SystemRequirements.md)
|
12
12
|
|
13
|
+
## Supported Platforms
|
14
|
+
|
15
|
+
Currently supported platforms are Linux and Darwin operating systems for x64 and arm64 CPU architectures.
|
16
|
+
|
13
17
|
## Installation
|
14
18
|
|
15
19
|
Add this line to your application's Gemfile:
|
@@ -45,7 +49,7 @@ Encrypt some data for a `partition_id`
|
|
45
49
|
|
46
50
|
```ruby
|
47
51
|
partition_id = 'user_1'
|
48
|
-
data = '
|
52
|
+
data = 'PII data'
|
49
53
|
data_row_record_json = Asherah.encrypt(partition_id, data)
|
50
54
|
puts data_row_record_json
|
51
55
|
```
|
@@ -61,23 +65,22 @@ puts decrypted_data
|
|
61
65
|
|
62
66
|
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.
|
63
67
|
|
64
|
-
To install this gem onto your local machine, run `
|
68
|
+
To install this gem onto your local machine, run `rake install`.
|
65
69
|
|
66
|
-
|
67
|
-
|
68
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/godaddy/asherah-ruby.
|
69
|
-
|
70
|
-
## Releasing new gem version
|
70
|
+
To release a new version, update the version number in `version.rb`, create and push a version tag:
|
71
71
|
|
72
72
|
```
|
73
|
-
# Create and push a version tag
|
74
73
|
git tag -a v$(rake version) -m "Version $(rake version)"
|
75
74
|
git push origin v$(rake version)
|
76
|
-
|
77
|
-
# Create a release in Github to trigger .github/workflows/publish.yml workflow
|
78
|
-
echo "Version $(rake version)"
|
79
75
|
```
|
80
76
|
|
77
|
+
And then create a release in Github with title `echo "Version $(rake version)"` that will trigger `.github/workflows/publish.yml` workflow and push the `.gem` file to [rubygems.org](https://rubygems.org):
|
78
|
+
|
79
|
+
|
80
|
+
## Contributing
|
81
|
+
|
82
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/godaddy/asherah-ruby.
|
83
|
+
|
81
84
|
## License
|
82
85
|
|
83
86
|
The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
|
data/Rakefile
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
-
require 'rubygems/package'
|
6
5
|
|
7
6
|
RSpec::Core::RakeTask.new(:spec)
|
8
7
|
|
@@ -10,112 +9,21 @@ require 'rubocop/rake_task'
|
|
10
9
|
|
11
10
|
RuboCop::RakeTask.new
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
'aarch64-linux' => ['libasherah-arm64.so'],
|
20
|
-
'arm64-darwin' => ['libasherah-arm64.dylib']
|
21
|
-
}.freeze
|
22
|
-
|
23
|
-
def current_filename
|
24
|
-
@current_filename ||=
|
25
|
-
begin
|
26
|
-
require 'cobhan'
|
27
|
-
Class.new.extend(Cobhan).library_file_name('libasherah')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def current_platform
|
32
|
-
@distribution ||= DISTRIBUTIONS.detect { |_k, v| v.include?(current_filename) }
|
33
|
-
@distribution.first
|
34
|
-
end
|
35
|
-
|
36
|
-
def native_build(platform, native_files)
|
37
|
-
puts "Building gem for #{platform}"
|
38
|
-
|
39
|
-
pkg_dir = File.join(__dir__, 'pkg')
|
40
|
-
FileUtils.mkdir_p(pkg_dir)
|
41
|
-
|
42
|
-
tmp_gem_dir = File.join(__dir__, 'tmp', platform)
|
43
|
-
FileUtils.rm_rf(tmp_gem_dir, verbose: true)
|
44
|
-
FileUtils.mkdir_p(tmp_gem_dir, verbose: true)
|
45
|
-
|
46
|
-
# Copy files to tmp gem dir
|
47
|
-
gemspec = Bundler.load_gemspec('asherah.gemspec')
|
48
|
-
(gemspec.files + [ASHERAH_BIN]).each do |file|
|
49
|
-
dir = File.dirname(file)
|
50
|
-
filename = File.basename(file)
|
51
|
-
FileUtils.mkdir_p(File.join(tmp_gem_dir, dir))
|
52
|
-
FileUtils.copy_file(file, File.join(tmp_gem_dir, dir, filename))
|
53
|
-
end
|
54
|
-
|
55
|
-
# Set platform for native gem build
|
56
|
-
gemspec.platform = Gem::Platform.new(platform)
|
57
|
-
|
58
|
-
native_dir = 'lib/asherah/native'
|
59
|
-
FileUtils.cd(tmp_gem_dir, verbose: true) do
|
60
|
-
FileUtils.mkdir_p(native_dir)
|
61
|
-
native_files.each do |native_file|
|
62
|
-
native_file_path = File.join(native_dir, native_file)
|
63
|
-
|
64
|
-
# Download native file
|
65
|
-
download_asherah_path = File.join(tmp_gem_dir, ASHERAH_BIN)
|
66
|
-
system("#{download_asherah_path} #{native_file}")
|
67
|
-
|
68
|
-
# Add native file in gemspec
|
69
|
-
gemspec.files << native_file_path
|
70
|
-
end
|
71
|
-
|
72
|
-
package = Gem::Package.build(gemspec)
|
73
|
-
FileUtils.mv package, File.join(pkg_dir, package)
|
12
|
+
desc 'Download the binary for the current platform'
|
13
|
+
task :download do
|
14
|
+
tmp_dir = 'tmp'
|
15
|
+
FileUtils.mkdir_p(tmp_dir)
|
16
|
+
FileUtils.cd(tmp_dir, verbose: true) do
|
17
|
+
system('ruby ../ext/asherah/extconf.rb')
|
74
18
|
end
|
75
19
|
end
|
76
20
|
|
77
|
-
|
78
|
-
|
79
|
-
task :build do
|
80
|
-
DISTRIBUTIONS.each do |platform, native_files|
|
81
|
-
native_build(platform, native_files)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
namespace :build do
|
86
|
-
DISTRIBUTIONS.each do |platform, native_files|
|
87
|
-
desc "Build native gem for #{platform}"
|
88
|
-
task :"#{platform}" do
|
89
|
-
native_build(platform, native_files)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
namespace :current do
|
95
|
-
desc 'Download asherah binary for current platform'
|
96
|
-
task :download do
|
97
|
-
download_asherah_path = File.join(__dir__, ASHERAH_BIN)
|
98
|
-
system("#{download_asherah_path} #{current_filename}")
|
99
|
-
end
|
100
|
-
|
101
|
-
desc 'Build native gem for current platform'
|
102
|
-
task :build do
|
103
|
-
native_build(current_platform, DISTRIBUTIONS[current_platform])
|
104
|
-
end
|
105
|
-
|
106
|
-
desc 'Smoke test native gem for current platform'
|
107
|
-
task smoke: :build do
|
108
|
-
platform = current_platform
|
109
|
-
gemspec = Bundler.load_gemspec('asherah.gemspec')
|
110
|
-
gemspec.platform = Gem::Platform.new(platform)
|
111
|
-
|
112
|
-
sh('gem uninstall asherah')
|
113
|
-
sh("gem install pkg/#{gemspec.file_name}")
|
114
|
-
sh('ruby spec/smoke_test.rb')
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
21
|
+
task default: %i[spec rubocop]
|
22
|
+
task spec: :download
|
118
23
|
|
24
|
+
desc 'Print current version'
|
119
25
|
task :version do
|
120
26
|
puts Asherah::VERSION
|
121
27
|
end
|
28
|
+
|
29
|
+
Rake.add_rakelib 'tasks'
|
data/asherah.gemspec
CHANGED
@@ -27,12 +27,13 @@ Gem::Specification.new do |spec|
|
|
27
27
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
28
28
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
29
29
|
`git ls-files -z`.split("\x0").reject do |f|
|
30
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
30
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features|tasks)/|\.(?:git|travis|circleci)|appveyor)})
|
31
31
|
end
|
32
32
|
end
|
33
33
|
spec.bindir = 'exe'
|
34
34
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
35
35
|
spec.require_paths = ['lib']
|
36
|
+
spec.extensions = ['ext/asherah/extconf.rb']
|
36
37
|
|
37
38
|
spec.add_dependency 'cobhan', '~> 0.2.0'
|
38
39
|
spec.add_development_dependency 'dotenv', '~> 2.7.6'
|
@@ -0,0 +1,5 @@
|
|
1
|
+
version: v0.4.11
|
2
|
+
libasherah-arm64.so: bc044b74453fc8fceca564fb127c9f2748aeac107791bd24c680ced1fcb7b816
|
3
|
+
libasherah-x64.so: 82f10505ef11fba2c8e027668d9b5c89584f73eb1e53a9f5ff21d5705ecffb3a
|
4
|
+
libasherah-arm64.dylib: 0b843d002212722c442c990d84e6ceac73c78e1663260be8c3f759a9a283b14a
|
5
|
+
libasherah-x64.dylib: fd0592ed4cdfbc7b3a2534b540c22301a9669c6c37dfb3d28f600ccc9ba975f8
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open-uri'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'digest'
|
6
|
+
require 'yaml'
|
7
|
+
require 'cobhan'
|
8
|
+
|
9
|
+
# Downloads native file and verifies checksum
|
10
|
+
class NativeFile
|
11
|
+
LIB_NAME = 'libasherah'
|
12
|
+
ROOT_DIR = File.expand_path('../../', __dir__)
|
13
|
+
CHECKSUMS_FILE = File.expand_path('checksums.yml', __dir__)
|
14
|
+
CHECKSUMS = YAML.load_file(CHECKSUMS_FILE)
|
15
|
+
VERSION = CHECKSUMS.fetch('version')
|
16
|
+
RETRIES = 3
|
17
|
+
RETRY_DELAY = 1
|
18
|
+
|
19
|
+
class << self
|
20
|
+
def download(
|
21
|
+
file_name: Class.new.extend(Cobhan).library_file_name(LIB_NAME),
|
22
|
+
dir: File.join(ROOT_DIR, 'lib/asherah/native')
|
23
|
+
)
|
24
|
+
file_path = File.join(dir, file_name)
|
25
|
+
if File.exist?(file_path)
|
26
|
+
puts "#{file_path} already exists ... skipping download"
|
27
|
+
return
|
28
|
+
end
|
29
|
+
|
30
|
+
checksum = CHECKSUMS.fetch(file_name) do
|
31
|
+
abort "Unsupported platform #{RUBY_PLATFORM}"
|
32
|
+
end
|
33
|
+
|
34
|
+
content = download_content(file_name)
|
35
|
+
|
36
|
+
sha256 = Digest::SHA256.hexdigest(content)
|
37
|
+
abort "Could not verify checksum of #{file_name}" if sha256 != checksum
|
38
|
+
|
39
|
+
FileUtils.mkdir_p(dir)
|
40
|
+
File.binwrite(file_path, content)
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def download_content(file_name)
|
46
|
+
tries = 0
|
47
|
+
|
48
|
+
begin
|
49
|
+
tries += 1
|
50
|
+
url = "https://github.com/godaddy/asherah-cobhan/releases/download/#{VERSION}/#{file_name}"
|
51
|
+
puts "Downloading #{url}"
|
52
|
+
URI.parse(url).open.read
|
53
|
+
rescue Net::OpenTimeout, Net::ReadTimeout => e
|
54
|
+
if tries <= RETRIES
|
55
|
+
puts "Got #{e.class}... retrying in #{RETRY_DELAY} seconds"
|
56
|
+
sleep RETRY_DELAY
|
57
|
+
retry
|
58
|
+
else
|
59
|
+
raise e
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
Binary file
|
data/lib/asherah/version.rb
CHANGED
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.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: aarch64-linux
|
6
6
|
authors:
|
7
7
|
- GoDaddy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cobhan
|
@@ -100,7 +100,8 @@ description: |
|
|
100
100
|
email:
|
101
101
|
- oss@godaddy.com
|
102
102
|
executables: []
|
103
|
-
extensions:
|
103
|
+
extensions:
|
104
|
+
- ext/asherah/extconf.rb
|
104
105
|
extra_rdoc_files: []
|
105
106
|
files:
|
106
107
|
- ".rspec"
|
@@ -115,6 +116,9 @@ files:
|
|
115
116
|
- Rakefile
|
116
117
|
- SECURITY.md
|
117
118
|
- asherah.gemspec
|
119
|
+
- ext/asherah/checksums.yml
|
120
|
+
- ext/asherah/extconf.rb
|
121
|
+
- ext/asherah/native_file.rb
|
118
122
|
- lib/asherah.rb
|
119
123
|
- lib/asherah/config.rb
|
120
124
|
- lib/asherah/error.rb
|