Malformed local configuration is silently accepted and can be overwritten
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
Línea de trabajo
Empieza en pkg/config/localconfig.go, alrededor de las líneas 103-112, donde se ignora el error de UnmarshalLocalFile y se valida la configuración con valores cero, y luego en las líneas 416-421, donde la ruta de watch devuelve una configuración vacía si falla el unmarshal. Devuelve un error cuando falle el unmarshal, manteniendo la rama os.IsNotExist. Está terminado cuando un archivo principal o de watch malformado produce un error de YAML y el archivo queda sin cambios, y ambos casos están cubiertos por pruebas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Malformed local configuration is silently accepted and can be overwritten
Evidence: pkg/config/localconfig.go:103-112 calls UnmarshalLocalFile, but does not return when that call fails; it proceeds to validate the zero-value config. The watch equivalent at :416-421 returns &config, nil even when unmarshalling fails.
Impact: A truncated or manually edited config file can be treated as an empty configuration instead of producing an error. Commands may then overwrite the corrupted file, losing contexts, servers, and cached credentials; a malformed watch file can silently erase watch entries.
steps to reproduce:
Run each command separately, pressing Enter after each command.
-
Create a malformed main configuration file:
set "CFG=%TEMP%\microcks-config.yaml" echo current-context: [broken> "%CFG%" type "%CFG%"The file should contain:
current-context: [broken -
Run:
go run . --config "%CFG%" context -
Observe that no YAML parse error is reported. The command instead reports that no contexts are defined, treating the malformed file as an empty configuration.
-
Save a copy and compare the file after any command that writes local configuration:
copy /y "%CFG%" "%CFG%.before" fc "%CFG%.before" "%CFG%" -
Repeat with a malformed watch configuration:
set "MICROCKS_CONFIG_DIR=%TEMP%\microcks-malformed" mkdir "%MICROCKS_CONFIG_DIR%" 2>nul echo entries: [broken> "%MICROCKS_CONFIG_DIR%\watch" type "%MICROCKS_CONFIG_DIR%\watch" go run ./watcherThe watcher should report a YAML parsing error. On the affected code, it starts with an empty watch configuration instead.
Suggested fix: Immediately return a typed environment/configuration error when unmarshalling fails, while preserving the existing os.IsNotExist behavior. Add tests for malformed main and watch files and verify the files remain unchanged after the failed read.
- Lenguaje dominante
- Go
- Estrellas
- 59
- Forks
- 74
- Merge medio
- 4 d 5 h
- PR fusionados (30 d)
- 15
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
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 microcks/microcks-cli
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
microcks/microcks-cli#610 ·
Los mantenedores suelen responder en 1 día
-
bug: microcks test get swallows test failure details and operation results in text output modeAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
microcks/microcks-cli#608 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
microcks/microcks-cli#606 ·
Los mantenedores suelen responder en 1 día
-
Windows test failures in MockFileSystem.Walk due to path separatorPosiblemente ocupada @dipak0000812 la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
microcks/microcks-cli#601 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Bug: `testEndpoint` URL Scheme Not ValidatedPosiblemente ocupada @aniket866 la tomó hace 3 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
microcks/microcks-cli#598 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de microcks/microcks-cli
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
riverqueue/river#1576 ·
Los mantenedores suelen responder en 1 día
-
NFS StorageProvider renders a missing nfsSubDir as "<no value>"Posiblemente ocupada @ldming la tomó hoy. Abiertokind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apecloud/kubeblocks#11067 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
emersion/go-msgauth#87 ·
-
CLI: `describe <ns>.<table>` reports "namespace does not exist" when only the table is missingPosiblemente ocupada @Shruthirdy la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
apache/iceberg-go#2423 ·
Los mantenedores suelen responder en 2 días
-
Add tests for CSV email parsingAbiertogood first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
mafzalkalwardev/mailforge#21 ·