Skip to content

Fix cache allowed hosts condition#411

Merged
inqrphl merged 2 commits into
mainfrom
cache-allowed-hosts-fix
Jul 14, 2026
Merged

Fix cache allowed hosts condition#411
inqrphl merged 2 commits into
mainfrom
cache-allowed-hosts-fix

Conversation

@inqrphl

@inqrphl inqrphl commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

two fixes:

fix if-else branch that checks if host cache is disabled or unpopulated

use a rw mutex for the resolvecache

AllowedHost.ResolveCache is populated lazily and not ahead of time during construction. In a race condition, multiple writes can overwrite eachother.

if multiple connections are being established at the same time, which happens in different goroutines, they can run AllowedHost.Contains at the same time as well and overwrite the ResolveCache

resolves #406

Ahmet Oeztuerk added 2 commits July 14, 2026 15:12
AllowedHost.ResolveCache is populated lazily and not ahead of time during construction. In a race condition, multiple writes can overwrite eachother.

if multiple connections are being established at the same time, which happens in different goroutines,  they can run AllowedHost.Contains at the same time as well and overwrite the ResolveCache
@sni

sni commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

looks good, can be merged once the unit tests are ready.

@inqrphl inqrphl merged commit a08554d into main Jul 14, 2026
147 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'cache allowed hosts' appears to use inverted DNS caching logic

2 participants