feat(broker): gate broker advertisement on bundled fduty capability#58
Merged
Conversation
A runner built with broker support always advertised broker=1, which makes safari deliver the per-person app_key out-of-band (never in the bash env). But the runner does not refresh fduty on self-update, so a fleet runner can carry a stale, pre-broker fduty across a runner upgrade. Such an fduty cannot read FLASHDUTY_CRED_FD, so every authenticated call would fail. Gate the advertisement on a one-time probe of the bundled fduty (`fduty version --json` -> broker_egress). Now broker=1 is advertised only when BrokerSupported AND the bundled fduty is broker-capable. A stale fduty keeps the legacy env-key path and, once updated, the next reconnect advertises broker mode — self-healing, and works in zero-egress BYOC where fduty cannot be refreshed. Verified end-to-end: new fduty -> broker=true + broker auth works; legacy fduty stub -> broker=false + env-key fallback still authenticates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The runner advertises
broker=1to safari only when both hold:BrokerSupported— Linux), andfduty version --json→broker_egress).Why (rollout safety)
A broker-capable runner always advertised
broker=1, which makes safari deliver the per-person app_key out-of-band (never in the bash env). But the runner does not refresh fduty on self-update, so a fleet runner can carry a stale, pre-broker fduty across a runner upgrade. That fduty can't readFLASHDUTY_CRED_FD→ every authenticated call would fail.Gating the advertisement on the bundled fduty's actual capability makes the rollout self-healing:
Works in zero-egress BYOC (no fduty refresh needed). Requires the companion cli change that adds
broker_egresstofduty version --json(flashduty-cli#36).How
environment/broker_capability.go:BrokerEgressEnabled()=BrokerSupportedAND a cached one-timefduty version --jsonprobe. Any probe failure (missing/old fduty, non-JSON, nonzero exit) → "not capable" → safe fallback.ws/client.go: advertisement now gates onBrokerEgressEnabled().Test
TestProbeFdutyBrokerEgress(capable / missing-field / false / legacy-plain-text / nonzero-exit) + missing-binary case.broker=true→ broker auth works (fduty whoamireturns the real identity, zero app_key in container env);broker=false→ env-key fallback still authenticates.Follows flashduty-runner#56.