mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
validation checks on cipher move
This commit is contained in:
@ -119,12 +119,12 @@ namespace Bit.Api.Controllers
|
||||
{
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), userId);
|
||||
if(cipher == null)
|
||||
if(cipher == null || cipher.OrganizationId.HasValue || cipher.UserId != userId)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
await _cipherService.MoveSubvaultAsync(model.Cipher.ToCipher(cipher),
|
||||
await _cipherService.MoveSubvaultAsync(model.Cipher.ToCipher(cipher), new Guid(model.Cipher.OrganizationId),
|
||||
model.SubvaultIds.Select(s => new Guid(s)), userId);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ namespace Bit.Api.IdentityServer
|
||||
var customResponse = new Dictionary<string, object>();
|
||||
if(!string.IsNullOrWhiteSpace(user.PrivateKey))
|
||||
{
|
||||
customResponse.Add("EncryptedPrivateKey", user.PrivateKey);
|
||||
customResponse.Add("PrivateKey", user.PrivateKey);
|
||||
}
|
||||
|
||||
context.Result = new GrantValidationResult(user.Id.ToString(), "Application",
|
||||
|
Reference in New Issue
Block a user