Skip to content

Security and Trust Model

This page explains the security boundaries, supply-chain checks, and fail-closed defaults built into Netherframe so security engineers and platform teams can evaluate how it handles code, provider binaries, plans, credentials, and state.


1. Execution boundary: Trusted Python

A Netherframe app is standard Python code imported and executed by nf (or nf.sdk) during plan, apply, destroy, lint, and synth.

  • Only run trusted app repositories and lint packs. Importing a module or calling an app factory executes Python in your environment; nf lint and nf plan are not sandboxes for untrusted third-party code.
  • Providers run as isolated child processes. Each Terraform provider executes in its own subprocess communicating over local gRPC (unix socket or loopback tcp), never exposing a network listener.

2. Provider binary supply-chain verification

When Netherframe downloads a provider binary (during nf generate providers, nf plan, or nf apply), it implements Terraform's provider installation authentication protocol natively in nf.core.providers.installation:

  • Registry downloads verify three independent checks before extracting or executing a binary:
  • The downloaded archive's SHA-256 matches the registry's SHA256SUMS manifest (ArchiveChecksum + ChecksumListed).
  • The SHA256SUMS document's OpenPGP signature verifies against HashiCorp's bundled public keys or the partner/self-signed GPG key advertised by the registry (ChecksumsSigned), reporting the exact trust level.
  • Network and filesystem mirrors (Artifactory, Nexus, or air-gapped local directories configured via --provider-mirror / provider_mirrors) verify package digests against h1: and zh: hashes.
  • Enterprise TLS & credentials: Extra root CAs are configured explicitly via --provider-ca-bundle and registry/mirror tokens via --provider-credentials-file (credentials.tfrc.json format), never via ad-hoc NF_* env vars.

See Install Providers from Registries and Mirrors.


3. Tamper-evident saved plans

A plan saved with nf plan --out FILE is a bound execution contract:

Protection What it prevents
SHA-256 content_digest Detects accidental corruption or manual edits to the plan JSON body.
Optional HMAC-SHA256 signature (nf-plan-sig-v1) Authenticates plan artifacts crossing untrusted CI artifact storage (sign_plan / verify_plan_signature).
State serial, lineage, and state_fingerprint Refuses applying a stale plan after another run modified state.
Provider version & config fingerprints Refuses applying a plan under a different provider release or configuration.
Recorded inputs & salted secret digests Refuses applying a plan with mismatched inputs; verifies Secret[T] inputs without storing plaintext.
Declared app-check names Refuses applying a plan if the app removed an app.check that was present when the plan was made.

4. Configuration integrity: Why NF_* env vars do not exist

Environment variables exported earlier in a shell or inherited from a shared CI runner are a frequent source of silent misconfiguration (retargeting prod, disabling checks, or pointing at the wrong state).

Netherframe enforces three strict configuration rules:

  1. Zero NF_* environment variables are read for settings or app inputs.
  2. Scoped user config (~/.config/nf/config.toml): May only contain machine-local preferences (TUI theme/keymap, logging, non-interactive, provider mirrors/caches). Any engine or backend setting (recovery-strategy, backend-type, max-concurrent-resources) is rejected so runs never depend on who executes them. CI jobs should pass --no-user-config.
  3. Fail-fast conflicts: Conflicting values between [tool.nf.config] and Python code raise ConfigurationError immediately instead of silently picking a winner.

5. Fail-closed runtime defaults

Netherframe defaults to stopping and asking rather than guessing whenever an assumption breaks:

  • Unattended --auto-approve blocks high-risk surprises: Plans containing import actions (without --approve-imports), externally deleted objects (default deleted_objects="review"), undeclared stack deletions (unless applying a reviewed --plan-file), or refresh unknowns are refused automatically.
  • Deferred rounds default to each_round approval and stop incomplete (exit 4) under unattended runs unless --apply-deferred is explicitly opted in.
  • Final-plan consistency fails closed: If re-planning unknown values at apply time alters a previously known value or escalates an update to a replacement, apply fails even on legacy Plugin SDK providers (unless allow_legacy_plan_drift=True is set).
  • Verified teardown switches (Teardown[T]): Netherframe rebuilds the app with Teardown parameters at their defaults and compares deployment shapes, rejecting any attempt to smuggle resource changes through a teardown flag.
  • Safe serialization: nf tui --record uses an allowlisted JSONL format (nf-tui-recording/2) with state values masked—never Python pickle.

6. Crash-resilient auditability and state fencing

  • Document state: Conditional writes (ETag / generation / serial CAS) prevent a run whose lock lapsed from overwriting a newer run's state.
  • PostgreSQL graph state: Every mutating provider RPC is a fenced operation tied to a renewable lease (kill_providers_on_lease_loss=True terminates provider subprocesses on lease loss, and uncertain operations quarantine their address until nf state recover).
  • Finalizers (phase="finalize"): Run records written beside state before the first change ensure a kill -9 or dead CI runner leaves an explicit running record until nf state verify re-runs verification under the lock.

Vulnerability reporting

To report a security issue privately, follow Support and Security Reporting.