Ensure pipelines.yaml is loaded safely (#13883) (#14091)

(cherry picked from commit 1f93672b73)

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2022-05-16 22:04:43 +01:00 committed by GitHub
parent 2c1771f89f
commit 1cd6341188
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,7 +93,7 @@ module LogStash module Config module Source
def read_pipelines_from_yaml(yaml_location) def read_pipelines_from_yaml(yaml_location)
logger.debug("Reading pipeline configurations from YAML", :location => pipelines_yaml_location) logger.debug("Reading pipeline configurations from YAML", :location => pipelines_yaml_location)
::YAML.load(IO.read(yaml_location)) ::YAML.safe_load(::File.read(yaml_location))
rescue => e rescue => e
raise ConfigurationError.new("Failed to read pipelines yaml file. Location: #{yaml_location}, Exception: #{e.inspect}") raise ConfigurationError.new("Failed to read pipelines yaml file. Location: #{yaml_location}, Exception: #{e.inspect}")
end end