fix(enrollment): emit 'error' anomaly metric on validation-failure exits (#984)#1099
Merged
ToddHebebrand merged 3 commits intoJun 6, 2026
Merged
Conversation
…heck findings) govulncheck (Security Scanning workflow) is failing on main and every open PR with 2 Go standard-library vulnerabilities, both fixed in go1.25.11: - GO-2026-5039 net/textproto (unescaped inputs in errors) - GO-2026-5037 crypto/x509 (inefficient candidate hostname parsing) These are stdlib-only (no third-party module bumps needed); a freshly-published advisory started failing the scan on unchanged code because CI pinned 1.25.10. Bump the GO_VERSION / go-version pins in ci.yml, codeql.yml and release.yml so the scan (and the released agent binary's stdlib) use the patched toolchain. go.mod's go directive (1.25.10 floor) is intentionally left as-is.
security.yml runs the Go Vulnerability Check job and had its own GO_VERSION: '1.25.10' (separate from ci.yml). Bumping it to 1.25.11 is what actually makes govulncheck use the patched stdlib.
…ly metric (LanternOps#984) recordAgentEnrollment was only called on the rate-limit 'denied' and the final 'success' exits, so every enrollment-secret rejection and the device-limit rejection recorded nothing — the recorder's declared 'error' variant was never emitted. That left the EnrollmentSpike alert (which fires on enrollment volume 'by tenant' and says 'verify this is an expected rollout, not a leaked key') blind to a burst of invalid-secret 403s from someone probing with a leaked/guessed enrollment key. Emit recordAgentEnrollment('error') at the five secret-validation 403 exits (missing + invalid, key-based + configured + production-enforce) and the device-limit rejection (with the partner id, which is resolved there). Metric calls only — no change to enrollment behavior. Adds a test asserting 'error' is recorded on the production-enforce rejection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #984.
Problem
recordAgentEnrollmentwas only called on two exits — rate-limit'denied'and the final'success'. Every secret-validation 403 and the device-limit rejection recorded nothing, and the recorder's declared'error'variant was never emitted anywhere. So the EnrollmentSpike alert (fires on enrollment volumeby (tenant), description: 'verify this matches an expected rollout, not a leaked enrollment key') is blind to a burst of invalid-secret 403s — exactly the signature of someone probing with a leaked/guessed key.Fix
Emit
recordAgentEnrollment('error')at:deviceLimitPartnerIdso it carries the tenantMetric calls only; no change to enrollment behavior or responses. Verified:
apps/apitsc clean, the 22-case enrollment suite passes including a new assertion that'error'is recorded on the production-enforce rejection.Note
Stacked on #1096 (Go-1.25.11 govuln fix) so Security Scanning is green; the 4 Go-workflow lines drop out when #1096 merges.