fix(proto): harden default-password server remediation#480
Draft
ankitgoswami wants to merge 2 commits into
Draft
fix(proto): harden default-password server remediation#480ankitgoswami wants to merge 2 commits into
ankitgoswami wants to merge 2 commits into
Conversation
🔐 Codex Security Review
Review SummaryOverall Risk: MEDIUM Findings[MEDIUM] Default-password miners drop out of fleet remediation views
NotesI did not find changed-hunk evidence of command injection, SQL injection, pool/wallet hijacking, breaking protobuf wire changes, frontend XSS, or new infrastructure secret exposure in this diff. Generated by Codex Security Review | |
4cb6a53 to
1193bc2
Compare
f524067 to
65dd2a6
Compare
5d857b3 to
a6cd903
Compare
00dafce to
780b195
Compare
4948b2b to
33f98ff
Compare
363b79d to
49b1daa
Compare
d40c0f6 to
4902877
Compare
4902877 to
00726ef
Compare
00726ef to
31d2388
Compare
31d2388 to
0ef25de
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.
Summary
Hardens the server-side
DEFAULT_PASSWORDremediation boundary introduced by #471. This PR keeps default-password miners telemetry-visible and remediation-resolvable, while preventing normal mutating commands, stale telemetry, stale pair reports, or cached handles from treating those miners as fully command-eligible.Stack: #471 -> this PR. #482 is stacked on this PR and contains the hand-written Fleet UI remediation UX; #477 is also stacked on this PR and handles credentials-only fleet-node enrollment. The diff here is relative to #471 and intentionally excludes Fleet UI gating/cards, which moved to #482. Phase 3 key-auth deletion remains out of scope.
How it works
The command layer now resolves default-password miners only through explicit remediation paths. Password update and unpair can use paired-like resolution, while regular mutating commands still require paired-only resolution and fail fast for
DEFAULT_PASSWORD. Fleet-node remote miners are admitted into the default-password state from pair reports, but password update is rejected before dispatch until the fleet-node protocol supports that command path.Telemetry reconciliation repeats paired-like guards at the SQL update boundary and invalidates miner cache entries only when the persisted pairing state changes. That prevents late telemetry from resurrecting unpaired/auth-needed rows and prevents stale cached PAIRED miner handles from bypassing the new command guard. Plugin-side hardening reduces login churn and preserves default-password signal behavior through status polling.
Diagrams
flowchart TD T["Telemetry default_password_active"] --> R["guarded SQL reconcile"] R --> C{"state changed?"} C -->|"yes"| X["evict miner cache"] C -->|"no"| K["keep cached handle"] A["Command request"] --> B{"command type"} B -->|"password update / unpair"| P["paired-like resolver"] B -->|"normal mutating command"| O["paired-only resolver"] O --> G["DEFAULT_PASSWORD rejected"] P --> F{"remote fleet-node miner?"} F -->|"password update"| N["fail precondition before dispatch"] F -->|"unpair"| U["allow remediation"]sequenceDiagram participant Poller as "Telemetry poller" participant DB as "device_pairing" participant Cache as "miner cache" participant Command as "command executor" Poller->>DB: reconcile DEFAULT_PASSWORD with current-row guard DB-->>Poller: rows affected + previous/current state alt state changed Poller->>Cache: evict miner handle end Command->>DB: resolve command target DB-->>Command: paired-only or paired-like result Command-->>Command: reject normal commands for DEFAULT_PASSWORDAreas of the code involved
server/internal/domain/commandserver/internal/domain/minerandserver/sqlc/queries/miner_service.sqlserver/internal/domain/telemetryandserver/sqlc/queries/device.sqlserver/internal/domain/stores/sqlstoresand store interfacesserver/internal/handlers/fleetnode/*,proto/fleetnodegateway/v1plugin/protoandserver/fake-proto-rigclient/src/protoFleet/api/generated/fleetnodegateway/v1/fleetnodegateway_pb.ts,server/generated/**Key technical decisions & trade-offs
Testing & validation
cd client && npm run lintcd server && ../bin/go test ./internal/domain/telemetry -run 'TestReconcileDefaultPasswordState'cd server && ../bin/go test ./internal/domain/command -run 'TestExecuteCommand_UpdateMinerPassword_FleetNodeMinerFailsBeforeDispatch'cd server && ../bin/go test ./internal/domain/stores/sqlstores -run TestReconcileDefaultPasswordPairingStatusByIdentifier_DoesNotResurrectConcurrentNonPairedState -count=1 -vcompleted with no matching tests on this split branch.git diff --checkNot fully covered locally: full DB-backed package suites still require the local Postgres/testcontainers setup that has been flaky in this workspace.