Skip to content

fix(security): Restrict authenticated media loader to its source URL - #2093

Merged
adrien-coye merged 1 commit into
masterfrom
fix/harden-url
Nov 27, 2026
Merged

adrien-coye merged 1 commit into
masterfrom
fix/harden-url

Conversation

@adrien-coye

Copy link
Copy Markdown
Contributor

Summary

  • The authenticated media resource loader now only handles the exact source URL it was created for (scheme, host, port, path and query must match).
  • Any other loading request is rejected before a request is sent.

Tests

  • Added cases to UTAuthenticatedMediaResourceLoader.
  • kDriveTests scheme passes locally (83 tests).

To check

  • Online video and audio playback still work on a device.

@adrien-coye
adrien-coye requested a balanced review from Copilot November 27, 2026 11:51
@adrien-coye adrien-coye added the security Related to security issues label Nov 27, 2026
@adrien-coye adrien-coye added this to the next milestone Nov 27, 2026

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.

🔵 Needs a closer look

Helper tests cover the exact-URL gate, but authenticated online audio/video playback still requires device validation of AVFoundation loading-request and redirect behavior that this review environment cannot provide.

No open issues 🎉

What changed in this PR

Restricts authenticated media loading to each asset’s original source URL, rejecting unexpected URLs before sending an authenticated request.

Changes:

  • Binds the loader to its source URL and checks the scheme, host, port, path, and query.
  • Adds tests for matching URLs, rejected alternatives, and custom-scheme wrapping.

No concrete security issue found in the reviewed kDrive trust boundaries.

Online audio and video playback still needs device verification.

File Description
kDriveTests/​kDriveCore/​VideoPlayer/​UTAuthenticatedMediaResourceLoader.swift Tests source matching and rejection of unexpected URLs.
kDriveCore/​VideoPlayer/​AuthenticatedMediaAsset.swift Binds authenticated requests to the asset’s source URL.

Review effort: Balanced

@adrien-coye
adrien-coye marked this pull request as ready for review November 27, 2026 12:00
@adrien-coye
adrien-coye requested a review from BaptGrv November 27, 2026 12:04
@adrien-coye

Copy link
Copy Markdown
Contributor Author

I did test on device both streamed content and offline content.
All good for me on my side.

@sonarqubecloud

Copy link
Copy Markdown

@adrien-coye
adrien-coye merged commit 6bf899a into master Nov 27, 2026
13 of 14 checks passed
@adrien-coye
adrien-coye deleted the fix/harden-url branch November 27, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Related to security issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants