Skip to content

Fix normalizeURI bypass for binary $request#17

Merged
sergeyfast merged 1 commit into
masterfrom
release/v0.1.3
May 19, 2026
Merged

Fix normalizeURI bypass for binary $request#17
sergeyfast merged 1 commit into
masterfrom
release/v0.1.3

Conversation

@sergeyfast
Copy link
Copy Markdown
Contributor

Summary

  • normalizeURI now returns invalidMarker when $request has no spaces; previously the SplitN early-return handed the raw blob back to the caller, skipping every normalizePath guard (length cap, utf8 check, control-byte and \x-escape checks) and letting binary land in the uri label.
  • Caught in production after 0.1.2: gatesrv kept logging label_value_too_long for topsrv_nginx_4xx_requests_total on riderhelp even with version="0.1.2". Samples were TLS-handshake bytes like \x06\x00\x00\x003_xgDcA\x00... and no /:invalid bucket ever appeared in VM — the giveaway that normalizePath was never being reached.

Test plan

  • GOEXPERIMENT=jsonv2 go test ./internal/topsrv/nginx/ — passes, including new regression cases (the prod TLS-handshake sample, empty string, single token).
  • Tag v0.1.3, watch goreleaser publish.
  • On riderhelp: systemctl restart topsrv after auto-update picks up 0.1.3, confirm gatesrv_push_validation_failed_total{project="vmkteam",reason="label_value_too_long"} stops climbing and /:invalid bucket starts populating in topsrv_nginx_4xx_requests_total.

- Return invalidMarker when $request has no spaces — previously the
  SplitN early-return handed the raw blob back to the caller, skipping
  every normalizePath guard (length cap, utf8 check, control-byte and
  \x escape checks) and letting binary land in the uri label
- This surfaced in prod after 0.1.2: gatesrv kept logging
  label_value_too_long for topsrv_nginx_4xx_requests_total on
  riderhelp with samples like "\x06\x00\x00\x003_xgDcA\x00..." even
  though the agent reported version=0.1.2; the giveaway was no
  "/:invalid" bucket ever appearing in VM for that instance
- Add regression cases (the riderhelp TLS-handshake sample, empty
  string, single token) to TestNormalizeURI so the early-return cannot
  regress unnoticed
@sergeyfast sergeyfast merged commit 80f450a into master May 19, 2026
2 checks passed
@sergeyfast sergeyfast deleted the release/v0.1.3 branch May 19, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant