public class CssScanner extends Object
scanInlineSheet() or
scanStyleSheet as appropriate.scanInlineStyle(String, String, int),
scanStyleSheet(String, int)| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_TIMEOUT |
protected ResourceBundle |
messages
The message bundled to pull error messages from.
|
protected org.apache.batik.css.parser.Parser |
parser
The parser to be used in any scanning
|
protected InternalPolicy |
policy
The policy file to be used in any scanning
|
| Constructor and Description |
|---|
CssScanner(InternalPolicy policy,
ResourceBundle messages)
Constructs a scanner based on the given policy.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
Deprecated.
|
protected void |
parseImportedStylesheets(LinkedList stylesheets,
CssHandler handler,
List<String> errorMessages,
int sizeLimit)
Parses through a
LinkedList of imported stylesheet
URIs, this method parses through those stylesheets and validates them |
CleanResults |
scanInlineStyle(String taintedCss,
String tagName,
int sizeLimit)
Scans the contents of an inline style declaration (ex. in the style
attribute of an HTML tag) and validates the style sheet according to
this
CssScanner's policy file. |
CleanResults |
scanStyleSheet(String taintedCss,
int sizeLimit)
Scans the contents of a full stylesheet (ex. a file based stylesheet
or the complete stylesheet contents as declared within <style>
tags)
|
protected static final int DEFAULT_TIMEOUT
protected final org.apache.batik.css.parser.Parser parser
protected final InternalPolicy policy
protected final ResourceBundle messages
public CssScanner(InternalPolicy policy, ResourceBundle messages)
policy - the policy to follow when scanningpublic CleanResults scanStyleSheet(String taintedCss, int sizeLimit) throws ScanException
taintedCss - a String containing the contents of the
CSS stylesheet to validatesizeLimit - the limit on the total size in bytes of any imported
stylesheetsCleanResuts object containing the results of
the scanScanException - if an error occurs during scanningpublic CleanResults scanInlineStyle(String taintedCss, String tagName, int sizeLimit) throws ScanException
CssScanner's policy file.taintedCss - a String containing the contents of the
CSS stylesheet to validatetagName - the name of the tag for which this inline style was
declaredsizeLimit - the limit on the total size in bites of any imported
stylesheetsCleanResuts object containing the results of
the scanScanException - if an error occurs during scanningprotected void parseImportedStylesheets(LinkedList stylesheets, CssHandler handler, List<String> errorMessages, int sizeLimit) throws ScanException
LinkedList of imported stylesheet
URIs, this method parses through those stylesheets and validates themstylesheets - the LinkedList of stylesheet URIs to
parsehandler - the CssHandler to use for parsingerrorMessages - the list of error messages to append tosizeLimit - the limit on the total size in bites of any imported
stylesheetsScanException - if an error occurs during scanningCopyright © 2013 The Open Web Application Security Project (OWASP). All rights reserved.