Skip to content

bifrost: enforce_budgets config field -> BIFROST_PLUGIN_ENFORCE_BUDGETS - #760

Merged
Evanfeenstra merged 1 commit into
bifrost-enforce-macaroonsfrom
bifrost-enforce-budgets
Sep 14, 2026
Merged

Evanfeenstra merged 1 commit into
bifrost-enforce-macaroonsfrom
bifrost-enforce-budgets

Conversation

@Evanfeenstra

Copy link
Copy Markdown
Collaborator

Stacked on #757 (base is bifrost-enforce-macaroons; retarget to master once that merges).

Adds enforce_budgets: Option<bool> to BifrostImage, emitted as BIFROST_PLUGIN_ENFORCE_BUDGETS=<bool> when set. Same contract as enforce_macaroons:

  • None (default, and what existing persisted state loads as) ⇒ no env var ⇒ the gateway image's config.json value stands (shadow).
  • skip_serializing_if keeps the key out of persisted JSON when unset.
  • Swarm config, not a host secret ⇒ comes from the struct, not getenv().

Gateway side: stakwork/stakgraph#1684. The plugin only honours enforce_budgets when enforce_macaroons is also on (budgets would otherwise be bypassable by dropping the macaroon), so the intended sequence per swarm is macaroons → watch auth: budget shadow lines → budgets.

Tests: emitted when set (true/false, independent of the macaroons knob), absent when unset, serde round-trip. cargo test --lib images::bifrost: 16 passed.

Mirrors enforce_macaroons: Option<bool> on BifrostImage, None ⇒ no env
var ⇒ the image's config.json value stands; skip_serializing_if keeps
persisted state unchanged. The gateway (stakgraph#1684) only honours it
alongside enforce_macaroons — rollout is macaroons first, then budgets
after watching the 'budget shadow' log lines.
@Evanfeenstra
Evanfeenstra merged commit 5a45a4f into bifrost-enforce-macaroons Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant