From c37a7f5068346493a3512332393d07a9c1d1e282 Mon Sep 17 00:00:00 2001 From: Konstantin Ilchenko Date: Thu, 18 Apr 2024 14:45:54 +0200 Subject: [PATCH 1/4] Update key files and exprire in 50 years --- .../provider/postgres_pgp_public_key_spec.rb | 6 +- spec/fixtures/private.asc | 110 +++++++++--------- spec/fixtures/public.asc | 77 +++++++----- 3 files changed, 105 insertions(+), 88 deletions(-) diff --git a/spec/crypt_keeper/provider/postgres_pgp_public_key_spec.rb b/spec/crypt_keeper/provider/postgres_pgp_public_key_spec.rb index f971e7e..a2fb308 100644 --- a/spec/crypt_keeper/provider/postgres_pgp_public_key_spec.rb +++ b/spec/crypt_keeper/provider/postgres_pgp_public_key_spec.rb @@ -3,9 +3,9 @@ describe CryptKeeper::Provider::PostgresPgpPublicKey do use_postgres - let(:cipher_text) { '\xc1c04c036c401ad086beb9e3010800987d6c4ccd974322190caa75a3a01aba37bc1970182c4c1d3faec98edf186780520f0586101f286e0626096a1eca91a229ed4d4058a6913a8d13cdf49f29ea44e2b96d10347f9b1b860bb3c959f000a3b1b415a95d2cd07af8c74aa6df8cd10ab06b6a6f7db69cdf3185466d68c5b66b95b813acdfb3ddfb021cac92e0967d67e90df73332f27970c1d2b9a56ac74f602d4107b163ed73ef89fca560d9a0a0d2bc7a74005f29fa27babfbaf950ac07b1c809049db4ab126be4824cf76416c278571f7064f638edf830a1ae5ee1ab544d35fce0f974f21b9dcbbea3986077d27b0de34144dc23f369f471090b57e067a056901e680493ddf2a6b29e4af3462387d235010259556079d07daa249b6703e2bc79345da556cfb46f228cad40a8a5b569ac46f08865f9176acf89129a3e0ceb2a7b1991012f65' } + let(:cipher_text) { '\xc1c24e03374ac5d225ffff71100bfe27156ec4de2509f29639db2820a08c79b54a5c35def273f57453c46bf2aa1e211437416afe62f97f350943519d7aa85498d98763118f5ddefa33632c8178eb1f4700dba97dadca79d9e369dc4d4b894f6fd8553185fd1ba8f4e997cbcdce71de376501eb162164668b1368743bd10f06d4ef3406faca262120f55baad2a156afe3953361cb25422a51d5fa82b55714d876ea11abe2e403b1634f7484c6db89d36d18161390b4e5531199b7cd3bd5b54a5702858d4e8cc9a9b67cedb7cb1ac00b1e9291b641e7e666a13a8a01e230506e553c0fab5a21c59f92548c16ba35b0eee42d3640ecbf55d7271ced731c5a3188b1608943b18f739614362bb52ceae7b8900abbae545bae26b8cdd8204da479b0b0fe9cb77c542c8ab20b2a149f0935929e885d1725e4e2d9406ea2bff5772e24c1d0f51b4ffd95d65995c8a0507f30f66e0e934310f603260d554d953bf5990a165c559e8ce6d0347a6ca136c6d666ea25ff751fff8952ef45aefd3aab1362799b8f67b9f05db612f6237153707757d30c009459859cb2a5133ab6062a10b22dca5c9476c7dbbd7c40a06259984a365cbca5b237b0cd2d9eac60c2dbb1ae41a362f2f6585d457a16ec221d3bf93e4fb2d2ed20ab8fe4954111292ebe1cd3a67bc180b4ea965832f1ddcf3c446bd6e686c564cbe9b467471c6d06074a5b97b1ec205ac1097a68db74b1ccb6f08405f91bf81b7449fd6cf1408f3a6b69ae0f9588e404c4389a941a1905322256afd207cdbf62df0f7824a8dbc84f9807c6ed618c2025ff1497d263a969d394d7426fc7ab85989b24a5e67b52f4e155499afef35ac43aa266d0c2afc69c20f04c0a0ee1bb949d210489d289b818be3fb1087d830c45a37ebfebb6dafb2702bd3f77006721d4bbb8366767cacd1471737be22123679cbe04f4a734b9865afbd76249da53f19219d90692f6cca1cac69fcd25a372fad325fc87f7ab1f3edcac65bc9a4cf3ba7da9cfbbabd67beba5319b984d7e855038edf9b3e5aaae5dfa8def1cfb9dd4ca0c1a9d5709f282cd4d9301adee0eada250c26668b126405b095c0e8dba69ca314f54d23501321b5c6c8bc0b25d693d6dc643b52c71f0c263e021b9a7c1a11b646175f95df6cbea5aba6210dadf9f35ef8afcf23c5a62db59ab' } - let(:integer_cipher_text) { '\xc1c04c036c401ad086beb9e30107ff59e674ba05958eb053c2427b44355e0f333f1726e18a0b851130130510c648f580b13b3f6a223eb26e397008596867c5a511a4f5bfbf2ecc852d8929814480d63166e525fa2b259b6a8d4474b5b1373b4e1a4fe70a491d25442e1c0046fd3d69466ad30153c8d8d920e9b4260d4e4e421ef3ead162b3aba5d85408c4ef9f9d342b5655c7568d1bdc61c27ddb419133bf091f22f42e7bc91ec6d279b7b25b87ea65119568b85ae81079dd0a6a7258b58fb219c6cc4580f33cb46de97770a1eb0880bdf87426fd0529576a1e791e521d9b3c426e393e63d83321f319b00f9dc4027ea5a81dd57c0f5ba868fb86d73179c34f2287c437266e8becc072b45a929562d2320194be54464e03854635d0f7d7fb10813adbc6efe51efa9095a9bacc2a03fb5c41d1c1896384e4f36b100c0f00e81d4cff7d' } + let(:integer_cipher_text) { '\xc1c24e03374ac5d225ffff71100c008d6566bcb0e23faab9665214c2611e9e04d37cf2dc775e834bb8ec0e5b4192927c165f3fc42e667e6b2c681ffe6b87226ff02d15907f82e72019f146347e0f00e395a2ae7c2399d2f8511b290ece078ddd4de03976aac074367b588ee79536490a30e0f24d61c9a25a543834cbcbe46e27448c5afa6e11f61368ea45758993da7e2dae9ee9b8ef365f30c18c9ef8b3dfd9b307dfc65204e0c3954e00a934536712e2374a98f87e4c2b7ec069274548f2e76ae95390b0cf996b2269e9a2d4d2fd437d117ad01628eaa86a686c00fdee98efa321e47063a90a60dee36362a96136482102d8012bc6d5d966e80d39d8548233f865429ad08590d1493f3ce8bf2a7b17a53d591975e2cb3d6b81dfb25f4ea621e1b1727c8b95cd637f539390523d2b6c3a2aba1aa94057706631d5e83124b7307f53ecd01668f83d568d094e461a8cc439859ecf9964d41c2ecf36c0b46b56cdd962c387a6ba5c2eeaa4093a2550099ab1783d9a36758be2ec8effd7498bf8c8ce1bc076d7a3535b52766709dfb9900bfe3073409e705506e006f9df051d7ce83af6a47b4b6a30e9e313db8e992a3f9600160ae8f82163567e7dee06f491c66de1837ef6493f1e791186a4c9704d9eb48c48351fc1bf62e7be0a9d940013142031ae15b3ead2c96748be35ee51157ea4748ca1e4d420974e72a8cd9c5c39606557569d3a4efc4c8ff6df8cfd243be43fc0cc1ea305fc54e2e94d7ae7487c175b0e0e784ce1816872ed57f765fe4f186b0181342d9d3c207bc69cb75ab5a063d60bb67f095a593e690b54cd37f8c1448f9af9d8be384fdb7fd281c13cb235446bc17f8a1a7a1b287fe193820d457c64e329c06d143991f0a858aaa2dd7a280ba29a86ec73b1e76f290be54abfeff60bfa5e1afa7ebb9f30bf9c1bb57bc87420c460e3cd616b47ee567e2e8a1962edc26584780626fe891b79a52ced914aff5261e7da4b6a1d4fddb3ec90e18f4ff543e237cbeb7a31f2ffd147f3e135c410463ff5a92950481889680c6f860b3548d3d7326cd9f5956d4bbfdd56e1d53f51a5abeb3ae7222a48920ca16708739e809a96f9d232014ad7f53dbe68cb1bc826d8a21e2761353199fc82d854070ca10ff11bb236221422ba17f1b8c77af3801310bacb7d23bd34' } let(:integer_plain_text) { 1 } let(:plain_text) { 'test' } @@ -15,7 +15,7 @@ end let(:private_key) do - IO.read(File.join(SPEC_ROOT, 'fixtures', 'private.asc')) + IO.read(File.join(SPEC_ROOT, 'fixtures', 'private.asc')) # Expiration date 2074-04-06 end subject { described_class.new key: ENCRYPTION_PASSWORD, public_key: public_key, private_key: private_key } diff --git a/spec/fixtures/private.asc b/spec/fixtures/private.asc index 0df1d1e..93ba1b3 100644 --- a/spec/fixtures/private.asc +++ b/spec/fixtures/private.asc @@ -1,60 +1,56 @@ -----BEGIN PGP PRIVATE KEY BLOCK----- -Version: GnuPG v1.4.10 (GNU/Linux) -lQO+BFKgjPQBCADxhlfBJIauF69IyfHaSYAKDELoLRLoKCqu9GGbm/d5HV4h0Qeb -TQLb3uQ+AEL9hPf5MLc2dj3T30jbUD9wnU+mak2cVilzbYw6Okuh8MP6KyTgkQos -/8pTDZsogirB0E6vx+UGen9Eo6DLljU6oCao8wvVe1AnXBUqLxX4gEOXgtXpf72g -dPY26NV66htB0l+wkIzbovg0+GF32lu0/M5+iU7QoVa0C/2FdKigASutzBtKTyKL -NYGnI+xYgXFW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BhYxUJDauSCuhrxxucp+pElroFAmYhFMcCGwwFCV38DwAACgkQ +xxucp+pElrorWAD/YapEqtCcOYiuXzPND+VmYGqQhuXfnAzfB4JVbzfpq48A/1ej +370TJlXXuICutb1UfCkPl0iFx8Ye3Y/2MQ3ECFEJ +=PrME -----END PGP PRIVATE KEY BLOCK----- diff --git a/spec/fixtures/public.asc b/spec/fixtures/public.asc index 8014820..8505156 100644 --- a/spec/fixtures/public.asc +++ b/spec/fixtures/public.asc @@ -1,31 +1,52 @@ -----BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.10 (GNU/Linux) -mQENBFKgjPQBCADxhlfBJIauF69IyfHaSYAKDELoLRLoKCqu9GGbm/d5HV4h0Qeb -TQLb3uQ+AEL9hPf5MLc2dj3T30jbUD9wnU+mak2cVilzbYw6Okuh8MP6KyTgkQos -/8pTDZsogirB0E6vx+UGen9Eo6DLljU6oCao8wvVe1AnXBUqLxX4gEOXgtXpf72g -dPY26NV66htB0l+wkIzbovg0+GF32lu0/M5+iU7QoVa0C/2FdKigASutzBtKTyKL -NYGnI+xYgXFWO+GiuQT0St2VmROPvU6di9k1NoaMh+5wK//fqXgf27+qMU5nmgnO -f/vK3gp72NThdobiK1QqDbNJdADzUFb+7molABEBAAG0SUNyeXB0IEtlZXBlciAo -cGFzc3dvcmQgaXMgc3VwZXJtYWRzZWNyZXRzdHJpbmcpIDxjcnlwdGtlZXBlckBl -eGFtcGxlLm9yZz6JATgEEwECACIFAlKgjPQCGwMGCwkIBwMCBhUIAgkKCwQWAgMB -Ah4BAheAAAoJECmzb1Ce/cj+kkEH/iQbhZgOUgDKn/eze0Ysy9ei4A3ygmwNZCdp -g8KApsi5QgmjIxvnSvmLhFfIA+BnxUa4uk9wdNzUCwTZDIqa/6WpWNHBvTYtEsu4 -7fAl0mtXjrsmtYF9xUHCPosHTb9uz3/HVdtlpwyLBF2N1RbZbLrDpzFIrxYnChNk -V5a7WMvb6ES3WvTu4oTC2FJ0V8oxK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6LiVq9zTFs6kFzUNZZp/KNR0/nEuYg0wSpsGyss2nOm +cHbi5WuyEDSSPzRYljvdBvsAtwv/fC1m/f6dO5T9rlJSELV0+/PRRklPyd1AxOaP +AAQNC/0bk9LKWkNughmZWoiiqRNYONdoiYHdcgEF1J0lsv++obO6Zvynqq07pm8s +C2YCA1bLnrdoIbfkW8wwBNIjcSPT+79DLnexVkc8WY8bGVxxmAECtKqf7NjT4MXa +p0rzEQvQ1qq/YKvI2TCjyHMvFmrPa2yUqgviooT7mx6BVKPL8B9cICvjK93HJy71 +cDZGoc99wgBNJbMg8SvwMqFGEUvtVjINVyYLRHC7JkaAKGY+55MuI9KbJ6eLLJgD +W0un+sAImd7739bKslOxD1Qvd1lLjtB1b5lvu21KRIOVLZk+LdU37yg9mxjUmobI +97Z57dR1s9mOhrVIwx8EKQ3qisQJB1Pfc8RKxo+0Obl6WSrHyXj6tUm4RBEYPsH3 +VNCb6Zb6LaSnLCz7S/Tbp4afZ2eYDuEwHeSlELDegJg1Z1QWMUbJyXBD8rsPO+01 +LxIqhVT/+V6pmp23Sy0ozbCugyDZVUM2IO9In41SX7fA1SmJXrklmHFclzOnMyVu +KZALmXmIfgQYEQgAJhYhBLrgYWMVCQ2rkgroa8cbnKfqRJa6BQJmIRTHAhsMBQld +/A8AAAoJEMcbnKfqRJa6K1gA/2GqRKrQnDmIrl8zzQ/lZmBqkIbl35wM3weCVW83 +6auPAP9Xo9+9EyZV17iArrW9VHwpD5dIhcfGHt2P9jENxAhRCQ== +=vtX2 -----END PGP PUBLIC KEY BLOCK----- From f69b6ed67e029df5f2809a72bb07303892268750 Mon Sep 17 00:00:00 2001 From: Konstantin Ilchenko Date: Thu, 18 Apr 2024 21:38:29 +0200 Subject: [PATCH 2/4] Upgrade to pass for Rails 7.1 --- .github/workflows/ruby.yml | 28 ++++++++++++++++++++-------- Appraisals | 15 ++++++--------- crypt_keeper.gemspec | 10 +++++----- gemfiles/activerecord_7_1.gemfile | 9 +++++++++ lib/crypt_keeper.rb | 4 ++++ lib/crypt_keeper/model.rb | 8 ++++++-- lib/crypt_keeper/version.rb | 2 +- spec/crypt_keeper/model_spec.rb | 11 +++++++++-- 8 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 gemfiles/activerecord_7_1.gemfile diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index a437088..4aba242 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -9,8 +9,8 @@ jobs: strategy: fail-fast: false matrix: - ruby-version: [ '2.7', '3.0', '3.1'] - rails: ['5_0', '5_1', '5_2', '6_0', '6_1', '7_0'] + ruby-version: [ '2.7', '3.0', '3.1', '3.2', '3.3'] + rails: ['5_0', '5_1', '5_2', '6_0', '6_1', '7_0', '7_1'] exclude: # exclude unsupported ruby versions: https://github.com/rails/rails/issues/40938 - ruby-version: '3.0' @@ -25,6 +25,18 @@ jobs: rails: '5_1' - ruby-version: '3.1' rails: '5_2' + - ruby-version: '3.2' + rails: '5_0' + - ruby-version: '3.2' + rails: '5_1' + - ruby-version: '3.2' + rails: '5_2' + - ruby-version: '3.3' + rails: '5_0' + - ruby-version: '3.3' + rails: '5_1' + - ruby-version: '3.3' + rails: '5_2' env: TESTING_RAILS_VERSION: ${{ matrix.rails }} @@ -41,7 +53,7 @@ jobs: --health-cmd pg_isready --health-interval 10s --health-timeout 5s - --health-retries 5 + --health-retries 5 ports: - 5432:5432 mysql: @@ -53,11 +65,11 @@ jobs: MYSQL_ROOT_PASSWORD: rootpassword ports: - 33306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: - uses: actions/checkout@v2 - + - name: Setup System run: sudo apt-get install libsqlite3-dev @@ -66,7 +78,7 @@ jobs: with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - + - name: Copy database config run: | cp spec/github_actions.database.yml spec/database.yml @@ -74,6 +86,6 @@ jobs: - name: Enable pgcrypto extension run: | PGPASSWORD=crypt_keeper psql crypt_keeper_providers -h localhost -p 5432 -U crypt_keeper -tc "CREATE EXTENSION IF NOT EXISTS pgcrypto;" - + - name: Run tests run: bundle exec rake diff --git a/Appraisals b/Appraisals index aff8851..7fd60ee 100644 --- a/Appraisals +++ b/Appraisals @@ -1,12 +1,3 @@ -appraise "activerecord_4_2" do - gem "activerecord", "~> 4.2.0" - gem "activesupport", "~> 4.2.0" - gem "sqlite3", "~> 1.3.0" - - # otherwise you get "undefined method `new' for BigDecimal:Class" in Ruby 2.7 - gem "bigdecimal", "1.3.5" -end - appraise "activerecord_5_0" do gem "activerecord", "~> 5.0.0" gem "activesupport", "~> 5.0.0" @@ -40,3 +31,9 @@ appraise "activerecord_7_0" do gem "activesupport", "~> 7.0.0" gem "pg", "~> 1.1" end + +appraise "activerecord_7_1" do + gem "activerecord", "~> 7.1.0" + gem "activesupport", "~> 7.1.0" + gem "pg", "~> 1.1" +end diff --git a/crypt_keeper.gemspec b/crypt_keeper.gemspec index c742ebd..3b288ce 100644 --- a/crypt_keeper.gemspec +++ b/crypt_keeper.gemspec @@ -18,8 +18,8 @@ Gem::Specification.new do |gem| gem.post_install_message = "WARNING: CryptKeeper 2.0 contains breaking changes and may require you to reencrypt your data! Please view the README at https://github.com/jmazzi/crypt_keeper for more information." - gem.add_runtime_dependency 'activerecord', '>= 4.2', '~> 7.0.0' - gem.add_runtime_dependency 'activesupport', '>= 4.2', '~> 7.0.0' + gem.add_runtime_dependency 'activerecord', '>= 5.0', '< 8' + gem.add_runtime_dependency 'activesupport', '>= 5.0', '< 8' gem.add_development_dependency 'rspec', '~> 3.5.0' gem.add_development_dependency 'guard', '~> 2.6.1' @@ -35,8 +35,8 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'activerecord-jdbcpostgresql-adapter' gem.add_development_dependency 'activerecord-jdbcmysql-adapter' else - gem.add_development_dependency 'sqlite3', '>= 1.3.3', '< 1.5' - gem.add_development_dependency 'pg', '~> 0.18.0' - gem.add_development_dependency 'mysql2', '>= 0.3.13', '< 0.6.0' + gem.add_development_dependency 'sqlite3', '>= 1.3' + gem.add_development_dependency 'pg', '>= 0.18.0' + gem.add_development_dependency 'mysql2', '>= 0.3.13' end end diff --git a/gemfiles/activerecord_7_1.gemfile b/gemfiles/activerecord_7_1.gemfile new file mode 100644 index 0000000..663bb1e --- /dev/null +++ b/gemfiles/activerecord_7_1.gemfile @@ -0,0 +1,9 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activerecord", "~> 7.1.0" +gem "activesupport", "~> 7.1.0" +gem "pg", "~> 1.1" + +gemspec :path => "../" diff --git a/lib/crypt_keeper.rb b/lib/crypt_keeper.rb index 5d4da35..71a0316 100644 --- a/lib/crypt_keeper.rb +++ b/lib/crypt_keeper.rb @@ -17,6 +17,10 @@ class << self attr_accessor :silence_logs alias_method :silence_logs?, :silence_logs + + def active_record_7_1? + ActiveRecord::VERSION::MAJOR >= 7 && ActiveRecord::VERSION::MINOR >= 1 + end end end diff --git a/lib/crypt_keeper/model.rb b/lib/crypt_keeper/model.rb index 7a18ed1..76dc58b 100644 --- a/lib/crypt_keeper/model.rb +++ b/lib/crypt_keeper/model.rb @@ -69,7 +69,11 @@ def crypt_keeper(*args) end crypt_keeper_fields.each do |field| - serialize field, encryptor + if CryptKeeper.active_record_7_1? + serialize field, coder: encryptor + else + serialize field, encryptor + end end end @@ -120,7 +124,7 @@ def decrypt_table! def encryptor_klass @encryptor_klass ||= "CryptKeeper::Provider::#{crypt_keeper_encryptor.to_s.camelize}".constantize rescue NameError - # couldn’t constantize... + # couldn’t constantize... nil end diff --git a/lib/crypt_keeper/version.rb b/lib/crypt_keeper/version.rb index 90fd711..868f030 100644 --- a/lib/crypt_keeper/version.rb +++ b/lib/crypt_keeper/version.rb @@ -1,3 +1,3 @@ module CryptKeeper - VERSION = "2.3.0" + VERSION = "2.4.0" end diff --git a/spec/crypt_keeper/model_spec.rb b/spec/crypt_keeper/model_spec.rb index a4b0da4..95901bd 100644 --- a/spec/crypt_keeper/model_spec.rb +++ b/spec/crypt_keeper/model_spec.rb @@ -54,7 +54,7 @@ end end - + context "Encryption and Decryption" do let(:plain_text) { 'plain_text' } let(:cipher_text) { 'tooltxet_nialp' } @@ -153,6 +153,13 @@ context "Initial Table Encryption" do subject { create_encrypted_model :storage, key: 'tool', salt: 'salt', encryptor: :active_support } + let(:error_class) do + if CryptKeeper.active_record_7_1? + ActiveSupport::MessageEncryptor::InvalidMessage + else + ActiveSupport::MessageVerifier::InvalidSignature + end + end before do subject.delete_all @@ -161,7 +168,7 @@ end it "encrypts the table" do - expect { subject.first(5).map(&:storage) }.to raise_error(ActiveSupport::MessageVerifier::InvalidSignature) + expect { subject.first(5).map(&:storage) }.to raise_error(error_class) subject.encrypt_table! expect { subject.first(5).map(&:storage) }.not_to raise_error end From f8db44e4b2ae06523a1191fdf236f2aa8afc4185 Mon Sep 17 00:00:00 2001 From: Konstantin Ilchenko Date: Thu, 18 Apr 2024 22:01:47 +0200 Subject: [PATCH 3/4] Restrict sqlite3 gem lower than 2 --- crypt_keeper.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypt_keeper.gemspec b/crypt_keeper.gemspec index 3b288ce..1ba43e8 100644 --- a/crypt_keeper.gemspec +++ b/crypt_keeper.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'activerecord-jdbcpostgresql-adapter' gem.add_development_dependency 'activerecord-jdbcmysql-adapter' else - gem.add_development_dependency 'sqlite3', '>= 1.3' + gem.add_development_dependency 'sqlite3', '>= 1.3', '< 2.0' gem.add_development_dependency 'pg', '>= 0.18.0' gem.add_development_dependency 'mysql2', '>= 0.3.13' end From e004f4697b79d6fa3c94709c6dee54d9059754a6 Mon Sep 17 00:00:00 2001 From: Konstantin Ilchenko Date: Sat, 8 Jun 2024 14:33:11 +0200 Subject: [PATCH 4/4] Downgrade upper bound rails to 7.2 --- crypt_keeper.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypt_keeper.gemspec b/crypt_keeper.gemspec index 1ba43e8..50797dc 100644 --- a/crypt_keeper.gemspec +++ b/crypt_keeper.gemspec @@ -18,8 +18,8 @@ Gem::Specification.new do |gem| gem.post_install_message = "WARNING: CryptKeeper 2.0 contains breaking changes and may require you to reencrypt your data! Please view the README at https://github.com/jmazzi/crypt_keeper for more information." - gem.add_runtime_dependency 'activerecord', '>= 5.0', '< 8' - gem.add_runtime_dependency 'activesupport', '>= 5.0', '< 8' + gem.add_runtime_dependency 'activerecord', '>= 5.0', '< 7.2' + gem.add_runtime_dependency 'activesupport', '>= 5.0', '< 7.2' gem.add_development_dependency 'rspec', '~> 3.5.0' gem.add_development_dependency 'guard', '~> 2.6.1'