File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
test/query-tests/DOM/TargetBlank Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ predicate hasDynamicHrefHostAttributeValue(DOM::ElementDefinition elem) {
44
44
// ... that does not start with a fixed host or a relative path (common formats)
45
45
not url .regexpMatch ( "(?i)((https?:)?//)?[-a-z0-9.]*/.*" ) and
46
46
// .. that is not a call to `url_for` in a Flask / nunjucks application
47
- not url .regexpMatch ( "\\{\\{\\s*url(_for)?\\(.+\\).*" )
47
+ not url .regexpMatch ( "\\{\\{\\s*url(_for)?\\(.+\\).*" ) and
48
+ // .. that is not a call to `url` in a Django application
49
+ not url .regexpMatch ( "\\{%\\s*url.*" )
48
50
)
49
51
)
50
52
}
Original file line number Diff line number Diff line change
1
+ ---
2
+ category : minorAnalysis
3
+ ---
4
+ * Added django URLs to detected "safe" URL patterns in ` js/unsafe-external-link ` .
Original file line number Diff line number Diff line change @@ -65,4 +65,7 @@ function f() {
65
65
< a href = "{{ url_for('foo.html', 'foo')}}" target = "_blank" > Example</ a > ;
66
66
67
67
// OK, nunjucks template
68
- < a href = "{{ url('foo', query={bla}) }}" target = "_blank" > Example</ a >
68
+ < a href = "{{ url('foo', query={bla}) }}" target = "_blank" > Example</ a > ;
69
+
70
+ // OK, Django application with internal links
71
+ < a href = "{% url 'admin:auth_user_changelist' %}" target = "_blank" > Example</ a >
You can’t perform that action at this time.
0 commit comments