Page MenuHomeFreeBSD

cut(1), rev(1): add Capsicum sandboxing
AcceptedPublic

Authored by nick_spun.io on Tue, May 26, 5:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 13, 1:16 AM
Unknown Object (File)
Tue, Jun 9, 4:22 PM
Unknown Object (File)
Mon, Jun 8, 1:57 AM
Unknown Object (File)
Mon, Jun 8, 1:46 AM
Unknown Object (File)
Sun, Jun 7, 6:46 PM
Unknown Object (File)
Sat, Jun 6, 2:25 AM
Unknown Object (File)
Fri, Jun 5, 10:09 PM
Unknown Object (File)
Fri, Jun 5, 10:06 PM

Details

Reviewers
oshogbo
Group Reviewers
capsicum
Summary

Open file arguments through Casper's cap_fileargs service and enter capability mode after limiting stdio rights, so cut(1) and rev(1) run sandboxed.

cut(1) is a bootstrap tool, so the Makefile drops the Casper libraries and -DWITH_CASPER while BOOTSTRAPPING; <casper/cap_fileargs.h> then resolves fileargs_*() to plain fopen(3), matching wc(1)/head(1).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 73453
Build 70336: arc lint + arc unit

Event Timeline

nick_spun.io held this revision as a draft.

yo, is this ready for review?

This revision is now accepted and ready to land.Mon, Jun 1, 3:53 PM

I'm doing a universe build with this right now; i'll land it if/when it finishes.

I've emailed -arch about this, there's been some feedback / concern about performance implications about starting a casper service each time these tools are called.

So let's hold off and dig into this a bit more.

We have a handful of similarly-positioned tools in base that do the same - this implementation was mostly lifted from head(1) - it should only fork when called with argv[] and should not fork when used with stdin/stdout so I think the sandboxing path should be relatively rare

Might be worth collecting some metrics here, as well as perhaps revisiting some of our other similar implementations depending on what we do with this - probably should try to remain consistent one way or the other