Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid configuration is not fatal #685

Open
mwisnicki opened this issue Mar 28, 2023 · 2 comments
Open

Invalid configuration is not fatal #685

mwisnicki opened this issue Mar 28, 2023 · 2 comments

Comments

@mwisnicki
Copy link

mwisnicki commented Mar 28, 2023

Describe the bug
If configuration is invalid (e.g. wrong SSL certs) then vault config prints exception and continues execution.
Even when spring.config.import is not set to optional.

This is probably because in LeaseAwareVaultPropertySource ignoreSecretNotFound is always true.

Sample
bug-vault-bad-config-nonfatal.zip

  1. Use spring-cloud-starter-vault-config:3.1.2
  2. Point config to invalid vault url
  3. Make sure import is non-optional
spring:
  cloud:
    vault:
      uri: https://bad.site/
      authentication: token
      token: foo
  config:
    import: vault://foo/bar

Log

2023-03-28T13:22:06.206-04:00  INFO 23668 --- [           main] o.s.v.c.e.LeaseAwareVaultPropertySource  : Vault location [foo/bar] not resolvable: I/O error on GET request for "https://bad.site:443/v1/foo/bar": bad.site
2023-03-28T13:22:06.592-04:00  INFO 23668 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=13545f80-8375-3886-af6d-4191f093e243
2023-03-28T13:22:06.862-04:00  INFO 23668 --- [           main] e.b.BugVaultBadConfigNonfatalApplication : Started BugVaultBadConfigNonfatalApplication in 1.657 seconds (process running for 2.251)
@mwisnicki mwisnicki changed the title Invalid kubernetes configuration is not fatal Invalid configuration is not fatal Mar 28, 2023
@mwisnicki
Copy link
Author

PS. I know about fail-fast but spring.config.import has concept of optional and non-optional imports and these should be honored IMHO.

@mp911de
Copy link
Member

mp911de commented Mar 29, 2023

Have you tried setting spring.cloud.vault.fail-fast=true? This has been in place since the bootstrap context.

Generally, we could switch entirely on the built-in mechanism by throwing ConfigDataResourceNotFoundException.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants