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 #36759 - only call allowed transpilers #9836

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented Sep 20, 2023

CVE-2022-3874: OS command injection via ct_command and fcct_command

Instead of allowing to call any command by changing a setting, only allow specific paths to ct/fcct. If the user needs a different path, they can set it via settings.yaml.

['ct', 'fcct'].each do |setting_prefix|
setting = Setting.where(name: "#{setting_prefix}_command")
if setting
setting.value = setting.value.drop(1)
Copy link
Member Author

Choose a reason for hiding this comment

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

this throws away the currently configured path and I did not add code to set up (fc)ct_location as I think an upgrade warning is sufficient.

@evgeni evgeni force-pushed the i36759 branch 5 times, most recently from 362e8b2 to 194f979 Compare September 20, 2023 09:17
@evgeni
Copy link
Member Author

evgeni commented Sep 20, 2023

[test katello]

@ehelms
Copy link
Member

ehelms commented Sep 20, 2023

If the user needs a different path, they can set it via settings.yaml.

Will we need to add a set of installer parameters for this?

@evgeni
Copy link
Member Author

evgeni commented Sep 20, 2023

We did for sendmail (theforeman/puppet-foreman@6c902a4), so I guess yeah?

ehelms
ehelms previously approved these changes Sep 21, 2023
Copy link
Member

@ehelms ehelms left a comment

Choose a reason for hiding this comment

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

👍 Not my area of expertise, but in general looks good.

@ekohl want to take a look?

@evgeni
Copy link
Member Author

evgeni commented Sep 22, 2023

hmmm, so the code reads correctly, and works inside the console, but the migration doesn't migrate shit

@evgeni
Copy link
Member Author

evgeni commented Sep 22, 2023

Validation failed: Name is not allowed to change

Aha!

CVE-2022-3874: OS command injection via ct_command and fcct_command

Instead of allowing to call *any* command by changing a setting, only
allow specific paths to ct/fcct. If the user needs a different path,
they can set it via settings.yaml.
@evgeni
Copy link
Member Author

evgeni commented Sep 22, 2023

I hate migrations…

@evgeni evgeni marked this pull request as ready for review September 22, 2023 12:32
@evgeni
Copy link
Member Author

evgeni commented Sep 22, 2023

[test katello]

@evgeni evgeni requested review from ehelms and ekohl September 25, 2023 14:34
@evgeni
Copy link
Member Author

evgeni commented Sep 26, 2023

release notes: theforeman/theforeman.org#2101

@G-Rath
Copy link

G-Rath commented Sep 27, 2023

Just a heads up that this is now being picked up by dependabot as GHSA-9jfq-54vc-9rr2 - if someone can confirm what version this fix is expected to land in, I can prepare a PR to update the advisory with the fixed version :)

Actually digging further, I think the GHSA might be wrong - someone has mixed up forman the gem with foreman the .. app (whatever the not-cli is called 😅)

I've opened github/advisory-database#2761 requesting the advisory be withdrawn.

@evgeni
Copy link
Member Author

evgeni commented Sep 28, 2023

@G-Rath thanks. the advisory was withdrawn now.

@evgeni evgeni merged commit d430f3f into theforeman:develop Sep 28, 2023
6 checks passed
@evgeni evgeni deleted the i36759 branch September 28, 2023 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants