hashicorp / hashicorp/consul

`proxycfg.State.Watch` not protected against multiple invocations

Open
#5,791 1 comment 0 reactions 0 assignees View on GitHub
theme/connect type/bug
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

https://github.com/hashicorp/consul/blob/20eefeea117dcd23e30dab942acd2cf007024d9e/agent/proxycfg/state.go#L93-L109

This overwrites the current ctx and cancel function, executes the `run` method in a go routine and returns a chan.

The problem is that if Watch is called multiple times we could:

1. Lose the current ctx/cancel and potentially leak some go routines
2. Completely break everything related to this `proxycfg.State`. They will be sharing some internal chans so it would be possible for neither instance of the go routine running to get a complete view of the proxy configuration and never think its configuration is valid.

At this point this is all purely theoretical but we may want to prevent this in the future.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.