Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readlinkfs: ignore some security-module specific xattrs #640

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/build/readlinkfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ func stringsFromByteSlice(buf []byte) []string {
return result
}

// xattrIgnoreList contains a mapping of xattr names used by various
// security features which leak their state into packages. We need to
// ignore these xattrs because they require special permissions to be
// set when the underlying security features are in use.
var xattrIgnoreList = map[string]bool{
"com.apple.provenance": true,
"security.csm": true,
}

func (f *rlfs) ListXattrs(path string) (map[string][]byte, error) {
realPath := filepath.Join(f.base, path)

Expand All @@ -108,6 +117,10 @@ func (f *rlfs) ListXattrs(path string) (map[string][]byte, error) {
xattrMap := map[string][]byte{}
xattrNames := stringsFromByteSlice(buf[:read])
for _, xattrName := range xattrNames {
if _, ok := xattrIgnoreList[xattrName]; ok {
continue
}

result, err := f.GetXattr(path, xattrName)
if err != nil {
return map[string][]byte{}, err
Expand Down