spring-cloud / spring-cloud/spring-cloud-vault
HttpMessageConverterExtractor (v. 5.3.22) not respecting response class / responds type of VaultResponses
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 291
- Forks
- 152
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 3
Description
spring cloud version: 2021.0.3
spring version: 2.7.3 (Spring boot starter)
the vault library doesn't seem to be respecting the response type as it passes it in to HttpMessageConverterExtractor
internally.
** note** please look at the screenshots of my debugger - you will see that HttpMessageConverterExtractor cannot properly parse VaultResponses
Ex:
public class SomeClass {
}
@SpringBootApplication
public class VaultdebugApplication {
@Bean void createBean() {
List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
messageConverters.add(new ByteArrayHttpMessageConverter());
messageConverters.add(new StringHttpMessageConverter());
messageConverters.add(new ResourceHttpMessageConverter(false));
HttpMessageConverterExtractor x = new HttpMessageConverterExtractor(SomeClass.class, messageConverters);
}
public static void main(String[] args) {
SpringApplication.run(VaultdebugApplication.class, args);
}
}
the above works - HttpMessageConverterExtractor recognizes SomeClass.class as the response type one I trace it through the debugger.

however - when I try to read a secret from a vault Versioned backend (kv2) for whatever reason running the debugger at that same place shows that HttpMessageConverterExtractor will not recognize SomeClass.class.
@SpringBootApplication
public class VaultdebugApplication {
@Bean
public Secrets secrets(VaultTemplate operations) {
VaultResponseSupport<SomeClass> response = operations.read("some/vault/path", SomeClass.class);
System.out.println(response.getRequiredData()); // results in null
System.out.println(response.getData()); // results in null
return null;
}
public static void main(String[] args) {
SpringApplication.run(VaultdebugApplication.class, args);
}
}

in fact you can even see that - whatever is passed into Type responseType field isn't a class but an instance of VaultResponses.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with VaultTemplate.read(..., SomeClass.class), VaultResponseSupport, and the HttpMessageConverterExtractor call shown in the report; reproduce the issue against a Vault KV2 backend and inspect the responseType passed to the extractor. Trace the existing response-conversion tests and add coverage showing that the requested class is preserved and its data is populated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100