70 lines
1.7 KiB
Plaintext
70 lines
1.7 KiB
Plaintext
include::../description.adoc[]
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
== Sensitive Code Example
|
|
|
|
Django
|
|
|
|
----
|
|
from django.core.validators import RegexValidator
|
|
from django.urls import re_path
|
|
|
|
RegexValidator('(a*)*b') # Sensitive
|
|
|
|
def define_http_endpoint(view):
|
|
re_path(r'^(a*)*b/$', view) # Sensitive
|
|
----
|
|
|
|
``++re++`` module
|
|
|
|
----
|
|
import re
|
|
from re import compile, match, search, fullmatch, split, findall, finditer, sub, subn
|
|
|
|
|
|
input = 'input string'
|
|
replacement = 'replacement'
|
|
|
|
re.compile('(a*)*b') # Sensitive
|
|
re.match('(a*)*b', input) # Sensitive
|
|
re.search('(a*)*b', input) # Sensitive
|
|
re.fullmatch('(a*)*b', input) # Sensitive
|
|
re.split('(a*)*b', input) # Sensitive
|
|
re.findall('(a*)*b', input) # Sensitive
|
|
re.finditer('(a*)*b',input) # Sensitive
|
|
re.sub('(a*)*b', replacement, input) # Sensitive
|
|
re.subn('(a*)*b', replacement, input) # Sensitive
|
|
----
|
|
|
|
``++regex++`` module
|
|
|
|
----
|
|
import regex
|
|
from regex import compile, match, search, fullmatch, split, findall, finditer, sub, subn, subf, subfn, splititer
|
|
|
|
input = 'input string'
|
|
replacement = 'replacement'
|
|
|
|
regex.subf('(a*)*b', replacement, input) # Sensitive
|
|
regex.subfn('(a*)*b', replacement, input) # Sensitive
|
|
regex.splititer('(a*)*b', input) # Sensitive
|
|
|
|
regex.compile('(a*)*b') # Sensitive
|
|
regex.match('(a*)*b', input) # Sensitive
|
|
regex.search('(a*)*b', input) # Sensitive
|
|
regex.fullmatch('(a*)*b', input) # Sensitive
|
|
regex.split('(a*)*b', input) # Sensitive
|
|
regex.findall('(a*)*b', input) # Sensitive
|
|
regex.finditer('(a*)*b',input) # Sensitive
|
|
regex.sub('(a*)*b', replacement, input) # Sensitive
|
|
regex.subn('(a*)*b', replacement, input) # Sensitive
|
|
|
|
----
|
|
|
|
include::../exceptions.adoc[]
|
|
|
|
include::../see.adoc[]
|