Class PolicyConfiguredCleaner
- java.lang.Object
-
- com.atlassian.confluence.content.render.xhtml.PolicyConfiguredCleaner
-
- All Implemented Interfaces:
RenderedContentCleaner,StorageFormatCleaner,XhtmlCleaner
public class PolicyConfiguredCleaner extends Object implements StorageFormatCleaner, RenderedContentCleaner, XhtmlCleaner
A thread safe xhtml/html/xml Cleaner which is configured via a policy file classpath resource.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.confluence.content.render.xhtml.StorageFormatCleaner
StorageFormatCleaner.AppliedRuleDescription, StorageFormatCleaner.Result
-
Nested classes/interfaces inherited from interface com.atlassian.confluence.content.render.xhtml.XhtmlCleaner
XhtmlCleaner.AppliedRuleDescription, XhtmlCleaner.Result
-
-
Constructor Summary
Constructors Constructor Description PolicyConfiguredCleaner(String policyResource)Deprecated, for removal: This API element is subject to removal in a future version.since 8.6 usecreateRenderedContentCleaner()orcreateStorageFormatCleaner()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description XhtmlCleaner.Resultclean(ContentEntityObject uncleanCeo)Clean the supplied body content markup and make it safe from security concerns.StorageFormatCleaner.ResultcleanEntity(ContentEntityObject uncleanCeo)Clean the supplied body content markup and make it safe from security concerns.StringcleanQuietly(ContentEntityObject uncleanCeo)Clean the specified body content markup and make it safe from security concerns with out reporting any clean up performedStringcleanQuietly(String unclean)Clean the specified String.StringcleanQuietly(String unclean, ConversionContext context)Clean the specified String.StringcleanStyleAttribute(String uncleanStyle)Convert the supplied value of an HTML style attribute into a safe form if necessary.static RenderedContentCleanercreateRenderedContentCleaner()static PolicyConfiguredCleanercreateStorageFormatCleaner()booleanisCleanUrlAttribute(String urlValue)Test that the supplied value of a URL type attribute (such as href) is safe for output.
-
-
-
Constructor Detail
-
PolicyConfiguredCleaner
@Deprecated(forRemoval=true) public PolicyConfiguredCleaner(String policyResource)
Deprecated, for removal: This API element is subject to removal in a future version.since 8.6 usecreateRenderedContentCleaner()orcreateStorageFormatCleaner()Constructor that will lazily load the Transformer as it is required.- Parameters:
policyResource- the resource file holding the security policy.
-
-
Method Detail
-
createRenderedContentCleaner
public static RenderedContentCleaner createRenderedContentCleaner() throws org.owasp.validator.html.PolicyException, IOException
- Throws:
org.owasp.validator.html.PolicyExceptionIOException- Since:
- 8.6
-
createStorageFormatCleaner
public static PolicyConfiguredCleaner createStorageFormatCleaner() throws org.owasp.validator.html.PolicyException, IOException
- Throws:
org.owasp.validator.html.PolicyExceptionIOException- Since:
- 8.6
-
clean
public XhtmlCleaner.Result clean(ContentEntityObject uncleanCeo)
Description copied from interface:XhtmlCleanerClean the supplied body content markup and make it safe from security concerns.- Specified by:
cleanin interfaceXhtmlCleaner- Parameters:
uncleanCeo- a CEO containing the body content to be processed. The CEO is not modified, but the cleaned body content is returned.- Returns:
- a result encapsulating the cleaned version of the supplied body content XHTML as well as a description of rules applied.
-
cleanEntity
public StorageFormatCleaner.Result cleanEntity(ContentEntityObject uncleanCeo)
Description copied from interface:StorageFormatCleanerClean the supplied body content markup and make it safe from security concerns.- Specified by:
cleanEntityin interfaceStorageFormatCleaner- Parameters:
uncleanCeo- a CEO containing the body content to be processed. The CEO is not modified, but the cleaned body content is returned.- Returns:
- a result encapsulating the cleaned version of the supplied body content XHTML as well as a description of rules applied.
-
cleanQuietly
public String cleanQuietly(ContentEntityObject uncleanCeo)
Description copied from interface:StorageFormatCleanerClean the specified body content markup and make it safe from security concerns with out reporting any clean up performed- Specified by:
cleanQuietlyin interfaceStorageFormatCleaner- Specified by:
cleanQuietlyin interfaceXhtmlCleaner- Parameters:
uncleanCeo- a CEO containing the body content to be processed. The CEO is not modified, but the cleaned body content is returned.- Returns:
- a cleaned up version of the supplied body content
-
cleanQuietly
public String cleanQuietly(String unclean, ConversionContext context)
Description copied from interface:StorageFormatCleanerClean the specified String.- Specified by:
cleanQuietlyin interfaceStorageFormatCleaner- Specified by:
cleanQuietlyin interfaceXhtmlCleaner- Parameters:
unclean- the String to be cleanedcontext- The ConversionContext that applies to the provided content.- Returns:
- a cleaned version of the supplied String
-
cleanQuietly
public String cleanQuietly(String unclean)
Description copied from interface:StorageFormatCleanerClean the specified String.- Specified by:
cleanQuietlyin interfaceRenderedContentCleaner- Specified by:
cleanQuietlyin interfaceStorageFormatCleaner- Specified by:
cleanQuietlyin interfaceXhtmlCleaner- Parameters:
unclean- the String to be cleaned- Returns:
- a cleaned version of the supplied String
-
cleanStyleAttribute
public String cleanStyleAttribute(String uncleanStyle)
Description copied from interface:StorageFormatCleanerConvert the supplied value of an HTML style attribute into a safe form if necessary. If the result of the safety checking results in no properties remaining then it is possible that an empty String will be returned.- Specified by:
cleanStyleAttributein interfaceRenderedContentCleaner- Specified by:
cleanStyleAttributein interfaceStorageFormatCleaner- Specified by:
cleanStyleAttributein interfaceXhtmlCleaner- Parameters:
uncleanStyle- the style attribute value to be cleaned- Returns:
- a cleaned version of the supplied style attribute value..
-
isCleanUrlAttribute
public boolean isCleanUrlAttribute(String urlValue)
Description copied from interface:StorageFormatCleanerTest that the supplied value of a URL type attribute (such as href) is safe for output.- Specified by:
isCleanUrlAttributein interfaceRenderedContentCleaner- Specified by:
isCleanUrlAttributein interfaceStorageFormatCleaner- Specified by:
isCleanUrlAttributein interfaceXhtmlCleaner- Returns:
- true if this attribute value can be output, otherwise false.
-
-