-
Notifications
You must be signed in to change notification settings - Fork 62
fix/ escape SQL values #627
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
Changes from all commits
f00b224
acde442
e980f99
db8d43a
2d3b54d
02e3ff2
f45c2d0
bcf08dd
818a32c
6a138c9
5d7202d
2d55a5d
7fbec49
96bdc49
0ad46d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ dist/ | |
| vendor/ | ||
| .gh_token | ||
| *.min.* | ||
|
|
||
| var/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -993,6 +993,7 @@ public function readUploadedFile($options = []) | |
| ), | ||
| ]; | ||
| } | ||
| unset($_FILES['filename']); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After move_uploaded_file(), the temporary file is deleted, but $_FILES['filename'] still contains its path. Later, when rendering the page, Html::footer() calls createFromGlobals(). An UploadedFile instance is created for each entry, and it checks whether the temporary file still exists. Since the file has already been moved and no longer exists, an exception is thrown. unset() clears the corresponding entry from $_FILES after the file has been moved. |
||
| } | ||
|
|
||
| //If file has not the right extension, reject it and delete if | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <phpunit | ||
| bootstrap="tests/bootstrap.php" | ||
| colors="true" | ||
| testdox="true" | ||
| cacheDirectory="var/phpunit" | ||
| > | ||
| <source> | ||
| <include> | ||
| <directory>src</directory> | ||
| </include> | ||
| </source> | ||
|
|
||
| <testsuites> | ||
| <testsuite name="Tests"> | ||
| <directory suffix="Test.php">tests</directory> | ||
| </testsuite> | ||
| </testsuites> | ||
| </phpunit> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * ------------------------------------------------------------------------- | ||
| * DataInjection plugin for GLPI | ||
| * ------------------------------------------------------------------------- | ||
| * | ||
| * LICENSE | ||
| * | ||
| * This file is part of DataInjection. | ||
| * | ||
| * DataInjection is free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation; either version 2 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * DataInjection is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with DataInjection. If not, see <http://www.gnu.org/licenses/>. | ||
| * ------------------------------------------------------------------------- | ||
| * @copyright Copyright (C) 2007-2023 by DataInjection plugin team. | ||
| * @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html | ||
| * @link https://github.com/pluginsGLPI/datainjection | ||
| * ------------------------------------------------------------------------- | ||
| */ | ||
|
|
||
| $current_plugin_folder = basename(realpath(__DIR__ . '/../')); | ||
|
|
||
| require __DIR__ . '/../../../tests/bootstrap.php'; | ||
| require dirname(__DIR__) . '/vendor/autoload.php'; | ||
|
|
||
| if (!Plugin::isPluginActive($current_plugin_folder)) { | ||
| throw new RuntimeException("Plugin $current_plugin_folder is not active in the test database"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An exception should be thrown or a warning logged if
$extrais not an array and is not empty