Commit graph

150 commits

Author SHA1 Message Date
El Mehdi Abenhazou
e8c101fac8 fix(TaskProcessing): restrict allowed_classes in Manager cache deserialization
The availableTaskTypes cache stores serialized arrays containing
ShapeDescriptor objects, ShapeEnumValue objects, and EShapeType enum
values. The unserialize() call did not restrict which classes could
be instantiated.

Restrict deserialization to the three known types:
- OCP\TaskProcessing\ShapeDescriptor
- OCP\TaskProcessing\ShapeEnumValue
- OCP\TaskProcessing\EShapeType

This prevents PHP Object Injection if an attacker gains write access
to the distributed cache backend.

Signed-off-by: El Mehdi Abenhazou <mehdiananas007@gmail.com>
2026-06-04 10:49:23 +02:00
XananasX7
d0cce3da70 fix(TaskProcessing): add allowed_classes to unserialize() in Manager cache
The availableTaskTypes cache stores serialized arrays containing
ShapeDescriptor objects, ShapeEnumValue objects, and EShapeType enum
values. The unserialize() call did not restrict which classes could
be instantiated.

Restrict deserialization to the three known types:
- OCP\TaskProcessing\ShapeDescriptor
- OCP\TaskProcessing\ShapeEnumValue
- OCP\TaskProcessing\EShapeType

This prevents PHP Object Injection if an attacker gains write access
to the distributed cache backend (e.g., a Redis instance without
authentication or with weak ACLs), which is a known real-world attack
vector in shared hosting and container environments.
2026-06-04 10:34:12 +02:00
Côme Chilliet
0d90f4272a
chore: Remove types from const properties
Support was added in PHP 8.3 and we need to support 8.2

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-06-02 09:46:16 +02:00
Côme Chilliet
b44f6a2957
fix: Remove static vars in TaskProcessing, TextProcessing, TextToImage
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-06-02 09:46:16 +02:00
Côme Chilliet
1ab09ec753
chore: Apply new coding standard to all files
The diff can be checked using: git diff --ignore-all-space --ignore-blank-lines
To see only the changes not related to blank lines.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-06-01 13:46:39 +02:00
Côme Chilliet
9680004b58
chore: Remove almost all uses of deprecated IServerContainer in lib/private
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-05-11 16:22:22 +02:00
Lukas Schaefer
574243fab3
feat(TaskProcessing): add TextToTextReformatParagraphs task type
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
2026-05-06 09:03:07 -04:00
Ferdinand Thiessen
e0ba4d71b6
chore: add missing Override attribute to OC
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-04-28 21:29:27 +02:00
Oleksander Piskun
f573285040 feat(taskprocessing): Add queue_stats API endpoint for external autoscalers
Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
2026-03-30 12:03:19 +00:00
provokateurin
f12cecb684
feat(rector): Enable SafeDeclareStrictTypesRector
Signed-off-by: provokateurin <kate@provokateurin.de>
2026-02-09 10:59:31 +01:00
Carl Schwan
c96ece0bcb
refactor: Add more typing
- repairs job
- database
- redis

And remove Helpertest which was unused outside of some tests.

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2026-02-06 13:55:39 +01:00
Carl Schwan
7b6078875b
refactor: Run rector on lib/private
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2026-02-06 13:50:18 +01:00
Marcel Klehr
c13d95809a Fix: Run cs:fix 2026-02-04 13:26:29 +01:00
Marcel Klehr
c48a09f27d fix(TaskProcessing): Refactor TextToImage fallback
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2026-02-04 13:26:29 +01:00
Marcel Klehr
25044f82ae fix(TaskProcessing): Adjust OCR task type to allow for multiple files and pdfs
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-12-09 09:21:33 +01:00
Julien Veyssier
b4f7fe2cb6
feat(taskprocessing): add a boolean 'includeWatermark' to taskprocessing tasks and pass it to ISynchronousWatermarkingProvider::process
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-11-27 11:32:08 +01:00
Marcel Klehr
d04d575ed3
Merge branch 'master' into feat/taskprocessing/user-facing-error-message
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-30 10:13:39 +01:00
Marcel Klehr
3ee6999682 fix: Use substr to cut error messages
This allows for cutting them to longer lengths

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-30 10:07:57 +01:00
Marcel Klehr
7f15598083 fix: address review comments
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-20 15:59:25 +02:00
Marcel Klehr
6a1501a7d6 fix: address review comments
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-20 15:59:25 +02:00
Marcel Klehr
044e92bf4e feat(TaskProcessing): Introduce ITriggerableProvider
Signed-off-by: Marcel Klehr <mklehr@gmx.net>

