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 SetMeta and SetParsed helpers #2845

Merged
merged 4 commits into from Feb 14, 2024
Merged

add SetMeta and SetParsed helpers #2845

merged 4 commits into from Feb 14, 2024

Conversation

buixor
Copy link
Contributor

@buixor buixor commented Feb 14, 2024

evt.SetMeta(key, value) and evt.SetParsed(key, value) allow scenarios to alter the event object for better (tm) scenarios:

type: trigger
name: crowdsecurity/http-trendy-cve-watch
data:
  - dest_file: http-trendy-cve.txt
    type: string
description: "blah"
filter: |
  let lowered_url = Lower(evt.Meta.http_path);
  evt.Meta.log_type in ['http_access-log', 'http_error-log'] and
  evt.Meta.http_status in ['404', '403'] and
  any( File('http-trendy-cve.txt'), 
      {
       let stuff = Split(#, ':');
       lowered_url contains stuff[1] && evt.SetMeta('CVE', stuff[0])
      })
...

http-trendy-cve.txt

#test
cve-2021-1234:/foobar
cve-2023-2313:/totolol
#
cve-2021-26086:/_/;/web-inf/web.xml

This would allow crowdsecurity/http-trendy-cve-watch scenario to watch for multiple vulnerabilities, adding the corresponding CVE name in Meta.CVE

Copy link

@buixor: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind enhancement
  • /kind fix
  • /kind chore
  • /kind dependencies
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

Copy link

@buixor: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area appsec
  • /area security
  • /area configuration
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@buixor
Copy link
Contributor Author

buixor commented Feb 14, 2024

/kind enhancement
/area agent

Copy link

codecov bot commented Feb 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2bbf0b4) 57.97% compared to head (c3f23e5) 57.94%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2845      +/-   ##
==========================================
- Coverage   57.97%   57.94%   -0.03%     
==========================================
  Files         239      239              
  Lines       30949    30983      +34     
==========================================
+ Hits        17942    17954      +12     
- Misses      11380    11399      +19     
- Partials     1627     1630       +3     
Flag Coverage Δ
bats 37.87% <0.00%> (-0.09%) ⬇️
unit-linux 52.37% <100.00%> (+<0.01%) ⬆️
unit-windows 47.83% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@buixor buixor merged commit 717fc97 into master Feb 14, 2024
17 checks passed
@buixor buixor deleted the SetMeta_helpers branch February 14, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/agent kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants