dotnet / dotnet/yarp

Require that routes have matching clusters

Open
#797 5 comments 0 reactions 0 assignees View on GitHub
samsp_list Type: Bug
Dominant language
C#
Stars
9.6k
Forks
933
Avg merge
12d 18h
Merged PRs (30d)
2

Description

Today routes and clusters are [validated](https://github.com/microsoft/reverse-proxy/blob/d9eeb548817364c7199acadd177f699781091a48/src/ReverseProxy/Service/Management/ProxyConfigManager.cs#L208-L209) individually before officially loading the model. However, this step does not validate if every route references a real cluster. When the model is rendered later it's possible that a route will be created that has no matching cluster.

Today this is allowed and then checks are done in middleware to short circuit routes without a cluster.
https://github.com/microsoft/reverse-proxy/blob/d9eeb548817364c7199acadd177f699781091a48/src/ReverseProxy/Middleware/DestinationInitializerMiddleware.cs#L32-L37

I reviewed this with @davidni and he said the expected scenarios for this (a more dynamic pipeline) never materialized.

Proposal:
- Check that each route references a valid cluster before accepting the config as valid.
- Remove the associated checks from middleware.

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.