Skip to main content

Module policy

Module policy 

Source
Expand description

Filter packs from Cloud.

GET /v1/policy/bundle (conditional) → verified here before anything is kept: filter packs must be signed by an Cloud key of the verified key set, match their digest and validate completely (every pattern compiles); all packs together stay within CLOUD_MAX_RULES. A bundle that fails any check never replaces the last good one; the refusal is shown in cloud status and lean-ctx doctor, and local work goes on under the last verified bundle.

Stored in <data_dir>/cloud/policy/: the verified bundle, its state, and filters/set.json, the one file the policy snapshot reads to apply the patterns (filter_rules).

Structs§

FilterRules
Cloud filter patterns as policy rules.
FilterSet
The verified filter packs in force, as one file the policy snapshot reads.
PolicyState
What the last verified bundle established.
PullRecord
The last policy pull, and whether Cloud has shown it sends policy nudges (<data_dir>/cloud/policy/pulls.json).

Enums§

PolicyPull
What a policy pull did.
PulledVia
What started a policy pull.

Constants§

CLOUD_MAX_RULES
Cloud filter rules have their own budget, apart from the user’s policy rules; a bundle above it is refused rather than applied in part.
FILTER_SET_SCHEMA

Functions§

filter_rules
Rules from the captured bytes of the filter set. Labels are unique (cloud:<label or id>, the first pack in id order wins) and every pattern compiled at installation within the policy limits.
filter_set_path
<data_dir>/cloud/policy/filters/set.json of this installation.
installed_filter_rules
The filter rules of this installation, read now (for screening, which has no policy snapshot of its own).
load_bundle
The last verified bundle, as received.
load_filter_set
The installed filter set of data_dir, as text (what the policy snapshot reads), if there is one.
load_pulls
load_state
note_nudges_seen
Note that Cloud sends policy nudges (written once).
note_pull
Note a successful pull started by via.
pull
Pull, verify and keep the policy bundle.
required_packs_installed
The policy runtime’s check for an org policy artifact it still holds from before Cloud-Protocol 2.1 (verified there, not here): for every filter pack its signed statement requires, the installed set must hold statement bytes whose SHA-256 is the signed digest, and the pack it applies must be exactly the one those bytes decode to. A set whose patterns, bytes or listing were changed or removed by hand is refused like any other tampering.
verify_bundle
Verify a whole bundle against the key set, and against the last accepted state (filter pack versions only move forward). Returns the state it establishes and the verified filter packs. The bundle’s TOML org policy fields are not read.