-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Dynamically created table names allow SQL injection #8986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Dynamically created table names allow SQL injection #8986
Conversation
@jorisvandenbossche Is there anything else that should be done here? |
b6cc746
to
b53af39
Compare
Also, @jorisvandenbossche --- this is now failing tests because of the rather brittle |
@artemyk Hmm, I was first using the existing |
@jorisvandenbossche I changed the test to |
@jorisvandenbossche Can we merge? |
def _get_unicode_name(name): | ||
try: | ||
uname = name.encode("utf-8", "strict").decode("utf-8") | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this catch a UnicodeDecodeError? (better not have bare excepts)
Cleanup doc Check for empty identifiers Tests fix Tests pass Doc update Error catching
8d75bd2
to
337b94d
Compare
@jorisvandenbossche Now catching UnicodeError... |
BUG: Dynamically created table names allow SQL injection
@artemyk Thanks! |
Working with the SQL code, I realized that the legacy code does not properly validate / escape passed in table and column names.
E.g.:
results in:
This fixes the issues.