Commit Graph
100 Commits
Author SHA1 Message Date
miniduikboot 01e9cccdf5 Set PlayerLevel in PlayerInfo on RPC SetLevel
Previously this used to be done by the host, but this is now the
server's responsibility.
2024-08-20 21:41:38 +02:00
miniduikbootandjs6pak fc79bd1536 Add Message24EndGameHostMigration serialization
Looks like Innersloth added this but hasn't actually used this. Weird..

When sent it makes the new host perform a full rejoin, which gums up
Impostor's spawning logic. Fixing that causes the client to gum itself
up. Sigh.

After some testing it seems like host migration still works fine, so
this investigation wasn't needed. Committing for posterity.

Co-Authored-By: js6pak <me@6pak.dev>
2024-08-20 21:41:38 +02:00
miniduikboot 9e1abe07ef Switch PlayerName writes to Outfit
In 2024.6.18 Innersloth changed the storage location of the PlayerName
from PlayerInfo to PlayerOutfit. If we don't set the PlayerName, we'll
send an incomplete PlayerInfo to new players, so new players are unable
to stay connected as they will not receive complete PlayerInfo objects
before a timeout in the client activates.

Because we publish PlayerName in the API, we can't completely remove
the PlayerName field from PlayerInfo. We also use it internally in a few
places, so I don't this is worth removing.
2024-08-20 21:41:38 +02:00
miniduikboot ccd36b6571 Sync over tasks
As tasks used to be part of the GameData, 2024.6.18 has moved them to
the PlayerInfo. Because they are now called on the PlayerInfo of the
correct player, the playerId field in the RPC is no longer necessary.
2024-08-20 21:41:38 +02:00
miniduikboot 44e9dfe28d Bump to 2024.8.13
Network side seems unchanged and officials allow crossplay
2024-08-20 21:41:38 +02:00
miniduikboot 09cadcb63b Spawn PlayerInfo's if host is not authoritive
This PlayerInfo also needs to be synced over if it is server owned
2024-08-20 21:41:38 +02:00
miniduikboot b118af12be Add NetId to SetName and SetColor
2024.6.18 adds a NetId field *in front* of the existing fields to help link back to the PlayerInfo. We don't actually need this NetId and assume it's called on the correct PlayerControl, so we ignore it.
2024-08-20 21:41:38 +02:00
miniduikboot 372ed8511f Set RoleWhenAlive when set to a Ghost role 2024-08-20 21:41:38 +02:00
miniduikboot 85296d2d46 Serialize Color -1 as 0 in PlayerOutfit
Official servers send 0 instead of -1 when the outfit is still
incomplete to prevent some client issues.
2024-08-20 21:41:38 +02:00
miniduikboot c43fdd2a69 Demote InnerGameData, promote InnerPlayerInfo
In 2024.6.18 Innersloth promoted PlayerInfo to its own network object, and gave it to the server. InnerGameData is now a container that holds these players. This commit implements the changes necessary to handle these separate PlayerInfo network objects.
2024-08-20 21:41:38 +02:00
miniduikboot 615469c6c8 Add dirty tracking to PlayerOutfit
To prevent excessive modifications in the codebase, which is prone to
issues if a callsite is missed, automatically do this using properties.

Keep the access modifiers intact for now.
2024-08-20 21:41:38 +02:00
miniduikboot 482b8c2b72 Add sequence id's to playeroutfit 2024-08-20 21:41:38 +02:00
miniduikboot 2eca9b4e9f Add canOverrideRole param to SetRole
This is currently unused by Innersloth
2024-08-20 21:41:38 +02:00
miniduikboot 079f58a7b7 Implement GameOptions V8
This adds a field for RulesPresets and SpecialGameModes, as well as
RoleOptions for the new roles.
2024-08-20 21:41:38 +02:00
miniduikboot c315ef9c28 VoteBanSystem now contains itself as a component
This makes it consistent with the other spawnables.
2024-08-20 21:41:38 +02:00
miniduikboot 0e7372d9d9 Update Dumpostor to v1.0.1 and run for 6.18
Add the RulesPresets and SpecialGamemodes enums
2024-08-20 21:41:38 +02:00
miniduikboot bf5a2c2be5 Prepare for 2024.6.18 update
Major changes are incoming, this doesn't yet work.
2024-08-20 21:41:38 +02:00
miniduikboot 066eca09ee Add scene param to forbidden scene log statement
I'm seeing multiple warnings in my server log about forbidden scene
changes. Unfortunately this warning does not include the actual scene
that was triggering the issue, which makes diagnosis/remediation difficult.

