Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password with newline leads to protocol violation #1133

Open
abos opened this issue May 9, 2024 · 0 comments
Open

Password with newline leads to protocol violation #1133

abos opened this issue May 9, 2024 · 0 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@abos
Copy link

abos commented May 9, 2024

Observed behavior

When the password contains a trailing newline, the connection process is broken.
The ErrorListenerLoggerImpl logs a java.util.concurrent.TimeoutException and the connect() methods throws a java.io.IOException.

In debug mode the nats server logs the following:

[7] 2024/05/09 15:55:51.075960 [TRC] 10.1.89.207:44104 - cid:10 - <<- [CONNECT {"lang":"java","version":"2.17.6","protocol":1,"verbose":false,"pedantic":false,"tls_required":false,"echo":true,"headers":true,"no_responders":true,"user":"backend]
[7] 2024/05/09 15:55:51.076231 [ERR] 10.1.89.207:44104 - cid:10 - unexpected end of JSON input
[7] 2024/05/09 15:55:51.076285 [DBG] 10.1.89.207:44104 - cid:10 - Client connection closed: Protocol Violation

Expected behavior

The connect() method should throw an AuthenticationException as described in the Javadoc.

Server and client version

Spring Boot 3.2.5 with
Jnats client: 2.17.6
and Nats server 2.10.14

Host environment

No response

Steps to reproduce

var connection = Nats.connect(new Options
  .Builder()
  .server(NATS_URL)
  .userInfo(USERNAME, PASSWORD + "\n")
  .build()
);
@abos abos added the defect Suspected defect such as a bug or regression label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

1 participant