[英]Rails 5.2 with master.key Digital Ocean deployment: ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
[英]Rails Master Key on GitHub Actions causes ActiveSupport::MessageEncryptor::InvalidMessage
任何人都有在 GH Actions 中使用RAILS_MASTER_KEY
的经验? 最近从 6 切换到 Rails 7。使用 credentials.yml.enc 存储 ActiveRecord 加密内容。 已在本地设置RAILS_MASTER_KEY
并且工作正常。 已经确认我可以很好地编码/解码东西。 但是,当推送到 GH 并使用我们的 CI(运行测试等)时,我遇到了这个错误:
ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
Caused by:
OpenSSL::Cipher::CipherError:
我已将 ENV 添加到 GH Action 但仍然没有骰子:
RAILS_MASTER_KEY=${{ secrets.RAILS_MASTER_KEY }}
然后我也在回购中设置了秘密,似乎它没有正确读取它?
我为此找到的修复方法是将以下内容添加到config/environments
中的test.rb
config.active_record.encryption.primary_key = "test"
config.active_record.encryption.deterministic_key = "test"
config.active_record.encryption.key_derivation_salt = "test"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.