mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:44:40 +08:00
SECURITY: Improve theme git import (#12694)
This commit is contained in:
@ -54,6 +54,14 @@ module Discourse
|
||||
checkout_version = target
|
||||
end
|
||||
|
||||
return if checkout_version.nil?
|
||||
|
||||
begin
|
||||
Discourse::Utils.execute_command "git", "check-ref-format", "--allow-onelevel", checkout_version
|
||||
rescue RuntimeError
|
||||
raise InvalidVersionListError, "Invalid ref name: #{checkout_version}"
|
||||
end
|
||||
|
||||
checkout_version
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user