-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #36759 - only call allowed transpilers
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.
- Loading branch information
Showing
5 changed files
with
56 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
db/migrate/20230920093000_move_ct_command_into_own_setting.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class MoveCtCommandIntoOwnSetting < ActiveRecord::Migration[6.1] | ||
def up | ||
['ct', 'fcct'].each do |setting_prefix| | ||
setting = Setting.find_by(name: "#{setting_prefix}_command") | ||
if setting | ||
setting.value = setting.value.drop(1) | ||
setting.name = "#{setting_prefix}_arguments" | ||
setting.save | ||
end | ||
end | ||
end | ||
|
||
def down | ||
['ct', 'fcct'].each do |setting_prefix| | ||
setting = Setting.find_by(name: "#{setting_prefix}_arguments") | ||
if setting | ||
setting.value = ["/usr/bin/#{setting_prefix}"] + setting.value | ||
setting.name = "#{setting_prefix}_command" | ||
setting.save | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters