Skip to content

Commit 8131f09

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

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

b3sum/what_does_check_do.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ 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+
> [!WARNING]
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. For example, if you generated a checkfile with
15+
> something like `b3sum my_dir/* > CHECKFILE`, then `b3sum --check CHECKFILE`
16+
> can succeed even if _new files_ are added to `my_dir`. Adding new files
17+
> without editing anything is often enough to execute arbitrary code, for
18+
> example by confusing `import` statements in Python. This is confusing enough
19+
> that I don't recommend using `--check` as a security tool in new code. "Has
20+
> this directory changed?" turns out to be a thorny problem, and my
21+
> recommendation is to use something like tarball hashes or Git commits instead
22+
> (even though those have their own limitations and security issues).
23+
1124
## The simple case
1225

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

0 commit comments

Comments
 (0)