fleet icon indicating copy to clipboard operation
fleet copied to clipboard

fleetctl silently fails when passing unexpected args

Open mostlikelee opened this issue 7 months ago • 3 comments

Fleet version: 4.66.0

Web browser and operating system:


💥  Actual behavior

Passed unexpected true to boolean flag, resulting in any following flags to be ignored silently

-> % ./build/fleetctl package --type=pkg --fleet-desktop --fleet-url=https://host.docker.internal:8080 --enroll-secret=${ENROLL_SECRET} --debug --disable-open-folder true --fleet-certificate=./tools/osquery/fleet.crt --enable-scripts
Generating your fleetd agent...

Success! You generated fleetd at /Users/tim/workspace/fleet/fleet-osquery.pkg

To add hosts to Fleet, install fleetd.
Learn how: https://fleetdm.com/learn-more-about/enrolling-hosts

🧑‍💻  Steps to reproduce

  • use the above command to generate a package
  • note that the command exits successfully
  • any flags after the incorrect --disable-open-folder true (should just be --disable-open-folder) are ignored

🕯️ More info (optional)

N/A

🛠️ To fix --> PR attached

  • when the cli hits unexpected output true in this case, it treats it as a positional arg. We should error when args > 0

mostlikelee avatar Mar 30 '25 16:03 mostlikelee

@mostlikelee Is there an existing error message for this or does one need to be crafted?

eugkuo avatar Mar 31 '25 11:03 eugkuo

@mostlikelee Is there an existing error message for this or does one need to be crafted?

@eugkuo I think so. This is what is in the PR now:

unexpected argument: <args here>

mostlikelee avatar Mar 31 '25 17:03 mostlikelee

@mostlikelee Thanks for confirming. Moving this forward

eugkuo avatar Mar 31 '25 17:03 eugkuo

Silent fail, no more, Like a lighthouse in the fog, Fleet guides with each flag.

fleet-release avatar May 23 '25 12:05 fleet-release