Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sprig templating functions to 'templatedfields' option #537

Open
sboschman opened this issue Jun 30, 2023 · 15 comments
Open

Add Sprig templating functions to 'templatedfields' option #537

sboschman opened this issue Jun 30, 2023 · 15 comments
Assignees
Labels
kind/feature New feature or request
Milestone

Comments

@sboschman
Copy link

sboschman commented Jun 30, 2023

Motivation

The default go templating language does not come with many data manipulation functions. This limits the 'templating' you can do with the templatedfields option. Especially manipulating the output field values from plugins. E.g. the github plugin only output the full repo uri (https://github.com/<owner>/<repo>). Would be nice to be able to use templatedfields to create a field just containing the <repo> part, instead of the full uri to pass on to one of falcosidekick' outputs.

Feature

Add Sprig template functions to the go template rendering of templatedfields. Helm uses Sprig as well to extend their templating functions.

Alternatives

Additional context

@sboschman sboschman added the kind/feature New feature or request label Jun 30, 2023
@Issif Issif added this to the 2.29.0 milestone Jun 30, 2023
@Issif
Copy link
Member

Issif commented Jun 30, 2023

Hi,

The templatedfields are a pretty new feature, thanks for having tested it. I see your point, I'll dig deeper to see the advantages/drawbacks to implement Sprig.

For you example, I suppose it should be even better to add directly github.repo.name and github.repo.url as fields in the plugin. It's not a big deal. Could you create the issue in https://github.com/falcosecurity/plugins/issues please?

@sboschman
Copy link
Author

Hi @Issif , having a github.repo.name and github.repo.url makes sense. But imo those two fields only really become useful once it is possible to add additional output fields, unrelated to the fields used in the output text field, in Falco itself (Falco #2172).

Currently it requires you to overwrite all the github rules to add e.g. github.repo.name to the output, so it gets added to output_fields by Falco. Other option is to modify all the default github rules to include both github.repo.name and github.repo.url. I consider both options as workarounds for the underlying issue described in Falco #2172.

Still, even if Falco provides a option to expand to output_fields in the future, the flexibility of more advanced manipulation in templatedfields sounds like a very nice feature to have.

@Issif
Copy link
Member

Issif commented Jul 5, 2023

I see. I'm adding that feature in my todo. I can't give you an ETA.

@poiana
Copy link

poiana commented Oct 3, 2023

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

@poiana
Copy link

poiana commented Nov 2, 2023

Stale issues rot after 30d of inactivity.

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

Rotten issues close after an additional 30d of inactivity.

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

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

/lifecycle rotten

@Issif
Copy link
Member

Issif commented Nov 2, 2023

/remove-lifecycle rotten

@poiana
Copy link

poiana commented Jan 31, 2024

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

@poiana
Copy link

poiana commented Mar 1, 2024

Stale issues rot after 30d of inactivity.

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

Rotten issues close after an additional 30d of inactivity.

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

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

/lifecycle rotten

@Issif
Copy link
Member

Issif commented Mar 2, 2024

/remove-lifecycle rotten

@mapkon
Copy link

mapkon commented Mar 26, 2024

@Issif Are you still working on this?

@Issif
Copy link
Member

Issif commented Mar 26, 2024

Still haven't started, sorry

@mapkon
Copy link

mapkon commented Mar 30, 2024

No worries, I was asking because I was looking for something to pick up. But I am working with @alacuku on something else.

@Issif Issif self-assigned this Apr 30, 2024
@Issif Issif modified the milestones: 2.29.0, 2.30 May 6, 2024
@poiana
Copy link

poiana commented Aug 4, 2024

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

@poiana
Copy link

poiana commented Sep 3, 2024

Stale issues rot after 30d of inactivity.

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

Rotten issues close after an additional 30d of inactivity.

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

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

/lifecycle rotten

@Issif
Copy link
Member

Issif commented Sep 4, 2024

/remove-lifecycle rotten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
Status: To do
Development

No branches or pull requests

4 participants