Commit c2174c5
fix(security): redact PasswordInput-masked field values from inline rows (#504)
The inline half of the #504 detail-view fix (#522). A field an inline
masks with `forms.PasswordInput` (typically
`formfield_overrides = {CharField: {"widget": PasswordInput}}`) was
serialized into the inline row payload **with its stored value intact** —
so a secret kept on that field shipped as plaintext in the detail JSON
(visible in the network tab), even though Django's admin renders a
PasswordInput with `render_value=False` and never echoes it back.
- `inlines.py`: `_password_redacted_fields` reads the inline's own bound
form widgets (the source of truth Django already applied via
`get_formset`, so `formfield_overrides` and a custom inline `form` are
both honoured) and `_rows_for_inline` ships `null` for those fields —
never reading or serializing the secret. `render_value=True` opts back
in, matching the top-level fix. Degrades to no-redaction on any error
(never 500s the parent detail).
This is the value-redaction (security) half — no wire-contract change
(the value was already nullable). Masking the inline input itself
(`widget: "password"` on `InlineFieldMeta`) is a wire-contract addition
left as a separate Tier-5 follow-up; the secret no longer leaks either way.
Tests (`tests/test_inlines.py`): a CharField masked via formfield_overrides
ships `null` for every row; a plain inline still ships the value (no
read-path regression); `render_value=True` preserves it. Inline + detail +
security + create + update suites green (102). ruff / mypy / black clean.
Refs #504, #522
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent bc9a001 commit c2174c5
2 files changed
Lines changed: 122 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
293 | 294 | | |
294 | 295 | | |
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 | + | |
296 | 327 | | |
297 | 328 | | |
298 | 329 | | |
| |||
306 | 337 | | |
307 | 338 | | |
308 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
309 | 343 | | |
310 | 344 | | |
311 | 345 | | |
312 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
313 | 352 | | |
314 | 353 | | |
315 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
0 commit comments