API Security Flaw: Client-Submitted Identity Parameter Bypasses JWT Authentication
A critical authentication vulnerability has been identified in two core API models, allowing attackers to potentially impersonate any user. The flaw stems from a dangerous design pattern where the API accepts both a cryptographically verified JWT token and a separate, client-submitted user ID parameter (`asf_uid`). This creates a fundamental ambiguity: which identity does the system trust? If backend handlers incorrectly prioritize the client-supplied `asf_uid` for authorization or audit logging, an attacker with a valid JWT for their own account could simply submit another user's ID, effectively hijacking their privileges and bypassing the intended security model.
The vulnerability is concretely located in the `atr/models/api.py` file, specifically within the `DistributeSshRegisterArgs` (lines 69-88) and `DistributionRecordFromWorkflowArgs` (lines 113-140) models. This pattern directly violates a foundational security principle: identity must be derived exclusively from verified credentials, not from parameters an attacker can freely manipulate. The system's trust is split between the server-validated JWT subject claim and a plaintext field from the request body, creating a clear attack vector for privilege escalation and data access violations.
The recommended remediation is unequivocal: remove the redundant `asf_uid` field from the API models entirely. Relying on the JWT-derived identity eliminates the ambiguity and closes the impersonation loophole. This flaw represents a significant architectural risk, exposing any downstream authorization logic, audit trails, and data access controls to potential compromise if the client-submitted parameter is ever used in place of the verified token identity.