xe lease silently ignores unknown flags: a typo in --duration or --provider runs with defaults instead of failing
Report
Suggested severity tier: Info
Area: CLI argument parsing, cmd/xe/main.go (parseLeaseArgs)
Repository state checked: xeprotocol/xe HEAD 978785929bc17a2f4ab30c383e5fc9cf4d634512
Summary
xe lease accepts any flag-like argument without complaint, even one it does not recognize. parseLeaseArgs walks the arguments with a switch that has no default case, so an unknown token is skipped and the command runs with default values. A typo such as --duraton 3600 silently produces a 300 second lease, and a typo such as --providr <address> silently lets the CLI pick any provider. Every sibling parser in the same CLI rejects unknown flags with an error. Only the lease parser stays silent.
What was proven
parseLeaseArgs in cmd/xe/main.go, around lines 975-1008, defaults to 1 vCPU, 1024 MB, 1 GB disk, and 300 seconds, then loops over the arguments:
for i := 0; i < len(args); i++ { switch args[i] { case "--vcpus": ... case "--provider": ... } }
There is no default case, so any token that matches none of the five known flags falls through with no error and no warning. The value that followed the typo is also skipped as an ordinary token, or consumed as a value by a later known flag.
Proven with a local test against the real parser:
- parseLeaseArgs(["--duraton", "3600"]) returns no error and duration 300. The user asked for 3600 seconds and got the 300 second default.
- parseLeaseArgs(["--bogus", "--provider", "abcd"]) returns no error and provider "abcd". The unknown token vanished without a trace.
For comparison, the sibling parsers all fail loudly. parseChatReadArgs returns unknown flag %q, parsePhraseOptions returns an error for anything outside --passphrase and --account, and cmdDirectory fatals on anything but --watch. (The send and burn parsers get the same treatment in PR #286, which adds parseSendArgs and parseBurnArgs returning unknown flag %q.) The lease parser is the only one that swallows unknown input.
Reproduction
- Clone https://github.com/xeprotocol/xe and confirm HEAD is 978785929bc17a2f4ab30c383e5fc9cf4d634512.
- Build the CLI from source.
- Run
xe lease --duraton 3600and observe the command proceeds with a 300 second lease instead of reporting the unknown flag. - Run
xe lease --providr <address>and observe the command proceeds with automatic provider selection instead of reporting the unknown flag.
Impact
No funds move to another party and no remote party can trigger this. The trigger is the user's own typo on their own command line. The harm is a lease that does not match what the user asked for: a shorter duration than planned, or a provider the user did not choose, with no signal that anything went wrong. The lease still settles normally and the user can notice the duration or provider afterwards, so the failure is recoverable and visible after the fact, just silent at the moment it matters.
Suggested fix
Add a default case to the switch in parseLeaseArgs that returns an error naming the unknown flag, the same way parseChatReadArgs already does (parseSendArgs and parseBurnArgs do the same in PR #286). The usage line should list the five accepted flags so a typo is easy to spot.
Related issues
This sits next to #267, which covered the send and burn parsers reading a consumed value again as a flag. The mechanism here is different: the lease parser already consumes values correctly, and the defect is the missing rejection of unknown flags. The fix for #267 (PR #286) hardened send and burn only and did not touch this parser.
Honest limits of this proof
The proof ran against the parser function in a local test harness, not against a live node, because the defect is in argument parsing before any network call happens. The typo examples use a local build only. No testnet or mainnet traffic was involved. The impact depends on the user mistyping a flag, so this is a silent misconfiguration, not a remotely exploitable vulnerability. If the maintainers intended the lease parser to accept and ignore extra arguments, the honest resolution is to document that behavior and this issue drops to docs.
Thread
Thanks for the report. We have confirmed the behaviour you describe in the lease command's argument handling and it is being handled. We will update you here at https://bounty.xe.network/XE-1248 when the fix lands.
Additional evidence on the same defect class, checked against HEAD 8cc209d: the send parser was not hardened the way this issue's body assumes. There is no parseSendArgs/parseBurnArgs in cmd/xe/main.go at this HEAD (and no trace of PR #286 in the history), and both cmdSend and cmdBurn still silently ignore unknown flags.
Proven with a local build (throwaway wallet, no transaction — all runs stop at the balance check):
xe send <addr> 1 --asste XE→error: insufficient XCU: have 0, need 1— the typo is swallowed and the asset silently falls back to the XCU default. With a funded wallet this would send XCU when the user asked for XE.- Control:
xe send <addr> 1 --asset XE→error: insufficient XE: have 0, need 1. xe send <addr> 1 --bogus→ also silently accepted, same XCU fallback.xe burn 1 --memoo hello/--bogus→ also silently accepted (burn's asset is hardcoded XE, so the impact there is limited to a dropped--memoor a missed--yes— the latter fails safe into the confirmation prompt).
So the fix for this issue should cover cmdSend (and cmdBurn for completeness), not just parseLeaseArgs — the send case is arguably worse than the lease case, since funds move to another party in the wrong asset. Suggested severity for this added evidence: Info/Low, same family as #300.