Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[fix] Fix columnQuote for �security issue reported by Snyk
- Loading branch information
Showing
1 changed file
with
5 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -500,6 +500,11 @@ protected function typeMap($value, $type) | |
|
|
||
| protected function columnQuote($string) | ||
| { | ||
| if (!preg_match('/^[a-zA-Z0-9]+(\.?[a-zA-Z0-9]+)?$/i', $string)) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
catfan
Author
Owner
|
||
| { | ||
| throw new InvalidArgumentException("Incorrect column name \"$string\""); | ||
| } | ||
|
|
||
| if (strpos($string, '.') !== false) | ||
| { | ||
| return '"' . $this->prefix . str_replace('.', '"."', $string) . '"'; | ||
|
|
||
It's perfect valid to use
_in a column name and I believe it's used quite often. This change would makev1.7.4literally unusable for most of people.Not sure about other SQL standard. For MySQL, it's valid to use some of UTF-8 chars as the column name.
https://dev.mysql.com/doc/refman/8.0/en/identifiers.html