aboutsummaryrefslogtreecommitdiffstats
path: root/build/.phan/plugins/SqlInjectionCheckerPlugin.php
diff options
context:
space:
mode:
Diffstat (limited to 'build/.phan/plugins/SqlInjectionCheckerPlugin.php')
-rw-r--r--build/.phan/plugins/SqlInjectionCheckerPlugin.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/build/.phan/plugins/SqlInjectionCheckerPlugin.php b/build/.phan/plugins/SqlInjectionCheckerPlugin.php
index 8cfd5ac4752..a9a0b817d5c 100644
--- a/build/.phan/plugins/SqlInjectionCheckerPlugin.php
+++ b/build/.phan/plugins/SqlInjectionCheckerPlugin.php
@@ -33,10 +33,10 @@ class SqlInjectionCheckerPlugin extends PluginV2 implements AnalyzeNodeCapabili
class SqlInjectionCheckerVisitor extends PluginAwareAnalysisVisitor {
- private function throwError() {
+ private function throwError(string $hint) {
$this->emit(
'SqlInjectionChecker',
- 'Potential SQL injection detected',
+ 'Potential SQL injection detected - ' . $hint,
[],
\Phan\Issue::SEVERITY_CRITICAL
);
@@ -64,6 +64,8 @@ class SqlInjectionCheckerVisitor extends PluginAwareAnalysisVisitor {
'createNamedParameter',
'createPositionalParameter',
'createParameter',
+ 'createFunction',
+ 'func',
];
$functionsToSearch = [
@@ -84,7 +86,7 @@ class SqlInjectionCheckerVisitor extends PluginAwareAnalysisVisitor {
// For set actions
if(isset($node->children['method']) && in_array($node->children['method'], $functionsToSearch, true) && !is_string($subChild)) {
if(!isset($subChild->children['method']) || !in_array($subChild->children['method'], $safeFunctions, true)) {
- $this->throwError();
+ $this->throwError('method: ' . ($subChild->children['method'] ?? 'no child method'));
}
}
@@ -115,7 +117,7 @@ class SqlInjectionCheckerVisitor extends PluginAwareAnalysisVisitor {
// If it is an IParameter or a pure string no error is thrown
if((string)$expandedNode !== '\OCP\DB\QueryBuilder\IParameter' && !is_string($secondParameterNode)) {
- $this->throwError();
+ $this->throwError('neither a parameter nor a string');
}
}
}