mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-05 18:48:41 +00:00
fix: multiple vulnerabilities
This commit is contained in:
@@ -294,9 +294,9 @@ namespace SharpbinV3.Server.Controllers
|
||||
)
|
||||
return Unauthorized(new { success = false, message = "Invalid API key." });
|
||||
|
||||
if (paste.AuthorUUID != HttpContext.GetJwtUser()?.UUID)
|
||||
if (paste.AuthorUUID == HttpContext.GetJwtUser()?.UUID)
|
||||
return Ok(new { success = true, message = "View not recorded for author's own paste." });
|
||||
if (paste.ExpiresAt < DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() && paste.Visibility != 0)
|
||||
if (paste.ExpiresAt != 0 && paste.ExpiresAt < DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() && paste.Visibility != 0)
|
||||
return Ok(new { success = true, message = "View not recorded for expired paste." });
|
||||
|
||||
var result = await _pasteService.RecordView(paste, HttpContext);
|
||||
|
||||
@@ -124,10 +124,7 @@ namespace SharpbinV3.Server.Controllers
|
||||
var actorIsAdmin = actorUser.Roles.HasFlag(Role.Admin);
|
||||
var isSelfUpdate = targetUser.UUID == actorUser.UUID;
|
||||
|
||||
if (
|
||||
(targetUser.Roles.HasFlag(Role.Admin) && !actorIsAdmin)
|
||||
|| (!actorIsAdmin && !isSelfUpdate)
|
||||
)
|
||||
if ((targetUser.Roles.HasFlag(Role.Admin) && !actorIsAdmin) || (!actorIsAdmin && !isSelfUpdate))
|
||||
return StatusCode(403, new { success = false, message = "You do not have permission to modify this user." });
|
||||
|
||||
if ((updatedUser.Roles.HasValue || updatedUser.IsBanned.HasValue) && !actorIsAdmin)
|
||||
|
||||
Reference in New Issue
Block a user