GPT-6.1 Sol · Heavy

anonymous-add-configurable-device-limit-grafana-codex

Grafana · Go · M · 100–299 lines · 6 files

The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.

Gold bugs found
2 of 2
Comments published
4
Comments matching a bug
2
Comments not matching
2
Cost of this PR
$1.302

Published comments (4)

highsecuritypkg/services/anonymous/anonimpl/client.go:44-50

Missing device header bypasses the anonymous device limit — Requests without `X-Grafana-Device-Id` receive an anonymous identity even when all device slots are occupied because `TagDevice` returns nil for an empty header. Enforce device admission for these requests rather than treating a tagging no-op as successful admission.

highbugpkg/setting/setting.go:1654

Environment-only anonymous device limit configuration is ignored — Setting only `GF_AUTH_ANONYMOUS_DEVICE_LIMIT` leaves `AnonymousDeviceLimit` at zero because environment overrides apply only to existing INI keys, and `conf/defaults.ini` lacks `device_limit`. Add `device_limit = 0` to its anonymous-auth section so environment-only configuration works.

highbugpkg/services/anonymous/anonimpl/impl.go:144-147

Rejected devices remain cached and bypass the device limit on retry — A rejected device can authenticate on retry because `tagDeviceUI` populates `localCache` before persistence, letting subsequent `TagDevice` calls skip the store check after `ErrDeviceLimitReached`. Cache only successfully persisted devices, or remove the cached entry before returning the error. **Also found in:** - `pkg/services/anonymous/anonimpl/client.go:44-46`

highbugpkg/services/anonymous/anonimpl/anonstore/database.go:109-117

Non-atomic device admission allows concurrent requests to exceed the limit — Concurrent requests can both pass `CountDevices` and insert distinct devices, exceeding `deviceLimit`. Make counting and admission mutually exclusive across server instances using a database lock and a suitably isolated transaction.

Gold bugs found (2)

hightagDeviceUI caches the device key before CreateOrUpdateDevice; when the store returns ErrDeviceLimitReached the entry stays, so the next request from the same device skips the limit check and authenticates for up to 29 minutes.
highThe new auth.anonymous device_limit setting has no entry in conf/defaults.ini, so the GF_AUTH_ANONYMOUS_DEVICE_LIMIT environment override is ignored and the limit stays 0.

Gold bugs missed (0)

None.