CodeQL library for Swift
codeql/swift-all 2.0.4-dev (changelog, source)
Search

Module Make

Classes and predicates implementing an analysis on regular expressions that match URLs and hostname patterns.

Import path

import codeql.regex.HostnameRegexp

Imports

Utils

Utility predicates and classes that doesn’t depend on any signature.

Predicates

alwaysMatchesHostname

Holds if term will always match a hostname, that is, all disjunctions contain a hostname pattern that isn’t inside a quantifier.

alwaysMatchesHostnameAlt

Holds if every child of alt contains a hostname pattern.

alwaysMatchesHostnameAlt

Holds if the first i children of alt contains a hostname pattern.

hasConsecutiveDots

Holds if seq contains two consecutive dots .. or escaped dots.

hasTopLevelDomainEnding

Holds if the given regular expression term contains top-level domain preceded by a dot, such as .com.

hasTopLevelDomainEnding

Holds if the given sequence seq contains top-level domain preceded by a dot, such as .com, excluding cases where this is at the very beginning of the regexp.

incompleteHostnameRegExp

Holds if regexp is a regular expression that is likely to match a hostname, but the pattern is incomplete and may match more hosts than intended.

isConstantInvalidInsideOrigin

Holds if the given constant is unlikely to occur in the origin part of a URL.

isDotConstant

Holds if term is a dot constant of form \. or [.].

isDotLike

Holds if term is a wildcard . or an actual . character.

isInsideChoiceOrSubPattern

Holds if term occurs inside a quantifier or alternative (and thus can not be expected to correspond to a unique match), or as part of a lookaround assertion (which are rarely used for capture groups).

isLeftArmTerm

Holds if term is one of the transitive left children of a regexp.

isLikelyCaptureGroup

Holds if group is likely to be used as a capture group.

isRightArmTerm

Holds if term is one of the transitive right children of a regexp.

matchesBeginningOfString

Holds if term will only ever be matched against the beginning of the input.

Parameters