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

Binary file accepted as valid configuration #4343

Closed
2 tasks done
mprimi opened this issue Jul 27, 2023 · 2 comments · Fixed by #4358
Closed
2 tasks done

Binary file accepted as valid configuration #4343

mprimi opened this issue Jul 27, 2023 · 2 comments · Fixed by #4358
Assignees

Comments

@mprimi
Copy link
Contributor

mprimi commented Jul 27, 2023

Defect

I mistakenly fed nats-server a binary rather than a configuration file, and -t tells me it is a valid configuration.

Make sure that these boxes are checked before submitting your issue -- thank you!

Versions of nats-server and affected client libraries used:

Noticed this on 2.9.21-RC.1, but this has not changed recently.

OS/Container environment:

Not relevant

Steps or code to reproduce the issue:

Pass the path of a binary (or other non-textfile, like PDF) as configuration argument:

 ./nats-server -t -c ./nats-server

Expected result:

Non zero-exit code, and a message telling me I'm doing it wrong

Actual result:

nats-server: configuration file ./nats-server is valid

Details

Stepping through the configuration parsing steps, it seems like the entire binary is treated treated like as itemKey, and accepted.

Even setting pedantic, there are no errors and no warnings.

@derekcollison
Copy link
Member

Hey @wallyqs I know you fixed this in dev IIRC, should we cherry pick to main?

@wallyqs
Copy link
Member

wallyqs commented Aug 2, 2023

fine to cherry pick I think, will make a PR

wallyqs added a commit that referenced this issue Aug 2, 2023
…ckport) (#4358)

This makes configuration files that are empty, or read and processed by
the parser but with no detected values now return an error.

Fixes #4343 
Backport from dev branch
(#4347)
@bruth bruth removed the 🐞 bug label Aug 18, 2023
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 a pull request may close this issue.

4 participants