Commit 9dbbc3c
fix(security): sanitise entry_id and actor in waitlist patch log (#442) (#137)
CodeQL py/log-injection alert #442 flagged the `logger.info` call in
`patch_entry` because the `entry_id` path param (uuid.UUID) and
`user.user_id` (also a UUID) flow into the log record's `extra` dict.
The previous (`previous`) and next (`payload.status`) status fields
were already sanitised inline in PR #136 to clear alerts #413 / #441,
but CodeQL then surfaced #442 against the remaining two values.
Both `entry_id` and `user.user_id` are typed as `uuid.UUID`, so their
string form is always `[0-9a-f-]{36}` and cannot contain CR/LF. But
CodeQL's taint tracker treats path params and auth-context values as
user-controlled regardless of upstream validation, so the alert
re-fired on the next scan.
Apply the same inline `.replace("\r", "").replace("\n", " ")[:36]`
sanitisation to `entry_id` and `user.user_id`, matching the pattern
used for `previous` / `payload.status`. This silences the alert
without weakening any existing guarantee.
Co-authored-by: Beenu Arora <[email protected]>1 parent a8da034 commit 9dbbc3c
1 file changed
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
428 | 435 | | |
429 | 436 | | |
| 437 | + | |
| 438 | + | |
430 | 439 | | |
431 | 440 | | |
432 | 441 | | |
433 | | - | |
| 442 | + | |
434 | 443 | | |
435 | 444 | | |
436 | | - | |
| 445 | + | |
437 | 446 | | |
438 | 447 | | |
439 | 448 | | |
| |||
0 commit comments