Commit Graph

63 Commits

Author SHA1 Message Date
Matthias Hanel
fc667aaafd [fiixed] infinite loop in config parser for include with quote and double quote
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-01-08 13:17:19 -05:00
Matthias Hanel
4649f9e691 [fixed] timeout in configuration lexer found by oss-fuzz (#1792)
* [fixed] timeout in configuration lexer found by oss-fuzz

Peek followed by next resulted in an infinite loop when eof was not
checked.
I looked for all instances of this pattern and return an error when eof is not already checked or skip was used.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-01-05 20:07:19 -05:00
Matthias Hanel
32b5a16d97 [fixed] two minor configuration lexer issues found by oss-fuzz
after eof isVariable had a buffer overflow
stringStateFn was not set when lexString was returned

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-01-05 18:25:41 -05:00
AdamKorcz
f6aca96696 Updated year in header 2020-11-17 18:13:21 +00:00
AdamKorcz
f7cbac7402 Added 2 fuzzers 2020-10-31 14:58:08 +00:00
Waldemar Quevedo
c9ff9c45a4 Run go fmt on tests
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-10-28 20:49:47 -07:00
Waldemar Quevedo
2047ed4537 Add support for base2 units in NATS config
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-10-28 13:52:35 -07:00
Derek Collison
ec0bc1dbec First pass account configuration for jetstream
Signed-off-by: Derek Collison <derek@nats.io>
2020-05-19 14:21:27 -07:00
Waldemar Quevedo
ff357d8317 Revert "Allow using quotes around include" 2019-04-25 18:02:01 -07:00
Derek Collison
46a2661114 Merge pull request #891 from wallyqs/include-parsing-fixes
Allow using quotes around include
2019-02-06 11:57:40 -08:00
Waldemar Quevedo
47055eddef Add support for unquoted config strings that start with number
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2019-02-06 08:57:09 -08:00
Waldemar Quevedo
457c442198 Show parse errors from looked up env vars
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2019-02-06 08:57:08 -08:00
Waldemar Quevedo
441d865c1c Allow using quotes around include
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2019-01-31 09:44:20 -08:00
Waldemar Quevedo
c3a441f6ec Fix dangling bracket and parens eof bugs in config parser
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2019-01-28 17:26:22 -08:00
Ivan Kozlovic
7449e9ac53 Replace megacheck with staticcheck
Fixed issues reported by staticcheck

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-01-09 14:14:47 -07:00
Derek Collison
2d54fc3ee7 Account lookup failures, account and client limits, options reload.
Changed account lookup and validation failures to be more understandable by users.
Changed limits to be -1 for unlimited to match jwt pkg.

The limits changed exposed problems with options holding real objects causing issues with reload tests under race mode.
Longer term this code should be reworked such that options only hold config data, not real structs, etc.

Signed-off-by: Derek Collison <derek@nats.io>
2018-12-05 14:25:40 -08:00
Waldemar Quevedo
e8928b7eed Fix conf parser hang on dangling quote
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-10-23 17:45:08 -07:00
Waldemar Quevedo
18cb7ed49a Fix position reporting of variables and bcrypt values
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-10-03 15:02:49 -07:00
Waldemar Quevedo
18a62cdb60 Change style of reporting errors with line and pos
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-10-03 14:52:57 -07:00
Waldemar Quevedo
181b07ebc1 Config reporting with line and error position
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-10-02 11:38:15 -07:00
Derek Collison
9f8330bcc9 Added import and export parsing for configs
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-29 13:04:19 +02:00
Waldemar Quevedo
df2364af26 Add -t pedantic config check to the server
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-09-11 16:06:53 -07:00
Derek Collison
3b953ce838 Allow localhost to not be defined, only need 127.0.0.1
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-28 16:10:19 -07:00
Waldemar Quevedo
c45d2f5b8b Improve compatibility with JSON in config parser
The configuration format from the server is almost already a superset
of JSON with exception of two cases:

1) trailing commas from values at the top level (although they are
   supported inside of maps)

2) initial and final brackets on the top level section.

This change relaxes the two cases above to just skip those tokens so
that the config syntax can also support valid JSON objects for
configuring the server which might be helpful when generating it
programmatically.
2018-03-21 01:03:41 -07:00
Derek Collison
00901acc78 Update license to Apache 2 2018-03-15 22:31:07 -07:00
Peter Miron
d1f38f38a2 changes to support random ports for clusters and profiler. 2017-06-10 10:35:01 -04:00
Eric Promislow
bcf8b7532b [477] - Bring up coverage. 2017-04-28 13:33:35 -07:00
Eric Promislow
122b697e41 Issue 477: Improve handling of escaped substrings
This involves evaluating and interpolating \-escaped sequences
in double-quoted and undelimited strings.

Added tests on various edge-conditions, as well as ruling out bare
strings like '\true' as a bool.
2017-04-27 18:04:47 -07:00
Derek Collison
6b307af1eb Add more options for Booleans 2016-11-21 15:06:15 -08:00
Derek Collison
e57c949658 Add support for 'include' to configuration files 2016-11-21 14:58:05 -08:00
Derek Collison
6f9e4d6512 Added support for integer suffixes, e.g. 1k, 8mb 2016-11-20 17:39:04 -08:00
Derek Collison
8f4b31b5ed Special case raw bcrypted passwords 2016-05-22 10:41:16 -07:00
Derek Collison
832bac98be First pass variable support.
This allows blocked scoped variables to be set and retrieved as values using the $ prefix.
e.g. foo = 22; bar = $foo

Also supports env variables being used as variables and will properly parse to the correct type.
2016-05-22 10:21:00 -07:00
Derek Collison
46a9e6f0bc First pass at multi-user support 2016-05-13 12:27:57 -07:00
Derek Collison
296227e46e parse test coverage 2016-05-04 13:59:48 -07:00
Derek Collison
9b41ee00aa lex coverage 2016-05-04 12:52:52 -07:00
Derek Collison
433d62ec0a Parse IPs and raw strings in arrays properly 2016-04-07 08:36:57 -07:00
Derek Collison
df02bc0bcf Removed sublist, hash and hashmap, no longer needed. 2016-04-02 12:52:48 -07:00
Colin Sullivan
2baac47820 Address issues found by golint.
* No functional changes
* Did not address the ALL_CAPS issues
* Did not modify public APIs and field names.
2016-03-15 15:21:13 -06:00
Derek Collison
99f1ea29bd Increased test coverage, remove dead code 2015-01-10 18:32:30 -08:00
Derek Collison
4af2395e7f go vet fixes for 1.2 2013-12-12 14:37:15 -08:00
Derek Collison
74ccae079e pkg comments 2013-10-24 10:46:54 -07:00
Derek Collison
eb518267a9 Removed unused file 2013-10-21 08:48:40 -07:00
Derek Collison
93f25345b9 Spelling. 2013-10-21 06:51:58 -07:00
Peter Ohler
e6b5c41e54 fixed problem with parsing arrays 2013-08-21 08:51:25 -07:00
Peter Ohler
e391e6f696 added support for blocks and removed feature that allowed mixed single and double quotes 2013-08-12 09:48:52 -07:00
Derek Collison
60c411638f quoted strings should allow internal spaces 2013-08-07 12:32:08 -07:00
Derek Collison
2833a1f05a Make sure special chars ok in key names 2013-08-07 11:21:39 -07:00
Derek Collison
d7876007d9 Support quoted map keys too 2013-08-07 09:17:32 -07:00
Derek Collison
b2187a7514 Allow key values to be quoted 2013-08-07 08:31:48 -07:00