A null body limit is refused, not read as no limit; the gate on the wrong machine is refused
Review of the registry hand-over. The proxy's bodyLimit treated an absent key and a JSON null alike, so a `max-request-body: null` was served unlimited here while the adapter skipped it and the catalogue refused it — one provider carrying what the others refuse. Presence is now checked before the value is read. The catalogue-backed test asserted the gate pulling the store in beside it as the feature. It was the fault: a node-scoped requirement with one candidate installs that candidate, so a gate assigned to a machine without the store raised a second, empty one there behind the real credentials and the public name. The store's seat is one per mesh now (mesh-catalog), and the test asserts the refusal by name. Delete is asserted only behind the lock. hq ADR 0082/0104, the registry hand-over.
This commit is contained in:
@@ -208,7 +208,8 @@ func TestABodyLimitIsReadFromTheContributionOrTheRouteIsSkipped(t *testing.T) {
|
||||
{"from":"gate","node":"anchor","values":{"name":"registry-api.example","port":5001,"max-request-body":21474836480}},
|
||||
{"from":"app","node":"anchor","values":{"name":"app.example","port":8080}},
|
||||
{"from":"odd","node":"anchor","values":{"name":"odd.example","port":8081,"max-request-body":"20g"}},
|
||||
{"from":"none","node":"anchor","values":{"name":"none.example","port":8082,"max-request-body":0}}
|
||||
{"from":"none","node":"anchor","values":{"name":"none.example","port":8082,"max-request-body":0}},
|
||||
{"from":"nul","node":"anchor","values":{"name":"nul.example","port":8083,"max-request-body":null}}
|
||||
]}`))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -219,7 +220,9 @@ func TestABodyLimitIsReadFromTheContributionOrTheRouteIsSkipped(t *testing.T) {
|
||||
if got := routes["app.example"].MaxRequestBody; got != 0 {
|
||||
t.Errorf("a route that asked for no limit was given one: %d", got)
|
||||
}
|
||||
for _, skipped := range []string{"odd.example", "none.example"} {
|
||||
// A `null` is not absence: the adapter skips it and the catalogue refuses it, and a proxy
|
||||
// that read it as "no limit" would be the one provider carrying what the others refuse.
|
||||
for _, skipped := range []string{"odd.example", "none.example", "nul.example"} {
|
||||
if _, served := routes[skipped]; served {
|
||||
t.Errorf("%s asked for a limit that is not a number of bytes and was served anyway", skipped)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user