fix(sanitize_fields): strengthen field check

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2026-02-06 18:20:45 +05:30
parent 20ceaa20a0
commit ab577751f2
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -499,9 +499,11 @@ from {tables}
if isinstance(token, Function):
if (name := (token.get_name())) and name.lower() in blacklisted_functions:
_raise_exception()
if token.ttype == tokens.Keyword:
if token.value.lower() in blacklisted_keywords:
if token.ttype in (tokens.Keyword, tokens.Name):
if any(re.search(rf"\b{kw}\b", token.value.lower()) for kw in blacklisted_keywords):
_raise_exception()
if token.is_group:
_check_sql_token(token)