Skip to content

Commit

Permalink
Prevent assignment of categories to non-handler users
Browse files Browse the repository at this point in the history
manage_proj_cat_update.php did not perform the necessary checks on the
provided user id (assigned_to parameter), allowing users with an access
level below handle_bug_threshold to be assigned to a category, and
subsequently to bugs created in that category.

Also added a check to ensure the provided user id is valid.

As suggested by @atrol, the checks are performed in Category API.

Fixes #27268
  • Loading branch information
dregad committed Sep 23, 2020
1 parent 42fc49d commit dd86c9c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/category_api.php
Expand Up @@ -173,6 +173,20 @@ function category_update( $p_category_id, $p_name, $p_assigned_to ) {
}

$t_old_category = category_get_row( $p_category_id );
$t_project_id = (int)$t_old_category['project_id'];

# Ensure target user exists and is allowed to handle bugs
if( $p_assigned_to != NO_USER ) {
if( user_exists( $p_assigned_to ) ) {
$t_handle_bugs = config_get( 'handle_bug_threshold' );
if( !access_has_project_level( $t_handle_bugs, $t_project_id, $p_assigned_to ) ) {
trigger_error( ERROR_USER_DOES_NOT_HAVE_REQ_ACCESS, ERROR );
}
} else {
error_parameters( $p_assigned_to );
trigger_error( ERROR_USER_BY_ID_NOT_FOUND, ERROR );
}
}

db_param_push();
$t_query = 'UPDATE {category} SET name=' . db_param() . ', user_id=' . db_param() . '
Expand Down

0 comments on commit dd86c9c

Please sign in to comment.