AdguardTeam / AdguardTeam/AdGuardHome

Invalid mobile-config client IDs return HTTP 500 instead of 400

Aperta
#8,508 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
36.9k
Fork
2.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Problem

The Apple mobile-configuration handlers pass `http.StatusBadRequest` to
`respondJSONError` for invalid client IDs, but the helper currently writes
`http.StatusInternalServerError` unconditionally.

For example:

```text
GET /apple/doh.mobileconfig?host=example.org&client_id=invalid/client
```

is classified as a server error even though the request itself is invalid.
The shared DoT path is affected as well.

### Impact

Clients and monitoring systems may treat a correctable input error as an
AdGuard Home failure, causing misleading alerts and inappropriate retries.

### Proposed fix

Have `respondJSONError` write the status supplied by its caller. The change is
local and does not alter the response schema.

I have a shared-handler regression test that fails with 500 on the current
implementation and passes with 400 after the fix. Local validation included:

- the focused race-enabled test repeated 20 times;
- the full `home` package under the race detector;
- `go vet`;
- `make go-check`;
- Linux and Windows compile checks.

Repository history indicates the status parameter was retained during a logger
refactor while the helper body began hard-coding 500. I found no overlapping
open issue or PR for this exact behavior. If this scope is acceptable, I can
send the focused fix and test as a separate PR.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.