fix(ingestion): an unlistable brain root is a scan error, not clean
PR #159 round 2: with the brain root at mode 0100 (enterable, not listable) WalkDir failed at the root, Scan discarded the error and reported clean, and startup passed while search, which goes straight into wiki/, served a planted symlink. Scan now returns the root's walk error, so startup refuses on anything but a missing root. Also pins that a cleared set is reported again when it reappears. Refs #157 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,3 +53,13 @@ func TestAlertingWarningsNamesTheSymlinkTripwire(t *testing.T) {
|
||||
w := strings.Join(alertingWarnings(func(string) string { return "" }), " ")
|
||||
assert.Contains(t, w, "symlink tripwire")
|
||||
}
|
||||
|
||||
func TestStartupSymlinkCheckRefusesAnUnlistableBrainRoot(t *testing.T) {
|
||||
if os.Geteuid() == 0 {
|
||||
t.Skip("root lists mode-0100 directories")
|
||||
}
|
||||
brain := t.TempDir()
|
||||
require.NoError(t, os.Chmod(brain, 0o100))
|
||||
t.Cleanup(func() { _ = os.Chmod(brain, 0o755) })
|
||||
assert.Error(t, startupSymlinkCheck(brain))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user