Prevent XML parser from loading external entities

This commit is contained in:
Mae 2023-08-04 22:24:17 +01:00 committed by Haelwenn (lanodan) Monnier
parent ff2f3862ab
commit fc10e07ffb

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