Skip to content

Commit

Permalink
[Winlogbeat] protect against accessing undefined variable in security…
Browse files Browse the repository at this point in the history
… module (elastic#22937)

Adding protection for undefined variable in copy target user
  • Loading branch information
Kyle Pearson authored Dec 7, 2020
1 parent 5f3d8ac commit 7c64f53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fields from Winlogbeat modules were not being included in index templates and patterns. {pull}18983[18983]
- Add source.ip validation for event ID 4778 in the Security module. {issue}19627[19627]
- Protect against accessing undefined variables in Sysmon module. {issue}22219[22219] {pull}22236[22236]
- Protect against accessing an undefined variable in Security module. {pull}22937[22937]

*Functionbeat*

Expand Down
10 changes: 6 additions & 4 deletions x-pack/winlogbeat/module/security/config/winlogbeat-security.js
Original file line number Diff line number Diff line change
Expand Up @@ -1519,11 +1519,13 @@ var security = (function () {
})
.Add(function(evt) {
var user = evt.Get("winlog.event_data.TargetUserName");
if (/.@*/.test(user)) {
user = user.split('@')[0];
evt.Put('user.name', user);
if (user) {
if (/.@*/.test(user)) {
user = user.split('@')[0];
evt.Put('user.name', user);
}
evt.AppendTo('related.user', user);
}
evt.AppendTo('related.user', user);
})
.Build();

Expand Down

0 comments on commit 7c64f53

Please sign in to comment.