Commit 90828ad
test(storemodel): three regression tests for path-traversal rejection in dropMimeData (#1466)
#1464 added a canonical-path check in StoreModel::executeDropAction that
refuses any drop whose source or destination resolves outside the
password store. The patch shipped with unit tests on the Util::isPathInStore
helper, but the integration of that helper into the drop flow was only
manually verified. These three tests close that gap by crafting mime
data with out-of-store source paths and asserting dropMimeData() returns
false without ever reaching Pass::Move/Copy.
- dropMimeDataRejectsSourceOutsideStore: mime carries /etc/passwd as
the source. canDropMimeData() lets it through (it's a UI policy
layer, not a fs check); executeDropAction's Util::isPathInStore call
must reject.
- dropMimeDataRejectsAbsoluteOutsideSource: source is a real
filesystem path inside a sibling QTemporaryDir, so the check runs
through canonical resolution on an existing path rather than a
non-existent one.
- dropMimeDataRejectsSymlinkEscape: creates a symlink physically
inside the store that resolves to a sibling QTemporaryDir, then
drops it onto a store-internal folder. canonicalFilePath() must
follow the link and reject. Unix-only — symlink creation on
Windows needs developer-mode / elevation.
Validated by temporarily defanging the guard (replacing the if
condition with `false && (...)`) — all three tests fail without the
check, confirming they actually exercise the security boundary. With
the guard in place, the qWarning output names each rejection.
Build clean. 33/33 storemodel tests pass (was 30, +3 new).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 318fd78 commit 90828ad
1 file changed
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
456 | 459 | | |
457 | 460 | | |
458 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
459 | 521 | | |
460 | 522 | | |
0 commit comments