Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Bool file symlinks #329
Conversation
zyga
added some commits
Jan 14, 2016
niemeyer
reviewed
Jan 20, 2016
| +type notSanitizedError struct{} | ||
| + | ||
| +func (e *notSanitizedError) Error() string { | ||
| + return "capability is not sanitized" |
niemeyer
Jan 20, 2016
Contributor
I don't really understand what this is trying to say.. my guess is that other people likely won't as well.
It should also be a var:
var errNotSanitized = errors.New("foo bar")
Or even inline, since there's really a single occurrence right now, which is never used in an error check.
niemeyer
reviewed
Jan 20, 2016
| +func (t *BoolFileType) dereferencedPath(c *Capability) (string, error) { | ||
| + path := c.Attrs["path"] | ||
| + if path == "" { | ||
| + return "", ¬SanitizedError{} |
niemeyer
Jan 20, 2016
Contributor
return fmt.Errorf("bool-file capability is invalid: missing path attribute")
?
niemeyer
Jan 20, 2016
Contributor
Actually, perhaps even:
return fmt.Errorf("%q bool-file capability is invalid: missing path attribute", c.Name)
So we say what the actual capability is as well.
niemeyer
reviewed
Jan 20, 2016
| + } | ||
| + realPath, err := evalSymlinks(path) | ||
| + if err != nil { | ||
| + return "", fmt.Errorf("bool-file path is invalid: %s", err) |
niemeyer
Jan 20, 2016
Contributor
return fmt.Errorf("%q bool-file capability has invalid path attribute: %s", c.Name, err)
|
The error reporting needs tweaking, but the direction this is going looks good! The description should be tweaked after the agreements on the mailing list too. |
zyga
closed this
Jan 22, 2016
|
I'll re-propose this, with fixes, to skills. |
zyga
deleted the
zyga:bool-file-symlinks
branch
Mar 8, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zyga commentedJan 15, 2016
This branch contains support for dereferencing symbolic links in bool-file's security code. This is required to effectively allow "/sys/class/leds/$something/brightness" which translates to "/sys/devices/pci.../usb.../something/etc".