Skip to content

Commit 068c443

Browse files
committed
readlinkfs: ignore some security-module specific xattrs
Certain security modules (such as Apple SIP and Google Container Threat Detection) use xattrs to store their state. Ignore this state when generating packages. Signed-off-by: Ariadne Conill <[email protected]>
1 parent 8d8924e commit 068c443

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/build/readlinkfs.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ func stringsFromByteSlice(buf []byte) []string {
8686
return result
8787
}
8888

89+
// xattrIgnoreList contains a mapping of xattr names used by various
90+
// security features which leak their state into packages. We need to
91+
// ignore these xattrs because they require special permissions to be
92+
// set when the underlying security features are in use.
93+
var xattrIgnoreList = map[string]bool{
94+
"com.apple.provenance": true,
95+
"security.csm": true,
96+
}
97+
8998
func (f *rlfs) ListXattrs(path string) (map[string][]byte, error) {
9099
realPath := filepath.Join(f.base, path)
91100

@@ -108,6 +117,10 @@ func (f *rlfs) ListXattrs(path string) (map[string][]byte, error) {
108117
xattrMap := map[string][]byte{}
109118
xattrNames := stringsFromByteSlice(buf[:read])
110119
for _, xattrName := range xattrNames {
120+
if _, ok := xattrIgnoreList[xattrName]; ok {
121+
continue
122+
}
123+
111124
result, err := f.GetXattr(path, xattrName)
112125
if err != nil {
113126
return map[string][]byte{}, err

0 commit comments

Comments
 (0)