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

fix: webhook template should support sprig funcs #3724

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

josedonizetti
Copy link
Collaborator

1. Explain what the PR does

Fix #3717

This PR adds support to Sprig's funcs for webhook templates.

2. Explain how to test it

create a test.tmpl with:

{
  "hostname": "{{ .HostName }}",
  "message": "Signature name: \"{{ .Metadata.Properties.signatureName }}\" description:\n{{ .Metadata.Description }}",
  "severity": "{{ .Metadata.Properties.Severity }}",
  "time": "{{ dateInZone "2006-01-02T15:04:05Z" (now) "UTC" }}",
  "tags": {
    "category": "{{ .Metadata.Properties.Category }}",
    "external_id": "{{ .Metadata.Properties.external_id }}",
    "signature_id": "{{ .Metadata.Properties.signatureId }}"
  }
}
sudo ./dist/tracee -e anti_debugging -o webhook:http://localhost:8080?gotemplate=test.tmpl

Tracee wouldn't boot if the parse failed before.

3. Other comments

Copy link
Contributor

@rafaeldtinoco rafaeldtinoco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rafaeldtinoco
Copy link
Contributor

@josedonizetti we should clear E2E before merging IMO.

@rafaeldtinoco rafaeldtinoco merged commit fb7da2f into aquasecurity:main Dec 5, 2023
31 checks passed
@josedonizetti josedonizetti deleted the fix-webhook-printer branch December 6, 2023 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Sprig functions in webhook templates
3 participants