Merge pull request 'fix: Prevent locals() from polluting player PATCH data dict' (#4) from fix/locals-pollution-patch-endpoint into main
All checks were successful
Build Docker Image / build (push) Successful in 2m45s

Reviewed-on: #4
This commit is contained in:
cal 2026-02-04 21:00:23 +00:00
commit ffcf0611b7
2 changed files with 5 additions and 4 deletions

View File

@ -1 +1 @@
2.5.2
2.5.3

View File

@ -117,12 +117,13 @@ async def patch_player(
):
"""Patch a player (partial update)."""
# Build dict of provided fields
data = {}
# IMPORTANT: Capture locals() BEFORE creating data dict to avoid including 'data' itself
locals_dict = locals()
data = {}
for key, value in locals_dict.items():
if key not in ('player_id', 'token') and value is not None:
if key not in ('player_id', 'token', 'locals_dict') and value is not None:
data[key] = value
return PlayerService.patch_player(player_id, data, token)