fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
3k stars 416 forks source link

Improve fleetctl apply validation and error handling #20075

Closed xpkoala closed 2 months ago

xpkoala commented 3 months ago

Fleet version: 4.50.0

Web browser and operating system: N/A


💥  Actual behavior

When running an apply command via fleetctl (ex fleetctl apply -f <file>) the command will accept any file.

🧑‍💻  Steps to reproduce

  1. With a fleetd binary created
  2. run fleectl apply -f <fleet_binary.pkg>
  3. An error will be displayed and then the full contents of the file will be streamed to stdout

🕯️ More info (optional)

reed@reed fleet % cat bad.file 
no soup for you
reed@reed fleet % ./build/fleetctl apply -f bad.file
Error: failed to unmarshal spec item error unmarshaling JSON: json: cannot unmarshal string into Go value of type spec.Metadata: 
no soup for you

🛠️ To fix

sharon-fdm commented 3 months ago

Hey team! Please add your planning poker estimate with Zenhub @getvictor @jacobshandling @lucasmrod @mostlikelee @RachelElysia

RachelElysia commented 3 months ago

I would like this ticket :)

fleet-release commented 2 months ago

Improved validation, Fleetctl errors no more, Like clouds, quiet peace.