rename enable-ssh to allow-ssh and use SSH Certs instead of keys - #460
Draft
patelspratik wants to merge 11 commits into
Draft
rename enable-ssh to allow-ssh and use SSH Certs instead of keys#460patelspratik wants to merge 11 commits into
patelspratik wants to merge 11 commits into
Conversation
patelspratik
force-pushed
the
cafornodes
branch
2 times, most recently
from
August 27, 2026 15:38
35f8f10 to
a1ba25c
Compare
patelspratik
force-pushed
the
cafornodes
branch
3 times, most recently
from
August 27, 2026 20:00
dc366d0 to
c609cbf
Compare
Rebased onto pr1-register-resiliency (post ssh-certs uptake). - BREV_ACCESS_KEY renamed to BREV_API_KEY (never released); all access-key identifiers and messages renamed to API key - Env-key orgs resolve in real time from the backend: the key is bound to exactly one org server-side, so no persisted org is consulted and staleness is impossible. Established logins keep persisted org behavior (APIKeyOrgID / active-org cache) - Single-org invariant hoisted to auth.SingleOrgForAPIKey, shared by register and the general resolution path - GetActiveOrganizationOrNil branches on credential source; env path returns the full org (name included) without a second GetOrganization round-trip - Register with no env key and no persisted credential now prompts the device-flow login (externalNodeAuth fallback) instead of erroring; tokens stay in memory, the login email is cached for pre-fill - Register tests moved/renamed to the APIKey convention
A declined login prompt used to spray stack-traced WARN/ERROR retry chatter through resty and print a multi-frame trace at exit. - auth: return DeclineToLoginError unwrapped from PromptForLogin, GetFreshAccessTokenOrLogin, and LoginAuth.GetAccessToken so the sentinel travels without trace wrapping - store: pass the sentinel through AuthHTTPStore/OnBeforeRequest unwrapped; quiet resty logger suppresses retry chatter for the decline message while logging everything else - cmderrors: friendly message + directive for declined login; no Sentry report, no stack trace - errors: export DeclineToLoginMessage const used by the log filter
patelspratik
force-pushed
the
cafornodes
branch
from
August 28, 2026 19:31
c609cbf to
267ab6d
Compare
The GetCurrentUser probe existed to catch stale JWTs before local side effects. With an API key present that probe is redundant — the key is validated for real by the first API call it authenticates (ResolveOrgForAPIKey) — so skip it and let the org resolution surface any auth failure with a key-specific message.
A declined login prompt is not an error: the user deliberately said no, and the prompt itself is all the context they need. Handle it before any Sentry breadcrumb or switch processing — no breadcrumb, no message, no directive. Remove the now-redundant DeclineToLoginError case from the display switch. Also update TestGetAPIKeyOrgID_MissingPersistedOrgReturnsError to match the renamed MissingAPIKeyOrgIDMessage wording.
The analytics flag serialization sent every explicitly-set flag's value to PostHog, including the hidden global --api-key flag — disclosing the full credential on both success and failure capture paths. Fix generically: - redactFlagValue: values matching a Brev API key (bak- prefix) or a JWT shape (three dot-separated segments) are replaced with "[redacted]"; benign values pass through - MarkFlagSensitive: pflag annotation for flags that must always be redacted regardless of value shape - applied to the global --api-key flag and login's --token/--api-key flags; redaction is centralized in one visitor shared by both capture paths Flag names are still reported, so usage analytics survive.
patelspratik
force-pushed
the
cafornodes
branch
from
August 28, 2026 20:13
267ab6d to
b971f81
Compare
The factory wired quietRestyLogger over discardLogger, so while the filter itself correctly forwarded non-decline messages, its sink swallowed everything: real HTTP errors, unexpected auth failures, and all debug output were silently dropped. The declined-login test masked this by replacing the sink after construction. Replace discardLogger with stderrLogger (mirrors resty's default: stderr, date+micro, WARN/ERROR RESTY prefixes) and test the full factory chain without sink replacement: declined login stays quiet, unrelated auth errors still reach stderr with their message.
patelspratik
force-pushed
the
cafornodes
branch
from
August 28, 2026 20:42
b971f81 to
068c9c3
Compare
Rename enable-ssh to allow-ssh. The command now writes a cert-authority,principals="brev:v1:vm:<nodeID>:login:<user>" <CA key> line to authorized_keys using the certificate_authority from the node. Add disallow-ssh command that removes the cert-authority line. Register sends sshprovider=certauth label in AddNode. Deregister removes the cert-authority line instead of per-user keys. CLI go.mod uses a local replace for the proto module until the BSR publishes the certificate_authority field.
patelspratik
force-pushed
the
cafornodes
branch
from
August 28, 2026 20:49
068c9c3 to
df9e8fe
Compare
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.
Uh oh!
There was an error while loading. Please reload this page.