Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade defaults ror 7.1 #7292

Merged
merged 8 commits into from
Nov 25, 2024
Merged

Upgrade defaults ror 7.1 #7292

merged 8 commits into from
Nov 25, 2024

Conversation

ddippolito
Copy link
Contributor

Copy link

github-actions bot commented Nov 18, 2024

Review app https://teaching-vacancies-review-pr-7292.test.teacherservices.cloud was successfully deleted

@ddippolito ddippolito force-pushed the upgrade-defaults-ror-7.1 branch 2 times, most recently from 119ea3a to f606bb6 Compare November 18, 2024 17:33
@@ -28,6 +28,8 @@ module TeachingVacancies
class Application < Rails::Application
config.load_defaults 7.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not be 7.1 now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

data = encryptor.decrypt_and_verify(token)
find(data[:id])
data = begin
encryptor(serializer: :json_allow_marshal).decrypt_and_verify(token)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this change? It looks this would get even more complicated with Rails 7.2. Are there any down-sides to just using the default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows previous subscriptions encrypted with marshal to be decrypted as we migrate towards json in the next Rails release.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think a comment (as per your slack message) would be useful here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the decrypt to be json_allow_marhsall to allow previously encrypted subscriptions (with the old marshal serialiser) to be read. If we want to keep json only, we might have to write a data migration to re-encrypt the subscription.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant in the code...

rescue ActiveSupport::MessageEncryptor::InvalidMessage
raise ActiveRecord::RecordNotFound
end

def token
token_values = { id: id }
self.class.encryptor.encrypt_and_sign(token_values)
self.class.encryptor(serializer: :json_allow_marshal).encrypt_and_sign(token_values)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having defaulted the encryptor to :json_allow_marshal, we don't need to make this change IMHO

@ddippolito ddippolito merged commit 02afcc6 into main Nov 25, 2024
13 checks passed
@ddippolito ddippolito deleted the upgrade-defaults-ror-7.1 branch November 25, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants