Secure your code by applying the Principle of Least Authority (POLA) and Delegation in these models of secure cooperation. pdf
## Facet
+----------+ +----------+ | +--------+ | +--------+ | |GetBytes<------------->GetBytes| | +-----+--+ | +-----+--+ | | | | | File <-----------+Read Facet| | | | | | +-----+--+ +----------+ | |SetBytes| | +-----+--+ | | +----------+
A facet presents a subset of authorities embodied in a more powerful object. The Read Facet can expose only the GetBytes method of a File.
## Revocable Forwarder
+---------------------+ | | | +-----------+--+ +-------+ | | Forwarder | | | | +--+ | +--------+--+ | File <-----> <---> |all methods| | | | +-^+ | +--------+--+ +-------+ | | | | | | +-----------+--+ | | | | | +-----------+--+ | | | Revoker | | | | +--------+--+ | +----+ | Revoke() | | | +--------+--+ | | | | +-----------+--+ | | +---------------------+
A revocable forwarder has two parts: the forwarder delegates messages to and replies from the underlying powerful object. The revoker, when called, destroys the link to the underlying object thereby revoking the authority conveyed by the forwarder.
## Composition
A facet could be created over the revoke method to delegate only the power to revoke without also exposing read and write access to the underlying file. Or a Revocable Forwarder could be applied to a read facet to create a Revocable Reader.
## Logger (Logging Forwarder)
Logger is another forwarder that creates an audit trail of messages delegated to the underlying powerful object. See Petnames below.
## Accountability
Chains of Loggers can be composed as each person delegates authorities to colleagues. This closely models how delegation and accountability occur in the physical world.
## POLA-rized Delegation Chain
Each delegation in a chain of loggers can include Facets which further limit the scope of authority for the delegate.
.
Patterns not yet captured here from the picture book get increasingly complicated and, I think, interesting.
Diagrams created with askiflow.com link
askiflow feels like an editor that could be given similar treatment as I've done with Apparatus.
Having mentioned that I also wonder about constructing these diagrams with Apparatus to reveal their dynamic properties.