[java-shib-shared] branch main updated: IDP-2050 - Support auto-throwing EntityResolver in default ParserPool

Scott Cantor cantor.2 at osu.edu
Thu Dec 8 19:17:44 UTC 2022


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=ac8c4d34c3fac9cc585466bb4a51bc334cff9976

The following commit(s) were added to refs/heads/main by this push:
     new ac8c4d34 IDP-2050 - Support auto-throwing EntityResolver in default ParserPool
ac8c4d34 is described below

commit ac8c4d34c3fac9cc585466bb4a51bc334cff9976
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Dec 8 14:17:42 2022 -0500

    IDP-2050 - Support auto-throwing EntityResolver in default ParserPool
    
    https://shibboleth.atlassian.net/browse/IDP-2050
    
    Add a dummy EntityResolver to install.
---
 .../shared/xml/impl/ThrowingEntityResolver.java    | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/ThrowingEntityResolver.java b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/ThrowingEntityResolver.java
new file mode 100644
index 00000000..bf105025
--- /dev/null
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/ThrowingEntityResolver.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID 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 net.shibboleth.shared.xml.impl;
+
+import java.io.IOException;
+
+import javax.annotation.Nullable;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * An implementation of {@link EntityResolver} that always throws an exception.
+ */
+public class ThrowingEntityResolver implements EntityResolver {
+
+    /** {@inheritDoc} */
+    @Nullable public InputSource resolveEntity(@Nullable final String publicId, @Nullable final String systemId)
+            throws SAXException, IOException {
+        throw new IOException("Blocked access to external entity: " + (systemId != null ? systemId : "(null)"));
+    }
+
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list