Skip to content

Fix Invalid signature on message decryption#7488

Merged
mrcasals merged 2 commits intodecidim:developfrom
mainio:fix/7487
Mar 2, 2021
Merged

Fix Invalid signature on message decryption#7488
mrcasals merged 2 commits intodecidim:developfrom
mainio:fix/7487

Conversation

@ahukkanen
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen commented Mar 1, 2021

🎩 What? Why?

Fixes invalid signature issues with decrypting non-encrypted data on installations that have been generated prior to Rails 5.2.

For pre-Rails 5.2 installations or installations that get their configuration defaults from Rails 5.1, the message decryption can fail due to ActiveSupport::MessageVerifier::InvalidSignature.

This happens in case you have the following configuration option in one of your initializers (or environment configuration):

Rails.application.config.active_support.use_authenticated_message_encryption = false

Alternatively, it can also happen if you have the following in your instance's config/application.rb because this was the default configuration for pre-Rails 5.2:

module DecidimAwesomeTown
  class Application < Rails::Application
    # ...
    config.load_defaults 5.1
    # ...
  end
end

📌 Related Issues

Testing

  • Create a 0.23 installation
  • Make sure you use the explained configurations (e.g. config.load_defaults 5.1 in config/application.rb)
  • Create the database, run the migrations for 0.23 and create the seed data
  • Run the following query in the console: Decidim::Authorization.create!(user: Decidim::User.first, name: "postal_code", metadata: {}, verification_metadata: { address: "Awesome street 1", verification_code: "12345", letter_sent_at: Time.current })
  • Upgrade the instance to 0.24.0.rc1
  • Run the migrations
  • See the error in the console.

📋 Checklist

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

Fixes invalid signature issues with decrypting non-encrypted
data on installations that have been generated prior to Rails
5.2.

For pre-Rails 5.2 installations or installations that get their
configuration defaults from Rails 5.1, the message decryption
can fail due to ActiveSupport::MessageVerifier::InvalidSignature.
@mrcasals mrcasals added module: core type: fix PRs that implement a fix for a bug labels Mar 2, 2021
@mrcasals mrcasals merged commit be9f33e into decidim:develop Mar 2, 2021
@mrcasals mrcasals changed the title Fix #7487 - Invalid signature on message decryption Fix Invalid signature on message decryption Mar 2, 2021
@mrcasals
Copy link
Copy Markdown
Contributor

mrcasals commented Mar 2, 2021

Yay thank you so much, @ahukkanen !

@ahukkanen ahukkanen deleted the fix/7487 branch March 2, 2021 08:19
entantoencuanto added a commit that referenced this pull request Mar 2, 2021
* develop: (25 commits)
  Add css selectors to emails to improve design customization (#7493)
  Only share tokens if component exists (#7499)
  Fix record encryptor hash values JSON parsing for legacy unencrypted hash values (#7494)
  Fix NULL error with weight field in assemblies & processes (#7486)
  Fix proposals to budget import (#7449)
  Fix cost display on proposals (#7450)
  Fix #7487 - Invalid signature on message decryption (#7488)
  New Crowdin updates (#7482)
  Move specs file to correct folder (#7476)
  Improve changelog generator (#7475)
  New Crowdin updates (#7472)
  Prepare 0.25-dev version (#7473)
  New Crowdin updates (#7470)
  New Crowdin updates (#7468)
  Feature proposal infinite edit time (#7406)
  New Crowdin updates (#7457)
  Trigger docs build on folder changes (#7360)
  Add changelog generator based on PR data (#7461)
  Add Votings to Open Data export (#7388)
  Add order in not highlighted assemblies by weight (#7444)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't migrate the DB after #6947

2 participants