Commit graph

1064 commits

Author SHA1 Message Date
Laurent Destailleur
c56858af27 Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-08-18 14:06:45 +02:00
Laurent Destailleur
c100564d05 Fix missing protection for external user - reported by Vulncheck 2026-08-18 12:31:40 +02:00
Laurent Destailleur
4679c736ed Automated merge from 24.0 to develop 2026-08-13 17:54:41 +02:00
Laurent Destailleur
2469bb54ae Merge branch '24.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-08-13 17:48:25 +02:00
Laurent Destailleur
48958ae565 Automated merge from 22.0 to 23.0 by tool pullmerge.sh 2026-08-13 17:38:17 +02:00
Laurent Destailleur
72a97f32ff Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 24.0 2026-08-13 17:16:49 +02:00
Laurent Destailleur
7cdc14b185 Complete commit 85384fb523 2026-08-13 03:44:04 +02:00
w3houde
6a647097bd
Fix #39355 load images.lib.php before image_format_supported in API (#39462)
The POST /documents endpoint with generateThumbs=1 called
image_format_supported() after requiring only files.lib.php, but that
function is defined in images.lib.php, which was never included on this
path. The call raised a fatal error and the request returned a bare
HTTP 500 with no JSON body. Add the missing require_once.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-08-11 19:41:49 +02:00
Laurent Destailleur
b1691356eb Fixed removed property pass_indatabase_crypted in api result - reported
by Vulncheck
2026-08-09 19:49:05 +02:00
tcesar
322e41b81a
Fix: API auth fails in multicompany transverse mode when user has several groups (#39409) 2026-08-06 17:58:33 +02:00
Laurent Destailleur
7e0f0c54f2 Fix deletion must not use the glob by default. 2026-07-29 13:20:28 +02:00
Laurent Destailleur
c1bd89c9a2 Fix external users can change links - Reported by Joost Grunwald 2026-07-24 04:43:07 +02:00
MDW
cbf8748dd2
Fix CI #39247: Fix phan notices by reorganising code (#39264)
* Fix #39247: Fix phan notices by reorganising code

# Fix #39247: Fix phan notices by reorganising code

Phan typing analysis was disturbed by conditional assignment to array fields of array items.

This reorganises the the code and uses a foreach and a loop item by reference.
The result array is filtered after the initial loop to find matching ECM items.

Not that this does not fix an unreported issue when paging is applied for filtered items
(paging is applied on the full list, not the filtered items and may result in small(er)
or empty pages).

* Qual: Fix Phan notices

# Qual: Fix Phan notices

- The page_count value was simply ceil(...) which is typed float, now casting to int.
- Add missing properties share and agenda_id to EcmFilesLine
2026-07-23 16:09:22 +02:00
Laurent Destailleur
87644de46e CI 2026-07-21 03:55:58 +02:00
Laurent Destailleur
4ba970312d Fix phan 2026-07-21 01:28:22 +02:00
Laurent Destailleur
b0e8f0aa14 Doc 2026-07-20 18:08:57 +02:00
Laurent Destailleur
89e3c8bec7 Doc 2026-07-20 18:08:15 +02:00
Laurent Destailleur
51d43a28c9 clean code 2026-07-20 17:42:20 +02:00
Laurent Destailleur
ef6e4bc7b8 Doc 2026-07-20 15:36:29 +02:00
Laurent Destailleur
b3d342393c Clean code 2026-07-20 14:58:04 +02:00
Laurent Destailleur
7335438ee1 Fix rewrite api /documents to solve duplicate and missing security check
at object-level
2026-07-20 14:57:23 +02:00
Laurent Destailleur
f7e3af214d Better test 2026-07-20 09:45:24 +02:00
minimexat
1f217c564c
FIX: enforce document upload access checks (#39125)
* FIX: enforce document upload access checks

* Update ChangeLog for version 24.0.0

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 16:13:51 +02:00
minimexat
6eb81e0166
FIX: check document list read permissions (#39131)
* FIX: Check document list read permissions

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 15:50:21 +02:00
minimexat
55c48e1fba
FIX: scope login API token reset to user row (#39132)
* FIX: Scope login API token reset to user row

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 15:48:37 +02:00
minimexat
c95e337c40
FIX: Require delete permission for email templates API (#39134)
Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 14:59:15 +02:00
minimexat
0442259154
FIX: restrict establishment setup API to admin users (#39137)
* FIX: Restrict establishment setup API to admins

* Update ChangeLog

---------

Co-authored-by: f-hoedl <hoefla14@htl-kaindorf.ac.at>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-13 14:29:21 +02:00
Laurent Destailleur
0726bf945a Typo 2026-07-13 11:59:49 +02:00
ThomasNgr-OpenDSI
1992ad49f9
Fix sql injection in sqlfilters API param - reported by sangkilp (#38794) (#39072)
Switch four list endpoints that still used the legacy DolibarrApi::_checkFilters
+ bare preg_replace_callback path to the hardened forgeSQLFromUniversalSearchCriteria()
already used by the rest of the same files. The legacy path only validated
parenthesis balance and concatenated non-matching text verbatim into the WHERE
clause, while the hardened path applies the dummy-criteria syntax check first.

Endpoints touched:
- htdocs/api/class/api_setup.class.php getListOfRegions
- htdocs/api/class/api_setup.class.php getListOfIncoterms
- htdocs/api/class/api_setup.class.php getListOfVAT
- htdocs/multicurrency/class/api_multicurrencies.class.php index

See #38768 for the report.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: w3houde <clement@pixodeo.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-07-10 17:45:13 +02:00
Laurent Destailleur
92ee0f2303 Fix - bad test permission on deleting documents api - credit Seonghyeon
Lee
2026-06-29 13:32:26 +02:00
Laurent Destailleur
de1d7a623e Fix - bad test permission on deleting documents api - credit Seonghyeon
Lee
2026-06-29 13:31:23 +02:00
Laurent Destailleur
b18a83f629 Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-06-26 11:20:52 +02:00
w3houde
08e9766c2a
Fix #37282 dispatch API classes whose name ends with the 'Api' suffix (#38819)
The API discovery loop in htdocs/api/index.php (around line 308) accepts
both Foo and FooApi class names when scanning module directories. The
dispatch loop on the request-handling side (line 422) only checked
class_exists($classname), so a module exposing class MyModuleApi from
api_mymodule.class.php would appear in the API Explorer yet 501 with
'API not found' when the endpoint was actually called.

Probe class_exists($classname.'Api') first to mirror the discovery
behavior. Falls back to the plain class name so existing modules keep
working.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-25 21:32:02 +02:00
Laurent Destailleur
05268dca37 Fix report by Bhuvaneswaran R, Security Engineer. Bad permission test on
delete links
2026-06-22 02:29:53 +02:00
Laurent Destailleur
4ed21499e2 Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-06-15 01:21:31 +02:00
William Mead
f472e1a564
Fixed extrafield type check (#38769) 2026-06-14 01:13:22 +02:00
w3houde
14db36e848
Fix sql injection in sqlfilters API param - reported by sangkilp (#38794)
Switch four list endpoints that still used the legacy DolibarrApi::_checkFilters
+ bare preg_replace_callback path to the hardened forgeSQLFromUniversalSearchCriteria()
already used by the rest of the same files. The legacy path only validated
parenthesis balance and concatenated non-matching text verbatim into the WHERE
clause, while the hardened path applies the dummy-criteria syntax check first.

Endpoints touched:
- htdocs/api/class/api_setup.class.php getListOfRegions
- htdocs/api/class/api_setup.class.php getListOfIncoterms
- htdocs/api/class/api_setup.class.php getListOfVAT
- htdocs/multicurrency/class/api_multicurrencies.class.php index

See #38768 for the report.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-14 01:02:16 +02:00
Frédéric FRANCE
3c8eef840a
fix CI (#38490) 2026-06-09 19:42:58 +02:00
Laurent Destailleur
c7b0f1e10e Automated merge from 23.0 to develop 2026-06-09 00:27:55 +02:00
Laurent Destailleur
e1eb9de6ef Automated merge from 22.0 to 23.0 by tool pullmerge.sh 2026-06-09 00:11:42 +02:00
Laurent Destailleur
5acee1b470 Automated merge from 21.0 to 22.0 by tool pullmerge.sh 2026-06-09 00:04:20 +02:00
Laurent Destailleur
632fb186f4 Replace uniq_id with bin2hex(random_bytes(32)) 2026-06-06 16:25:37 +02:00
w3houde
4d2b73e18e
Fix #37445 Suppress PHP message display in API responses (#38512)
API endpoints return JSON or XML. When PHP display_errors is on (the
default outside production), any warning or notice raised before the
response is written ends up in the response body and breaks the parser
on the caller side. The reporter noted that "HTML should never appear
before a JSON answer", which is exactly what happens to a development
or staging install whose conf.php does not set dolibarr_main_prod.

Set display_errors=0 and log_errors=1 at the top of api/index.php so
that the messages stay visible in the server log while the response
body stays clean. This applies to every API call independently of the
production flag handled by filefunc.inc.php.

Reported by @gagarine.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-05-30 23:18:06 +02:00
Laurent Destailleur
b4b1a40751 Clean API 2026-05-29 12:36:54 +02:00
Laurent Destailleur
bf432da483 Doc example 2026-05-29 12:16:42 +02:00
Laurent Destailleur
52638e8c43 Fix protection against bad use of ->$field in API 2026-05-29 11:56:44 +02:00
Laurent Destailleur
aef08a38cd Fix protection to avoid bad use of ->$fields in API 2026-05-29 11:52:46 +02:00
Laurent Destailleur
1a423622b0 Move stats as view mode 2026-05-11 00:29:34 +02:00
Laurent Destailleur
a09e083798 Clean code 2026-05-10 22:45:23 +02:00
Laurent Destailleur
85384fb523 Fix sanitize fields in API put and post for extrafields 2026-05-09 01:16:35 +02:00