internal/pkg: optionally validate flat pathnames
All checks were successful
Test / Create distribution (push) Successful in 43s
Test / Sandbox (push) Successful in 2m34s
Test / Hakurei (push) Successful in 3m35s
Test / ShareFS (push) Successful in 3m37s
Test / Hpkg (push) Successful in 4m21s
Test / Sandbox (race detector) (push) Successful in 4m57s
Test / Hakurei (race detector) (push) Successful in 5m50s
Test / Flake checks (push) Successful in 1m42s

This makes the decoder safe against untrusted input without hurting performance for a trusted stream. This should still not be called against untrusted input though.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-01-03 18:59:18 +09:00
parent ce249d23f1
commit 55465c6e72
2 changed files with 19 additions and 4 deletions

View File

@@ -85,7 +85,7 @@ func TestFlatten(t *testing.T) {
t.Fatalf("Flatten: error = %v", err)
}
s := pkg.NewDirScanner(bytes.NewReader(buf.Bytes()))
s := pkg.NewDirScanner(bytes.NewReader(buf.Bytes()), true)
var got []pkg.FlatEntry
for s.Scan() {
got = append(got, *s.Entry())