projectdiscovery / goflags

A go flag wrapper with convenience helpers
MIT License
84 stars 16 forks source link

Incorrect behavior in case of invalid CLI arguments #118

Closed forgedhallpass closed 3 months ago

forgedhallpass commented 1 year ago

The code silently fails if there is an incorrect positional CLI argument and ignores every other parameter coming after it.

Example:

nuclei -no-interactsh test -v -debug -u http://projectdiscovery.io -id tech-detect

-no-interactsh is a boolean type which has an invalid positional argument after (test). When executing the above command nuclei will not parse the other arguments after it, hence it won't execute the tech-detect template as expected.

Since the solution doesn't even warn about the incorrect parameters the execution will be non-deterministic and will cause a lot of confusion.

I made the following mistake by adding a URL after the -pi boolean flag and was incorrectly assuming that the proxy functionality is not working in the following example:

nuclei -id tech-detect -u https://projectdiscovery.io -v -debug -pi http://localhost:8080 -proxy http://localhost:8080
dogancanbakir commented 3 months ago

Closing this. Reason: https://github.com/projectdiscovery/goflags/pull/159#pullrequestreview-1808958539