livepeer/go-livepeer

Inserting random words on the command line stops the CLI from being parsed

Open

#2,642 opened on Oct 31, 2022

 (3 comments) (0 reactions) (1 assignee)Go (223 forks)auto 404
good first issue

Repository metrics

Stars
 (583 stars)
PR merge metrics
 (PR metrics pending)

Description

Good behavior:

▶ livepeer -broadcaster -network offchain -foo=bar
flag provided but not defined: -foo
Usage of livepeer:
[snip]

Bad behavior:

▶ livepeer -broadcaster -network offchain random_nonsense -foo=bar
*-------------*------*
| Broadcaster | true |
*-------------*------*
I1031 18:09:17.953699   23455 starter.go:337] ***Livepeer is running on the offchain network***
I1031 18:09:17.956990   23455 starter.go:495] ***Livepeer is in off-chain mode***
[snip]

Actual flags on the far side of random_nonsense are ignored too:

▶ livepeer -network offchain random_nonsense -broadcaster
*
*
I1031 18:12:28.799456   23478 starter.go:337] ***Livepeer is running on the offchain network***
F1031 18:12:28.802987   23478 starter.go:460] No services enabled; must be at least one of -broadcaster, -transcoder, -orchestrator, -redeemer, -reward or -initializeRound

I suppose our CLI parsing library is seeing random_nonsense there as a subcommand? But we should be crashing if that's there, this can only cause bugs for people.

Contributor guide