Commit f0b8a92
feat: Server enforced rpc invoke permission (#3731)
* Secure RpcMessage against SenderClientId spoofing
When a server receives an RpcMessage, it should update the SenderClientId to match the SenderId provided by the messaging manager. This is to prevent modified clients from spoofing their SenderClientId as other clients.
* Replaced RequireOwnership with a new RpcInvokePermission
that is respected from the server for both direct and
proxy RPCs.
* Replaced RequireOwnership with a new RpcInvokePermission
that is respected from the server for both direct and
proxy RPCs.
* Add missing switch case
* Another missing switch case
* Restore and deprecate RequireOwnership in favor of RpcInvokePermission
* Only do permission validations on server
context.SenderId will be the server for a client receiving the proxied message, so the checks will not be accurate. The checks are also unnecessary considering the checks have already been done by the server.
* ClientRpc properly assigned InvokePermission
Assigning ClientRpc.InvokePermission in the constructor was incorrect. Since we can check if it is a ClientRpc easily, I just do that in ILPP
* Move test files
* Get logic working and add tests
* Mark ServerRpc.RequireOwnership as deprecated
* small fixes
* Add back RpcAttributeParams.RequireOwnership
* Update CHANGELOG
* Add InvokePermission attribute when RequireOwnership is defined
* Fix whitespace
* fix __registerRpc breaking change
* second try at fixing breaking change
* Fix ilpp to log message if NetworkManager is not connected or listening
* Update com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc.md
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
* Update com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc.md
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
* Update com.unity.netcode.gameobjects/Documentation~/terms-concepts/ownership.md
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
* Update log messages
* Fix naming in networkvariable.md doc
* Update com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc.md
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
* Update com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc.md
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
* Add invocation order documentation
---------
Co-authored-by: xmanning <166966460+xmanning@users.noreply.github.com>
Co-authored-by: xmanning <xmanning@ufl.edu>
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
Co-authored-by: Unity Netcode CI <74025435+netcode-ci-service@users.noreply.github.com>1 parent b7dcc09 commit f0b8a92
File tree
39 files changed
+995
-132
lines changed- com.unity.netcode.gameobjects
- Documentation~
- advanced-topics/message-system
- basics
- terms-concepts
- Editor/CodeGen
- Runtime
- Core
- Messaging
- Messages
- Tests
- Editor
- Runtime
- NetworkTransform
- Rpc
- testproject
- Assets
- Samples/SpawnObject
- Scripts
- Tests
- Manual
- DeltaPositionNetworkTransform
- HybridScripts
- InSceneObjectParentingTests
- NestedNetworkTransforms
- NetworkAnimatorTests
- Scripts
- Runtime
- Support
- Legacy/MultiprocessRuntime
39 files changed
+995
-132
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | | - | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
Lines changed: 112 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
218 | 328 | | |
219 | 329 | | |
220 | 330 | | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
0 commit comments