dolibarr/htdocs/core/db
MDW a0b820564f
QUAL: Add SqlInjectionPlugin to detect unsafe SQL variable usage (fixes, notices) (#38722)
* QUAL: Add SqlInjectionPlugin to detect unsafe SQL variable usage

# QUAL: Add SqlInjectionPlugin to detect unsafe SQL variable usage

This commit adds a new SqlInjectionPlugin to the Phan configuration, which helps detect unsafe SQL variable usage in the Dolibarr codebase. The plugin checks for variables used in sql expressions that are not properly escaped, cast, or protected by safe methods.

* Qual: Add SqlInjection exceptions to Phan baseline

* Qual: Add SqlInjection exceptions to Phan baseline

* Qual: Update baseline.txt to remove SqlInjection suppressions

The SqlInjection suppressions have been removed from the baseline.txt file.
This reenables the notification of "unfixed" cases.

* Qual: SQL injection detection for missing quotes on escaped strings

# Qual: SQL injection detection for missing quotes on escaped strings

In summary: report lines with missing quotes as in `" WHERE ".$db->escape($value)." OR "`.

* Qual: Fix code for SqlInjection analysis

# Qual: Fix code for SqlInjection analysis

Rewrite some escape calls, change escape() in sanitize(), rename variable, ignore SqlInjection notices.

* Qual: Update baseline

Allow some SqlInjection* notices, to be fixed later or already fixed in develop.
2026-08-08 11:19:04 +02:00
..
Database.interface.php Qual: Remove unnecessary quotes around integer values in SQL queries (#39290) 2026-07-27 12:59:14 +02:00
DoliDB.class.php Qual: Fix phan notices (#37837) 2026-04-13 12:50:23 +02:00
mysqli.class.php QUAL: Add SqlInjectionPlugin to detect unsafe SQL variable usage (fixes, notices) (#38722) 2026-08-08 11:19:04 +02:00
pgsql.class.php QUAL: Add SqlInjectionPlugin to detect unsafe SQL variable usage (fixes, notices) (#38722) 2026-08-08 11:19:04 +02:00
sqlite3.class.php QUAL: Add SqlInjectionPlugin to detect unsafe SQL variable usage (fixes, notices) (#38722) 2026-08-08 11:19:04 +02:00