Additionally change this logging call to use names suitable for
structured logging.
2024-08-20 17:18:00 +02:00
miniduikboot 35c66cda5f Change default ListenIp to match with config
The default ListenIp for the base game server has been set to 0.0.0.0 in
config.json for as long as I remember, and a different value is only
sporadically used. I remember a case where someone was fancy with Split
DNS. 0 is better as a default than localhost, so change the code
accordingly to aligh with config.json
2024-08-10 18:50:57 +02:00
miniduikboot 2d82e1af19 Bump System.Text.Json to 8.0.4
Fixes CVE-2024-30105 (High 7.5/10)
https://github.com/advisories/GHSA-hh2w-p6rv-4g7w

Impostor doesn't use the affected
JsonSerializer.DeserializeAsyncEnumerable method as it doesn't accept
JSON formatted payloads, but the NU1903 warning is shown on all builds,
leading to warning fatigue.
2024-07-29 19:59:24 +02:00
miniduikboot c6bad15346 Let hosts handle exiles
Previously Impostor liked to kill exiled players server side to raise an
event. This is quite early, as the host will SetRole them to a ghost
role later.

However as PlayerInfo is server-owned by default in 2024.6.18, it starts
killing players client side. This caused meetings to immediately
conclude if the final impostor was voted out, ruining the cutscene.

So this commit makes Impostor wait for hosts to actually kill the player
using SetRole. Do set the LastDeathReason property though for players
using the API.
2024-07-29 19:58:33 +02:00
miniduikboot b26f451a07 Make Start/Finish GameData API public 2024-07-29 19:57:52 +02:00
miniduikboot 4f7ef58b00 Refactor Start/FinishRpc to add GameData methods
Rpc's are a specific sort of GameData packets, so it makes sense to
split and extract a method for sending GameData packets from these functions.
2024-07-29 19:57:52 +02:00
miniduikbootandjs6pak fe3ea67510 Don't DC the client if they send an unknown flag
This item is only used in a LogTrace call, so it seems excessive to kick
a player on servers just for a log statement

Co-Authored-By: js6pak <me@6pak.dev>
2024-07-27 19:13:42 +02:00
miniduikboot c522dd9f88 Add compatibility option to allow host authority
There are various bugs in the 2024.6.18 implementation of host-authoritive
multiplayer such that I can't recommend players to use it. Fixing these
issues on the server side is impossible, and I can't smell remotely if
clients have applied the necessary fixes. The currently known bugs
include at least:

- Unable to join more than 8 players in a room
- Unable for new players to join if host switched from host authoritive
  to server authoritive
- Host is unable to kill if it is in a host authoritive game while it
  thinks it is in server authoritive mode

If Innersloth fixes this mode in future game patches, this option may be
reconsidered.
2024-07-27 18:49:04 +02:00
miniduikboot 46caeb76c2 Add new option to full config example
Some people were confused by config-full.json, thinking that this file
should be edited too. This is not the case and the values in this file
don't apply as it was only meant as an example, so rename the file to
make that more clear.

