spring-cloud / spring-cloud/spring-cloud-consul

Instance not being marked as secure when secure=true tag present

Open
#743 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
822
Forks
539
Avg merge
9h 31m
Merged PRs (30d)
7

Description

Specifically using:

  • Spring Boot: 2.4.6
  • Spring Cloud: 2020.0.3
  • Spring Cloud Consul Discover 3.0.3

When the ConsulDiscoveryClient.getInstances() is called, and the service is registered within consul with the secure=true tag being set, the returned ServiceInstance is not flagged as secure.

From looking at the ConsulServiceInstance, it appears that getSecure(healthService) is only checking the Metadata, however I believe it should be checking both the metadata and the tags.

The reason I believe it should be both is because our Spring Cloud Gateway instances (Spring Boot 2.3.9, Spring Cloud Hoxton.SR9) is registering itself with consul, and Spring Cloud Consul Discovery is registering and setting that secure=true tag and not setting any metadata.

Edit: I realize after looking a bit more, this may be by design and PR https://github.com/spring-cloud/spring-cloud-consul/pull/700 could resolve it once completed.

Contributor guide

Open the contributing guide

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

The reported behavior is in ConsulServiceInstance, reached through ConsulDiscoveryClient.getInstances(); start by reading getSecure(healthService) and how metadata and tags are populated. Confirm the intended handling of secure=true from Consul registration, including the linked PR #700 context, and document or test the resulting ServiceInstance secure flag.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.