Skip to content

Commit a1bcda6

Browse files
committed
add a warning to the --check doc
1 parent 8bec2fb commit a1bcda6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

b3sum/what_does_check_do.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ complicated than it might seem, is that representing filepaths as text means we
88
need to consider many possible edge cases of unrepresentable filepaths. This
99
document describes all of these edge cases in detail.
1010

11+
> [!CAUTION]
12+
> `b3sum --check` (like all the Coreutils `--check` features) tells you whether
13+
> some _filepaths_ have changed, but it can't tell you whether a _directory_
14+
> has changed in general. If you generate a checkfile with something like
15+
> `b3sum my_dir/* > CHECKFILE`, then `b3sum --check CHECKFILE` will succeed
16+
> even after _new files_ are added to `my_dir`. Adding new files without
17+
> changing anything else is often enough to execute arbitrary code, for example
18+
> by shadowing an `import` in Python or installing something in `.git/hooks`.
19+
> This is confusing enough that I don't recommend using `--check` as a security
20+
> tool in new code. "Has this directory changed?" turns out to be a thorny
21+
> problem, and my recommendation is to use something like tarball hashes or Git
22+
> commits instead, even though those have their own limitations and security
23+
> issues.
24+
1125
## The simple case
1226

1327
Here's the result of running `b3sum a b c/d` in a directory that contains

0 commit comments

Comments
 (0)