Skip to content

Webhook log authorization and file system path checks#19177

Merged
kjac merged 4 commits intorelease/15.4from
v15/bugfix/webhook-log-permissions-and-file-path-parent
Apr 28, 2025
Merged

Webhook log authorization and file system path checks#19177
kjac merged 4 commits intorelease/15.4from
v15/bugfix/webhook-log-permissions-and-file-path-parent

Conversation

@AndyButland
Copy link
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Description

This PR handles a couple of low severity security concerns:

  • Webhook logs are readable by backoffice users without access to the webhooks feature.
  • The validation for reading from the file system outside of the root exposes the resolved path.

Testing

For the first issue, verify that the webhook logs are still displayed when logged into the backoffice with a user that has access to webhooks.

Verify that this request to the management API fails with a 403 response when signed in as a user without access to webhooks.

GET /umbraco/management/api/v1/webhook/{id}/logs?skip=0&take=100

For the second, verify this request to the management API fails but only reveals the originally requested relative path.

GET /umbraco/management/api/v1/tree/partial-view/children?parentPath=..%2F&skip=0&take=100

Copilot AI review requested due to automatic review settings April 28, 2025 09:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses low severity security concerns by ensuring sensitive filesystem paths are not exposed in exception messages and by enforcing proper webhook authorization in the backoffice.

  • Updated the exception message in PhysicalFileSystem to prevent leaking the filesystem's resolved full path details.
  • Added authorization policies to WebhookLogControllerBase and WebhookItemControllerBase to restrict webhook access to authorized users.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Umbraco.Core/IO/PhysicalFileSystem.cs Simplified the exception message to hide sensitive path details.
src/Umbraco.Cms.Api.Management/Controllers/Webhook/Logs/WebhookLogControllerBase.cs Added authorization attribute to enforce proper user permissions for accessing webhook logs.
src/Umbraco.Cms.Api.Management/Controllers/Webhook/Item/WebhookItemControllerBase.cs Added authorization attribute and necessary using directive for consistent permission checks.

@NguyenThuyLan
Copy link
Contributor

Look good to me 😊

Copy link
Contributor

@kjac kjac left a comment

Choose a reason for hiding this comment

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

Rolled back changes to the webhooks "items" API as discussed - otherwise this is excellent 👍

@kjac kjac enabled auto-merge (squash) April 28, 2025 11:38
@kjac kjac merged commit e932fa5 into release/15.4 Apr 28, 2025
21 checks passed
@kjac kjac deleted the v15/bugfix/webhook-log-permissions-and-file-path-parent branch April 28, 2025 12:10
AndyButland added a commit that referenced this pull request Apr 28, 2025
* Add authorization for webhooks to item and log endpoints.

* Remove full path details from exception when requesting a path outside of the physical file system's root.

* Added missing usings.

* Revert changes to the webhook items API

---------

Co-authored-by: kjac <kja@umbraco.dk>
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.

4 participants