Keep the values of a session's environment out of the Job's spec (a Secret for each session) #54
Loading…
Reference in a new issue
No description provided.
Delete branch "server-secret"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Item 2 of specs-18's request, as the owner chose it ("A"): no value of gc's environment, nor
ROOMCITY_TOKEN, is written into a Job's spec. Replaces #52, which hadserver-envas its base: #50 is in, this is the same commit rebased onmain.ROOMCITY_*. The pod reads it withenvFrom; the container's ownenvisPATHand the paths of mounted files (path_env,ROOMCITY_SECRET_*), which win over the Secret's. The Job owns the Secret (owner reference, set once the Job has its UID), so deleting the Job, asstop, a failed start andkill-objectdo, removes it;DeleteandDeleteObjectalso delete it by name.the server may not make Secrets in the namespace ... (its Role: create, get, update and delete on secrets)as the start's error, and no Job is made. A start that finds the session's Job already there neither overwrites nor removes its Secret.DeleteObject; Forbidden gives the error and no Job; a Job that cannot be made leaves no Secret.GC_DOLT_PASSWORDstays, my judgement: it is no longer in a spec, but bd in the pod reads its credentials from the fileBEADS_CREDENTIALS_FILEnames (the Secret ofroomcity.toml), so a second copy in the session's Secret serves nothing.Lands with the image that needs it: saraksh/kube's Role (roomcity-5e) gets
create,get,update,deleteonsecretsin the namespace, nolist. Of those, this code uses create, update and delete;getis granted as the owner said and not used.Assisted-By: Claude noreply@anthropic.com
Read at
36fbc82: the suite is green here under-race,internal/kubeten times withGOMAXPROCS=1. The Job's spec holds no value, the pod reads the Secret, the Job owns it, and a server without the right fails the start with the reason.Two changes before it merges.
The Role does not need
get. The code creates a session's Secret, updates it and deletes it, and never reads one (Secrets(...)is called three times in internal/kube/jobs.go: Create and Update inputEnvSecret, Update for the owner, Delete). Withgetthe server's account could read every Secret of its namespace by name: Claude Code's token, Kimi's key, the proxy's. Without it the server writes sessions' Secrets and reads none. Socreate,updateanddelete, in the README, in the error's text and its test, and in saraksh/kube's Role when it comes.if job.UID == "" { return nil }inCreateis there for the fake clientset: a real cluster never returns a Job without a UID, and with the branch a Secret that got no owner passes for a start that succeeded. Give the fake's Jobs a UID innewJobs, asTestTheJobOwnsTheSecretAndTheyGoTogetheralready does with a reactor, and drop the branch.Two limits I do not ask you to change here; say them in the README's section or tell me they are wrong.
Create. A Job that appears between that check and the Job's creation has had its Secret overwritten by then, and theAlreadyExistsbranch deletes it.operate's start deletes the name's Job and takes the name in the registry first, so only something outside the server could make that Job.For the map, not for this pull request:
updateanddeletecannot be narrowed to the sessions' Secrets by RBAC, so this Role lets the server overwrite or delete any Secret of its namespace.b6160dd84e01550796283f64da6f5a59cc6874ac