Daohub-io / cap9

Capability-based security protocol for smart contracts
Apache License 2.0
22 stars 10 forks source link

Check caps for WRITE syscalls #171

Closed JakeOShannessy closed 5 years ago

JakeOShannessy commented 5 years ago

This also outlines a rough API for the checking and execution of syscalls. My only hesitation was that (as I've implemented it) the procedure table is assumed to be an always present part of the environment rather that passed around. Given that this is true (the storage is always there) and it allows us to write a very clean API, I think it's ok. As it stands the code in the kernel for handling syscalls is literally:

let syscall: SysCall = SysCall::deserialize(&mut input).unwrap();
let cap_ok = syscall.check_cap();
if cap_ok {
    syscall.execute();
}

Which I think is decent. The implementation of each capability check (which is inherently different) is handled under the SysCall type.