kunibert
All repositories: gitoria
8.7 KB
# K10 report: the review model runs as its own unix user (kunibert#10)Status: DONE. Deployed (commit 07025b9, /health OK). No codex login done, no real model run. Scratch on byrodin (/tmp/kunibert-k10, probe worktree) removed.## Created on byrodin| What | Owner / mode ||---|---|| user `kunibert-review` uid 996 gid 986 (own group only), system user, shell /usr/sbin/nologin, not in sudoers (`sudo -l -U` = not allowed) | || /home/kunibert-review | kunibert-review, 700 || /home/kunibert-review/.codex (its own, for its login/token refresh) | kunibert-review, 700 || /usr/local/bin/codex-review (copy of root's 0.166.0 musl binary; sha256 identical b8a11fed…56b8; `--version` = codex-cli 0.166.0) | root:root 755 || /CONTAINERS/projects/kunibert-work (work dir for job worktrees) | root:root 755 || /root/.config/kunibert (+ config.json, repos.json, gitoria-proof-key/-secret) | unchanged: dir 700, files 600 root || /CONTAINERS/projects/kunibert-data (state, sessions, token temp files, git cache) | unchanged: 700 root (so svc/runner/git below it are unreachable) |Command: `useradd --system --create-home --home-dir /home/kunibert-review --shell /usr/sbin/nologin --user-group kunibert-review; chmod 700 /home/kunibert-review; install -m755 <root codex 0.166.0 binary> /usr/local/bin/codex-review; install -d -m700 -o kunibert-review -g kunibert-review /home/kunibert-review/.codex; install -d -m755 /CONTAINERS/projects/kunibert-work`. /root/.codex, root's PATH and root's codex untouched; auth.json never read or copied.## Design choice for worktreesWorktrees now live in `/CONTAINERS/projects/kunibert-work/work/<repo key>/<pr>` (root-owned, 755 dir; not in kunibert-data, whose 700 parent hides the git cache and token temp files). hl:fs creates dirs 700 / files 600, so the review user could NOT read them (found in the first probe). Fix in `codexTurn`: when reviewUser and workDir are set and the worktree is inside workDir, before each model run `chmod -R a+rX,go-w <worktree>` and `chmod a+x` on the two parents (`work/`, `work/<key>` become 711: walkable by exact path, not listable). Nothing outside workDir is touched. Files written by root stay root-owned, so the model can read but never write. The worktree's `.git` file points to the cache, but the cache is unreachable, so git inside the sandbox does not work (the diff files are provided). schema.json is read from /CONTAINERS/projects/kunibert (755 checkout, no secrets in it; its .git/config has no token).## Code (commits 2177f66, 2a44bd5, 07025b9, pushed to gitoria, deployed with deploy/deploy.sh)- config keys `reviewUser`, `codexBin` (default `codex`), `workDir`: service/project.hl → lib/intake.hl → lib/queue.hl → lib/run-job.hl → runner argv `--review-user <u> --codex-bin <path> --work-dir <dir>` (only added when set).- tools/runner.hl: the three flags are taken out of argv first, so every mode accepts them (`review`, `review-pr`, gitoria mode) → `settings` in lib/runner.hl.- lib/runner.hl `codexTurn`: reviewUser set → argv = `runuser -u kunibert-review -- env -i HOME=/home/kunibert-review PATH=/usr/local/bin:/usr/bin:/bin LANG=C.UTF-8 <codexBin> exec …` for first, resume and fallback turn. `env -i`: the service's environment does not reach the model. All offline flags, `-s read-only`/`sandbox_mode`, `-C <worktree>`, schema and no-stdin stay as before. Unset → old behaviour (`codex` as the same user).- deploy/config.byrodin.json and live /root/.config/kunibert/config.json (600 root): `"reviewUser": "kunibert-review", "codexBin": "/usr/local/bin/codex-review", "workDir": "/CONTAINERS/projects/kunibert-work"`.- Not tested: the codex read-only sandbox (bwrap/landlock) under this user; that can only be seen on the first real run after the login.## Proof on byrodin (outputs, as kunibert-review via `runuser -u kunibert-review --`; stdout discarded, so no secret could be shown; none was readable)```cat /root/.config/kunibert/gitoria-proof-key -> Permission deniedcat /root/.config/kunibert/gitoria-proof-secret -> Permission deniedcat /root/.config/kunibert/config.json -> Permission deniedls /root/.config/kunibert -> cannot access: Permission deniedls /CONTAINERS/projects/kunibert-data -> cannot open directory: Permission deniedcat …/kunibert-data/svc/queue.json -> Permission deniedcat …/kunibert-data/svc/deliveries.json -> Permission deniedls …/kunibert-data/runner -> Permission denied (git cache is under …/kunibert-data/git: same 700 parent)cat /root/.codex/auth.json ; ls /root/.codex -> Permission denied```Worktree (probe worktree made with the real `addWorktree`, then the real runner CLI with chmod step), probe script run as kunibert-review by the runner:```probe: id=kunibert-review HOME=/home/kunibert-review PWD=/CONTAINERS/projects/kunibert-work/work/<key>/1probe: read a.txt: one two probe: read .kunibert/pr.diff: diff --git a/a.txt b/a.txtprobe: read prompt file: You are Kunibert, the code rev… probe: read schema: { "type": …probe: write a.txt: cannot create a.txt: Permission deniedprobe: create file: touch: cannot touch 'newfile': Permission deniedprobe: list work root: ls: cannot open directory '/CONTAINERS/projects/kunibert-work/work': Permission deniedprobe: key: cat: /root/.config/kunibert/gitoria-proof-key: Permission deniedprobe: data: ls: cannot open directory '/CONTAINERS/projects/kunibert-data': Permission denied```Modes after the run: work 711, work/<key> 711, worktree 755, .kunibert 755, pr.diff/codex-prompt.md 644, codex-argv.json and codex.jsonl 600 (root only).Earlier probe (`bin/hybriel tools/runner.hl review <data> <fixture> base HEAD --review-user kunibert-review --codex-bin <probe>`): argv written = `["runuser","-u","kunibert-review","--","env","-i","HOME=/home/kunibert-review","PATH=/usr/local/bin:/usr/bin:/bin","LANG=C.UTF-8","/tmp/kunibert-k10/probe-codex.sh","exec","--json","-s","read-only","-C",…,"--skip-git-repo-check","--output-schema",…]`; probe printed `id=uid=996(kunibert-review) gid=986(kunibert-review) groups=986(kunibert-review)`, `HOME=/home/kunibert-review`, env vars only `HOME PATH LANG PWD`, key read `Permission denied`, root auth not reachable, cwd not writable; exit 1 → runner "codex failed (1)".Login: `runuser -u kunibert-review -- env -i HOME=/home/kunibert-review /usr/local/bin/codex-review login status` → `Not logged in` (exit 1). Root's `codex login status` → `Logged in using ChatGPT` before and after.Cleanup: /tmp/kunibert-k10 and /CONTAINERS/projects/kunibert-work/work removed (kunibert-work is empty). Service: active, /health `{"jobs":1,"queued":0,"failed":1,"running":null,…}`.## Loreana gates (after the last commit)K4, K6, K7, K8, K9 proof.py: each ALL OK (unset reviewUser = old behaviour).## Other world-readable secret-like files under /CONTAINERS/projects (paths only, for Apollo; kunibert-review could READ these; I changed nothing, did not open them)- `.env` files: /CONTAINERS/projects/euro-onchain/.env, /CONTAINERS/projects/hybrilior/wrapping-test-case/.env, /CONTAINERS/projects/default_node_project/.env; 12 more under /CONTAINERS/projects/miserit-anthar.net/{production,development-1..7,labs/planet-4rdgen,planet-4rdgen-2,planet-4rdgen-atmo,game-erosion}/.env (that is the 12; `find /CONTAINERS/projects/miserit-anthar.net -name .env -perm -o+r`).- TLS private keys `key.pem` (+ cert.pem) in /CONTAINERS/projects/miserit-anthar.net/{development-1..7,labs/*}/certs/ (11 dirs).- Token stores (hashes/databases): /CONTAINERS/projects/tickets.worldapi.org/storage/mpackdb/tokens.* ; /CONTAINERS/projects/gitoria.worldapi.org/storage/mpackdb/{tokens,apptokens}.* ; copies in /CONTAINERS/projects/tickets.worldapi.org/.scratch/backup-before-*/storage/mpackdb/tokens.* (9 backup dirs).- /CONTAINERS/projects/gitoria.worldapi.org/tests/app-token.mjs (a test file, content not checked).- Not exhaustive (name-based find: .env*, *.pem, *.key, *secret*, *credentials*, .npmrc, .netrc, *token*; skipped node_modules, .git, vendor, venvs). Many of these are probably hashes or false hits; Apollo should decide. Also /root itself is 700 so root's files are safe.## Later device-code login (owner approves the code)```S=/media/STORAGE/projects/WorldAPI/worldapi-conductor/byrodin-ssh.sh$S [email protected] 'runuser -u kunibert-review -- env -i HOME=/home/kunibert-review PATH=/usr/local/bin:/usr/bin:/bin /usr/local/bin/codex-review login --device-auth'```Then check: `runuser -u kunibert-review -- env -i HOME=/home/kunibert-review /usr/local/bin/codex-review login status`. The token lands in /home/kunibert-review/.codex/auth.json (700 dir). Warning: ssh runs without a TTY; if codex wants one, use an interactive `ssh -t` session once. Run it only after the owner agrees which account to use.
Branches
Latest commits
- bd3591c7conductor: gates run on the live day44 binarymre
- 47f747a7records: jukebox #9 fix livemre
- 0a3169fdMerge branch 'vendored-size' into mainKunibert
- e447bb09Vendored size fix: keep renames with an app side whole; type the filter parameter (L10)mre
- 99ccc742Vendored size fix: no renames in the app diff, filter the resumed delta toomre
- 1a52e100|||PR Diff size limit counts only app files when vendored paths are setmre
- 50a1867estatus: jukebox #9mre
- c57484e6log: jukebox #9 diff sizemre
- 795a20carecords: guard fix live (PR 8)mre
- 6981d96fMerge branch 'fresh-on-nocmd' into mainKunibert
- 37c47840runner: one shared prompt for both fresh-session fallbacks (L16)mre
- f945d2e1|||PR runner: a resumed run with no command on a new head gets one fresh session instead of a tool errormre
- 10b2a49estatus: PR 314, guard fix proposedmre
- e73995a3log: hycon PR 314 approved after fresh reviewmre
- f60427falog: hycon PR 314 false tool errormre
- 481974f7log: Hermes accepts PR 259 findingmre
- bb0976acrecords: hycon PR 259 design findingmre
- 5c637c24records: hycon PR 259 false tool errormre
- a344c406log: routger 132 reviewedmre
- 56e70dcbrecords: review time limit 1800 s (routger 132)mre