问题 / Problem
中文:VideosResource.create 和 TasksResource.create 从 params.get("idempotency_key") 生成 Idempotency-Key header,但同一个 params 又传给 _payload 作为 JSON body,因此调用 create(..., idempotency_key="idem_1") 会同时发送 header 和 body 字段 idempotency_key。如果服务端 schema 不接受该字段,请求会被拒绝;即使接受,也会把只应属于传输层的控制参数混入业务 payload。修复应在构造 body 前移除 idempotency_key。价值:减少 4xx 请求失败和排障成本,让 SDK 参数语义更清晰可靠。English: VideosResource.create and TasksResource.create derive the Idempotency-Key header from params.get("idempotency_key"), but the same params is also passed to _payload as the JSON body, so create(..., idempotency_key="idem_1") sends both the header and a body field named idempotency_key. If the server schema rejects unknown fields, the request fails; even if accepted, a transport control parameter leaks into the business payload. Remove idempotency_key before building the body. Value: fewer 4xx failures and lower debugging cost, with clearer SDK parameter semantics.
价值 / Value
修复该问题可以提升正确性、可靠性和用户信任,降低 idempotency_key leaked into create request bodies 带来的排障与运维成本。
Fixing this issue improves correctness, reliability, and user trust while reducing debugging and operational cost caused by idempotency_key leaked into create request bodies.
证据 / Evidence
File: src/globalrouter/_resources.py
Line: 335
Severity / 严重级别: medium
Summary / 摘要: idempotency_key leaked into create request bodies
问题 / Problem
中文:
VideosResource.create和TasksResource.create从params.get("idempotency_key")生成Idempotency-Keyheader,但同一个params又传给_payload作为 JSON body,因此调用create(..., idempotency_key="idem_1")会同时发送 header 和 body 字段idempotency_key。如果服务端 schema 不接受该字段,请求会被拒绝;即使接受,也会把只应属于传输层的控制参数混入业务 payload。修复应在构造 body 前移除idempotency_key。价值:减少 4xx 请求失败和排障成本,让 SDK 参数语义更清晰可靠。English:VideosResource.createandTasksResource.createderive theIdempotency-Keyheader fromparams.get("idempotency_key"), but the sameparamsis also passed to_payloadas the JSON body, socreate(..., idempotency_key="idem_1")sends both the header and a body field namedidempotency_key. If the server schema rejects unknown fields, the request fails; even if accepted, a transport control parameter leaks into the business payload. Removeidempotency_keybefore building the body. Value: fewer 4xx failures and lower debugging cost, with clearer SDK parameter semantics.价值 / Value
修复该问题可以提升正确性、可靠性和用户信任,降低
idempotency_key leaked into create request bodies带来的排障与运维成本。Fixing this issue improves correctness, reliability, and user trust while reducing debugging and operational cost caused by
idempotency_key leaked into create request bodies.证据 / Evidence
File:
src/globalrouter/_resources.pyLine: 335
Severity / 严重级别: medium
Summary / 摘要: idempotency_key leaked into create request bodies