Default configuration path falls back to the current directory when the home directory cannot be determined
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
Direzione di ricerca
Inizia da pkg/config/localconfig.go, in corrispondenza di DefaultConfigDir e DefaultLocalConfigPath, poi segui il modo in cui comandi come context list caricano la configurazione locale predefinita. Verifica come viene gestito l’errore di ricerca della directory home e come il comportamento scelto si applica sia alle letture sia alle scritture. Il lavoro è concluso quando un errore nella ricerca della directory home non produce più un percorso di configurazione relativo alla directory corrente e la CLI segnala chiaramente l’errore o usa un ripiego deliberato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Go
- Stelle
- 58
- Fork
- 72
- Merge medio
- 1g 11h
- PR unite (30g)
- 27
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microcks/microcks-cli
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
microcks/microcks-cli#573 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug: YAML parse error in config is silently swallowed, login overwrites all other contextsForse già presa @Sarthak-Shreshtha01 l’ha presa 6 giorni fa. Apertacomponent/cli kind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
microcks/microcks-cli#572 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
import-dir uploads secondary artifacts before their primary API definitionForse già presa @doraem-on l’ha presa 13 giorni fa. Apertacomponent/cli kind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
microcks/microcks-cli#561 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
TEST: `ConnectAndGetToken` Returns Error on Non-200 ResponseForse già presa @aniket866 l’ha presa 16 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
microcks/microcks-cli#554 ·
I maintainer di solito rispondono entro 1 giorno
-
Empty `AuthToken` Causes Cryptic JWT Parse ErrorForse già presa @aniket866 l’ha presa 16 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
microcks/microcks-cli#551 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microcks/microcks-cli
Issue simili
-
os: RawConn methods of a closed File return internal/poll.ErrFileClosing instead of ErrClosedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Bedrock invoke-with-response-stream reports `stop_reason: "end_turn"` for tool-use turnsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
oalders/clodhopper#162 ·
I maintainer di solito rispondono entro 1 giorno
-
component/server severity/minor type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
diagnose globalnet reports a failure for every exported headless ServiceForse già presa @kurtyoon l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
submariner-io/subctl#1948 ·
I maintainer di solito rispondono entro 1 giorno