Fix score uploading exploit

This commit is contained in:
Slendy 2022-11-05 22:37:16 -05:00
parent 84e2914e40
commit b0d780b91e
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -4,6 +4,7 @@ using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Levels;
using LBPUnion.ProjectLighthouse.Logging;
using LBPUnion.ProjectLighthouse.Match.MatchCommands;
using LBPUnion.ProjectLighthouse.PlayerData;
using LBPUnion.ProjectLighthouse.PlayerData.Profiles;
using LBPUnion.ProjectLighthouse.Serialization;
@ -74,6 +75,13 @@ public class ScoreController : ControllerBase
return this.BadRequest();
}
if (!score.PlayerIds.Contains(username))
{
Logger.Warn("Rejecting score upload, requester username is not present in playerIds" +
$" (user={username}, playerIds={string.Join(",", score.PlayerIds)}", LogArea.Score);
return this.BadRequest();
}
SanitizationHelper.SanitizeStringsInClass(score);
if (slotType == "developer") id = await SlotHelper.GetPlaceholderSlotId(this.database, id, SlotType.Developer);