mirror of
https://github.com/github/codeql.git
synced 2026-02-26 11:53:42 +01:00
20 lines
628 B
Plaintext
20 lines
628 B
Plaintext
/**
|
|
* @name Missing part of special group in regular expression
|
|
* @description Incomplete special groups are parsed as normal groups and are unlikely to match the intended strings.
|
|
* @kind problem
|
|
* @tags quality
|
|
* reliability
|
|
* correctness
|
|
* @problem.severity warning
|
|
* @sub-severity high
|
|
* @precision high
|
|
* @id py/regex/incomplete-special-group
|
|
*/
|
|
|
|
import python
|
|
import semmle.python.regex
|
|
|
|
from RegExp r, string missing, string part
|
|
where r.getText().regexpMatch(".*\\(P<\\w+>.*") and missing = "?" and part = "named group"
|
|
select r, "Regular expression is missing '" + missing + "' in " + part + "."
|