Skip to content

Commit

Permalink
Incorrect access check on attachment downloads
Browse files Browse the repository at this point in the history
Even if config variables $g_download_attachments_threshold and
$g_view_attachments_threshold are set to 55 (developer), users with
lower privileges can download attachments.

Fixes #17742

Signed-off-by: Damien Regad <dregad@mantisbt.org>
  • Loading branch information
mantis authored and dregad committed Nov 15, 2014
1 parent 49c3d08 commit 5f0b150
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/file_api.php
Expand Up @@ -120,8 +120,8 @@ function file_can_view_bug_attachments( $p_bug_id, $p_uploader_user_id = null )
# Check if the current user can download attachments for the specified bug.
function file_can_download_bug_attachments( $p_bug_id, $p_uploader_user_id = null ) {
$t_uploaded_by_me = auth_get_current_user_id() === $p_uploader_user_id;
$t_can_download = access_has_bug_level( config_get( 'download_attachments_threshold' ), $p_bug_id );
$t_can_download = $t_can_download || ( $t_uploaded_by_me && config_get( 'allow_download_own_attachments' ) );
$t_can_download = access_has_bug_level( config_get( 'download_attachments_threshold', null, null, bug_get_field( $p_bug_id, 'project_id' ) ), $p_bug_id );
$t_can_download = $t_can_download || ( $t_uploaded_by_me && config_get( 'allow_download_own_attachments', null, null, bug_get_field( $p_bug_id, 'project_id' ) ) );
return $t_can_download;
}

Expand Down

0 comments on commit 5f0b150

Please sign in to comment.