Two key features enable SHILL’s declarative security
policies: language-level capabilities and contracts.
SHILL scripts access system resources only through capabilities:
unforgeable tokens that confer privileges on
resources. SHILL scripts receive capabilities only from
the script invoker; SHILL scripts cannot store or arbitrarily
create capabilities. Moreover, SHILL uses capabilitybased
sandboxes to control the execution of arbitrary
software. Thus, the capabilities that a user passes to a
SHILL script limit the script’s authority, including any
programs it invokes. SHILL’s contracts specify what capabilities
a script requires and how it intends to use them.
SHILL’s runtime and sandboxes enforce these contracts,
hence they serve as fine-grained, expressive, declarative
security policies that bound the effects of a script.
For example, Figure 1 shows a SHILL contract for a
script to grade a single student submission (corresponding
to the grade.sh script described above). It is a
declarative security specification for the function grade,
which takes 5 arguments: a read-only file submission
(i.e., the student’s source code), a read-only directory
tests (containing the test suite), a “working directory”
in which the script may create subdirectories with full
privileges, a writeable file grade log for recording the
student’s grade, and a “wallet” that provides sufficient
capabilities to invoke the OCaml compiler. This contract
serves two purposes: it clearly describes what grade
needs to execute correctly and it also provides guarantees
about what grade may do when invoked. Given this contract,
a user can be confident that grade satisfies the security
requirements described above, even though grade
will compile and execute student-submitted code. Specifically:
grade will not read any other student’s submission;
grade will not communicate over the network (as
it has no capability for network access); grade will not
corrupt the test suite nor write any files other than the
grade log and subdirectories it creates within the working
directory. The implementation of grade (not shown)
focuses solely on the functionality for grading, and is not
concerned with enforcing security requirements.