Skip to content

Quarkus Update led to net.sf.saxon.trans.XPathException: URI scheme 'file' has been disallowed #9182

Description

@dcheng1248

Bug description

Hello,

we performed a quarkus update from 3.38.1 to 3.39.4 today and the camel quarkus xslt-saxon component threw the following error: net.sf.saxon.trans.XPathException: URI scheme 'file' has been disallowed.

This seems to be related to recent security features. We found the following workaround, by adding the transformer factory:

public class SaxonProducer {

  @Produces
  @Singleton
  @Unremovable
  @Named("saxonTf")
  public TransformerFactory saxonTransformerFactory() throws TransformerConfigurationException {
    TransformerFactoryImpl factory = new TransformerFactoryImpl();
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
    factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
    factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "file");
    return factory;
  }
}

We did not find anything in the xslt-saxon documentation that enables easier configuration. Would appreciate knowing if we missed an obvious solution or if this is bug.

Thank you for your work.

Activity

  1. jamesnetherton commented on Sep 17, 2026

    @jamesnetherton
    Contributor

    I think it comes from the Camel 4.22.0 upgrade in Camel Quarkus 3.39.0.

    Camel now restricts the Saxon transformer's access to external resources by default. It's covered in the Camel 4.22 upgrade guide:

    https://camel.apache.org/manual/camel-4x-upgrade-guide-4_22.html#_camel_xslt_saxon_secure_processing_now_applied_unconditionally

    So either use your custom TransformerFactory bean workaround. Or perhaps better, use TransformerFactoryConfigurationStrategy. That way Camel will still apply its own security config.

    TransformerFactoryConfigurationStrategy bean:

    @Produces
    @Singleton
    @Unremovable
    @Named("allowFileAccess")
    public TransformerFactoryConfigurationStrategy allowFileAccess() {
        return (factory, endpoint) -> factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "file");
    }

    Route endpoint:

    to("xslt-saxon:my.xsl?transformerFactoryConfigurationStrategy=#allowFileAccess")

    There is also a secureProcessing=false option but it does not lift all of the required restrictions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions