Skip to content

fix(metrics): local users could exhaust the daemon's file descriptors - #143

Merged
jamesconwaydev merged 1 commit into
mainfrom
fix/metrics-connection-cap
Nov 2, 2026
Merged

jamesconwaydev merged 1 commit into
mainfrom
fix/metrics-connection-cap

Conversation

@jamesconwaydev

Copy link
Copy Markdown
Owner

F2 in docs/security-review.md. The metrics endpoint had no connection limit, so any local user could hold connections open (5 s each) until the daemon hit its 1024 fd limit, taking the control socket and sinks down with it. The server now closes any connection past 16 open ones.

The new test opens two idle connections against a cap of 2 and checks the third is closed at once (on main it waits for the header timeout and the test times out), then that a scrape works once they're gone. Off by default, so only hosts with metrics.enabled = true were exposed. #127 still covers aborting a connection that stops reading.

The metrics endpoint accepted connections without limit, and each could
sit for the 5 s header timeout. About 200 a second from any local user
kept the daemon at its 1024-descriptor limit, which also stopped the
control socket and the sinks. Close any connection past 16 open ones.

This is F2 in docs/security-review.md.

Signed-off-by: James Conway <148910373+jamesconwaydev@users.noreply.github.com>
@jamesconwaydev
jamesconwaydev merged commit 921bbbb into main Nov 2, 2026
7 checks passed
@jamesconwaydev
jamesconwaydev deleted the fix/metrics-connection-cap branch November 2, 2026 14:16

@jamesconwaydev jamesconwaydev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

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.

2 participants