Skip to main content

Module record

Module record 

Source
Expand description

What the grants file said when someone last allowed it: the record that makes a change to the file visible and keeps a new or wider grant from working until it is acknowledged.

The broker keeps one small file beside the grants file (aws-grants.record.json): the hash of the grants file as last read and, for each grant, a summary (tier, agents, switched off, reason needed, limits and a fingerprint of the recipe, never the recipe’s text or any credential), what was last acknowledged, and which recorded change put the grant there. Reading the grants file after a change compares it with that record:

  • a grant that is new, or wider than what was acknowledged (a write tier where there was a read tier, more agents, a different recipe, switched back on, no reason needed, longer sessions, a higher hourly cap), is held: the broker refuses it until a native agent or a person allows it, with a reason that is recorded;
  • a grant that is removed or narrower takes effect at once;
  • every added, removed, widened or narrowed grant is an event the caller records in the Audit view;
  • a file whose grants are unchanged records nothing.

The first time the broker reads a file it has no record of, it records that file as the baseline: every grant in it counts as acknowledged, and the Audit view says so. This is pure: reading and writing the record file are the functions at the bottom.

Structs§

ChangeRow
One line of what changed, as the Identity surface shows it.
Decision
An answer to a held grant.
Entry
Event
Something the Audit view should show. held marks the ones a person should look at.
GrantView
One grant as the Identity surface lists it.
Record
Summary
What a grant allows, as far as a change to it can widen it.
View

Enums§

Delta
How a grant now compares with what was acknowledged.
State
What the broker does with a grant.

Constants§

BASELINE_BY
Who a grant of the baseline is acknowledged by.
MAX_REASON
The longest reason that is kept.

Functions§

compare
decide
effective
The grants as the broker honours them: a held or refused grant is marked, so it is refused whatever else is true.
hold_all
Every grant held: what the broker does when the record can’t be read, so a damaged record never lets a grant through.
path_beside
aws-grants.record.json beside the grants file (the same stem, so a test’s own file has its own record).
read
The record on disk: none when there is no file (the first run), an error when it is there and can’t be read.
sha256_hex
sync
Compare the grants file policy (with the hash of its text) with what was recorded, and say what changed. old is the record read from disk: none on the first run, which records the file as the baseline.
view
write
Writes the record in one step, so a reader never sees half of it.