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

HttpMessageConverterExtractor (v. 5.3.22) not respecting response class / responds type of VaultResponses

未关闭
#653 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

status: waiting-for-feedback
主要语言
Java
星标
291
派生
152
平均合并
11 小时 24 分钟
30 天内合并 PR
3

描述

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.

image

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);
	}
}

image

in fact you can even see that - whatever is passed into Type responseType field isn't a class but an instance of VaultResponses.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 VaultTemplate.read(..., SomeClass.class)、VaultResponseSupport 以及报告中所示的 HttpMessageConverterExtractor 调用开始;在 Vault KV2 后端上复现该问题,并检查传递给 extractor 的 responseType。跟踪现有的响应转换测试,并添加覆盖范围以表明请求的类得以保留且其数据已填充。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, spring, spring-boot
领域
backend, security
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。