Default configuration path falls back to the current directory when the home directory cannot be determined
Mantenedores costumam responder em até 1 dia
@Sarthak-Shreshtha01 já está trabalhando nisso.
Desde 13/10/2026.
- #584 de @Sarthak-Shreshtha01 — aberto
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 76/100
Direção de pesquisa
Comece em pkg/config/localconfig.go, em DefaultConfigDir e DefaultLocalConfigPath, e depois acompanhe como comandos como context list carregam a configuração local padrão. Verifique como o erro ao localizar o diretório home é tratado e como o comportamento escolhido se aplica tanto às leituras quanto às gravações. O trabalho estará concluído quando uma falha ao localizar o diretório home deixar de gerar um caminho de configuração relativo ao diretório atual e a CLI informar um erro claro ou usar uma alternativa deliberada.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Go
- Estrelas
- 58
- Forks
- 72
- Merge médio
- 1d 11h
- PRs com merge (30d)
- 27
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de microcks/microcks-cli
-
microcks test exits with code 1 (contract failure) instead of code 11 (connection) when polling loop times outTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
microcks/microcks-cli#573 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
bug: YAML parse error in config is silently swallowed, login overwrites all other contextsTalvez já em andamento @Sarthak-Shreshtha01 assumiu há 7 dias. Abertacomponent/cli kind/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
microcks/microcks-cli#572 · 6 comentários ·
Mantenedores costumam responder em até 1 dia
-
import-dir uploads secondary artifacts before their primary API definitionTalvez já em andamento @doraem-on assumiu há 14 dias. Abertacomponent/cli kind/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
microcks/microcks-cli#561 · 4 comentários ·
Mantenedores costumam responder em até 1 dia
-
TEST: `ConnectAndGetToken` Returns Error on Non-200 ResponseTalvez já em andamento @aniket866 assumiu há 17 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
microcks/microcks-cli#554 ·
Mantenedores costumam responder em até 1 dia
-
Empty `AuthToken` Causes Cryptic JWT Parse ErrorTalvez já em andamento @aniket866 assumiu há 17 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
microcks/microcks-cli#551 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de microcks/microcks-cli
Issues semelhantes
-
perf(translator): Claude→Responses stream re-validates the whole request body on every SSE chunkAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
router-for-me/CLIProxyAPI#6665 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
superplanehq/superplane#8557 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
copilot-api domain:platform go
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
docs: clarify gh api -f vs -F and @-file expansion in the gh skillTalvez já em andamento @MatiasOlivera assumiu hoje. Abertaenhancement
Dificuldade 2/5 Meio dia Facilidade para iniciantes 62/100
cli/cli#14701 · 2 comentários ·
Mantenedores costumam responder em até 1 dia