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

Fixes #35432 - Use Rails 6.1 defaults #9748

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

ofedoren
Copy link
Member

No description provided.

@theforeman-bot
Copy link
Member

Issues: #35432

@ofedoren ofedoren marked this pull request as draft June 26, 2023 15:58
# disabled in FIPS mode

require 'digest/sha1'
ActiveSupport::Digest.hash_digest_class = ::Digest::SHA1
Copy link
Member

Choose a reason for hiding this comment

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

Ah, good catch. I didn't notice this one myself.

# Rails 5.0 changed this to true, but a lot of code depends on this
config.active_record.belongs_to_required_by_default = false

# Rails 5.2 changed this to true, but we already do this in app/controllers/application_controller.rb#7
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to remove it from there and rely on the defaults?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added a comment there. I think it's better to leave as it is, so we have fewer changes until we actually decide to do them. Basically, this setting will add protect_from_forgery to ActionController::Base, which we use for ApplicationController, Api::BaseContoller and Api::GraphqlController. The Rails' default is the same what we have for ApplicationController, but we change the behaviour a bit for API related controllers.

config/application.rb Outdated Show resolved Hide resolved
@ofedoren ofedoren force-pushed the feat-35432-load-rails-defaults branch 3 times, most recently from a05d7d6 to 7a359de Compare June 29, 2023 15:49
# changing default cipher from aes-256-cbc to aes-256-gcm.
# Leaving this disabled, since the application worked with aes-256-cbc.
# Failed tests on aes-256-gcm require revisit application to ensure we can do the switch.
config.active_support.use_authenticated_message_encryption = false
Copy link
Member Author

Choose a reason for hiding this comment

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

There is also use_authenticated_cookie_encryption setting, which it seems should be safer to enable (default), but I'm not quite sure, since we don't have a test for that.

WDYT, @ekohl ? Encryption is not my strongest part :/

Copy link
Member

Choose a reason for hiding this comment

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

It's not a regression compared to today so we don't have to fix it right now. We should still fix it since cbc ciphers are considered weak nowadays so I'd be fine with opening a separate ticket for that.

@ofedoren ofedoren marked this pull request as ready for review June 29, 2023 16:32
@ofedoren ofedoren requested a review from a team as a code owner June 29, 2023 16:32
@ofedoren ofedoren marked this pull request as draft June 29, 2023 16:33
@ofedoren
Copy link
Member Author

Sorry for the noise, was going to undraft since the tests are green, but forgot that this PR contains a CPed commit just to fix the unrelated failures :/

@ekohl
Copy link
Member

ekohl commented Jun 29, 2023

I saw fog-vsphere 3.6.2 was released so perhaps you can just rebase and leave out the commit. Since I've seen it's green, I can also merge it with failing tests.

@ofedoren ofedoren force-pushed the feat-35432-load-rails-defaults branch from 7a359de to cc6257e Compare June 30, 2023 14:45
@ofedoren ofedoren marked this pull request as ready for review June 30, 2023 14:46
config.active_record.belongs_to_required_by_default = false

# Rails 5.1 changed this to false, re-enabling this due to https://github.com/theforeman/foreman/pull/9711/files#r1247901552
config.assets.unknown_asset_fallback = true
Copy link
Member Author

Choose a reason for hiding this comment

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

@ofedoren
Copy link
Member Author

ofedoren commented Jun 30, 2023

unknown_asset_fallback can be removed, so we see that exception until we fix it, but not sure :/

Otherwise it seems like we can finally use at least some defaults. I couldn't check all the parts, but hammer seems to be working, hosts can be provisioned, the tests are green 🤷

@ekohl ekohl merged commit f034a4f into theforeman:develop Jun 30, 2023
7 checks passed
@ekohl
Copy link
Member

ekohl commented Jun 30, 2023

Thanks for moving this forward! Even if we didn't use all the defaults, this is a great step forward.

@ekohl ekohl mentioned this pull request Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants