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 related.entity to okta integration #11589

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

romulets
Copy link
Member

tldr; Adding related.entity to okta is part of the initial steps of CDR (epic overview). That enables our customers to better correlate events based on entities and enhances the investigation workflows for the Cloud Security use case.

ECS related.entity PR

Background

Elastic Cloud Security Team has been focusing, this past year, on Cloud Detection and Response (CDR). One of the first steps towards the CDR vision is to enhance investigation workflows for the Cloud Security use-case in SIEM.

As part of enhancing investigation workflows it's necessary to be able to correlate events and entities. Meaning, if an alert is triggered on the user [email protected], it is of great value to easily be able to search all the events related to that entity, across multiple indices, with one query. Therefore we are working on extracting entities and enabling them to be correlated.

Why related.entity

With this background, we've researched a few options on what would be the best approach to enable such feature (discussions https://github.com/elastic/security-team/issues/10026 and https://github.com/elastic/security-team/issues/9798, and outcomes https://github.com/elastic/security-team/issues/10152), and arrived at the ecs field related.

Based on the related description:

This field set is meant to facilitate pivoting around a piece of data.

Some pieces of information can be seen in many places in an ECS event.
To facilitate searching for them, store an array of all seen values to their
corresponding field in related..

To add a broad related.entity field that can hold any needed identifier to pivot data on seems to be well fitted. This would enable customers to simply run related.entity: "i-000000000" and get all the hits to that specific cloud resource.

What is an entity?

An "entity" in our context refers to any discrete component within an IT environment that can be uniquely identified and monitored. This broad term encompasses both managed and unmanaged elements.

The term "entity" is broader than the current set of available fields under related. Although ipuser and hosts can be identities, there is a lack of space to represent messaging queues, load balancers, storage systems, databases and others. Therefore the proposal to add a new field.

Related issues

@romulets romulets added the enhancement New feature or request label Oct 30, 2024
@romulets romulets requested a review from a team as a code owner October 30, 2024 11:13
lang: painless
source: |
boolean addValue(Set entities, String value) {
if (value == null || value == "" || value == "unknown") {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tinnytintin10 I'm ignoring the value unknown because if the alternative id is unknown to okta, the value in the event is unknown, e.g.

image

Do you agree with that decision?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd caution on ignoring unknown for Display Name and Alternate ID, specifically when it comes to custom client's that use Okta's API. Typically any custom client that uses the API will not be recognized by Okta and thus be considered unknown. In your example, the authentication enrollment is user specific. As long as we favor the existing Alternate ID over unknown, then we should be fine here.

When testing Okta, I'd test via 3 ways to have a good showcase of the workflows:

  • Console Admin --> You logging in and doing stuff
  • Custom Client --> Create App integration > API Services and then use the API key and client secret to interact with Okta's API.
  • Third-Party App --> Register a third-party application that is available via Browse App Catalog and setup auth workflows. Then assign this to an existing user or yourself and interact with your registered applications via your Okta portal or browser plugin.

Each of these will have different workflows and potentially different related entities, targets, etc. From what I have found from past research is okta.actor.alternate_id (source), okta.target (target) and okta.debug_context.debug_data (context) will be your go to for most of this.

TreeSet related = new TreeSet();

addValue(related, field("json.actor.id").get(null));
addValue(related, field("json.actor.alternateId").get(null));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tinnytintin10

Do we also capture alternateId? I deemed it relevant because it's where we have the email present, which should be able to pivot on. But I also kept the id because it's the Okta id.

Any thoughts on if I should capture both indeed? Or maybe just one of the two? Same goes for target.

Copy link
Contributor

@terrancedejesus terrancedejesus Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im in favor of both. Specifically for directory sync purposes. The Id does capture what Okta has registered as an IdP, but when acting as an IdP on behalf of other SaaS applications, alternateId is often pulled by syncing directory services. For example, if an environment sync'd Okta directory services with an Active Directory forest in a Windows Server, the Alternate ID will be more reliable than the Okta ID based on the functionality of the Universal Directory in Okta.

@elastic-vault-github-plugin-prod

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@andrewkroh andrewkroh added Integration:okta Okta Team:Security-Service Integrations Security Service Integrations Team [elastic/security-service-integrations] labels Oct 30, 2024
@elasticmachine
Copy link

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@terrancedejesus
Copy link
Contributor

cc @efd6 --> Adding Dan here who has been making some Okta adjustments requested by TRADE where we have discussed okta.target and a few other fields as well. Want to make sure we are all in sync here.

addValue(related, field("json.actor.id").get(null));
addValue(related, field("json.actor.alternateId").get(null));

field("json.target").get(new ArrayList()).stream().forEach(target -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen okta.target as an array of JSON objects but also a single JSON object. Just want to confirm that the code here addresses that or maybe that is inherit regardless.

Screenshot 2024-10-30 at 9 03 51 AM Screenshot 2024-10-30 at 9 03 46 AM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I covered it in the painless script.

Interesting, once I tried to test with it we got a different error. The event is generated, but if an error. I wonder if that happens on pro.

Anyway it seems to work. Also with what I tested

@elasticmachine
Copy link

💚 Build Succeeded

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Integration:okta Okta Team:Security-Service Integrations Security Service Integrations Team [elastic/security-service-integrations]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants