help: give every libxslt preference a value, not just one of them

A preference left unset keeps whatever libxslt defaults to, so name each
one instead of only XSLT_SECPREF_READ_FILE.

Reads over the network are allowed as well now, as a help page pulls in
another page through a vnd.sun.star.help URL and libxslt counts any
scheme other than file as a network read.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1ad16fe7244505ae6122a1a272597464612f099d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9935
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit d8923fe423af48cb02a60b01ec881aa12f6c14ca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210432
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Caolán McNamara
2026-09-14 12:56:39 +02:00
committed by Xisco Fauli
parent 5033a915c3
commit f8ed170f27
@@ -851,7 +851,15 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
xsltSecurityPrefsPtr securityPrefs = xsltNewSecurityPrefs();
if (securityPrefs)
{
// Refuse every option libxslt has, then allow back the reads the help pages
// need. One page pulls in another through a vnd.sun.star.help URL, and libxslt
// counts every scheme other than file as a network read.
for (auto eOption : { XSLT_SECPREF_READ_FILE, XSLT_SECPREF_WRITE_FILE,
XSLT_SECPREF_CREATE_DIRECTORY, XSLT_SECPREF_READ_NETWORK,
XSLT_SECPREF_WRITE_NETWORK })
xsltSetSecurityPrefs(securityPrefs, eOption, xsltSecurityForbid);
xsltSetSecurityPrefs(securityPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityAllow);
xsltSetSecurityPrefs(securityPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityAllow);
if (xsltSetCtxtSecurityPrefs(securityPrefs, transformContext) == 0)
{
res = xsltApplyStylesheetUser(cur, doc, parameter, nullptr, nullptr, transformContext);