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

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

オープン
#653 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

status: waiting-for-feedback
主要言語
Java
スター
291
フォーク
152
平均マージ
11時間 24分
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. 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 を短くまとめたダイジェスト。