gitoria

kunibert

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmainbd3591c7conductor: gates run on the live day44 binarymremain/reports/K10-review-user.md

8.7 KB

  1. # K10 report: the review model runs as its own unix user (kunibert#10)
  2. Status: DONE. Deployed (commit 07025b9, /health OK). No codex login done, no real model run. Scratch on byrodin (/tmp/kunibert-k10, probe worktree) removed.
  3. ## Created on byrodin
  4. | What | Owner / mode |
  5. |---|---|
  6. | user `kunibert-review` uid 996 gid 986 (own group only), system user, shell /usr/sbin/nologin, not in sudoers (`sudo -l -U` = not allowed) | |
  7. | /home/kunibert-review | kunibert-review, 700 |
  8. | /home/kunibert-review/.codex (its own, for its login/token refresh) | kunibert-review, 700 |
  9. | /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 |
  10. | /CONTAINERS/projects/kunibert-work (work dir for job worktrees) | root:root 755 |
  11. | /root/.config/kunibert (+ config.json, repos.json, gitoria-proof-key/-secret) | unchanged: dir 700, files 600 root |
  12. | /CONTAINERS/projects/kunibert-data (state, sessions, token temp files, git cache) | unchanged: 700 root (so svc/runner/git below it are unreachable) |
  13. 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.
  14. ## Design choice for worktrees
  15. Worktrees 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).
  16. ## Code (commits 2177f66, 2a44bd5, 07025b9, pushed to gitoria, deployed with deploy/deploy.sh)
  17. - 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).
  18. - 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.
  19. - 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).
  20. - 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"`.
  21. - 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.
  22. ## Proof on byrodin (outputs, as kunibert-review via `runuser -u kunibert-review --`; stdout discarded, so no secret could be shown; none was readable)
  23. ```
  24. cat /root/.config/kunibert/gitoria-proof-key -> Permission denied
  25. cat /root/.config/kunibert/gitoria-proof-secret -> Permission denied
  26. cat /root/.config/kunibert/config.json -> Permission denied
  27. ls /root/.config/kunibert -> cannot access: Permission denied
  28. ls /CONTAINERS/projects/kunibert-data -> cannot open directory: Permission denied
  29. cat …/kunibert-data/svc/queue.json -> Permission denied
  30. cat …/kunibert-data/svc/deliveries.json -> Permission denied
  31. ls …/kunibert-data/runner -> Permission denied (git cache is under …/kunibert-data/git: same 700 parent)
  32. cat /root/.codex/auth.json ; ls /root/.codex -> Permission denied
  33. ```
  34. 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:
  35. ```
  36. probe: id=kunibert-review HOME=/home/kunibert-review PWD=/CONTAINERS/projects/kunibert-work/work/<key>/1
  37. probe: read a.txt: one two probe: read .kunibert/pr.diff: diff --git a/a.txt b/a.txt
  38. probe: read prompt file: You are Kunibert, the code rev… probe: read schema: { "type": …
  39. probe: write a.txt: cannot create a.txt: Permission denied
  40. probe: create file: touch: cannot touch 'newfile': Permission denied
  41. probe: list work root: ls: cannot open directory '/CONTAINERS/projects/kunibert-work/work': Permission denied
  42. probe: key: cat: /root/.config/kunibert/gitoria-proof-key: Permission denied
  43. probe: data: ls: cannot open directory '/CONTAINERS/projects/kunibert-data': Permission denied
  44. ```
  45. 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).
  46. 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)".
  47. 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.
  48. 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,…}`.
  49. ## Loreana gates (after the last commit)
  50. K4, K6, K7, K8, K9 proof.py: each ALL OK (unset reviewUser = old behaviour).
  51. ## 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)
  52. - `.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`).
  53. - TLS private keys `key.pem` (+ cert.pem) in /CONTAINERS/projects/miserit-anthar.net/{development-1..7,labs/*}/certs/ (11 dirs).
  54. - 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).
  55. - /CONTAINERS/projects/gitoria.worldapi.org/tests/app-token.mjs (a test file, content not checked).
  56. - 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.
  57. ## Later device-code login (owner approves the code)
  58. ```
  59. S=/media/STORAGE/projects/WorldAPI/worldapi-conductor/byrodin-ssh.sh
  60. $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'
  61. ```
  62. 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