Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

Conversation

@s-urbaniak
Copy link
Contributor

Currently the xattr field is ignored, when untarring files. This fixes
it.

Fixes #3179

pkg/tar/tar.go Outdated

if typ == tar.TypeReg || typ == tar.TypeRegA {
for k, v := range hdr.Xattrs {
err := syscall.Setxattr(p, k, []byte(v), 0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a little worried, that I am simply setting these xattr fields 1:1. Are there any security concerns?

/cc @lucab

Copy link
Member

@lucab lucab Oct 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not specific cases off the top of my head, but I can imagine several misuses. I'd say it would be safer to perform some prefix-whitelisting on k here, and just allow security.capability and user prefixes for the moment.

Copy link
Member

@lucab lucab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a simple naming nit, otherwise code and tests look fine. Feel free to self-merge once renaming is done.

pkg/tar/tar.go Outdated
return []syscall.Timespec{fileutil.TimeToTimespec(hdr.AccessTime), fileutil.TimeToTimespec(hdr.ModTime)}
}

func forbiddenXattr(xattr string) bool {
Copy link
Member

@lucab lucab Oct 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are doing whitelisting, this function name (and logic) is a bit misleading. Can we turn it into isXattrAllowed() and negate the returned bool?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, I was back-and-forth on this one actually ;)

Currently the xattr field is ignored, when untarring files. This fixes
it.

Fixes rkt#3179
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problems running a binary with setcap as an unprivileged user

2 participants