From 562f5ed7971603a4e4e3315a7fe4188153bfc205 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 15 Jan 2025 10:07:51 +0900 Subject: fst: hide sockets exposed via Filesystem This is mostly useful for permissive defaults. Signed-off-by: Ophestra --- fst/path.go | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 fst/path.go (limited to 'fst/path.go') diff --git a/fst/path.go b/fst/path.go new file mode 100644 index 00000000..2bdab87c --- /dev/null +++ b/fst/path.go @@ -0,0 +1,11 @@ +package fst + +import ( + "path/filepath" + "strings" +) + +func deepContainsH(basepath, targpath string) (bool, error) { + rel, err := filepath.Rel(basepath, targpath) + return err == nil && rel != ".." && !strings.HasPrefix(rel, string([]byte{'.', '.', filepath.Separator})), err +} -- cgit v1.3.1