Also update this file to add the options from the Modular Anticheat
2024-07-27 17:05:34 +02:00
miniduikboot b218079f9e Merge pull request #599 from miniduikboot/fix/compatman-no-invalid-clients
Improve CompatMgr behaviour for unknown versions
2024-07-19 20:11:44 +02:00
miniduikboot a61524842f Improve CompatMgr behaviour for unknown versions
Currently, Impostor will show an "Client is in an invalid state."
message if a player tries to join a match where the host or the joining
player is using a version unknown to Impostor.

This message confused a *lot* of people, so this PR changes the API such
that if the version is not registered, the version itself is put in a
compatibility group and compared, assuming no other game versions are
compatible with it. This works fine in most cases, as Among Us network
versions generally increase over time.

Failure on 2222.2.2 (which is ancient at this point, so likely no longer
used) and future cases where Innersloth messes up (which is unlikely) is
an acceptable consequence to me.
2024-06-14 21:49:12 +02:00
miniduikboot 34c14f69a4 Merge pull request #598 from miniduikboot/fix/custom-rpc-gamelogic
Accept RPC's called on GameManager
2024-06-14 07:13:20 +02:00
miniduikboot da0ee81b5d Accept RPC's called on GameManager
Previously Impostor would just throw when a method was called on a
GameManager, but this caused issues with client mods that did just this,
even through vanilla never calls an RPC on GameManager.

This commit changes that throw statement to pass the exception to the
custom message handler/anticheat instead, which is also how it works for
the other NetObjects
2024-06-13 20:52:25 +02:00
miniduikboot 468a71d01e Merge pull request #597 from Impostor/feature/2024.6.4
Add 2024.6.4 game version
2024-06-05 19:43:03 +02:00
miniduikboot 6f05946689 Bump Impostor version 2024-06-05 19:16:59 +02:00
miniduikboot b2a9bab125 Add 2024.6.4 game version
Officials allow crossplay and after inspecting the Mono I don't see any
major changes, so I'm following officials here
2024-06-04 20:42:18 +02:00
miniduikboot 9f55fe205d Prepare release 1.9.2 2024-06-01 16:12:10 +02:00
miniduikboot 734643c8c9 Merge pull request #596 from miniduikboot/fix/cleanup-disposed-clients
Clean up clients that refuse to quit properly
2024-05-30 21:47:31 +02:00
miniduikboot 661421da5a Clean up clients that refuse to quit properly
When a player is kicked or banned from a game, the client is expected to
disconnect in response. When they decide not to *or* the disconnect
packet is lost, Impostor just silently disposes of the connection.
This does not remove them from ClientManager, which is how I tracked
this bug down.

By sending them a proper disconnect message, clients should have
received *a* disconnection message before dropping their connection.

Future work should split this entire method in removing players from a
game and processing kick/bans because the latter feature is not relevant
for other callers of this method.
2024-05-26 22:05:21 +02:00
miniduikboot ff2e80d939 Merge pull request #594 from miniduikboot/feature/refine-modular-ac
Change some anticheat checks categories
2024-05-11 13:54:49 +02:00
miniduikboot ddd701320d Add similar AC check to HandleSetName 2024-04-28 20:55:50 +02:00
miniduikboot be39c9facf Move Name checks to NameLimits 2024-04-28 20:55:50 +02:00
miniduikboot 6f56e1acaf Move remaining Color checks to ColorLimits
Some mods add custom colors and still use the standard vanilla SetColor
RPC, which leads to issues with this check.
2024-04-28 20:50:41 +02:00
miniduikboot f1f5185f10 Merge pull request #593 from Pietrodjaowjao/master
Patch game-breaking exploits
2024-04-28 20:44:40 +02:00
miniduikboot 414303b2c1 Documentation: Update .NET 7 to .NET 8 2024-04-28 18:31:34 +02:00
miniduikboot ac12bacb00 Merge pull request #591 from NikoCat233/add-broadcast-check-to-most-of-calls
[AntiCheat] Add ValidateBroadCast check to most of the rpc calls
2024-04-28 08:22:55 +02:00
miniduikboot 2f3e1a620b Fix embarrassing bugs 2024-04-27 20:20:04 +02:00
miniduikboot d391b24aad Remove use of SetInfected RPC
Client no longer sends the RPC nor does anything with it when receiving it
2024-04-27 16:55:50 +02:00
miniduikboot 5854000220 Refactor if statements to be more vertically dense
Multiple guard clauses make the file harder to navigate, so put them in
a single guard clause with one validation rule per line. Some statements
in the file were already set up like this, so this commit makes it consistent
2024-04-27 16:45:15 +02:00
miniduikboot ef022b04e4 Add Broadcast checks to remaining RPC's 2024-04-27 16:43:50 +02:00
miniduikboot 155c3e69d9 Merge pull request #589 from miniduikboot/feature/game-created-event-add-host
Add Host property to IGameCreatedEvent
2024-04-21 21:44:24 +02:00
miniduikboot 2c0f45c5d1 Add Host property to IGameCreatedEvent
When a game has just been created, it does not yet have any players in
them, and as a result you can't get the host or its connection id when
this event is called. This makes it annoying to link between this event
and the IGameCreationEvent that came just before it.

