Fix: kb_file attachment download had no permission check - #4
Open
bonelifer wants to merge 1 commit into
Open
Conversation
… has Attachments were served by attach_id alone, with no check that the requester can actually see the article they belong to. u_kb_view and the approval gate (kb_m_approve) already protect the article text in article.php; this applies the same checks before streaming a file. Orphaned attachments (uploaded during composition, not yet attached to a saved article) are left visible only to their own uploader, so the existing preview-while-composing flow keeps working.
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.
Had Claude review the extension's permission model, and it found
kb_file.phpserved any attachment byattach_idwith no check that the requester could actually see the article it belongs to, unlikearticle.php, which already gates article text behindu_kb_viewand the approval status (kb_m_approve). This let anyone, including guests, download files from unapproved or otherwise-inaccessible articles by guessing or enumerating the small sequentialattach_id.This applies the same checks
article.phpuses before streaming a file:u_kb_view(ora_manage_kb), matching the article page's own gate.kb_m_approve/a_manage_kb, the same rulearticle.phpalready applies to the article text itself.posting.phpkeeps working.services.ymlgets three new arguments (auth,user, the sharedfunctions_kbhelper) and one new table parameter (articles_table) to support the lookups.