fix 11779 SQLReport can run arbitrary queries
This commit is contained in:
parent
02121fb7a9
commit
0957759fa9
3 changed files with 9 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
7.9.12
|
||||
- webgui.org homepage gives 404 (#11778)
|
||||
- fixed #11779: SQLReport can run arbitrary queries
|
||||
|
||||
7.9.11
|
||||
- fixed #11755: New cart does not update shipping methods correctly
|
||||
|
|
|
|||
|
|
@ -383,6 +383,9 @@ sub queryIsAllowed {
|
|||
my $self = shift;
|
||||
my $query = shift;
|
||||
|
||||
# Remove all comments before checking validity
|
||||
$query =~ s{/[*].*?[*]/}{}g;
|
||||
|
||||
my ($firstWord) = $query =~ /(\w+)/;
|
||||
$firstWord = lc $firstWord;
|
||||
return isIn($firstWord, split(/\s+/, lc $self->{_databaseLink}{allowedKeywords})) ? 1 : 0;
|
||||
|
|
|
|||
|
|
@ -156,6 +156,11 @@ my $queries = [
|
|||
expect => 1,
|
||||
comment => '... parenthesized',
|
||||
},
|
||||
{
|
||||
query => '/* SELECT */ DELETE FROM users',
|
||||
expect => 0,
|
||||
comment => 'Initial comment with valid keyword',
|
||||
},
|
||||
];
|
||||
|
||||
plan tests => 14
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue