feat(policy): detect destructive command chaining in exec strings

Abierto
#755 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
security

Línea de trabajo

Comienza comparando openshell-sandbox/data/sandbox-policy.rego, la ruta de políticas YAML a través de openshell-prover y los filtros a nivel de Rust en el crate sandbox. Rastrea dónde sigue disponible la cadena de comando sin procesar antes de execve y, después, define pruebas para primitivas destructivas unidas mediante &&, punto y coma o pipelines, y para las excepciones de operadores.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

state:stale

Running OpenShell on a Mac Mini M4 (Docker Desktop) to sandbox coding agents, same setup I flagged in #745. Ran into an adjacent gap in what actually gets enforced.

Binary-level policy (seccomp, Landlock) allows rm, dd, mkfs, shred for legit use. That's fine. The problem isn't running them individually, it's chaining them in a single exec string:

rm -rf /data && dd if=/dev/zero of=/dev/sda

That ships as one command. Each binary is allowed. The chain is what does the damage.

&& is the one I've actually hit. ; and stuff like find ... | xargs rm show up too. Subshells/backticks are possible, but I haven't seen those in practice. Landlock and seccomp only see individual execve calls, so none of this composition is visible at that layer. It all exists at the shell level.

Want a policy that looks at the raw command string before execve, and blocks when multiple destructive primitives are chained together. Then let operators carve out exemptions where that pattern is actually intentional.

Simple string inspection with awareness of chaining operators is probably enough for this class of issue. Full AST parsing feels like overkill and fragile. A small set of dangerous primitives (rm, dd, mkfs, shred, maybe fdisk, diskutil) covers most of the high-risk cases.

This is a guardrail, not perfect detection. Some legit workflows will trip it, and that's what exemptions are for.

#745 covers visibility into which layers are active. This is the adjacent gap: what gets enforced semantically, while the full command string still exists pre-execve.

Not sure where this should live. I see openshell-sandbox/data/sandbox-policy.rego, YAML policies via openshell-prover, and Rust-level filters in the sandbox crate. Would want direction before picking a lane.

Lenguaje dominante
Rust
Estrellas
8.7k
Forks
1.3k
Merge medio
2 d 7 h
PR fusionados (30 d)
243

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NVIDIA/OpenShell

Todos los issues de NVIDIA/OpenShell

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.