Having this link is useful for the usecase of a game code allocation
plugin that allocates codes from a pool, and needs to return codes to
a pool if these codes weren't picked.
2024-04-12 22:53:01 +02:00
miniduikboot 9b7b1e8b26 Merge pull request #571 from Impostor/bugfix/misc-ac
Miscellaneous Anticheat fixes
2024-04-04 20:17:44 +02:00
miniduikboot 1a11b5f43e Rework Color calculation loop to always terminate 2024-04-04 20:12:44 +02:00
miniduikboot bdd65e9e9f Don't dequeue a color when none are available 2024-04-04 20:10:23 +02:00
miniduikboot ba9eeb5bb4 Check AC config in SetName/Color checks
Previously this was not done causing these checks to be unconditionally enabled
2024-04-04 20:10:23 +02:00
miniduikboot 5dafd9fe5b Allow host-only mods to desync kill timeouts 2024-04-04 20:10:23 +02:00
miniduikboot 7f943e6b2e Allow host-only mods to desync murder roles 2024-04-04 20:10:23 +02:00
miniduikboot 28f3cb3b2e Make Impostor's AC modular (#559)
* Add extra configuration options for the anticheat

* Implement option to exempt hosts from AC checks

* Add AntiCheatConfig to InnerNetObject and friends

* Categorize calls in InnerNetObject.Anticheat

* Categorize other calls to ReportCheatAsync

* Update cosmetics AC handling

When Innersloth changed SetHat etc to SetHatStr as part of the cosmicube
update we accidentally created a few dead methods. Restore and update
the code.

* Push up cheat category to ReportCheatAsync

This makes it possible to log failed checks for diagnosis. Also much
cleaner now that we don't have to push AntiCheatConfig everywhere.
Should've done this immediately q.q

* Add back old version of ReportCheatAsync

some plugins used this method. affected plugins should rebuild after the
next impostor release

* Add documentation for modular anticheat

* Address comments

* Sort AntiCheatConfig keys

* Rework the option to allow cheating hosts

This option should actually be tristate: to not break host-only mods we
should disable the anticheat for hosts running host-only mods.

* Document CheatingHostMode

