]> git.deb.at Git - rhonda/impostor.git/commitdiff
Add new cheat category for InvalidObject checks
authorminiduikboot <mini@duikbo.at>
Thu, 27 Feb 2025 22:48:00 +0000 (23:48 +0100)
committerminiduikboot <mini@duikbo.at>
Thu, 22 May 2025 21:50:28 +0000 (23:50 +0200)
For some network objects, like PlayerControl, we expect that there is an
PlayerInfo object associated to them. If there isn't, throw an exception
in this AC category

docs/Server-configuration.md
src/Impostor.Api/CheatCategory.cs
src/Impostor.Api/Config/AntiCheatConfig.cs
src/Impostor.Server/Net/Client.cs

index 0a882bab13ac129615cfc679155b2ff68146fcc1..c1cae38f217d75d72b7cfadc606bebd22d181723 100644 (file)
@@ -25,19 +25,20 @@ Impostor has an Http Server that is used by recent versions of Among Us to conne
 
 Impostor has an Anticheat that makes it possible to kick cheaters from games automatically. Note that the anticheat is tuned on the vanilla version of the game, so client-side modifications could trigger the Anticheat if you're playing with them.
 
-| Key                        | Default   | Value                                                                                                                                                                                                               |
-|----------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| **Enabled**                | `true`    | Whether the anticheat should be enabled.                                                                                                                                                                            |
-| **BanIpFromGame**          | `true`    | When anticheat is enabled and a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. |
-| **AllowCheatingHosts**     | `"Never"` | Configure whether hosts are allowed to cheat. "Never" forbids it, "Always" allows it. "IfRequested" allows hosts to cheat if they connect with the DisableServerAuthorityFlag set.                                  |
-| **EnableGameFlowChecks**   | `true`    | Enable checks that check if certain actions are done in the appropriate order or at the appropriate moment in the game. This includes changing cosmetics while in game or murdering too fast.                       |
-| **EnableMustBeHostChecks** | `true`    | Enables checks that check if players are the host before they can do actions that require them to be host of the game. This includes starting the game and spawning objects.                                        |
-| **EnableColorLimitChecks** | `true`    | Enables checks that checks if players request colors that are already in use.                                                                                                                                       |
-| **EnableNameLimitChecks**  | `true`    | Enables checks that checks if player names have a length that is possible to set using the user interface.                                                                                                          |
-| **EnableOwnershipChecks**  | `true`    | Enables checks that check if players are allowed to perform a certain action on themself or another player.                                                                                                         |
-| **EnableRoleChecks**       | `true`    | Enables checks that check if players have the correct role when performing certain role abilities like venting or murdering.                                                                                        |
-| **EnableTargetChecks**     | `true`    | Enables checks that check if certain packets to everyone that should only have been sent to certain players or vice versa. This includes sending votes or network objects.                                          |
-| **ForbidProtocolExtensions** | `true`  | If disabled allows players to send network packets that go beyond the network packets sent by the vanilla game. This is necessary for most mods that need all players to install it.                                |
+| Key                           | Default   | Value                                                                                                                                                                                                               |
+|-------------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **Enabled**                   | `true`    | Whether the anticheat should be enabled.                                                                                                                                                                            |
+| **BanIpFromGame**             | `true`    | When anticheat is enabled and a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. |
+| **AllowCheatingHosts**        | `"Never"` | Configure whether hosts are allowed to cheat. "Never" forbids it, "Always" allows it. "IfRequested" allows hosts to cheat if they connect with the DisableServerAuthorityFlag set.                                  |
+| **EnableGameFlowChecks**      | `true`    | Enable checks that check if certain actions are done in the appropriate order or at the appropriate moment in the game. This includes changing cosmetics while in game or murdering too fast.                       |
+| **EnableMustBeHostChecks**    | `true`    | Enables checks that check if players are the host before they can do actions that require them to be host of the game. This includes starting the game and spawning objects.                                        |
+| **EnableColorLimitChecks**    | `true`    | Enables checks that checks if players request colors that are already in use.                                                                                                                                       |
+| **EnableInvalidObjectChecks** | `true`    | Enables checks that check if network objects are spawned properly.                                                                                                                                                  |
+| **EnableNameLimitChecks**     | `true`    | Enables checks that checks if player names have a length that is possible to set using the user interface.                                                                                                          |
+| **EnableOwnershipChecks**     | `true`    | Enables checks that check if players are allowed to perform a certain action on themself or another player.                                                                                                         |
+| **EnableRoleChecks**          | `true`    | Enables checks that check if players have the correct role when performing certain role abilities like venting or murdering.                                                                                        |
+| **EnableTargetChecks**        | `true`    | Enables checks that check if certain packets to everyone that should only have been sent to certain players or vice versa. This includes sending votes or network objects.                                          |
+| **ForbidProtocolExtensions**  | `true`    | If disabled allows players to send network packets that go beyond the network packets sent by the vanilla game. This is necessary for most mods that need all players to install it.                                |
 
 ### Compatibility
 
index bbc8740385047e22dae57d67165d3cc6b07b8115..9972268ce54d581193a982c9d7a21bdf0641e0b2 100644 (file)
@@ -26,6 +26,9 @@ public enum CheatCategory
     /// <summary>A packet was sent to a player that should be broadcasted, or vice versa.</summary>
     Target,
 
+    /// <summary>A packet was sent on an invalid network object, like a PlayerControl without PlayerInfo.</summary>
+    InvalidObject,
+
     /// <summary>Legacy category for unsorted anticheat checks.</summary>
     Other,
 }
index 257666417e9cb07af1aef39a908e1c02d2d92bb6..b675855f9db7fd00079b9462e4d59d1f07a666aa 100644 (file)
@@ -24,6 +24,8 @@
 
         public bool EnableTargetChecks { get; set; } = true;
 
+        public bool EnableInvalidObjectChecks { get; set; } = true;
+
         public bool ForbidProtocolExtensions { get; set; } = true;
     }
 }
index 20cd05ef03582b7a224b7efca6045d3ef56d579b..2463037facd0fde8f827041f9b8ef353bd7713c2 100644 (file)
@@ -73,6 +73,7 @@ namespace Impostor.Server.Net
                 CheatCategory.Ownership => _antiCheatConfig.EnableOwnershipChecks,
                 CheatCategory.Role => _antiCheatConfig.EnableRoleChecks,
                 CheatCategory.Target => _antiCheatConfig.EnableTargetChecks,
+                CheatCategory.InvalidObject => _antiCheatConfig.EnableInvalidObjectChecks,
                 CheatCategory.Other => true,
                 _ => LogUnknownCategory(category),
             };