Skip to content

windows: fix support for user-provided processors#4180

Merged
efd6 merged 1 commit intoelastic:mainfrom
efd6:whitespacecatastrophe
Sep 12, 2022
Merged

windows: fix support for user-provided processors#4180
efd6 merged 1 commit intoelastic:mainfrom
efd6:whitespacecatastrophe

Conversation

@efd6
Copy link
Copy Markdown
Contributor

@efd6 efd6 commented Sep 12, 2022

What does this PR do?

The user-provided YAML is deindented before being appended to the existing lines from the agent template. This results in an indentation disagreement such as this:

processors:
  - translate_sid:
      field: winlog.event_data.MemberSid
      account_name_target: winlog.event_data._MemberUserName
      domain_target: winlog.event_data._MemberDomain
      account_type_target: winlog.event_data._MemberAccountType
      ignore_missing: true
      ignore_failure: true
- add_fields:
    target: project
    fields:
      name: myproject
      id: '574734885120952459'

This results in a YAML parse failure. So deindent the translate_sid processor.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • [ ]

How to test this PR locally

Attempt to add the add_fields processor to any of the powershell, powershell_operational or sysmon_operational datastreams when installing the windows integration here.

Related issues

Screenshots

@efd6 efd6 added bug Something isn't working, use only for issues Team:Security-External Integrations Integration:windows Windows labels Sep 12, 2022
@efd6 efd6 self-assigned this Sep 12, 2022
@efd6 efd6 force-pushed the whitespacecatastrophe branch from 9493b65 to dabb947 Compare September 12, 2022 03:44
@efd6 efd6 marked this pull request as ready for review September 12, 2022 03:45
@efd6 efd6 requested review from a team as code owners September 12, 2022 03:45
@efd6 efd6 requested review from belimawr and leehinman September 12, 2022 03:45
@elasticmachine
Copy link
Copy Markdown

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

@elasticmachine
Copy link
Copy Markdown

elasticmachine commented Sep 12, 2022

💚 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

  • Duration: 24 min 11 sec

Test stats 🧪

Test Results
Failed 0
Passed 129
Skipped 0
Total 129

🤖 GitHub comments

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

  • /test : Re-trigger the build.

@elasticmachine
Copy link
Copy Markdown

elasticmachine commented Sep 12, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (4/4) 💚
Files 87.5% (7/8)
Classes 87.5% (7/8)
Methods 83.516% (76/91)
Lines 92.714% (5039/5435)
Conditionals 100.0% (0/0) 💚

The user-provided YAML is deindented before being appended to the existing lines
from the agent template. This results in an indentation disagreement such as this:

	processors:
	  - translate_sid:
	      field: winlog.event_data.MemberSid
	      account_name_target: winlog.event_data._MemberUserName
	      domain_target: winlog.event_data._MemberDomain
	      account_type_target: winlog.event_data._MemberAccountType
	      ignore_missing: true
	      ignore_failure: true
	- add_fields:
	    target: project
	    fields:
	      name: myproject
	      id: '574734885120952459'

This results in a YAML parse failure. So deindent the translate_sid processor.
@efd6 efd6 force-pushed the whitespacecatastrophe branch from dabb947 to 475a59f Compare September 12, 2022 04:31
Copy link
Copy Markdown
Contributor

@leehinman leehinman left a comment

Choose a reason for hiding this comment

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

I think this is the second time I've seen this bug with indentation inside of lists with static & user supplied content. I wonder if we could get a check in elastic-package to help catch this? It is really hard for developers to spot.

@efd6
Copy link
Copy Markdown
Contributor Author

efd6 commented Sep 12, 2022

@leehinman Yes, that would be really helpful. I had to edit the running kibana instance to see what it was having issues with. A real solution would be for the full error rendering to provide not just the error text, but the input syntax that caused the error ± a couple of lines of context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working, use only for issues Integration:windows Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Windows integration sysmon operational template is invalid

4 participants