|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packagecom.itextpdf.styledxmlparser.jsoup.safetyas colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a tag will cause all subsequent paragraphs to be displayed differently.
TheClass Cleaner, constructor Cleaner(Whitelist)whitelistsafelist based HTML cleaner. Use to ensure that end-user provided HTML contains only the elements and attributes that you are expecting; no junk, and no cross-site scripting attacks!The HTML cleaner parses the input as HTML and then runs it through a
whitesafe-list, so the output HTML can only contain HTML that is allowed by thewhitelistsafelist.It is assumed that the input HTML is a body fragment; the clean methods only pull from the source's body, and the canned
whitesafe-lists only allow body contained tags.Rather than interacting directly with a Cleaner object, generally see the {@code clean} methods in com.itextpdf.styledxmlparser.jsoup.Jsoup.
Class Cleaner, Document clean(Document)CreateUsea new cleaner, that sanitizes documents using the supplied.Cleaner(Safelist)whitelistinstead.@param whitelist white-listdeprecatedto cleanas ofwith1.14.1.
Creates a new, clean document, from the original dirty document, containing only elements allowed by theClass Cleaner, boolean isValid(Document)whitelistsafelist. The original document is not modified. Only elements from thedirtdirty document'sbodyare used.The OutputSettings of the original document are cloned into the clean document. @param dirtyDocument Untrusted base document to clean. @return cleaned document.
Determines if the input document bodyis valid, against thewhitelistsafelist. It is considered valid if all the tags and attributes in the input HTML are allowed by thewhitelistsafelist, and that there is no content in thehead.This method can be used as a validator for user input
forms. An invalid document will still be cleaned successfully using the .clean(Document) document. If using as a validator, it is recommended to still clean the document to ensure enforced attributes are set correctly, and that the output is tidied. @param dirtyDocument document to test @return true if no tags or attributes need to be removed; false if they do
Whitelists define what HTML (elements and attributes) to allow through the cleaner. Everything else is removed. Start with@deprecatedoneAs ofthe defaults: .none .simpleText .basicreleasev1.,basicWithImages14.relaxed If you need to allow more through (please be careful!)1tweak athisbase whitelistclass iswith:deprecatedin.addTagsfavour.addAttributesof.addEnforcedAttributeSafelist.addProtocolsYou can remove any setting from an existing whitelistThe name has been changed with the intent ofwith:promotingmore.removeTagsinclusive language.removeAttributes.removeEnforcedAttributeSafelist.removeProtocolsisaThedrop-incleanerreplacement, andthese whitelists assume that you want to clean ano further changes other than updating the name inbodyyourfragment of HTMLcode are required(toadd user supplied HTML intocleanlya templated page), andmigrate.not to clean a full HTMLThis class will be removed indocumentv1..If the latter15.1is the caseUntil that release,either wrap the document HTML around the cleanedthisbodyclassHTML, oractscreateas awhitelist thatshimallowstohtmlmaintainandcodeheadcompatibilityelements(sourceasandappropriatebinary).
If you are going to extendFor awhitelist, please be very careful. Make sure you understandclearwhatrationaleattributes may leadofto XSS attackthe removal ofvectors.thisURLchange,attributes areplease seeparticularlyTerminology,vulnerablePower, andrequire careful validation. See http://ha.ckers.org/xss.html for some XSSInclusiveattackLanguageexamples.in@authorInternet-DraftsJonathanandHedleyRFCs