Skip to content

fix(branding): validate file paths before deletion to prevent path traversal#1090

Merged
perber merged 3 commits into
mainfrom
fix/branding-delete-path-traversal
Jun 2, 2026
Merged

fix(branding): validate file paths before deletion to prevent path traversal#1090
perber merged 3 commits into
mainfrom
fix/branding-delete-path-traversal

Conversation

@perber

@perber perber commented May 31, 2026

Copy link
Copy Markdown
Owner

Add containsPathTraversal check in DeleteLogo and DeleteFavicon, mirroring the same guard already present in resolveBrandingAssetPath for asset serving.

…aversal

Add containsPathTraversal check in DeleteLogo and DeleteFavicon, mirroring
the same guard already present in resolveBrandingAssetPath for asset serving.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Copilot AI review requested due to automatic review settings May 31, 2026 18:15

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.

Pull request overview

This PR hardens branding asset deletion by adding a path-traversal guard before removing logo and favicon files, aligning deletion behavior with existing asset-serving protections.

Changes:

  • Adds a containsPathTraversal helper for validating stored branding filenames.
  • Applies the guard in DeleteLogo and DeleteFavicon to prevent deleting paths outside the branding assets directory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/branding/branding_service.go Outdated
Comment thread internal/branding/branding_service.go
perber added 2 commits June 2, 2026 15:06
Block absolute and volume-based asset paths during logo and favicon deletion.
Add tests to verify invalid stored paths fail without deleting external files.
Reject absolute and volume-based branding asset paths in the HTTP adapter.
Add route tests to keep asset serving aligned with delete path validation.
@perber
perber merged commit 2a6bd32 into main Jun 2, 2026
8 checks passed
@perber
perber deleted the fix/branding-delete-path-traversal branch June 2, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants