class DisallowUnsafeDynamicJS extends AbstractDynamicContentCheck

Constants

XMLNS_XSL

XSL namespace

Properties

protected bool $ignoreUnknownAttributes from  AbstractDynamicContentCheck

Methods

void
check(DOMElement $template, Tag $tag)

Look for improperly-filtered dynamic content

array
getNodes(DOMElement $template)

Get the nodes targeted by this check

bool
isSafe(Attribute $attribute)

Return whether an attribute is considered safe

void
detectUnknownAttributes()

Configure this template check to detect unknown attributes

void
ignoreUnknownAttributes()

Configure this template check to ignore unknown attributes

void
checkAttribute(DOMNode $node, Tag $tag, string $attrName)

Test whether a tag attribute is safe

void
checkAttributeExpression(DOMNode $node, Tag $tag, string $expr)

Test whether an attribute expression is safe

void
checkAttributeNode(DOMAttr $attribute, Tag $tag)

Test whether an attribute node is safe

void
checkContext(DOMNode $node)

Test whether a node's context can be safely assessed

void
checkCopyOfNode(DOMElement $node, Tag $tag)

Test whether an node is safe

void
checkElementNode(DOMElement $element, Tag $tag)

Test whether an element node is safe

void
checkExpression(DOMNode $node, string $expr, Tag $tag)

Test the safety of an XPath expression

void
checkNode(DOMNode $node, Tag $tag)

Test whether a node is safe

void
checkVariable(DOMNode $node, Tag $tag, string $qname)

Check whether a variable is safe in context

void
checkVariableDeclaration(DOMNode $node, Tag $tag, string $query)

Check whether a variable declaration is safe in context

void
checkSelectNode(DOMAttr $select, Tag $tag)

Test whether a select attribute of a node is safe

bool
isExpressionSafe(string $expr)

Test whether given expression is safe in context

bool
tagFiltersAttributes(Tag $tag)

Test whether given tag filters attribute values

Details

void check(DOMElement $template, Tag $tag)

Look for improperly-filtered dynamic content

Parameters

DOMElement $template

node

Tag $tag

Tag this template belongs to

Return Value

void

at line 20
protected array getNodes(DOMElement $template)

Get the nodes targeted by this check

Parameters

DOMElement $template

node

Return Value

array

Array of DOMElement instances

at line 36
protected bool isSafe(Attribute $attribute)

Return whether an attribute is considered safe

Parameters

Attribute $attribute Attribute

Return Value

bool

void detectUnknownAttributes()

Configure this template check to detect unknown attributes

Return Value

void

void ignoreUnknownAttributes()

Configure this template check to ignore unknown attributes

Return Value

void

protected void checkAttribute(DOMNode $node, Tag $tag, string $attrName)

Test whether a tag attribute is safe

Parameters

DOMNode $node

Context node

Tag $tag

Source tag

string $attrName

Name of the attribute

Return Value

void

protected void checkAttributeExpression(DOMNode $node, Tag $tag, string $expr)

Test whether an attribute expression is safe

Parameters

DOMNode $node

Context node

Tag $tag

Source tag

string $expr

XPath expression that evaluates to one or multiple named attributes

Return Value

void

protected void checkAttributeNode(DOMAttr $attribute, Tag $tag)

Test whether an attribute node is safe

Parameters

DOMAttr $attribute

Attribute node

Tag $tag

Reference tag

Return Value

void

protected void checkContext(DOMNode $node)

Test whether a node's context can be safely assessed

Parameters

DOMNode $node

Source node

Return Value

void

protected void checkCopyOfNode(DOMElement $node, Tag $tag)

Test whether an node is safe

Parameters

DOMElement $node

node

Tag $tag

Reference tag

Return Value

void

protected void checkElementNode(DOMElement $element, Tag $tag)

Test whether an element node is safe

Parameters

DOMElement $element Element
Tag $tag

Reference tag

Return Value

void

protected void checkExpression(DOMNode $node, string $expr, Tag $tag)

Test the safety of an XPath expression

Parameters

DOMNode $node

Source node

string $expr

XPath expression

Tag $tag

Source tag

Return Value

void

protected void checkNode(DOMNode $node, Tag $tag)

Test whether a node is safe

Parameters

DOMNode $node

Source node

Tag $tag

Reference tag

Return Value

void

protected void checkVariable(DOMNode $node, Tag $tag, string $qname)

Check whether a variable is safe in context

Parameters

DOMNode $node

Context node

Tag $tag

Source tag

string $qname

Name of the variable

Return Value

void

protected void checkVariableDeclaration(DOMNode $node, Tag $tag, string $query)

Check whether a variable declaration is safe in context

Parameters

DOMNode $node

Context node

Tag $tag

Source tag

string $query

XPath query

Return Value

void

protected void checkSelectNode(DOMAttr $select, Tag $tag)

Test whether a select attribute of a node is safe

Parameters

DOMAttr $select

Select attribute node

Tag $tag

Reference tag

Return Value

void

at line 28
protected bool isExpressionSafe(string $expr)

Test whether given expression is safe in context

Parameters

string $expr

XPath expression

Return Value

bool

Whether the expression is safe in context

protected bool tagFiltersAttributes(Tag $tag)

Test whether given tag filters attribute values

Parameters

Tag $tag

Return Value

bool