epugh commented on PR #5306: URL: https://github.com/apache/solr/pull/5306#issuecomment-6881530787
> 🤖 _AI-assisted, reviewed by Jan_ > > [@epugh](https://github.com/epugh), found while porting `test_secure_example.bats` to CATS ([#5323](https://github.com/apache/solr/pull/5323)): `solr start -e <example> --host other-host` never reaches RunExampleTool. `bin/solr` forwards the option as `--solr.host.advertise <value>` (`PASS_TO_RUN_EXAMPLE`, since [#3814](https://github.com/apache/solr/pull/3814) / [SOLR-15442](https://issues.apache.org/jira/browse/SOLR-15442)), but RunExampleTool declares `--host`, so picocli stops with `Unknown option: '--solr.host.advertise'` and exit 2. That hits every example, not only `secure`. For the secure example it also means the "Unsupported argument provided" check is never the one that fires; the BATS case "secure example rejects unsupported options" passes because `assert_output --partial 'host'` matches the usage text picocli prints. Reproduced on a current build of main: > > ``` > $ bin/solr start -e techproducts --no-prompt --host other-host > Unknown option: '--solr.host.advertise' > usage: bin/solr run_example [-fhvy] [--user-managed] -d=DIR -e=NAME [--example-dir=DIR] [--host=HOSTNAME] ... > $ echo $? > 2 > ``` > > Looks like a one-word fix in `bin/solr` plus a tighter assertion in that BATS case. Happy to file the JIRA if you want. @janhoy I think I am stuck a bit on do the -e examples still allow all the other parameters to be supplied... Or altenratively, maybe we would want -e to NOT support everything that the bin/solr start supports? Right now we are a bit in the middle... Almost makes me wonder if it should habe been `bin/solr example secure` instead of `bin/solr start -e secure`? Though I like the idea that it is subordinated to the bin/solr start... And so much of the start process... Right now, I don't think we do any matrix testing of "let me run each example with all the various bin/solr start options that could be passed in and make sure the RunExampleTool does the right hting"... So that is part of why we keep finding these.. Is there actually a use case for `bin/solr start -e films --host other-host` ???? If so, then we should definitly deal with this. If not, well, we should I guess still prevent the error, but it porbably is very unlikely anywone will hit it in the wild! Though maybe those open doors to security flaws? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
