spring-cloud / spring-cloud/spring-cloud-vault

Invalid configuration is not fatal

Open
#685 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
291
Forks
152
Avg merge
11h 24m
Merged PRs (30d)
3

Description

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with LeaseAwareVaultPropertySource and reproduce the behavior using the supplied bug-vault-bad-config-nonfatal.zip sample and YAML configuration. Check how ignoreSecretNotFound and the non-optional spring.config.import affect the invalid Vault URL, then verify that the application no longer continues after the configuration error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, cloud, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.