Prevent XML parser from loading external entities

This commit is contained in:
Chizu 2023-08-05 12:18:29 +00:00
parent d6ac4aff42
commit f56267280e

View file

@ -29,7 +29,10 @@ defmodule Pleroma.Web.XML do
{doc, _rest} =
text
|> :binary.bin_to_list()
|> :xmerl_scan.string(quiet: true)
|> :xmerl_scan.string(
quiet: true,
fetch_fun: fn _, _ -> raise "Resolving external entities not supported" end
)
{:ok, doc}
rescue