Aller au contenu

Regex DoS (ARCH9135)

Ce contenu n’est pas encore disponible dans votre langue.

Key swift.security.regex-dos · Severity warning · Category security · CWE CWE-1333

Flags regex literals with nested quantifiers ((a+)+, (\w*)*) that backtrack catastrophically.

try NSRegularExpression(pattern: "(a+)+$")
try NSRegularExpression(pattern: "a+$")

Rewrite without nested quantifiers, or bound the input length.