* Split Limits category in Color and Name Limits
2024-04-04 20:09:59 +02:00
miniduikboot 7a49d2d917 Prepare release 1.9.1 2024-04-03 19:59:30 +02:00
miniduikboot 092504f2f1 Merge pull request #573 from ykundesu/fix/AprilFools2024
fixed AprilFools2024 Deserialize error
2024-04-01 13:30:35 +02:00
miniduikboot 453d12171e Fix compile warning 2024-04-01 13:23:18 +02:00
miniduikboot 2be1d68eeb Merge pull request #569 from Impostor/feature/2024.3.5
Feature/2024.3.5
2024-03-30 16:25:41 +01:00
miniduikboot c7ea59fed9 Run Dumpostor on 2024.3.5 2024-03-06 21:07:09 +01:00
miniduikboot 6cc2185915 Add new game version for 2024.3.5
Officials don't allow crosplay either, so neither should we
2024-03-06 21:06:16 +01:00
miniduikboot 7b23d80978 Merge pull request #563 from Impostor/feature/net8
Upgrade to net8.0
2024-01-25 12:31:07 +01:00
miniduikboot 1582b2c65a Merge pull request #564 from Impostor/hotfix/docker-actions
Migrate to environment files correctly
2024-01-25 12:26:35 +01:00
miniduikboot 81753a53e0 Migrate to environment files correctly
See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2024-01-25 12:21:56 +01:00
miniduikboot a9fdd82345 Merge pull request #562 from Impostor/fix/http2-warning
Don't set HTTP protocols explicitly
2024-01-25 12:15:43 +01:00
miniduikboot d06b21b066 Merge pull request #561 from miniduikboot/chore/update-gh-actions
Update Github actions
2024-01-25 12:15:26 +01:00
miniduikboot c1fb4336df Merge pull request #560 from Impostor/fix/dleks
Allow spawning in the Dleks map
2024-01-25 12:14:59 +01:00
miniduikboot 9c02a912b4 Merge pull request #557 from miniduikboot/fix/http-default-listenip
Change default ListenIp of Http server to 0.0.0.0
2024-01-25 12:14:31 +01:00
miniduikboot 3143c67eb4 Merge pull request #552 from Impostor/feature/options-changed-event
Implement event to detect game option changes
2024-01-25 12:14:02 +01:00
miniduikboot 012e45c6a9 Remove unnecessary using directive 2024-01-25 12:05:09 +01:00
miniduikboot 165621a8cc Update Github actions
- Update versions to the latest one
- Get rid of .gitmodules as we dumped that years ago
- Change ::set-output to output files as the former is slated for removal
2024-01-24 21:37:37 +01:00
miniduikboot 83fe5814ab Only throw warning outside of docker containers 2024-01-24 21:21:07 +01:00
miniduikboot d640f90d88 Allow spawning in the Dleks map
Now with 100% less crash cascades on spawn attempts and it even includes
working map data!
2024-01-24 20:45:21 +01:00
miniduikboot f4f10269b2 Show both warnings 2024-01-24 19:55:35 +01:00
miniduikboot 880951c5b8 Add warning message for direct configuration 2024-01-24 18:13:02 +01:00
miniduikboot 3b514f82f2 Change default ListenIp of Http server to 0.0.0.0
We see that a lot of support tickets are caused by this default setting,
as it is one of the things that blocks connections to the server with no
obvious indication that this is happening. To make it easier for first
time users to set up Impostor, it is important that this setting is
changed.

Previously we also recommended against direct exposing due to security
reasons, but I believe this fear to be unfounded: Microsoft claims that
the Kestrel server is hardened against web server vulnerabilities and
supports its use both with and without a reverse proxy.[1]

We still recommend using reverse proxies if HTTPS support is needed, so
that section of documentation still remains. Setting the ListenIp to
127.0.0.1 is still recommended when using a reverse proxy to remove the
ability for people to connect directly, so we add it there as a recommendation.

[1]: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/when-to-use-a-reverse-proxy?view=aspnetcore-8.0
2024-01-10 19:17:38 +01:00
miniduikbootandjs6pak b5ea1d8864 Update docs to reflect http plugin merge (#546)
Co-authored-by: js6pak <me@6pak.dev>
2023-12-17 20:22:36 +01:00
miniduikboot 6e03e90bd0 Merge pull request #553 from Impostor/feature/2023.11.28
Add new network version for 2023.11.28
2023-12-03 23:27:05 +01:00
miniduikboot 87fd177e39 more comments sent over discord pm's 2023-12-03 22:55:05 +01:00
miniduikboot fa024b70c5 Process comments 2023-12-03 22:49:13 +01:00
miniduikboot 2c12623a65 Get rid of Rpc02 SyncSettings
This RPC is still sent by clients, but no longer used by clients. As the
server can get the info it wants from LogicOptions instead, remove this
RPC to prevent people from using it accidentally
2023-11-29 22:14:59 +01:00
miniduikboot e303065688 Process comments 2023-11-28 23:09:39 +01:00
miniduikboot 92920357f8 Add new network version for 2023.11.28
Did a quick run through, didn't seem too broken
2023-11-28 20:25:38 +01:00
miniduikboot 5edb409388 Implement event to detect game option changes
This can be triggered by both RPC 02 and a(nother) plugin calling
SyncSettings to force certain settings on the host. Users of this API
could cause this event to recurse by calling SyncSettingsAsync inside an
event handler, so we prevent such reasonable foreseeable misuse.
2023-11-26 23:16:11 +01:00
miniduikboot 66763a4066 Merge pull request #549 from Impostor/feature/2023.10.24
Feature/2023.10.24
2023-11-17 22:08:18 +01:00
miniduikboot c592bd1a9e Debounce CheckMurder calls
In games where players have a high ping, they can get disconnected if
they try and murder a player twice. If a player tries to kill a player
again while they are still under a cooldown from their previous kill,
cancel their request if the game is server authoritive and don't process
it anymore if the game is host authoritive
2023-11-16 17:55:50 +01:00
miniduikboot acb923e3a3 Fix SA1629 violations 2023-11-10 19:11:46 +01:00
miniduikboot d4342dee35 Actually implement CNT serialization 2023-11-10 19:11:46 +01:00
miniduikbootandjs6pak 86423a0b3c Update src/Impostor.Server/Net/State/Game.cs
Co-authored-by: js6pak <kubastaron@hotmail.com>
2023-11-10 16:13:10 +01:00
miniduikboot 21d1333b08 Make API remarks show up in the documentation
Some xmldoc processors don't process stuff that is not inside a remarks
tag, so we add them here.
2023-11-10 15:41:48 +01:00
miniduikboot b65f139eff Bump priority of the unsupported version logging
Currently this only gives an error message on the client but doesn't
send extra details to the server log in the default setup
2023-11-10 14:43:55 +01:00
miniduikboot b67ca158ea Refresh Murder Event API
- IPlayerCheckMurderEvent now exists
- You can see if a kill was successful with IPlayerMurderEvent
- You can now see if host authority was requested with Game.IsHostAuthoritive
2023-10-29 00:37:30 +02:00
miniduikboot 946d7e2164 Implement server side guardian angel 2023-10-28 23:05:28 +02:00
miniduikboot b038d0e098 Cleanup previous commit 2023-10-27 00:00:21 +02:00
miniduikboot 821a2248a7 Fix MurderPlayer for vanilla clients
In 2023.10.24, vanilla started expecting that CheckMurder is handled on
the server. That is, unless the host is modded, then CheckMurder calls
are handled by the host as before
2023-10-26 23:14:09 +02:00
miniduikboot 3d60cf58a9 Skip deserializing the UpdateSystem RPC for now
Innersloth merged RepairSystem and UpdateSystem into one RPC and the
decoding now depends on *which* system is being deserialized.
2023-10-25 22:29:39 +02:00
miniduikboot fd2d457e6b Clean up stuff for old versions 2023-10-25 21:37:38 +02:00
miniduikboot 5c31df8c05 Cleanup code 2023-10-25 21:37:29 +02:00
miniduikboot b0901507f7 Rework CustomNetworkTransform
Innersloth has changed CNT from position/velocity to a queue of
positions. As a result, drop the velocity as well.

We're currently not tracking the current position of the player, so
we're just storing the last one
2023-10-25 21:28:03 +02:00