Skip to content
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

SQL injection #33

Open
frafra opened this issue Apr 20, 2021 · 1 comment
Open

SQL injection #33

frafra opened this issue Apr 20, 2021 · 1 comment

Comments

@frafra
Copy link
Contributor

frafra commented Apr 20, 2021

imgs_existing = dbConn.execute('''
SELECT filename FROM {}.image;
'''.format(dbSchema), None, 'all')

dbConn.insert('''
INSERT INTO {}.image (filename)
VALUES %s;
'''.format(dbSchema),
imgs)

isMigrated = dbConnector.execute('''
SELECT COUNT(*) AS cnt
FROM aide_admin.project
WHERE shortname = %s;
''', (dbSchema,), 1)

There are various examples of this in the source code.

@bkellenb
Copy link
Collaborator

bkellenb commented May 14, 2021

Hello,

Thank you very much for raising these issues.
As a matter of fact most of them are in legacy import and export scripts that are more or less replaced with browser functionality.
I nonetheless replaced them in the latest commit on the current development branch ("aide_detectron2"), which is going to become the new master branch accordingly. All other locations should be SQL injection-proof as well.

The only exception is the setup/migrate_aide.py script, which would require too many formatting commands for each project. However, this script is only executed at the launch of AIDE and cannot be accessed from the Web server in any normal way.

FYI: the first two examples pose a risk to SQL injection; the third is the officially recommended way of using the psycopg2 library and involves automatic SQL injection prevention in the library itself (see documentation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants