Repository navigation
Commit 780966d
committed
file-safety: bind the commit rename to the identity the caller authorized
rename has no conditional form, so the pathname re-check above it cannot bind an authorization made
outside this module: the path can become a link, or a different file, between the re-check and the
commit. When SafeWriteTextOptions.authorizedTarget carries the dev/ino the caller authorized, the
commit step now refuses unless the target still has that identity, which narrows the window to the
stat-plus-rename pair - it does not close it, because no OS primitive renames only if the identity
is unchanged. A failure to read the identity counts as "not that file", so the guard fails closed.
Answers PRRT_kwDOSK-bwM609gmQ (CodeRabbit row on #1917 at guardedWrite.ts:230), landing in #1911 as
ruled. Pinned interpreter v22.23.4: tsc --noEmit -p tsconfig.json exit 0 with 0 error lines; eslint
--prune-suppressions --max-warnings=0 exit 0 with src/eslint-suppressions.json deep-unchanged (265
entries, 0 differing); prettier 3.9.10 --check exit 0; the six suites that cover this file pass.
Gate at this head against merge-base 73931fe with --unified=0: 496 of 500 counted executable
lines (411 to 416 in this file), i.e. +5 as an increment over 1910's head after a rebase.1 parent f2847c4 commit 780966d
2 files changed
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
17 | 25 | | |
18 | 26 | | |
19 | 27 | | |
| |||
735 | 743 | | |
736 | 744 | | |
737 | 745 | | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
738 | 757 | | |
739 | 758 | | |
740 | 759 | | |
| |||
0 commit comments