|
|
6764ca |
diff --git a/src/org/apache/xalan/processor/TransformerFactoryImpl.java b/src/org/apache/xalan/processor/TransformerFactoryImpl.java
|
|
|
6764ca |
index 1298943..96a5e58 100644
|
|
|
6764ca |
--- a/src/org/apache/xalan/processor/TransformerFactoryImpl.java
|
|
|
6764ca |
+++ b/src/org/apache/xalan/processor/TransformerFactoryImpl.java
|
|
|
6764ca |
@@ -335,6 +335,10 @@ public class TransformerFactoryImpl extends SAXTransformerFactory
|
|
|
6764ca |
reader = XMLReaderFactory.createXMLReader();
|
|
|
6764ca |
}
|
|
|
6764ca |
|
|
|
6764ca |
+ if(m_isSecureProcessing)
|
|
|
6764ca |
+ {
|
|
|
6764ca |
+ reader.setFeature("http://xml.org/sax/features/external-general-entities",false);
|
|
|
6764ca |
+ }
|
|
|
6764ca |
// Need to set options!
|
|
|
6764ca |
reader.setContentHandler(handler);
|
|
|
6764ca |
reader.parse(isource);
|
|
|
6764ca |
diff --git a/src/org/apache/xalan/processor/XSLTElementProcessor.java b/src/org/apache/xalan/processor/XSLTElementProcessor.java
|
|
|
6764ca |
index b946743..17b7395 100644
|
|
|
6764ca |
--- a/src/org/apache/xalan/processor/XSLTElementProcessor.java
|
|
|
6764ca |
+++ b/src/org/apache/xalan/processor/XSLTElementProcessor.java
|
|
|
6764ca |
@@ -338,17 +338,31 @@ public class XSLTElementProcessor extends ElemTemplateElement
|
|
|
6764ca |
}
|
|
|
6764ca |
else
|
|
|
6764ca |
{
|
|
|
6764ca |
- // Can we switch the order here:
|
|
|
6764ca |
-
|
|
|
6764ca |
- boolean success = attrDef.setAttrValue(handler, attrUri, attrLocalName,
|
|
|
6764ca |
- attributes.getQName(i), attributes.getValue(i),
|
|
|
6764ca |
- target);
|
|
|
6764ca |
-
|
|
|
6764ca |
- // Now we only add the element if it passed a validation check
|
|
|
6764ca |
- if (success)
|
|
|
6764ca |
- processedDefs.add(attrDef);
|
|
|
6764ca |
- else
|
|
|
6764ca |
- errorDefs.add(attrDef);
|
|
|
6764ca |
+ //handle secure processing
|
|
|
6764ca |
+ if(handler.getStylesheetProcessor()==null)
|
|
|
6764ca |
+ System.out.println("stylesheet processor null");
|
|
|
6764ca |
+ if(attrDef.getName().compareTo("*")==0 && handler.getStylesheetProcessor().isSecureProcessing())
|
|
|
6764ca |
+ {
|
|
|
6764ca |
+ //foreign attributes are not allowed in secure processing mode
|
|
|
6764ca |
+ // Then barf, because this element does not allow this attribute.
|
|
|
6764ca |
+ handler.error(XSLTErrorResources.ER_ATTR_NOT_ALLOWED, new Object[]{attributes.getQName(i), rawName}, null);//"\""+attributes.getQName(i)+"\""
|
|
|
6764ca |
+ //+ " attribute is not allowed on the " + rawName
|
|
|
6764ca |
+ // + " element!", null);
|
|
|
6764ca |
+ }
|
|
|
6764ca |
+ else
|
|
|
6764ca |
+ {
|
|
|
6764ca |
+
|
|
|
6764ca |
+
|
|
|
6764ca |
+ boolean success = attrDef.setAttrValue(handler, attrUri, attrLocalName,
|
|
|
6764ca |
+ attributes.getQName(i), attributes.getValue(i),
|
|
|
6764ca |
+ target);
|
|
|
6764ca |
+
|
|
|
6764ca |
+ // Now we only add the element if it passed a validation check
|
|
|
6764ca |
+ if (success)
|
|
|
6764ca |
+ processedDefs.add(attrDef);
|
|
|
6764ca |
+ else
|
|
|
6764ca |
+ errorDefs.add(attrDef);
|
|
|
6764ca |
+ }
|
|
|
6764ca |
}
|
|
|
6764ca |
}
|
|
|
6764ca |
|
|
|
6764ca |
diff --git a/src/org/apache/xalan/transformer/TransformerImpl.java b/src/org/apache/xalan/transformer/TransformerImpl.java
|
|
|
6764ca |
index dd0d4d9..0906d24 100644
|
|
|
6764ca |
--- a/src/org/apache/xalan/transformer/TransformerImpl.java
|
|
|
6764ca |
+++ b/src/org/apache/xalan/transformer/TransformerImpl.java
|
|
|
6764ca |
@@ -438,7 +438,9 @@ public class TransformerImpl extends Transformer
|
|
|
6764ca |
try
|
|
|
6764ca |
{
|
|
|
6764ca |
if (sroot.getExtensions() != null)
|
|
|
6764ca |
- m_extensionsTable = new ExtensionsTable(sroot);
|
|
|
6764ca |
+ //only load extensions if secureProcessing is disabled
|
|
|
6764ca |
+ if(!sroot.isSecureProcessing())
|
|
|
6764ca |
+ m_extensionsTable = new ExtensionsTable(sroot);
|
|
|
6764ca |
}
|
|
|
6764ca |
catch (javax.xml.transform.TransformerException te)
|
|
|
6764ca |
{te.printStackTrace();}
|
|
|
6764ca |
diff --git a/src/org/apache/xpath/functions/FuncSystemProperty.java b/src/org/apache/xpath/functions/FuncSystemProperty.java
|
|
|
6764ca |
index 4bea356..78ac980 100644
|
|
|
6764ca |
--- a/src/org/apache/xpath/functions/FuncSystemProperty.java
|
|
|
6764ca |
+++ b/src/org/apache/xpath/functions/FuncSystemProperty.java
|
|
|
6764ca |
@@ -58,7 +58,7 @@ public class FuncSystemProperty extends FunctionOneArg
|
|
|
6764ca |
|
|
|
6764ca |
String fullName = m_arg0.execute(xctxt).str();
|
|
|
6764ca |
int indexOfNSSep = fullName.indexOf(':');
|
|
|
6764ca |
- String result;
|
|
|
6764ca |
+ String result = null;
|
|
|
6764ca |
String propName = "";
|
|
|
6764ca |
|
|
|
6764ca |
// List of properties where the name of the
|
|
|
6764ca |
@@ -98,14 +98,20 @@ public class FuncSystemProperty extends FunctionOneArg
|
|
|
6764ca |
|
|
|
6764ca |
try
|
|
|
6764ca |
{
|
|
|
6764ca |
- result = System.getProperty(propName);
|
|
|
6764ca |
-
|
|
|
6764ca |
- if (null == result)
|
|
|
6764ca |
- {
|
|
|
6764ca |
-
|
|
|
6764ca |
- // result = System.getenv(propName);
|
|
|
6764ca |
- return XString.EMPTYSTRING;
|
|
|
6764ca |
- }
|
|
|
6764ca |
+ //if secure procession is enabled only handle required properties do not not map any valid system property
|
|
|
6764ca |
+ if(!xctxt.isSecureProcessing())
|
|
|
6764ca |
+ {
|
|
|
6764ca |
+ result = System.getProperty(propName);
|
|
|
6764ca |
+ }
|
|
|
6764ca |
+ else
|
|
|
6764ca |
+ {
|
|
|
6764ca |
+ warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION,
|
|
|
6764ca |
+ new Object[]{ fullName }); //"SecurityException when trying to access XSL system property: "+fullName);
|
|
|
6764ca |
+ }
|
|
|
6764ca |
+ if (null == result)
|
|
|
6764ca |
+ {
|
|
|
6764ca |
+ return XString.EMPTYSTRING;
|
|
|
6764ca |
+ }
|
|
|
6764ca |
}
|
|
|
6764ca |
catch (SecurityException se)
|
|
|
6764ca |
{
|
|
|
6764ca |
@@ -120,14 +126,20 @@ public class FuncSystemProperty extends FunctionOneArg
|
|
|
6764ca |
{
|
|
|
6764ca |
try
|
|
|
6764ca |
{
|
|
|
6764ca |
- result = System.getProperty(fullName);
|
|
|
6764ca |
-
|
|
|
6764ca |
- if (null == result)
|
|
|
6764ca |
- {
|
|
|
6764ca |
-
|
|
|
6764ca |
- // result = System.getenv(fullName);
|
|
|
6764ca |
- return XString.EMPTYSTRING;
|
|
|
6764ca |
- }
|
|
|
6764ca |
+ //if secure procession is enabled only handle required properties do not not map any valid system property
|
|
|
6764ca |
+ if(!xctxt.isSecureProcessing())
|
|
|
6764ca |
+ {
|
|
|
6764ca |
+ result = System.getProperty(fullName);
|
|
|
6764ca |
+ }
|
|
|
6764ca |
+ else
|
|
|
6764ca |
+ {
|
|
|
6764ca |
+ warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION,
|
|
|
6764ca |
+ new Object[]{ fullName }); //"SecurityException when trying to access XSL system property: "+fullName);
|
|
|
6764ca |
+ }
|
|
|
6764ca |
+ if (null == result)
|
|
|
6764ca |
+ {
|
|
|
6764ca |
+ return XString.EMPTYSTRING;
|
|
|
6764ca |
+ }
|
|
|
6764ca |
}
|
|
|
6764ca |
catch (SecurityException se)
|
|
|
6764ca |
{
|