Opened 11 years ago
Closed 11 years ago
#5478 closed defect (bug) (fixed)
Activity items can be favorited multiple times by the same user
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.0 | Priority: | high |
Severity: | normal | Version: | |
Component: | Activity | Keywords: | |
Cc: | mpa4hu@… |
Description
This is not much security issue but interesting workaround.
var type = target.hasClass('fav') ? 'fav' : 'unfav';
var parent = target.closest('.activity-item');
var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
target.addClass('loading');
jq.post( ajaxurl, {
action: 'activity_mark_' + type,
'cookie': bp_get_cookies(),
'id': parent_id
}
this is a client side script that handles favoriting activity.
Then on server side when removing activity favorite (bp_activity_remove_user_favorite
) you check
$my_favs = array_unique( array_flip( $my_favs ) );
array_unique
(i think) guarantees that array meta data stays clean.
On the other hand when adding activity as favorite (bp_activity_add_user_favorite
) There is no such thing.
at first this might not sound serious, but for example I have a filter thats orders activities by favorite_count
meta. and since there is no check from backend if its already favorited or not, I can increment that meta as many times as I want.
Change History (5)
#1
@
11 years ago
- Component changed from Core to Activity
- Milestone changed from Awaiting Review to 2.0
- Summary changed from Security while favorting activity to Activity items can be favorited multiple times by the same user
#2
@
11 years ago
- Owner set to boonebgorges
- Resolution set to fixed
- Status changed from new to closed
In 8175:
Good catch.