Skip to content

Conversation

@shmsr
Copy link
Member

@shmsr shmsr commented Dec 4, 2025

Proposed commit message

This PR improves the robustness of the Zookeeper server by adding proper bounds checking to prevent potential index-out-of-range panics, removes unused regex variables, and adds test coverage for edge cases.

  • Bug Fixes:
    • Added bounds checking for versionCapturer.FindStringSubmatch() results before accessing the capture group, preventing panic on malformed version lines
    • Added bounds checking for dateCapturer.FindStringSubmatch() results before accessing the capture group, preventing panic on malformed date lines
    • Fixed off-by-one error in mode line parsing: changed len(modeSplit) < 1 to len(modeSplit) < 2 since the code accesses modeSplit[1]
  • Code Cleanup:
    • Removed 4 unused regex variables: ipCapturer, thatNumberCapturer, portCapturer, dataCapturer

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

…tests

- Add bounds checking for version and date regex matches to prevent
  index-out-of-range panics on specific input
- Fix off-by-one error in mode split check (< 1 → < 2)
- Remove unused regex variables (ipCapturer, thatNumberCapturer,
  portCapturer, dataCapturer)
- Add TestParseSrvrEdgeCases with table-driven tests for edge cases
@shmsr shmsr requested a review from a team as a code owner December 4, 2025 10:39
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 4, 2025
@shmsr shmsr requested a review from Copilot December 4, 2025 10:39
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@shmsr shmsr self-assigned this Dec 4, 2025
@shmsr shmsr requested review from tommyers-elastic and removed request for Copilot December 4, 2025 10:39
@shmsr shmsr added the Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team label Dec 4, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 4, 2025
@mergify
Copy link
Contributor

mergify bot commented Dec 4, 2025

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @shmsr? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@shmsr
Copy link
Member Author

shmsr commented Dec 9, 2025

@mykola-elastic Could you please review this as well?

@shmsr shmsr requested a review from mykola-elastic December 10, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants