Skip to content

Commit

Permalink
Flag more code patterns in asyncpg-sqli ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
kholia committed Aug 3, 2023
1 parent 259b56b commit 41661c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/lang/security/audit/sqli/asyncpg-sqli.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def bad10(conn: asyncpg.Connection):
# ruleid: asyncpg-sqli
cur = await conn.cursor(sql_query)

def bad11(conn: asyncpg.Connection):
import common
# ruleid: asyncpg-sqli
cur = conn.fetch(common.bad_query_1.format(user_input))

def ok1(user_input):
con = await asyncpg.connect(user='postgres')
# ok: asyncpg-sqli
Expand Down
1 change: 1 addition & 0 deletions python/lang/security/audit/sqli/asyncpg-sqli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ rules:
$QUERY = '...' % ()
...
- pattern: $CONN.$METHOD(..., $X + $Y, ...)
- pattern: $CONN.$METHOD(..., $Y.format(...), ...)
- pattern: $CONN.$METHOD(..., '...'.format(...), ...)
- pattern: $CONN.$METHOD(..., '...' % (...), ...)
- pattern: $CONN.$METHOD(..., f'...{$USERINPUT}...', ...)
Expand Down

0 comments on commit 41661c6

Please sign in to comment.