Skip to main content

Module effective_floor

Module effective_floor 

Source
Expand description

The Cloud effective policy as a floor of the gateway policy engine (Release B 3.1.4).

A verified bundle (the Cloud connector’s effective-policy pull) is installed as two files in <data_dir>/cloud/policy/effective/, both 0600 and written atomically:

  • floor.json (Floor): the verified policy (default + per vault), its version, digest and not_after;
  • required.json: the highest version ever installed. It only grows, and it is what makes a missing policy never mean “no rules”: while it exists, a missing, damaged or older floor fails every policy refresh closed instead of dropping the Cloud rules.

The policy snapshot (crate::core::policy::runtime) reads both files and folds the floor underneath whatever the engine would enforce otherwise (local pack, org policy), with crate::core::policy::floor::merge_floor: every field merges toward the stricter side, so a local setting can only tighten the Cloud policy, never loosen it. loosened_by_floor names the local settings the floor overrides, for cloud status.

Only the members the schema marks x-enforcement: engine are mapped (their x-engine field; security.readable_roots and never_send are applied to reads by crate::core::policy::cloud_io instead); everything else is reported as unenforced on the ack. Expiry (not_after) does not lift the floor: the last valid rules keep restricting local work offline; only sensitive operations fail closed (the connector’s sensitive-operation gate).

Structs§

Floor
What floor.json holds: the verified effective policy, nothing else.
Required
required.json: the highest installed version.

Constants§

DIR
FLOOR_FILE
FLOOR_NAME
Name of the resolved Cloud floor (shows in policy diagnostics).
FLOOR_SCHEMA
REQUIRED_FILE

Functions§

apply
Fold the Cloud floor under effective (what the engine enforces without it). Tighten-only: see crate::core::policy::floor::merge_floor.
check
The installed floor and requirement, checked against each other: Ok(None) only when neither exists (no Cloud policy was ever installed here).
floor_dir
<data_dir>/cloud/policy/effective of this installation.
floor_dir_in
floor_dir below a Cloud store’s data directory (<data_dir>/cloud).
is_policy_path
Whether target (canonical) lies in <data_dir>/cloud/policy, the files only the engine’s own policy pull writes: agent file tools are refused there (crate::core::pathjail::enforce_writable).
local_overrides
The local settings of the project at project_root (its .lean-ctx/policy.toml) that the installed Cloud floor overrides.
loosened_by_floor
The settings of local that are looser than the Cloud floor and are therefore ignored, one line each, in a fixed order.
read
Read both files of dir (absent = None).
resolve
The floor for vault (or the default) as a resolved policy, or None when no Cloud policy is installed or the verified policy sets no members. Enrollment metadata alone must not activate protected source/egress mode. An inconsistent pair is still an error, and the caller fails closed.
to_resolved
The x-engine mapping of every engine member onto the gateway pack.
vault_for
The vault whose effective policy applies to project_root, when the floor has per-vault entries: the vault this checkout is linked to.