Skip to content

Require permissions before generating asset upload URLs - #198

Merged
timkelty merged 3 commits into
3.xfrom
timkelty/fix-upload-url-authorization
Aug 21, 2026
Merged

Require permissions before generating asset upload URLs#198
timkelty merged 3 commits into
3.xfrom
timkelty/fix-upload-url-authorization

Conversation

@timkelty

@timkelty timkelty commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Require the appropriate volume permissions before generating presigned asset upload URLs. Resolve replacement uploads against the target asset folder, return not found for unknown targets, and add focused regression coverage.

Copilot AI lite review requested due to automatic review settings August 21, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds permission checks before generating presigned asset upload URLs while preserving replacement-specific authorization and adding regression coverage.

Changes:

  • Enforces saveAssets for standard uploads.
  • Retains replacement and peer-volume permission checks.
  • Adds denied-upload regression tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Summary Review status
tests/unit/AssetsControllerTest.php Adds coverage for denied upload URL generation. No blocking findings.
src/controllers/AssetsController.php Adds upload permission validation. Critical: requests containing both assetId and folderId can authorize the wrong operation, use the wrong upload key, and cause replacement failure.
Suppressed comments (1)

src/controllers/AssetsController.php:75

  • The new upload-URL path now has a separate replacement branch that enforces both replaceFiles and replacePeerFiles, but the added regression test only exercises the saveAssets branch. Please add a focused test with an assetId that verifies both replacement permission checks run and prevent presigned URL generation; otherwise this security-sensitive branch can regress without detection.
        if ($assetToReplace) {
            $this->requireVolumePermissionByAsset('replaceFiles', $assetToReplace);
            $this->requirePeerVolumePermissionByAsset('replacePeerFiles', $assetToReplace);

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

Comment thread src/controllers/AssetsController.php Outdated
Copilot AI review requested due to automatic review settings August 21, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/controllers/AssetsController.php
Copilot AI review requested due to automatic review settings August 21, 2026 10:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

@timkelty
timkelty marked this pull request as ready for review August 21, 2026 11:01
@timkelty
timkelty merged commit 33384bf into 3.x Aug 21, 2026
10 checks passed
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