Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Security fix#59

Merged
princessmiku merged 8 commits into
masterfrom
security_fix
May 15, 2024
Merged

Security fix#59
princessmiku merged 8 commits into
masterfrom
security_fix

Conversation

@princessmiku
Copy link
Copy Markdown
Owner

No description provided.

princessmiku and others added 8 commits May 19, 2023 11:19
…= 0) its didn't use the standard size. It now uses the allowed size
Updates were made to the UpdateBuilder class in the MariaDB SQL builder. Changes include introducing measures for preventing SQL injection attacks by modifying how values are validated and executed. The code now supports both raw SQL execution and proper parameter binding, thus enhancing the security against injection threats.
The provided commit removes the 'allow_injection' feature and instead consistently uses parameterized queries for all SQL generation in the codebase. This change simplifies the code and provides a more reliable protection against SQL injection attacks. Modifications were made in the way conditions are handled to support these changes.
The unnecessary function `_transform_value_valid` has been removed from the base builder module. The execution method in the insert builder has been refactored; it now uses a list of values for execute, thus improving code readability and maintainability. This new approach avoids hardcoding values directly into the SQL query, enhancing security by mitigating potential SQL injection vulnerability.
In the mariadb_sqlbuilder package, the 'cursor.execute()' function in various builders is now updated to include 'self.values_for_execute'. This change aids the execution of SQL queries with values to be inputted at runtime. Furthermore, unnecessary value transformation functionality is removed in the UpsertBuilder to streamline operations.
The version of MariaDB-SQLBuilder was updated from 1.0.1 to 1.1. Keywords in the setup file were also modified, with 'orm' removed. A security fix was applied to prevent SQL injections by ensuring variables are given directly to the cursor instead of being written into SQL. This adjustment modifies the function “get_sql()” and introduces “values_for_execute” to manage variables.
Copy link
Copy Markdown
Owner Author

@princessmiku princessmiku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check

@princessmiku princessmiku merged commit 25d4726 into master May 15, 2024
@princessmiku princessmiku deleted the security_fix branch May 15, 2024 22:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant