aboutsummaryrefslogtreecommitdiffhomepage
path: root/fst/path.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-01-15 10:07:51 +0900
committerOphestra <cat@gensokyo.uk>2025-01-15 10:13:18 +0900
commit562f5ed7971603a4e4e3315a7fe4188153bfc205 (patch)
tree2a751ea418e305c97bcef5625b5d4b8633b74834 /fst/path.go
parentdb03565614821695efdb283a81a4733e6d321670 (diff)
fst: hide sockets exposed via Filesystem
This is mostly useful for permissive defaults. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'fst/path.go')
-rw-r--r--fst/path.go11
1 files changed, 11 insertions, 0 deletions
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
+}