From 71cd46f8c46adbb86bb837c154afa982e9ec2a29 Mon Sep 17 00:00:00 2001 From: Andreas Eriksen Date: Sat, 6 Aug 2022 01:46:36 +0200 Subject: validate _all_ xml files only in public --- .../config/server/session/SessionPreparer.java | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'configserver') diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java index a90c3b958d7..63ba8197960 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java @@ -279,19 +279,21 @@ public class SessionPreparer { vespaPreprocess(applicationPackageDir.getAbsoluteFile(), hostsXml, applicationPackage.getMetaData()); } - // Validate all other XML files - try (var paths = Files.find(applicationPackageDir.getAbsoluteFile().toPath(), Integer.MAX_VALUE, - (path, attr) -> attr.isRegularFile() && path.getFileName().toString().matches(".*\\.[Xx][Mm][Ll]"))) { - paths.filter(p -> !(p.equals(servicesXml.getAbsoluteFile().toPath()) || p.equals(hostsXml.getAbsoluteFile().toPath()))) - .forEach(xmlPath -> { - try { - new ValidationProcessor().process(XML.getDocument(xmlPath.toFile())); - } catch (IOException | TransformerException e) { - throw new RuntimeException(e); - } - }); - } catch (IOException e) { - throw new RuntimeException(e); + if (zone.system().isPublic()) { + // Validate all other XML files + try (var paths = Files.find(applicationPackageDir.getAbsoluteFile().toPath(), Integer.MAX_VALUE, + (path, attr) -> attr.isRegularFile() && path.getFileName().toString().matches(".*\\.[Xx][Mm][Ll]"))) { + paths.filter(p -> !(p.equals(servicesXml.getAbsoluteFile().toPath()) || p.equals(hostsXml.getAbsoluteFile().toPath()))) + .forEach(xmlPath -> { + try { + new ValidationProcessor().process(XML.getDocument(xmlPath.toFile())); + } catch (IOException | TransformerException e) { + throw new RuntimeException(e); + } + }); + } catch (IOException e) { + throw new RuntimeException(e); + } } // Validate pom.xml files in OSGi bundles -- cgit v1.2.3