-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
adding a for loop with script processor to add values from cisco.umbrella.identities to related.user field #25776
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank You.
Do you have any example logs we can add to the test directory that will exercise this?
For the script, I made a few changes:
- will add
related.user
if it doesn't exist - will only iterate on
cisco.umbrella.identities
if it is a list
Can you test to see if this works?
- script:
if: ctx?.cisco?.umbrella?.identites != null && ctx.cisco.umbrella.identites instanceof List
lang: painless
description: "Extract user name values from ctx.cisco.umbrella.identities and append it to related.user"
source: |-
void addRelatedUser(def x) {
if (ctx?.related == null) {
Map map = new HashMap();
ctx.put("related", map);
}
if (ctx?.related?.user == null) {
ArrayList al = new ArrayList();
ctx.related.put("user", al);
}
if (!ctx.related.user.contains(x)) {
ctx.related.user.add(x);
}
}
for (cisco_identity in ctx.cisco.umbrella.identities) {
if (cisco_identity_contains('@')) {
addRelatedUser(cisco_identity);
}
}
Hi @leehinman , I like the changes. I tried your version and it complains with error below. Maybe you can spot what can be changed quick?
|
oops, need to pass in the context. - script:
if: ctx?.cisco?.umbrella?.identites != null && ctx.cisco.umbrella.identites instanceof List
lang: painless
description: "Extract user name values from ctx.cisco.umbrella.identities and append it to related.user"
source: |-
void addRelatedUser(def ctx, def x) {
if (ctx?.related == null) {
Map map = new HashMap();
ctx.put("related", map);
}
if (ctx?.related?.user == null) {
ArrayList al = new ArrayList();
ctx.related.put("user", al);
}
if (!ctx.related.user.contains(x)) {
ctx.related.user.add(x);
}
}
for (cisco_identity in ctx.cisco.umbrella.identities) {
if (cisco_identity.contains('@')) {
addRelatedUser(ctx, cisco_identity);
}
} |
@leehinman There was a typo in the condition which I corrected and it works like a charm. identites --> identities. I will sanitize the sample logs and share it
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
This pull request is now in conflicts. Could you fix it? 🙏
|
4 similar comments
This pull request is now in conflicts. Could you fix it? 🙏
|
This pull request is now in conflicts. Could you fix it? 🙏
|
This pull request is now in conflicts. Could you fix it? 🙏
|
This pull request is now in conflicts. Could you fix it? 🙏
|
…elated.user field
…le duplicative values
1060d21
to
9788abd
Compare
…ella.identities to related.user field (#25776) * adding users from cisco.umbrella.identities to related.user field Co-authored-by: Lee E. Hinman <[email protected]> (cherry picked from commit cec5906)
…ella.identities to related.user field (#25776) (#25856) * adding users from cisco.umbrella.identities to related.user field Co-authored-by: Lee E. Hinman <[email protected]> (cherry picked from commit cec5906) Co-authored-by: hungnguyen-elastic <[email protected]>
Enhancement Request
What does this PR do?
This PR added the foreach loop to append the value from cisco.umbrella.identities field to related.user field in cisco umbrella module pipeline
Why is it important?
There are instances where cisco.umbrella.identities actually contains the username that is involved with the action and is not included in the related.user field. This addition will make sure the values are added.
for example: event below will be missing the actual username in the related.user field
"message" : ""2021-05-14 19:39:58","hostname34P787","hostname34P787,User Name([email protected])","1.1.1.1","2.2.2.2","Allowed","1 (A)","NOERROR","v-google.com.","Infrastructure","Roaming Computers","Roaming Computers,AD Users","""
Output:
With the script processor
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs