beacon.RequireInitiatorIsPartyLeader

beacon.RequireInitiatorIsPartyLeader

#Overview

name: beacon.RequireInitiatorIsPartyLeader

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of beacon.RequireInitiatorIsPartyLeader is to enforce validation for party reservation Remote Procedure Calls (RPCs) by ensuring that the initiator of the reservation RPC is the party leader. This setting is part of the online subsystem utils and is specifically used in the party beacon functionality.

This setting variable is primarily used in the OnlineSubsystemUtils plugin, which is part of Unreal Engine’s networking and online services infrastructure. It’s specifically utilized in the PartyBeaconClient module, which handles party-related networking operations.

The value of this variable is set as a console variable using the TAutoConsoleVariable class. It’s initialized with a default value of true, meaning the validation is enabled by default.

The associated variable CVarRequireInitiatorIsPartyLeader directly interacts with beacon.RequireInitiatorIsPartyLeader. They share the same value and purpose.

Developers must be aware that when this setting is enabled (which is the default), it adds an additional layer of security to party-related RPCs. This means that only the party leader can initiate certain reservation RPCs, which can prevent unauthorized members from making changes to the party’s state or reservations.

Best practices when using this variable include:

  1. Keeping it enabled in most scenarios to maintain security in party operations.
  2. Only disabling it if there’s a specific need for non-leader party members to initiate reservation RPCs.
  3. If disabling it, ensure that other security measures are in place to prevent misuse of party reservation functions.

Regarding the associated variable CVarRequireInitiatorIsPartyLeader:

The purpose of CVarRequireInitiatorIsPartyLeader is identical to beacon.RequireInitiatorIsPartyLeader. It’s the actual console variable object that controls the behavior described above.

This variable is used in the IsRPCInitiatorValid function to determine whether the initiator of an RPC is valid based on whether they are the party leader. The function uses GetValueOnGameThread() to retrieve the current value of the setting.

Developers should be aware that changing the value of CVarRequireInitiatorIsPartyLeader at runtime will immediately affect the behavior of party-related RPCs. They should also ensure that any code relying on non-leader party members initiating reservation RPCs is updated if this setting is enabled.

Best practices for CVarRequireInitiatorIsPartyLeader include:

  1. Using GetValueOnGameThread() to access its value, as shown in the example code.
  2. Considering the implications on game design and network security when modifying this value.
  3. Documenting any changes to this setting and communicating them to the team, as it can have significant impacts on party functionality.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconClient.cpp:46

Scope (from outer to inner):

file
namespace    BeaconConsoleVariables

Source code excerpt:

	/** Whether to restrict party reservation RPCs to require that the initiator is the party leader. */
	TAutoConsoleVariable<bool> CVarRequireInitiatorIsPartyLeader(
		TEXT("beacon.RequireInitiatorIsPartyLeader"),
		true,
		TEXT("Enforce RPC validation which checks whether the initiator of a reservation RPC is the party leader\n")
		TEXT("Enabled"),
		ECVF_Default);
}

#Associated Variable and Callsites

This variable is associated with another variable named CVarRequireInitiatorIsPartyLeader. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconClient.cpp:45

Scope (from outer to inner):

file
namespace    BeaconConsoleVariables

Source code excerpt:


	/** Whether to restrict party reservation RPCs to require that the initiator is the party leader. */
	TAutoConsoleVariable<bool> CVarRequireInitiatorIsPartyLeader(
		TEXT("beacon.RequireInitiatorIsPartyLeader"),
		true,
		TEXT("Enforce RPC validation which checks whether the initiator of a reservation RPC is the party leader\n")
		TEXT("Enabled"),
		ECVF_Default);
}

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/PartyBeaconClient.cpp:57

Scope (from outer to inner):

file
namespace    anonymous
function     bool IsRPCInitiatorValid

Source code excerpt:

	bool IsRPCInitiatorValid(const FUniqueNetIdRepl& BeaconOwner, const FUniqueNetIdRepl& RequestPartyLeader)
	{
		const bool bInitiatorValidationEnabled = BeaconConsoleVariables::CVarRequireInitiatorIsPartyLeader.GetValueOnGameThread();
		const bool bInitiatorIsValid = bInitiatorValidationEnabled ? (RequestPartyLeader.IsValid() && RequestPartyLeader == BeaconOwner) : true;
		return bInitiatorIsValid;
	}
}

/** Max time to wait for a response from the server for CancelReservation */