Skip to content

Commit b09648a

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

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 by installing something in
19+
> `.git/hooks`. This is confusing enough that I don't recommend using `--check`
20+
> as a security tool in new code. "Has this directory changed?" turns out to be
21+
> a thorny problem, and my recommendation is to use something like tarball
22+
> hashes or Git commits instead, even though those have their own limitations
23+
> and security 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)