What's wrong
ObjectStore.OpenStaging only accepts upstream keys made of [A-Za-z0-9_-] (GitLfsCache/Storage/ObjectStore.cs, IsValidUpstream / IsUpstreamCharacter), and throws ArgumentException otherwise. Nothing earlier applies the same rule:
GitLfsCacheOptionsValidator.ValidateUpstreams does not check the key's characters, so startup succeeds.
UpstreamRegistry and LfsRouteParser accept any key, so /…/{upstream}/…/info/lfs/objects/batch works and the batch is rewritten.
The failure only shows up on the object routes:
- Download miss (
Endpoints/ObjectRouteHandler.cs:332): the object is fetched from upstream, and then store.OpenStaging(route.Upstream) throws. The client gets a 500 and nothing is stored, so every download of every object fails, every time.
- Upload (
Endpoints/ObjectRouteHandler.cs:226): OpenStaging is the first thing called, so every PUT fails.
Failure scenario
Upstreams__gitlab.com__BaseUrl=https://gitlab.com
Repositories__0=**
git lfs pull through the cache: the batch call returns 200, then every object GET returns 500. A test using the repo's own ProxyFixture showed:
batch status 200
download threw ArgumentException: 'gitlab.com' is not a valid upstream key. (Parameter 'upstream')
upstream fetches: 1
A dotted key is a natural thing to configure, because upstreams are usually named after their host.
Suggested fix
Either:
- make
GitLfsCacheOptionsValidator reject keys that ObjectStore would reject, with a message naming the setting and the allowed characters, so the misconfiguration fails at startup rather than per request; or
- map the upstream key to a safe directory name in
ObjectStore (an escaped form or a hash), so any key the registry accepts can be stored.
Acceptance: a configuration with a dotted upstream key is either refused at startup with a clear error, or serves downloads and uploads successfully. There is a test for whichever option is chosen.
What's wrong
ObjectStore.OpenStagingonly accepts upstream keys made of[A-Za-z0-9_-](GitLfsCache/Storage/ObjectStore.cs,IsValidUpstream/IsUpstreamCharacter), and throwsArgumentExceptionotherwise. Nothing earlier applies the same rule:GitLfsCacheOptionsValidator.ValidateUpstreamsdoes not check the key's characters, so startup succeeds.UpstreamRegistryandLfsRouteParseraccept any key, so/…/{upstream}/…/info/lfs/objects/batchworks and the batch is rewritten.The failure only shows up on the object routes:
Endpoints/ObjectRouteHandler.cs:332): the object is fetched from upstream, and thenstore.OpenStaging(route.Upstream)throws. The client gets a 500 and nothing is stored, so every download of every object fails, every time.Endpoints/ObjectRouteHandler.cs:226):OpenStagingis the first thing called, so every PUT fails.Failure scenario
git lfs pullthrough the cache: the batch call returns 200, then every object GET returns 500. A test using the repo's ownProxyFixtureshowed:A dotted key is a natural thing to configure, because upstreams are usually named after their host.
Suggested fix
Either:
GitLfsCacheOptionsValidatorreject keys thatObjectStorewould reject, with a message naming the setting and the allowed characters, so the misconfiguration fails at startup rather than per request; orObjectStore(an escaped form or a hash), so any key the registry accepts can be stored.Acceptance: a configuration with a dotted upstream key is either refused at startup with a clear error, or serves downloads and uploads successfully. There is a test for whichever option is chosen.