app-server: implement device key v2 methods#18430
Conversation
a6f5f5e to
e4e9f03
Compare
69b06f8 to
789f413
Compare
e4e9f03 to
f9220dd
Compare
789f413 to
4351eda
Compare
f9220dd to
75ba150
Compare
3f5129c to
6f55c87
Compare
b59b13f to
f7b198b
Compare
9b550dc to
6951f1a
Compare
54f7030 to
c4e3b95
Compare
d0ea927 to
7501a60
Compare
c4e3b95 to
20c2078
Compare
20c2078 to
cd244b7
Compare
b8a5f17 to
e8bc757
Compare
cd244b7 to
b371887
Compare
|
[P1] Add regression coverage that device/key/* is rejected over remote‑control origin (not just raw websocket). Code blocks it via ConnectionOrigin::RemoteControl, but no test asserts the slingshot path can’t call device/key/sign. |
b371887 to
f664fa1
Compare
e8bc757 to
4f7294e
Compare
|
[codex] Addressed in |
f664fa1 to
123af8e
Compare
069064a to
4189212
Compare
123af8e to
03de8e3
Compare
4189212 to
41e132c
Compare
03de8e3 to
a2c2733
Compare
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/device-key/src/platform.rs
Lines 10 to 24 in a2c2733
device/key/* now routes through DeviceKeyStore::default(), but platform::default_provider() still returns UnsupportedDeviceKeyProvider. Its create always errors with HardwareBackedKeysUnavailable, and get_public/sign always return KeyNotFound, so the newly exposed app-server methods cannot succeed on any platform.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
etraut-openai
left a comment
There was a problem hiding this comment.
One recommended addition for future maintainability, but otherwise looks good.
|
|
||
| impl ConnectionOrigin { | ||
| pub(crate) fn allows_device_key_requests(self) -> bool { | ||
| matches!(self, Self::Stdio | Self::InProcess) |
There was a problem hiding this comment.
I recommend adding a big comment here so it's clear to future reviewers (and more importantly to Codex!) that it's important to restrict this to local connection origins. That way, if a new remote connection origin is added, it will be properly excluded from this check.
a2c2733 to
32d677d
Compare
32d677d to
5212b20
Compare
41e132c to
e6e34ae
Compare
e6e34ae to
ed32f55
Compare
5e7948e to
ced4291
Compare
ed32f55 to
3661fcf
Compare
ced4291 to
f6a41e2
Compare
The protocol needs an app-server implementation that keeps local key operations behind the same request-processing boundary as other v2 APIs. app-server owns request dispatch, transport policy, documentation, and JSON-RPC error shaping. `codex-device-key` owns key binding, validation, platform provider selection, and signing mechanics. Keeping that adapter thin makes the boundary easier to review and avoids moving local key-management details into thread orchestration code. - Added `DeviceKeyApi` as the app-server adapter around `DeviceKeyStore`. - Converted protocol protection policies, payload variants, algorithms, and protection classes to and from the device-key crate types. - Encoded SPKI public keys and DER signatures as base64 protocol fields. - Routed `device/key/create`, `device/key/public`, and `device/key/sign` through `MessageProcessor`. - Rejected remote transports before provider access while allowing local `stdio` and in-process callers to reach the device-key API. - Added stdio, in-process, and websocket tests for device-key validation and transport policy. - Documented the device-key methods in the app-server v2 method list. - `device_key_create_rejects_empty_account_user_id` - `in_process_allows_device_key_requests_to_reach_device_key_api` - `device_key_methods_are_rejected_over_websocket` - `cargo test -p codex-app-server device_key` - `just fix -p codex-app-server`
f6a41e2 to
6aeae28
Compare
Why
The device-key protocol needs an app-server implementation that keeps local key operations behind the same request-processing boundary as other v2 APIs.
app-server owns request dispatch, transport policy, documentation, and JSON-RPC error shaping.
codex-device-keyowns key binding, validation, platform provider selection, and signing mechanics. Keeping the adapter thin makes the boundary easier to review and avoids moving local key-management details into thread orchestration code.What changed
DeviceKeyApias the app-server adapter aroundDeviceKeyStore.device/key/create,device/key/public, anddevice/key/signthroughMessageProcessor.stdioand in-process callers to reach the device-key API.Test coverage
device_key_create_rejects_empty_account_user_idin_process_allows_device_key_requests_to_reach_device_key_apidevice_key_methods_are_rejected_over_websocketStack
This is PR 3 of 4 in the device-key app-server stack. It is stacked on #18429.
Validation
cargo test -p codex-app-server device_keyjust fix -p codex-app-server