Default configuration path falls back to the current directory when the home directory cannot be determined
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Empieza en pkg/config/localconfig.go, en DefaultConfigDir y DefaultLocalConfigPath, y luego sigue cómo comandos como context list cargan la configuración local predeterminada. Comprueba cómo se gestiona el error al buscar el directorio de inicio y cómo se aplica el comportamiento elegido tanto a las lecturas como a las escrituras. El trabajo estará terminado cuando un error al buscar el directorio de inicio deje de generar una ruta de configuración relativa al directorio actual y la CLI informe de un error claro o use una alternativa deliberada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
When MICROCKS_CONFIG_DIR is unset and the CLI cannot determine the user's home directory, DefaultConfigDir in pkg/config/localconfig.go discards the error returned by getHomeDir() and returns an empty string with no error.
DefaultLocalConfigPath then constructs the configuration path using this empty directory. Instead of returning an error or selecting a documented fallback, the resulting path can be the relative path config.
This creates an unexpected dependency on the process's current working directory. Commands that load or save local configuration may consequently resolve the configuration file relative to whichever directory the CLI was launched from, rather than using a stable, user-specific configuration directory.
Depending on the command and its execution path, this could cause the CLI to read an unintended file, create configuration in an unexpected location, or fail in a way that obscures the underlying problem. If the relative file contains authentication data, using an unintended location could also create a credential-handling risk.
Expected behavior
The CLI should not silently accept an empty configuration directory after home-directory resolution fails.
It should either:
Return a clear, actionable error indicating that the home directory could not be determined; or
Use a documented and deliberate fallback location that does not unexpectedly resolve to a file in the current working directory.
The selected behavior should be consistent for commands that read and write the default configuration.
Actual behavior
The error from getHomeDir() is discarded, and DefaultConfigDir returns an empty path with a nil error. DefaultLocalConfigPath can consequently resolve to the relative path config, allowing subsequent file operations to depend on the current working directory.
How to Reproduce?
-
Build the CLI or a small diagnostic program against the affected source.
-
Create and switch to a temporary working directory that does not contain an existing configuration file.
-
Unset MICROCKS_CONFIG_DIR and the relevant home-directory environment variables. On Windows, unset USERPROFILE; on Unix-like systems, unset HOME.
-
Call config.DefaultLocalConfigPath() or run a CLI command that loads the default local configuration, such as context list.
-
Inspect the resolved path and the command's behavior.
For a direct path-resolution check, call DefaultLocalConfigPath() and print both its returned path and error. Under the affected conditions, the expected reproduction is a relative path such as config with no reported error.
To verify actual file access separately, place a harmless, deliberately malformed test configuration file named config in the temporary working directory and run a command that loads the local configuration. A parsing error can help demonstrate that the relative file is being read. Do not use real configuration files or credentials for this test.
Microcks version or git rev
main
Install method (docker-compose, helm chart, operator, docker-desktop extension,...)
CLI
Additional information
No response
- Lenguaje dominante
- Go
- Estrellas
- 57
- Forks
- 73
- Merge medio
- 1 d 9 h
- PR fusionados (30 d)
- 28
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 1/5 Menos de una hora Aptitud para principiantes 88/100
microcks/microcks-cli#573 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug: YAML parse error in config is silently swallowed, login overwrites all other contextsPosiblemente ocupada @Sarthak-Shreshtha01 la tomó hace 5 días. Abiertocomponent/cli kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
microcks/microcks-cli#572 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
import-dir uploads secondary artifacts before their primary API definitionPosiblemente ocupada @doraem-on la tomó hace 12 días. Abiertocomponent/cli kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
microcks/microcks-cli#561 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
TEST: `ConnectAndGetToken` Returns Error on Non-200 ResponsePosiblemente ocupada @aniket866 la tomó hace 15 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microcks/microcks-cli#554 ·
Los mantenedores suelen responder en 1 día
-
Empty `AuthToken` Causes Cryptic JWT Parse ErrorPosiblemente ocupada @aniket866 la tomó hace 15 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
microcks/microcks-cli#551 ·
Los mantenedores suelen responder en 1 día
Todos los issues de microcks/microcks-cli
Issues similares
-
difficulty: easy documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
scaleway_lb_frontend: updating a frontend with external_acls = true deletes all scaleway_lb_aclAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
scaleway/terraform-provider-scaleway#4485 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100