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

x-pack/filebeat/input/entityanalytics/provider/azuread: avoid work on unwanted datasets #36753

Merged
merged 2 commits into from
Oct 7, 2023

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Oct 4, 2023

Proposed commit message

During full sync the provider may have state from a previous dataset. So in the case that the user has changed dataset from users to devices or vice versa the provider may publish already existing state in the entity graph. This change adds conditional checks to ensure that unwanted dataset records are not published.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@efd6 efd6 added enhancement Filebeat Filebeat Team:Security-External Integrations backport-skip Skip notification from the automated backport with mergify 8.12-candidate labels Oct 4, 2023
@efd6 efd6 self-assigned this Oct 4, 2023
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Oct 4, 2023
@elasticmachine
Copy link
Collaborator

elasticmachine commented Oct 4, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-10-06T23:28:39.325+0000

  • Duration: 75 min 38 sec

Test stats 🧪

Test Results
Failed 0
Passed 3209
Skipped 174
Total 3383

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@efd6 efd6 force-pushed the azure_avoid_unwanted_work branch from 9b8942a to 99c1b96 Compare October 5, 2023 19:46
@mergify

This comment was marked as off-topic.

@efd6 efd6 force-pushed the azure_avoid_unwanted_work branch from 99c1b96 to ace7053 Compare October 5, 2023 19:58
@efd6 efd6 marked this pull request as ready for review October 5, 2023 20:03
@efd6 efd6 requested a review from a team as a code owner October 5, 2023 20:03
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

Comment on lines 215 to 216
wantUsers := p.conf.wantUsers()
wantDevices := p.conf.wantDevices()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@taylor-swanson I think we can omit these conditions here since the returned values form doFetch should be empty in the case that. Do you agree?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it would seem they are redundant in this particular case. I'm trying to think if there is some other edge case, but can't think of anything. doFetch will return empty an empty set if the dataset is disabled, so we really only need to guard the full sync case.

@efd6 efd6 requested a review from taylor-swanson October 5, 2023 20:03
Copy link
Contributor

@taylor-swanson taylor-swanson left a comment

Choose a reason for hiding this comment

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

LGTM

See other comment, but I'm good with removing the wantUsers/wantDevices guards in the incremental update case.

Comment on lines 215 to 216
wantUsers := p.conf.wantUsers()
wantDevices := p.conf.wantDevices()
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it would seem they are redundant in this particular case. I'm trying to think if there is some other edge case, but can't think of anything. doFetch will return empty an empty set if the dataset is disabled, so we really only need to guard the full sync case.

@mergify
Copy link
Contributor

mergify bot commented Oct 6, 2023

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b azure_avoid_unwanted_work upstream/azure_avoid_unwanted_work
git merge upstream/main
git push upstream azure_avoid_unwanted_work

efd6 added 2 commits October 7, 2023 09:56
… unwanted datasets

During full sync the provider may have state from a previous dataset. So
in the case that the user has changed dataset from users to devices or
vice versa the provider may publish already existing state in the entity
graph. This change adds conditional checks to ensure that unwanted
dataset records are not published.
@efd6 efd6 force-pushed the azure_avoid_unwanted_work branch from ace7053 to c70e6c7 Compare October 6, 2023 23:28
@efd6 efd6 enabled auto-merge (squash) October 6, 2023 23:28
@efd6 efd6 merged commit ba2a641 into elastic:main Oct 7, 2023
8 checks passed
Scholar-Li pushed a commit to Scholar-Li/beats that referenced this pull request Feb 5, 2024
… unwanted datasets (elastic#36753)

During full sync the provider may have state from a previous dataset. So
in the case that the user has changed dataset from users to devices or
vice versa the provider may publish already existing state in the entity
graph. This change adds conditional checks to ensure that unwanted
dataset records are not published.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.12-candidate backport-skip Skip notification from the automated backport with mergify enhancement Filebeat Filebeat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants