mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
fixing vulnerability on soft delete
This commit is contained in:
parent
6858aa31d7
commit
53936e1809
@ -709,11 +709,9 @@ public class CiphersController : Controller
|
|||||||
public async Task Delete(Guid id)
|
public async Task Delete(Guid id)
|
||||||
{
|
{
|
||||||
var userId = _userService.GetProperUserId(User).Value;
|
var userId = _userService.GetProperUserId(User).Value;
|
||||||
var user = await _userService.GetUserByIdAsync(userId);
|
|
||||||
var cipher = await GetByIdAsync(id, userId);
|
var cipher = await GetByIdAsync(id, userId);
|
||||||
var canDelete = NormalCipherPermissions.CanDelete(user, cipher, null);
|
|
||||||
|
|
||||||
if (cipher == null || !canDelete)
|
if (cipher == null)
|
||||||
{
|
{
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
@ -782,7 +780,11 @@ public class CiphersController : Controller
|
|||||||
{
|
{
|
||||||
var userId = _userService.GetProperUserId(User).Value;
|
var userId = _userService.GetProperUserId(User).Value;
|
||||||
var cipher = await GetByIdAsync(id, userId);
|
var cipher = await GetByIdAsync(id, userId);
|
||||||
if (cipher == null)
|
var user = await _userService.GetUserByIdAsync(userId);
|
||||||
|
var orgAbility = await _applicationCacheService.GetOrganizationAbilityAsync(cipher.OrganizationId.Value); //Clean thi sup later
|
||||||
|
var canDelete = NormalCipherPermissions.CanDelete(user, cipher, orgAbility);
|
||||||
|
|
||||||
|
if (cipher == null || !canDelete)
|
||||||
{
|
{
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user