Skip to content

Commit e932fa5

Browse files
AndyButlandkjac
andauthored
Webhook log authorization and file system path checks (#19177)
* 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 <[email protected]>
1 parent 83e580c commit e932fa5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Umbraco.Cms.Api.Management/Controllers/Webhook/Logs/WebhookLogControllerBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
using Microsoft.AspNetCore.Authorization;
12
using Microsoft.AspNetCore.Mvc;
23
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
34
using Umbraco.Cms.Api.Management.Factories;
45
using Umbraco.Cms.Api.Management.Routing;
56
using Umbraco.Cms.Api.Management.ViewModels.Webhook.Logs;
67
using Umbraco.Cms.Core;
78
using Umbraco.Cms.Core.Models;
9+
using Umbraco.Cms.Web.Common.Authorization;
810

911
namespace Umbraco.Cms.Api.Management.Controllers.Webhook.Logs;
1012

1113
[VersionedApiBackOfficeRoute($"{Constants.UdiEntityType.Webhook}")]
1214
[ApiExplorerSettings(GroupName = "Webhook")]
15+
[Authorize(Policy = AuthorizationPolicies.TreeAccessWebhooks)]
1316
public class WebhookLogControllerBase : ManagementApiControllerBase
1417
{
1518
protected PagedViewModel<WebhookLogResponseModel> CreatePagedWebhookLogResponseModel(PagedModel<WebhookLog> logs, IWebhookPresentationFactory webhookPresentationFactory)

src/Umbraco.Core/IO/PhysicalFileSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public string GetFullPath(string path)
358358

359359
// nothing prevents us to reach the file, security-wise, yet it is outside
360360
// this filesystem's root - throw
361-
throw new UnauthorizedAccessException($"File original: [{originalPath}] full: [{path}] is outside this filesystem's root.");
361+
throw new UnauthorizedAccessException($"Requested path {originalPath} is outside this filesystem's root.");
362362
}
363363

364364
/// <summary>

0 commit comments

Comments
 (0)