1
0
mirror of https://github.com/bitwarden/server synced 2025-12-06 00:03:34 +00:00

[PM-23183] Add logger data before throwing for mismatched encryptedFor (#6078)

This commit is contained in:
Shane Melton
2025-07-11 07:32:59 -07:00
committed by GitHub
parent ca1baa1220
commit 067e464ec4

View File

@@ -157,6 +157,7 @@ public class CiphersController : Controller
{
if (model.EncryptedFor != user.Id)
{
_logger.LogError("Cipher was not encrypted for the current user. CurrentUser: {CurrentUserId}, EncryptedFor: {EncryptedFor}", user.Id, model.EncryptedFor);
throw new BadRequestException("Cipher was not encrypted for the current user. Please try again.");
}
}
@@ -186,6 +187,7 @@ public class CiphersController : Controller
{
if (model.Cipher.EncryptedFor != user.Id)
{
_logger.LogError("Cipher was not encrypted for the current user. CurrentUser: {CurrentUserId}, EncryptedFor: {EncryptedFor}", user.Id, model.Cipher.EncryptedFor);
throw new BadRequestException("Cipher was not encrypted for the current user. Please try again.");
}
}
@@ -218,6 +220,7 @@ public class CiphersController : Controller
{
if (model.Cipher.EncryptedFor != userId)
{
_logger.LogError("Cipher was not encrypted for the current user. CurrentUser: {CurrentUserId}, EncryptedFor: {EncryptedFor}", userId, model.Cipher.EncryptedFor);
throw new BadRequestException("Cipher was not encrypted for the current user. Please try again.");
}
}
@@ -244,6 +247,7 @@ public class CiphersController : Controller
{
if (model.EncryptedFor != user.Id)
{
_logger.LogError("Cipher was not encrypted for the current user. CipherId: {CipherId}, CurrentUser: {CurrentUserId}, EncryptedFor: {EncryptedFor}", id, user.Id, model.EncryptedFor);
throw new BadRequestException("Cipher was not encrypted for the current user. Please try again.");
}
}
@@ -281,6 +285,7 @@ public class CiphersController : Controller
{
if (model.EncryptedFor != userId)
{
_logger.LogError("Cipher was not encrypted for the current user. CipherId: {CipherId}, CurrentUser: {CurrentUserId}, EncryptedFor: {EncryptedFor}", id, userId, model.EncryptedFor);
throw new BadRequestException("Cipher was not encrypted for the current user. Please try again.");
}
}
@@ -706,6 +711,7 @@ public class CiphersController : Controller
{
if (model.Cipher.EncryptedFor != user.Id)
{
_logger.LogError("Cipher was not encrypted for the current user. CipherId: {CipherId} CurrentUser: {CurrentUserId}, EncryptedFor: {EncryptedFor}", id, user.Id, model.Cipher.EncryptedFor);
throw new BadRequestException("Cipher was not encrypted for the current user. Please try again.");
}
}
@@ -1077,6 +1083,7 @@ public class CiphersController : Controller
{
if (cipher.EncryptedFor.HasValue && cipher.EncryptedFor.Value != userId)
{
_logger.LogError("Cipher was not encrypted for the current user. CipherId: {CipherId}, CurrentUser: {CurrentUserId}, EncryptedFor: {EncryptedFor}", cipher.Id, userId, cipher.EncryptedFor);
throw new BadRequestException("Cipher was not encrypted for the current user. Please try again.");
}
}