# Conflicts:
#	lib/private/TaskProcessing/Db/TaskMapper.php
2025-10-20 15:59:25 +02:00
Marcel Klehr
9df303f876 fix: address review comments
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-20 15:54:10 +02:00
Marcel Klehr
3f527661b1 fix: Create new class instead of extending existing class
to make it easier to use this across nextcloud versions

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-15 11:20:00 +02:00
Marcel Klehr
7373f11af6 feat(TaskProcessing): user-facing error messages
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-14 16:53:41 +02:00
Marcel Klehr
be8e168f38 fix: Address psalm issues and review comments
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-14 15:51:31 +02:00
Marcel Klehr
16da8bbc8a fix(TaskProcessingApiController): Implement getNextScheduledTasks for next_batch endpoint
in order to avoid hitting the DB with multiple 1 row requests

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-14 11:50:29 +02:00
Marcel Klehr
ea8ab8e192
Merge pull request #55646 from nextcloud/feat/taskprocessing/is-internal
enh(TaskProcessing): Introduce internal task types
2025-10-14 08:25:00 +02:00
Marcel Klehr
13eb2d1cbd feat(TaskProcessing): Introduce internal task types
which are not shown in the assistant UI

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-13 11:07:40 +02:00
Marcel Klehr
a6f899f925 fix(TaskProcessing): Increase MAX_TASK_AGE to 6 months
to comply with the EU AI act

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-06 16:44:53 +02:00
Marcel Klehr
fe54914ef9 fix(TaskProcessing): Cache task types by
user language

fixes https://github.com/nextcloud/assistant/issues/357

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-09-17 14:16:01 +02:00
Julien Veyssier
8c447eaba6
feat(taskprocessing): add manager method to get the list of available task type IDs
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-09-05 11:37:34 +02:00
Julien Veyssier
aa2ca86fb3
feat(taskprocessing): avoid generator cascade
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-08-07 15:12:22 +02:00
Julien Veyssier
e2c65b2493
feat(taskprocessing): fix mistake
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-08-07 15:12:22 +02:00
Julien Veyssier
222b19b805
feat(taskprocessing): rename cleanup column to allow_cleanup
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-08-07 15:12:22 +02:00
Julien Veyssier
cc295f2452
feat(taskprocessing): use Generator::getReturn to get the list of deleted tasks in the cleanup command
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-08-07 15:12:21 +02:00
Julien Veyssier
19801f7ec4
feat(taskprocessing): move cleanup method to private taskprocessing manager, use it in the cleanup bg job and implement a cleanup command
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-08-07 15:12:21 +02:00
Julien Veyssier
8c52b6c0fe
feat(taskprocessing): add cleanup flag to tasks to decide if they should be cleaned up automatically
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-08-07 15:12:21 +02:00
Julien Veyssier
be7ef439cf
fix(taskprocessing): move LAZY_CONFIG_KEYS constant to the private namespace
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-08-04 10:11:24 +02:00
Julien Veyssier
2e3fa51132
feat(taskprocessing): load and store some config keys lazily
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-08-04 10:11:24 +02:00
Lukas Schaefer
4731ecf4d4
Merge branch 'master' into feat/task/analyze-image 2025-07-08 08:35:04 -04:00
Julien Veyssier
2da3f450fa
feat(TaskProcessing): add agency audio-to-audio task type
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-07-07 15:29:55 +02:00
Julien Veyssier
af059cbf61
feat(TaskProcessing): add audio-to-audio chat task type
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2025-07-07 11:39:47 +02:00
Lukas Schaefer
20a779e4aa
feat: support multiple images
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
2025-07-03 11:01:10 -04:00
Jana Peper
603522a59c test: fix tests
Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
2025-07-03 10:25:19 +02:00
Jana Peper
f8886fe27a feat: add toggle for AI guest restriction
Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
2025-07-03 10:25:19 +02:00
Lukas Schaefer
3e24c40939
feat(TaskProcessing): Add AnalyzeImage TaskType
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
2025-07-02 09:18:53 -04:00
Ferdinand Thiessen
5981b7eb51
chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +02:00
Edward Ly
6af7ca0a85
fix(TaskProcessing): increase task cleanup delay
Signed-off-by: Edward Ly <contact@edward.ly>
2025-05-05 11:24:13 -07:00
Lukas Schaefer
99e8849b6c
feat(TaskProcessing): Add TextToSpeech provider
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
2025-04-26 00:46:23 -04:00
Oleksander Piskun
c23ab0d1f7 fix(taskprocessing): use the event for AppAPI to get list of AI providers
Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
2025-04-09 15:47:48 +03:00