fix: race condition of the lastmatcherevent (#6080)

This commit is contained in:
Nakul Bharti 2025-03-03 16:10:12 +05:30 committed by GitHub
parent 99f8df3fbd
commit fa7329f16e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -215,8 +215,10 @@ func (e *TemplateExecuter) Execute(ctx *scan.ScanContext) (bool, error) {
if lastMatcherEvent != nil {
lastMatcherEvent.Lock()
defer lastMatcherEvent.Unlock()
lastMatcherEvent.InternalEvent["error"] = getErrorCause(ctx.GenerateErrorMessage())
lastMatcherEvent.Unlock()
writeFailureCallback(lastMatcherEvent, e.options.Options.MatcherStatus)
}