bug: SQLite-based agents fail in sandboxes because the default policy leaves /var/tmp unwritable

Aperta
#5,958 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, linux, rust, sqlite
Ambito
devops, security

Direzione di ricerca

Start with the default sandbox policy definition, where /tmp is read-write and /var/tmp is not, and check how Landlock rules are built from it. Reproduce with the command in the issue: touch /var/tmp/a should fail while touch /tmp/a succeeds. Done means either /var/tmp is in the default read-write baseline or TMPDIR=/tmp is set when the image doesn't define it, and the default policy docs describe the change.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

User Story

I run coding agents such as Codex in OpenShell sandboxes. Codex 0.172 exits at startup in a sandbox with the default policy, because its SQLite state database can't create a temporary file. I need common agent CLIs to start under the default policy without per-image workarounds.

Problem Statement

The default policy makes /tmp read-write but leaves /var/tmp unwritable. With TMPDIR unset, SQLite on Linux chooses its temporary directory from SQLITE_TMPDIR, TMPDIR, /var/tmp, /usr/tmp and /tmp, in that order. Its check that a directory is writable doesn't account for Landlock, so it picks /var/tmp and then fails to open a file there with SQLITE_CANTOPEN (code 14).

Any workload that uses SQLite temporary files, or that otherwise writes to /var/tmp, fails the same way.

Impact / Why This Matters

Codex 0.172 stops at startup:

Error: failed to initialize sqlite state runtime under /sandbox/.codex: failed to
migrate state DB at /sandbox/.codex/state_5.sqlite: while executing migration 23:
error returned from database: (code: 14) unable to open database file

The cause isn't visible to the user: the error names the database under the writable home directory, not /var/tmp. The workaround is to export TMPDIR and SQLITE_TMPDIR pointing at a writable directory in every image or startup command, or to add /var/tmp to a custom policy.

Acceptance Criteria

  • Under the default policy, a workload that uses SQLite temporary files with TMPDIR unset works, for example Codex 0.172 starting in a sandbox.
  • The default policy page documents the behavior.

Reproduction Steps

  1. Create a sandbox with the default image and policy:

    openshell sandbox create -- sh -c 'touch /tmp/a && echo "/tmp writable"; touch /var/tmp/a || echo "/var/tmp not writable"; sleep infinity'
    
  2. The output shows /tmp writable and /var/tmp not writable.

  3. Any SQLite program that needs a temporary file, run with TMPDIR unset, fails with unable to open database file.

Environment

  • OpenShell: 0.1.10-dev, PR #5856 branch at 8c4ee70
  • OS: Fedora, Linux 7.2
  • Runtime: Docker compute driver, default policy, default nvcr.io/nvidia/base/ubuntu:24.04 base image with Codex 0.172.0 added

Suggested UX (if applicable)

Either option would fix it without user action:

  • Add /var/tmp to the default read-write baseline, next to /tmp.
  • Set TMPDIR=/tmp in the sandbox environment when the image doesn't set it.
Lingua principale
Rust
Stelle
21.5k
Fork
2.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA/OpenShell

Tutte le issue di NVIDIA/OpenShell

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.