-
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
3 changed files
with
51 additions
and
10 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
24 changes: 24 additions & 0 deletions
24
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,24 @@ | ||
class MoveCtCommandIntoOwnSetting < ActiveRecord::Migration[6.1] | ||
def up | ||
['ct', 'fcct'].each do |setting_prefix| | ||
setting = Setting.where(name: "#{setting_prefix}_command") | ||
if setting | ||
setting.value = setting.value[1..] | ||
setting.name = "#{setting_prefix}_arguments" | ||
setting.save | ||
end | ||
end | ||
end | ||
|
||
def down | ||
['ct', 'fcct'].each do |setting_prefix| | ||
setting = Setting.where(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 | ||
|