Enforce the share password on the public audio endpoints - #661
Open
MiMoHo wants to merge 1 commit into
Open
Conversation
getPublicAudioInfo() and createPublicAudioStream() resolved a public share by token via getShareByToken() and served its metadata / audio bytes without ever checking the share password. Any holder of a password-protected share's token (but not its password) could therefore read and stream the shared audio, bypassing the password protection. Gate both endpoints on the same session authentication core uses for password-protected public shares (PublicShareController::DAV_AUTHENTICATED_FRONTEND): non-password shares are unaffected; a password-protected share is only served when the current session has authenticated to that token with a matching password hash. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enforce the share password on the public audio endpoints
Problem
MusicService::getPublicAudioInfo()andcreatePublicAudioStream()resolve a public share by token viagetShareByToken()and then serve its metadata / audio bytes without ever checking the share password (these are plain#[PublicPage]controller methods, so the framework's public-share password middleware never runs):Any holder of a password-protected public share's token (but not its password) can therefore read the metadata and stream the audio, bypassing the password.
Fix
Gate both endpoints on the same session authentication core uses for password-protected public shares (
\OCP\AppFramework\PublicShareController::DAV_AUTHENTICATED_FRONTEND). Non-password shares are unaffected; a password-protected share is only served when the current session has authenticated to that token with a matching password hash.Testing (reproduced live on a Nextcloud 35 instance)
Password-protected public folder share of an audio file, requested by a different authenticated user who has neither the file nor the password:
🤖 Disclosure: prepared by Claude Code – Opus 4.8 (xhigh)