You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_ =tryNSRegularExpression(pattern:#"\.com|\.org"#).matches(in: input, range: inputRange) // OK, has no domain name
101
101
_ =tryNSRegularExpression(pattern:#"example\.com|whatever"#).matches(in: input, range: inputRange) // OK, the other disjunction doesn't match a hostname [FALSE POSITIVE]
102
+
103
+
// tests for the `isLineAnchoredHostnameRegExp` case
_ =tryNSRegularExpression(pattern:"^good\\.com$").matches(in: attackUrl1, range: attackUrl1Range) // OK
108
+
_ =tryNSRegularExpression(pattern:"^good\\.com$", options:.anchorsMatchLines).matches(in: attackUrl1, range: attackUrl1Range) // BAD [NOT DETECTED]: with the .anchorsMatchLines option this matches the attack URL
109
+
_ =tryNSRegularExpression(pattern:"(?i)^good\\.com$").matches(in: attackUrl1, range: attackUrl1Range) // OK
110
+
_ =tryNSRegularExpression(pattern:"(?i)^good\\.com$", options:.anchorsMatchLines).matches(in: attackUrl1, range: attackUrl1Range) // BAD [NOT DETECTED]: with the .anchorsMatchLines option this matches the attack URL
111
+
_ =tryNSRegularExpression(pattern:"^good\\.com$|^another\\.com$").matches(in: attackUrl1, range: attackUrl1Range) // OK
112
+
_ =tryNSRegularExpression(pattern:"^good\\.com$|^another\\.com$", options:.anchorsMatchLines).matches(in: attackUrl1, range: attackUrl1Range) // BAD [NOT DETECTED]: with the .anchorsMatchLines option this matches the attack URL
_ =tryNSRegularExpression(pattern:"^good\\.com/").matches(in: attackUrl2, range: attackUrl2Range) // OK
117
+
_ =tryNSRegularExpression(pattern:"^good\\.com/", options:.anchorsMatchLines).matches(in: attackUrl2, range: attackUrl2Range) // BAD [NOT DETECTED]: with the .anchorsMatchLines option this matches the attack URL
118
+
_ =tryNSRegularExpression(pattern:"(?i)^good\\.com/").matches(in: attackUrl2, range: attackUrl2Range) // OK
119
+
_ =tryNSRegularExpression(pattern:"(?i)^good\\.com/", options:.anchorsMatchLines).matches(in: attackUrl2, range: attackUrl2Range) // BAD [NOT DETECTED]: with the .anchorsMatchLines option this matches the attack URL
120
+
_ =tryNSRegularExpression(pattern:"^good\\.com/|^another\\.com/").matches(in: attackUrl2, range: attackUrl2Range) // OK
121
+
_ =tryNSRegularExpression(pattern:"^good\\.com/|^another\\.com/", options:.anchorsMatchLines).matches(in: attackUrl2, range: attackUrl2Range) // BAD [NOT DETECTED]: with the .anchorsMatchLines option this matches the attack URL
0 commit comments