feat(token-id-capture): add an optional bearer token to the read route - #2182
feat(token-id-capture): add an optional bearer token to the read route#2182ananthsub wants to merge 0 commit into
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
3346a5b to
bca52ad
Compare
5a9e97a to
eb9ecf6
Compare
dca43c5 to
93decff
Compare
d19e056 to
aa4fcdb
Compare
0954c70 to
35ef310
Compare
aa4fcdb to
515a66f
Compare
35ef310 to
ccce798
Compare
515a66f to
0991e95
Compare
66668a5 to
c58892c
Compare
cbf548b to
cb2f6c6
Compare
c58892c to
93be757
Compare
cb2f6c6 to
6bad3e2
Compare
c9d74e7 to
79a1883
Compare
|
Closing: the read path this guards has been removed from the stack rather than secured. The route served a rollout's records over HTTP for a reader that cannot see the writer's filesystem. Two problems surfaced while verifying the stack end to end:
So #2124 no longer registers the route and no longer ships either reader, When a non-colocated reader is actually needed it should come back as one PR: a route that serves records and the incomplete flag, a client that implements Documented in #2341: "Reader and writer have to be on the same node today." |
6bad3e2 to
79a1883
Compare
Adds an optional bearer token on the route that serves a rollout's captured training tokens.
Why
The read route exists so a trainer that cannot see the writer's filesystem can still read a rollout's records. It serves those raw tokens on the same server the harness calls to generate.
Inside a trusted cluster that is acceptable. It stops being acceptable once the harness runs in a sandbox whose only egress is that server, because the harness could then read its own training data, or another rollout's.
flowchart LR harness["Agent Harness<br/>(sandboxed, inside the Agent Server)"] -->|generate| server server["Model Server<br/>serves generation and the token read route"] harness -.->|"GET /ng-capture/tokens/<id><br/>401 without the token"| server reader["Gym rollout collection<br/>or the training framework"] -->|"GET with bearer token"| serverWhat it does
Set, the route requires a matching bearer token and returns 401 otherwise. The comparison is constant-time, since that token is the only thing between an untrusted harness and every rollout's training data.
Unset, the route stays open and logs a warning once at startup.
On the default
Defaulting a security control to off is worth naming rather than glossing. The reason is that an existing deployment upgrading to this version would otherwise start getting 401s from a reader that has no way to learn the token. The warning is there so the gap is visible rather than silent.
There is a better end state: both the model server and the reader resolve the same configuration, so the token could be generated once during config resolution and reach both automatically, with an explicit value still overriding for runs where the configuration is not shared. That is not in this PR, and I would rather state the tradeoff than defend the current default as obviously right.
Set it before running a harness in a sandbox.
Tests
That the route returns 401 without a token when one is configured, that it serves the records with a correct token, and that it stays open when no token is set.