This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jaxp-configurator.git
commit f74717d91509b5dc0c458d4ce369d6295d10f067 Author: Robert Munteanu <[email protected]> AuthorDate: Fri Jan 23 13:31:02 2026 +0100 Initial version of the JAXP configurator bundle --- pom.xml | 106 +++++++++++++++++++++ .../apache/sling/jaxpconfig/impl/Activator.java | 49 ++++++++++ 2 files changed, 155 insertions(+) diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..96c15b1 --- /dev/null +++ b/pom.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.sling</groupId> + <artifactId>sling-bundle-parent</artifactId> + <version>65</version> + <relativePath /> + </parent> + + <artifactId>org.apache.sling.jaxp-configurator</artifactId> + <version>0.1.0-SNAPSHOT</version> + + <name>Apache Sling JAXP Configurator</name> + + <properties> + <sling.java.version>11</sling.java.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.framework</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.resource</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.bundle</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.versioning</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.component.annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.component</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.metatype.annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.servlets.annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.jetbrains</groupId> + <artifactId>annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.api</artifactId> + <version>3.0.2</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- Configure bnd-baseline to skip when no previous version exists. Remove after first release --> + <plugin> + <groupId>biz.aQute.bnd</groupId> + <artifactId>bnd-baseline-maven-plugin</artifactId> + <configuration> + <failOnMissing>false</failOnMissing> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/src/main/java/org/apache/sling/jaxpconfig/impl/Activator.java b/src/main/java/org/apache/sling/jaxpconfig/impl/Activator.java new file mode 100644 index 0000000..7825aeb --- /dev/null +++ b/src/main/java/org/apache/sling/jaxpconfig/impl/Activator.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.jaxpconfig.impl; + +import java.util.Map; + +import org.osgi.annotation.bundle.Header; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * Ensures that secure processing system properties are set when the bundle is started. + */ +@Header(name = "Bundle-Activator", value = "${@class}") +public class Activator implements BundleActivator { + + private static final Map<String, String> PROPERTIES = Map.of( + "javax.xml.accessExternalDTD", "", + "javax.xml.accessExternalSchema", "", + "javax.xml.accessExternalStylesheet", ""); + + @Override + public void start(final BundleContext context) { + // not logging to make sure that no dependencies are requires, as this bundle should + // start as early as possible, before any XML processing takes place + PROPERTIES.forEach(System::setProperty); + } + + @Override + public void stop(final BundleContext context) { + // intentionally not unsetting the property + } +}
