]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Sanitize admin UI input for role bans (#35422)
authorKillerqu00 <47712032+Killerqu00@users.noreply.github.com>
Tue, 27 May 2025 06:27:31 +0000 (07:27 +0100)
committerGitHub <noreply@github.com>
Tue, 27 May 2025 06:27:31 +0000 (23:27 -0700)
if job does not exist, log it

Content.Server/Administration/BanPanelEui.cs

index 3eedad3ed507bd350dd0ab27547f631a2a9ea5f4..0a09ad557f511906a3cd2c5820c925edfeb9d30c 100644 (file)
@@ -7,7 +7,9 @@ using Content.Server.EUI;
 using Content.Shared.Administration;
 using Content.Shared.Database;
 using Content.Shared.Eui;
+using Content.Shared.Roles;
 using Robust.Shared.Network;
+using Robust.Shared.Prototypes;
 
 namespace Content.Server.Administration;
 
@@ -19,6 +21,7 @@ public sealed class BanPanelEui : BaseEui
     [Dependency] private readonly IPlayerLocator _playerLocator = default!;
     [Dependency] private readonly IChatManager _chat = default!;
     [Dependency] private readonly IAdminManager _admins = default!;
+    [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
 
     private readonly ISawmill _sawmill;
 
@@ -121,7 +124,14 @@ public sealed class BanPanelEui : BaseEui
             var now = DateTimeOffset.UtcNow;
             foreach (var role in roles)
             {
-                _banManager.CreateRoleBan(targetUid, target, Player.UserId, addressRange, targetHWid, role, minutes, severity, reason, now);
+                if (_prototypeManager.HasIndex<JobPrototype>(role))
+                {
+                    _banManager.CreateRoleBan(targetUid, target, Player.UserId, addressRange, targetHWid, role, minutes, severity, reason, now);
+                }
+                else
+                {
+                    _sawmill.Warning($"{Player.Name} ({Player.UserId}) tried to issue a job ban with an invalid job: {role}");
+                }
             }
 
             Close();