Skip to content

Prevent Telnet clients reaching or stalling the application - #318

Draft
FreeAndNil wants to merge 3 commits into
masterfrom
Feature/318-telnet-default
Draft

Prevent Telnet clients reaching or stalling the application#318
FreeAndNil wants to merge 3 commits into
masterfrom
Feature/318-telnet-default

Conversation

@FreeAndNil

Copy link
Copy Markdown
Contributor

Two findings on TelnetAppender, both about what a connected client can do to
the host application rather than to the log.

  • f012 The appender streams the log to any client that connects,
    unauthenticated, and defaulted to every interface on port 23. It now defaults
    to 127.0.0.1; remote access is opt-in via listenAddress. Every documented
    example already used loopback.
  • f014 Clients were written to serially under the appender lock, so one that
    stopped reading held up every thread that logs for sendTimeoutMillis. Writes
    go through a background thread now, bounded by sendQueueSize (500), with a
    logging call waiting at most enqueueTimeoutMillis (50) for room.

Both change behaviour and need release notes:

  • Relying on the implicit all-interfaces bind loses remote access until
    listenAddress is set.
  • Telnet delivery is asynchronous and drops under load, never the log. While the
    queue stays full, enqueueTimeoutMillis caps logging at 20 events/s; set it to 0
    to drop immediately instead of waiting.

A third commit merges three copies of RecordingErrorHandler in the tests into
one helper, which is what the f014 test needed.

- The appender streams the rendered log to any client that connects, with no
  authentication and no encryption, and defaulted to every interface on port 23.
- It now defaults to 127.0.0.1. Watching from another machine is opt-in: set
  listenAddress to 0.0.0.0 or ::. Every documented example already used loopback.
- SocketHandler(port, sendTimeoutMillis) defaults the same way.

Deliberate default flip: a deployment relying on the implicit all-interfaces
bind loses remote access until it sets listenAddress.

audit da18b6f-f012
Three copies, two identical and one collecting into a joined string instead of
a list. Now one internal helper beside SimpleTelnetClient and UdpMock, exposing
Messages; the ANSI test asserts on that instead of its own Message property.
- Clients were written to serially under the appender lock, so one that stopped
  reading blocked every logging thread for sendTimeoutMillis.
- Events are queued now, sendQueueSize 500, enqueueTimeoutMillis 50.
- A full queue drops from the telnet stream, never from the log.
- While the queue stays full, enqueueTimeoutMillis caps logging at 20 events/s;
  set it to 0 to drop immediately instead of waiting.

audit da18b6f-f014
@FreeAndNil FreeAndNil added this to the 3.5.0 milestone Sep 4, 2026
@FreeAndNil
FreeAndNil changed the base branch from master to Feature/2.x September 4, 2026 20:47
@FreeAndNil
FreeAndNil changed the base branch from Feature/2.x to master September 4, 2026 20:47
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