Giter VIP home page Giter VIP logo

Comments (7)

Cakmakli-a avatar Cakmakli-a commented on May 27, 2024 1

@asc-schleupen
Hab das gleiche Problem. Nur kommt bei mir ein JBoss zum Einsatz und der liefert Xerces (xercesImpl-2.11.0) auch gleich mit.
Die SchemaFactory, die von Xerces implementiert wird mit org.apache.xerces.jaxp.validation.XMLSchemaFactory
läßt sicher allerdings nicht konfigurieren wie ich feststellen mußte.
Wie schon @apenski erwähnt hat, solte man eine eigene Resolving-Strategie entwickeln.
In dieser habe ich allerdings die com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory aus dem JDK
eingesetzt und festgestellt, dass es funktioniert.

from validator.

asc-schleupen avatar asc-schleupen commented on May 27, 2024 1

@Cakmakli-a
Vielen Dank für den Tipp. Es hat funktioniert. Die CustomStrategy habe ich von StrictLocalResolvingStrategy übernommen und die createSchemaFactory-Methode wie folgt überschrieben:

@Override
public SchemaFactory createSchemaFactory() {
		forceOpenJdkXmlImplementation();
		final SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI, "com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory", this.getClass().getClassLoader() );
		disableExternalEntities(sf);		
		allowExternalSchema(sf, "vfs");
		return sf;
	}

from validator.

apenski avatar apenski commented on May 27, 2024

Cannot cast object 'de.kosit.validationtool.config.ConfigurationLoader@475d59c0' with class 'de.kosit.validationtool.config.ConfigurationLoader' to class 'de.kosit.validationtool.api.Configuration'

da hat sich ein Fehler in der Doku eingeschlichen. Es muss heißen:

Configuration.load(scenarios.toURI()).build()

Hintergrund: man kann die geladene Konfiguration mit dem Builder noch etwas anpassen. Ich denke da müssen wir die API noch etwas selbsterklärender gestalten.

Can not disable external DTD access. Maybe an unsupported JAXP implementation is used.

der Validator setzt bzgl. Security auf die XML-Implementierung vom OpenJDK. Wenn diese nicht verwendet wird (nicht OpenJDK oder XercesJ im Classpath o.ä.) kann die XML-Sicherheit nicht gewährleistet werden. Um die Sicherheit nicht gefährden, hab wir da auch keinen Ignore-Switch o.ä.

Möchte man das trotzdem machen, muss man eine eigene Resolving-Strategie entwickeln (also die XML-Factories in konfigurierter Form bereitstellen). Siehe Security Dokumentation

from validator.

Moetez16 avatar Moetez16 commented on May 27, 2024

Danke fuer die Informationen.

Welche OpenJDK Distributions und Version sollte man am besten nutzen bzw. was nutzt Ihr eigentlich?

from validator.

apenski avatar apenski commented on May 27, 2024

also eigentlich alles was als als OpenJDK-Distribution durchgeht, sollte gehen. Wir testen aktiv die in der CI-Definition aufgeführten

from validator.

asc-schleupen avatar asc-schleupen commented on May 27, 2024

Hallo,

wir sind auf den gleichen Fehler gelaufen

URL scenarios = this.getClass().getClassLoader().getResource("/resources/scenarios.xml");
   Configuration config = Configuration.load(scenarios.toURI()).build();

Das Laden der Konfiguration führt zu folgender Exception

2020-12-18 08:50:13,514 ERROR [de.schleupen.cs.ap.bi.birtreportingservice.businesscases.XRechnungValidationControllerImpl] (default task-1) Fehler beim Erstellen des Prüfberichts: java.lang.IllegalStateException: Can not disable external DTD access. Maybe an unsupported JAXP implementation is used.
	at deployment.BirtReportingService.war//de.kosit.validationtool.impl.xml.BaseResolvingStrategy.setProperty(BaseResolvingStrategy.java:85)
	at deployment.BirtReportingService.war//de.kosit.validationtool.impl.xml.BaseResolvingStrategy.disableExternalEntities(BaseResolvingStrategy.java:127)
	at deployment.BirtReportingService.war//de.kosit.validationtool.impl.xml.BaseResolvingStrategy.disableExternalEntities(BaseResolvingStrategy.java:115)
	at deployment.BirtReportingService.war//de.kosit.validationtool.impl.xml.StrictRelativeResolvingStrategy.createSchemaFactory(StrictRelativeResolvingStrategy.java:91)
	at deployment.BirtReportingService.war//de.kosit.validationtool.impl.ContentRepository.<init>(ContentRepository.java:99)
	at deployment.BirtReportingService.war//de.kosit.validationtool.config.ConfigurationLoader.build(ConfigurationLoader.java:137)
	
[xercesImpl-2.12.0.SP02.zip](https://github.com/itplr-kosit/validator/files/5714541/xercesImpl-2.12.0.SP02.zip)


es wird folgendes JDK verwendet

java --version
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)

Die Xerces Implementierung kommt durch den Wildfly-Server Version (>= 18.0.1) : xercesImpl-2.12.0.SP02.jar

Die Prüfung des JDKs in BaseResolvingStrategy.isOpenJdkXmlImplementationAvailable ist erfolgreich. Welche Optionen haben wir die Prüfung zum Laufen zu bringen?

from validator.

Moetez16 avatar Moetez16 commented on May 27, 2024

OpenJDK bei mir:

adopt-openj9-1.8.0_265

from validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.