feat(asb): authenticate the rpc server#1095
Merged
Merged
Conversation
The ASB JSON-RPC server generates a random token on startup, writes it to a .cookie file in the data directory, and requires it as an HTTP Bearer token. asb-controller reads the cookie via --cookie and attaches the header; a new `cookie` subcommand prints the token. The orchestrator mounts the asb-data volume into the controller and passes --cookie.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cfa4668. Configure here.
Reuse the existing .cookie token when present so clients keep working across ASB restarts; only generate a new token when the file is missing or empty, and propagate genuine read errors.
Replace the cookie-file scheme with a hashed password: the ASB verifies the presented Bearer password against a salt:hmac HMAC-SHA256 verifier read from --rpc-auth-file (mandatory when the RPC server is enabled). asb-controller prompts for the password on startup and verifies before granting access. The orchestrator gains a gen-rpc-auth command to produce the keyfile and mounts it into the asb container.
binarybaron
commented
Jun 10, 2026
| // Start RPC server conditionally | ||
| let _rpc_server = if let (Some(host), Some(port)) = (rpc_bind_host, rpc_bind_port) { | ||
| let auth_file = rpc_auth_file.context( | ||
| "The JSON-RPC server requires authentication: pass --rpc-auth-file pointing at a `salt:hmac` verifier file", |
Author
There was a problem hiding this comment.
salt:hmac is too specific here
binarybaron
commented
Jun 10, 2026
| let auth_file = rpc_auth_file.context( | ||
| "The JSON-RPC server requires authentication: pass --rpc-auth-file pointing at a `salt:hmac` verifier file", | ||
| )?; | ||
| let auth_verifier = std::fs::read_to_string(&auth_file) |
Author
There was a problem hiding this comment.
extact this into a function (together with the sanity check below)
binarybaron
commented
Jun 10, 2026
| format!("{salt}:{hmac}") | ||
| } | ||
|
|
||
| /// Constant-time check of a password against a `<salt>:<hmac>` verifier. |
binarybaron
added a commit
that referenced
this pull request
Jun 10, 2026
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.

No description provided.