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

db operations are susceptible to SQL injection attacks #2

Open
olitomlinson opened this issue Mar 24, 2023 · 0 comments
Open

db operations are susceptible to SQL injection attacks #2

olitomlinson opened this issue Mar 24, 2023 · 0 comments

Comments

@olitomlinson
Copy link
Owner

This is vulnerable to sql-injection as-is, need to try converting to a proc because you can't use parameters in code blocks like below.

            var sql = @$"
            DO $$
            BEGIN 
                IF EXISTS
                    ( SELECT 1
                    FROM   information_schema.tables 
                    WHERE  table_schema = '{_schema}'
                    AND    table_name = '{_table}'
                    )
                THEN
                    DELETE FROM {SchemaAndTable}
                    WHERE 
                        key = '{key}'
                        AND
                        etag = '{etag}';
                END IF;
            END
            $$;";
@olitomlinson olitomlinson changed the title db operations are suseptible to SQL injection attacks db operations are susceptible to SQL injection attacks Mar 24, 2023
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

1 participant