From 12b32aa06c0475d60ee51b3753052ac2e4d09308 Mon Sep 17 00:00:00 2001 From: bolshevik Date: Tue, 17 Apr 2018 20:33:04 +0200 Subject: Improved xattr handling on non-linux systems (#227) * Fixed xattr filtering for MacOS. "system." and "user." prefixes are only relevant for Linux. * Small cleanup and additional tests.--- internal/fusefrontend/xattr_linux.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 internal/fusefrontend/xattr_linux.go (limited to 'internal/fusefrontend/xattr_linux.go') diff --git a/internal/fusefrontend/xattr_linux.go b/internal/fusefrontend/xattr_linux.go new file mode 100644 index 0000000..ebe42b1 --- /dev/null +++ b/internal/fusefrontend/xattr_linux.go @@ -0,0 +1,15 @@ +// +build linux + +// Package fusefrontend interfaces directly with the go-fuse library. +package fusefrontend + +import "strings" + +// Only allow the "user" namespace, block "trusted" and "security", as +// these may be interpreted by the system, and we don't want to cause +// trouble with our encrypted garbage. +const xattrUserPrefix = "user." + +func disallowedXAttrName(attr string) bool { + return !strings.HasPrefix(attr, xattrUserPrefix) +} -- cgit v1.2.3