Provider keys in the process environment reach model-run bash commands
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 68/100
Línea de trabajo
Start with StreamingEnv in internal/exec/bare/streaming.go:120 and JobShellEnv in internal/exec/tools.go:1594 and :1938, then read APIKeyAt in internal/config/apikey.go:60. Run the supplied unit test in internal/exec/bare and inspect the two belt paths. Done means provider credentials are scrubbed by default, explicit pass-through works, exported and profile-only cases are covered without secret logging, and the opt-in is documented.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Seen on dev@debffabf6.
What happened
Both belts pass the parent process environment to bash commands run for a model. When OPENROUTER_API_KEY is exported, the child receives it. JobShellEnv removes tmux variables but does not remove provider credentials. A key stored only in the profile is read by config.APIKeyAt; that function does not export it into codeaf's process environment, so the profile-only case does not by itself expose OPENROUTER_API_KEY to the child.
Replication
Deterministic (no model). Save as internal/exec/bare/shell_env_key_test.go and run go test ./internal/exec/bare -run TestAProviderKeyDoesNotReachAModelsShell -count=1:
package bare
import (
"strings"
"testing"
)
// A provider key in codeaf's environment must not reach a model's shell.
func TestAProviderKeyDoesNotReachAModelsShell(t *testing.T) {
t.Setenv("OPENROUTER_API_KEY", "probe-not-a-key")
for _, entry := range StreamingEnv() {
if strings.HasPrefix(entry, "OPENROUTER_API_KEY=") {
t.Fatal("OPENROUTER_API_KEY reaches the environment of the model's shell")
}
}
}
Today it fails with OPENROUTER_API_KEY reaches the environment of the model's shell. StreamingEnv is the seam the foreground bash tool and the job registry both use.
Field (real models). With OPENROUTER_API_KEY exported, in a throwaway repository: codeaf do --json 'run exactly this shell command and report its output: if [ -n "${OPENROUTER_API_KEY+x}" ]; then echo key-set; else echo key-unset; fi'. Under a minute, a fraction of a cent. Today the reply reports key-set. The command never prints the value.
Where
At dev@debffabf6, internal/exec/bare/streaming.go:120, StreamingEnv, starts from os.Environ(); internal/exec/tools.go:1594 and :1938, JobShellEnv, preserve provider keys. internal/config/apikey.go:60, APIKeyAt, reads a profile key without setting an environment variable.
The fix
Give model-run child processes a scrubbed environment that removes provider credentials by default. Provide a deliberate opt-in pass-through for a task that genuinely needs one.
Acceptance
- e2e: a bash call on each belt prints
key-unsetfor a provider key inherited by codeaf unless an explicit pass-through was granted. - Unit: environment filtering covers exported and profile-only keys without logging secret values.
- Document the opt-in and record the former inheritance in
invalidates.
- Lenguaje dominante
- Go
- Estrellas
- 115
- Forks
- 14
- Merge medio
- 9 h 38 min
- PR fusionados (30 d)
- 749
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Agent-Field/CodeAF
-
area:chat feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Agent-Field/CodeAF#1510 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Agent-Field/CodeAF#1489 ·
Los mantenedores suelen responder en 1 día
-
area:chat bug good first issue sev:papercut
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Agent-Field/CodeAF#1470 ·
Los mantenedores suelen responder en 1 día
-
area:chat bug good first issue sev:papercut
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Agent-Field/CodeAF#1469 ·
Los mantenedores suelen responder en 1 día
-
area:chat bug sev:papercut
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Agent-Field/CodeAF#1468 ·
Los mantenedores suelen responder en 1 día
Todos los issues de Agent-Field/CodeAF
Issues similares
-
security
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
cvss-severity:high devguard l3montree-cybersecurity/...ard-k8s-image-inventory pkg:oci/devguard-k8s-ima...ch=amd64&tag=main-amd64 pkg:oci/devguard-k8s-ima...ch=arm64&tag=main-arm64 risk:low state:open
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
l3montree-dev/devguard#3094 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
JuliusBrussee/caveman#1127 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement low priority
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
eugenioenko/ttt#674 ·
Los mantenedores suelen responder en 1 día
-
kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
gpustack/gpustack-operator#640 ·
Los mantenedores suelen responder en 1 día