teler-sh / teler-waf

teler-waf is a Go HTTP middleware that protects local web services from OWASP Top 10 threats, known vulnerabilities, malicious actors, botnets, unwanted crawlers, and brute force attacks.
https://test.teler.sh
Apache License 2.0
342 stars 31 forks source link

fix: data race on count pending Falco events #112

Closed dwisiswant0 closed 11 months ago

dwisiswant0 commented 11 months ago

IMPORTANT: Please do not create a PR without creating an issue first!

(Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request).

Summary

Race condition while count pending Falco events in checkFalcoEvents.

Proposed of changes

This PR fixes/implements the following bugs/features:

How has this been tested?

Proof:

$ go test -v -cover -race -count=1 -run="TestNewWithFalcoSidekickURL" ./
=== RUN   TestNewWithFalcoSidekickURL
--- PASS: TestNewWithFalcoSidekickURL (8.19s)
PASS
coverage: 48.2% of statements
ok      github.com/kitabisa/teler-waf   9.243s  coverage: 48.2% of statements

Closing issues

Fixe #111

Checklist:

codecov-commenter commented 11 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (2914f61) 76.81% compared to head (78d7003) 78.60%. Report is 3 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #112 +/- ## ========================================== + Coverage 76.81% 78.60% +1.78% ========================================== Files 6 6 Lines 1113 1117 +4 ========================================== + Hits 855 878 +23 + Misses 206 187 -19 Partials 52 52 ``` | [Files](https://app.codecov.io/gh/kitabisa/teler-waf/pull/112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kitabisa) | Coverage Δ | | |---|---|---| | [falcosidekick.go](https://app.codecov.io/gh/kitabisa/teler-waf/pull/112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kitabisa#diff-ZmFsY29zaWRla2ljay5nbw==) | `54.23% <75.00%> (+37.87%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.