feat: add SSH settings for device and namespace#6148
feat: add SSH settings for device and namespace#6148henrybarreto wants to merge 1 commit intomasterfrom
Conversation
|
Claude finished @henrybarreto's task in 7m 11s —— View job Code Review CompleteReviewed 28 files. 6 inline issues posted (2 critical, 2 high, 2 medium). Critical: Cloud compilation breakage (non-inlinable)
Additional notes
If you've addressed the feedback and want a new review, tag |
2f24e04 to
a34b829
Compare
|
/review |
|
Claude finished @gustavosbarreto's task in 7m 6s —— View job Code Review CompleteReviewed 32 files. 2 inline issues posted (1 critical, 1 high). Critical: Auth method restriction bypass via SSH fallbackThe Additional notes
If you've addressed the feedback and want a new review, tag |
| func (p *publicKeyAuth) Evaluate(session *Session) error { | ||
| if session.Namespace.Settings.DisablePublicKey { | ||
| return ErrPublicKeyDisabled | ||
| } |
There was a problem hiding this comment.
Critical: DisablePublicKey check can be bypassed via SSH auth method fallback
This Evaluate() check and the corresponding DisablePassword check in passwordAuth.Evaluate() are only called from Auth() in session.go when the session state is StateEvaluated (line 650). When the first auth method (e.g., public key) passes Evaluate() and register(), the state advances to StateRegistered (line 658) before connect() runs. If connect() then fails (unauthorized key), the state remains StateRegistered. When the SSH client falls back to a second auth method (e.g., password), Auth() enters the StateRegistered case directly, completely skipping auth.Evaluate().
Attack scenario: Admin sets disable_password: true. An attacker with no authorized key: (1) attempts public key auth — Evaluate() passes (public key not disabled), register() succeeds → state becomes StateRegistered, connect() fails; (2) falls back to password auth — enters StateRegistered, passwordAuth.Evaluate() is never called, DisablePassword check is bypassed, password is forwarded to the agent. Same bypass works in reverse for disable_public_key.
Fix: In session.go Auth() method, move the auth.Evaluate(sess) call before the switch state block so it runs on every authentication attempt regardless of cached session state.
a34b829 to
486eeca
Compare
f422ac4 to
b2afb9b
Compare
Add allow-based SSH settings for both namespace and device configuration, update the backend migrations and auth flow, and wire the React console to edit the new settings consistently. Closes #6136
b2afb9b to
32cfb65
Compare
Add allow-based SSH settings for both namespace and device configuration, update the backend migrations and auth flow, and wire the React console to edit the new settings consistently.
Closes #6136
Namespace's settings:
Device's settings:
