Documentation
¶
Overview ¶
Package intent carries what access a project INTENDED, so a scan can say whether reality matches it.
unruly proves what an attacker can reach. Until this, it did not know what the attacker was SUPPOSED to reach -- so a relation readable by anyone was reported identically whether it held a public price list or a table of payslips, and a relation that was correctly locked was reported as nothing at all. The operator supplies the missing half.
NO MODEL RUNS DURING A SCAN. An agent reads the application once, out of band, and writes this down; verification is then a comparison. The same manifest and the same target give the same answer, every time, and the answer can be re-checked after a fix -- which is the whole difference between an assessment and a test.
Index ¶
Constants ¶
const SchemaVersion = 1
SchemaVersion is the manifest format this binary understands.
A manifest from a newer version is REFUSED rather than half-read: ignoring unrecognised fields would silently drop expectations and report the remainder as full coverage, which is the failure this package exists to prevent, committed by the package itself.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Expectation ¶
type Expectation struct {
Resource string `yaml:"resource"`
Operation Operation `yaml:"operation"`
Subject Subject `yaml:"subject"`
Scope Scope `yaml:"scope,omitempty"`
// Result defaults to allow when a scope is given and deny otherwise, but
// it is written out in practice: an omitted field is a decision nobody can
// see.
Result Result `yaml:"result,omitempty"`
}
An Expectation is one intended rule.
type Manifest ¶
type Manifest struct {
SchemaVersion int `yaml:"schema_version"`
Expect []Expectation `yaml:"expect"`
}
A Manifest is the whole intended policy.
type Observation ¶
type Observation struct {
Resource string
Operation Operation
Subject Subject
// Scope is what the measurement established. Empty means the instrument
// did not distinguish own rows from all rows and cannot satisfy an own-only
// expectation.
Scope Scope
Allowed bool
}
An Observation is what the scan actually established.
Only facts the scan MEASURED belong here. A relation nobody probed produces no observation, which is what makes the expectation unverified rather than satisfied.
func Observations ¶
func Observations(access scan.Access) []Observation
Observations translates the provider-neutral pipeline artifact.
type Outcome ¶
type Outcome struct {
Expectation Expectation
State State
// Detail says what was observed, or why nothing was.
Detail string
}
An Outcome is one expectation, checked.
func Verify ¶
func Verify(m Manifest, obs []Observation) []Outcome
Verify compares intent against what the scan measured.
Pure and total: every expectation produces exactly one outcome, in the manifest's own order, so the result is a statement about the WHOLE intended policy rather than a list of the parts that went wrong.
type Scope ¶
type Scope string
A Scope narrows an allow to the subject's own rows.
`owner` may read invoices -- their own. Recorded because the difference between "the owner can read invoices" and "the owner can read ALL invoices" is the difference between a working product and a data breach, and a manifest that cannot express it would have to be written the loose way.
type State ¶
type State string
State is how one expectation came out.
const ( // Matched: reality agrees with the intent. Matched State = "matched" // Violated: reality and the intent disagree. Usually reality is more // permissive, which is a hole; occasionally more restrictive, which is an // outage waiting to happen and still evidence that one of the two is // wrong. Violated State = "violated" // Unverified: the scan never established this, so nothing is known. NOT a // pass -- counting it as one would let a manifest of intentions produce a // clean report from a scan that measured none of them. Unverified State = "unverified" )
type Subject ¶
type Subject string
A Subject is who is asking.
The five tiers a real policy distinguishes. anonymous and authenticated are what unruly already measures; owner and other_tenant are the pair that catches broken ownership, which anonymous testing cannot see at all -- a relation correctly closed to strangers and open to every signed-in user reads as protected until somebody asks as a DIFFERENT signed-in user.