falcosecurity / falco

Cloud Native Runtime Security
https://falco.org
Apache License 2.0
7.24k stars 893 forks source link

Follow CLI args standards in Falco #3049

Open incertum opened 7 months ago

incertum commented 7 months ago

Proposing to follow common and standard Program Argument Syntax Conventions for Falco's CLI options, for example see this resource. For example -pk and similar options seem to fall outside of these conventions.

GLVSKiriti commented 6 months ago

@Andreagit97 @incertum I am interested in this issue! Can I work on this?

Andreagit97 commented 6 months ago

Not clear to me what was the plan @incertum had in mind when she opened this issue, so I'll let her answer here. My 2 cents, this issue seems related to possible breaking changes in the Falco UX, maybe something that we want to tackle for Falco 1.0.0, not sure this is a "good first issue" but let's see what others think about that

incertum commented 6 months ago

Goal is to correct the -pc, -pk or -pcontainer, -pkubernetes flags that do not conform to standard CLI practices. Usually -pc implies a combination of -p and -c.

https://falco.org/docs/outputs/formatting/ https://github.com/falcosecurity/falco/blob/99781f79364264411fc4e95d8dcd1edf2629ddff/userspace/falco/app/options.cpp#L187

I would propose them being:

Suggesting to sync with @leogr.

leogr commented 6 months ago

Usually -pc implies a combination of -p and -c.

This is the main issue, likely.

If we follow POSIX's recommendation:

Multiple options may follow a hyphen delimiter in a single token if the options do not take arguments. Thus, ‘-abc’ is equivalent to ‘-a -b -c’.

So, -pc is not ok.

But:

An option and its argument may or may not appear as separate tokens. (In other words, the whitespace separating them is optional.) Thus, -o foo and -ofoo are equivalent.

So -pcontainer is equivalent to -p container and it would be ok (and it is what's happening here).

My recommendation is to reaudit all flags, and try to make them consistent with POSIX. The cobra project may be a source of inspiration. Also, if we follow Cobra/posix recommendations, we will have consistency across all our other tools (which are implemented in Go).

Let's dig deeper into this once we have found some time.

incertum commented 6 months ago

Agreed @leogr let's investigate more. It's something valuable for Falco 1.x.

LucaGuerra commented 4 months ago

/milestone 1.0.0

poiana commented 1 month ago

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

leogr commented 3 weeks ago

/remove-lifecycle stale

leogr commented 2 weeks ago

/assign @LucaGuerra