Commit 2b4e78b
committed
Stop leaking share material to /tmp and to other users
Two findings from a full read of src/, both reproduced before fixing.
Extracted share archives were left on disk whenever anything went wrong. The
rmtree sat at the end of the loop body, so it was skipped both by the `raise`
on an invalid share and by the `continue` on an unreadable one. A single failed
decrypt left /tmp/fractum_share_* holding share_N.txt and, when the archive had
been built with --bundle-encrypted, the ciphertext beside it. Accumulate enough
of those and the leftovers alone are enough to reconstruct. Cleanup moves into
a finally.
Nothing set permissions on any output, so the process umask decided them: the
share archives, the .enc file and the reconstructed plaintext all landed as
-rw-r--r--, readable by every user on the machine. They are now created 0600.
Verified: a share with corrupt JSON now leaves zero temp directories, the three
outputs are -rw-------, the encrypt/decrypt round trip through the official
image with --network=none returns an identical SHA-256, and the suite is still
107 tests, 8/8 files.1 parent 2497888 commit 2b4e78b
3 files changed
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
587 | 595 | | |
588 | 596 | | |
589 | 597 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| |||
0 commit comments