allow flask url_for urls in TargetBlank.ql

This commit is contained in:
Erik Krogh Kristensen
2020-10-03 14:35:54 +02:00
parent 78c58c2415
commit d6dc4bb655
2 changed files with 8 additions and 1 deletions

View File

@@ -31,7 +31,9 @@ predicate hasDynamicHrefHostAttributeValue(DOM::ElementDefinition elem) {
// fixed string with templating
url.regexpMatch(Templating::getDelimiterMatchingRegexpWithPrefix("[^?#]*")) and
// ... that does not start with a fixed host or a relative path (common formats)
not url.regexpMatch("(?i)((https?:)?//)?[-a-z0-9.]*/.*")
not url.regexpMatch("(?i)((https?:)?//)?[-a-z0-9.]*/.*") and
// .. that is not a call to `url_for` in a Flask application
not url.regexpMatch("\\{\\{\\s*url_for.*")
)
)
}