falcosecurity / falco

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

Follow CLI args standards in Falco #3049

Open incertum opened 10 months ago

incertum commented 10 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 8 months ago

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

Andreagit97 commented 8 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 8 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 8 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 8 months ago

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

LucaGuerra commented 6 months ago

/milestone 1.0.0

poiana commented 3 months 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 months ago

/remove-lifecycle stale

leogr commented 3 months ago

/assign @LucaGuerra

poiana commented 4 days 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