Skip to content

fix(TaskProcessing): Harden task scheduling with webhooks - #63687

Merged
marcelklehr merged 1 commit into
masterfrom
fix/harden-task-processing-webhook
Sep 1, 2026
Merged

fix(TaskProcessing): Harden task scheduling with webhooks#63687
marcelklehr merged 1 commit into
masterfrom
fix/harden-task-processing-webhook

Conversation

@marcelklehr

Copy link
Copy Markdown
Member

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@marcelklehr marcelklehr added this to the Nextcloud 36 milestone Aug 27, 2026
@marcelklehr
marcelklehr requested a review from a team as a code owner August 27, 2026 08:30
@marcelklehr marcelklehr added the 3. to review Waiting for reviews label Aug 27, 2026
@marcelklehr
marcelklehr requested review from CarlSchwan, icewind1991 and leftybournes and removed request for a team August 27, 2026 08:30
@marcelklehr
marcelklehr requested a review from come-nc August 27, 2026 08:30
@marcelklehr

Copy link
Copy Markdown
Member Author

/backport to stable32

@marcelklehr

Copy link
Copy Markdown
Member Author

/backport to stable33

@marcelklehr

Copy link
Copy Markdown
Member Author

/backport to stable34

@marcelklehr

Copy link
Copy Markdown
Member Author

/backport to stable35

@@ -168,6 +169,18 @@ private function handleScheduleTaskInternal(
bool $preferStreaming = false,
): DataResponse {
$task = new Task($type, $input, $appId, $this->userId, $customId);
if ($webhookUri !== null && $webhookUri !== ''
&& str_starts_with((string)$webhookMethod, 'HTTP:')) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check when the method is lowercase? I mean, are we sure the method is systematically uppercase?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julien-nc
julien-nc self-requested a review August 27, 2026 09:28
@marcelklehr
marcelklehr requested a review from kesselb August 27, 2026 09:46

@joshtrichards joshtrichards left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this validation be moved into the manager to also cover callers that schedule tasks directly? e.g., could a shared validator be invoked from prepareTask() to cover all scenarios / both scheduleTask() and runTask()?

Comment thread core/Controller/TaskProcessingApiController.php Outdated
Comment thread core/Controller/TaskProcessingApiController.php Outdated
Comment thread core/Controller/TaskProcessingApiController.php Outdated
@joshtrichards joshtrichards linked an issue Aug 27, 2026 that may be closed by this pull request
8 tasks
@marcelklehr
marcelklehr force-pushed the fix/harden-task-processing-webhook branch from 3331ebc to 40aef4e Compare August 31, 2026 08:28
@marcelklehr

Copy link
Copy Markdown
Member Author

Reimplemented this with a a separate validation method that is called from prepareTask

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The public manager contract does not document the newly introduced webhook validation failures.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Hardens task scheduling by validating webhook methods, URIs, lengths, and remote hosts.

Changes:

  • Adds HTTP and AppAPI webhook validation.
  • Adds unit coverage for valid, invalid, and local-host webhooks.
File summaries
File Description
lib/private/TaskProcessing/Manager.php Validates webhook configuration before scheduling.
tests/lib/TaskProcessing/TaskProcessingTest.php Tests webhook validation behavior.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/private/TaskProcessing/Manager.php
Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
marcelklehr force-pushed the fix/harden-task-processing-webhook branch from 40aef4e to 0667068 Compare August 31, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SSRF Through webhookURI in TaskProcessing

6 participants