Skip to content

windows/powershell: fix regexp constraints in event 800 parameter detail processing#3495

Merged
efd6 merged 1 commit intoelastic:mainfrom
efd6:3494-windows
Jun 9, 2022
Merged

windows/powershell: fix regexp constraints in event 800 parameter detail processing#3495
efd6 merged 1 commit intoelastic:mainfrom
efd6:3494-windows

Conversation

@efd6
Copy link
Copy Markdown
Contributor

@efd6 efd6 commented Jun 9, 2022

What does this PR do?

This tightens constraints in the regular expression to prevent greedy consumption of the input and regexp complexity explosion.

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

Related issues

Screenshots

@efd6 efd6 added bug Something isn't working, use only for issues Team:Security-External Integrations Integration:windows Windows labels Jun 9, 2022
@efd6 efd6 self-assigned this Jun 9, 2022
@efd6 efd6 marked this pull request as ready for review June 9, 2022 00:37
@efd6 efd6 requested review from a team as code owners June 9, 2022 00:37
@elasticmachine
Copy link
Copy Markdown

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

@efd6 efd6 requested review from cmacknz and fearful-symmetry June 9, 2022 00:37
@elasticmachine
Copy link
Copy Markdown

elasticmachine commented Jun 9, 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

  • Start Time: 2022-06-09T00:38:00.681+0000

  • Duration: 16 min 18 sec

Test stats 🧪

Test Results
Failed 0
Passed 126
Skipped 0
Total 126

🤖 GitHub comments

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

  • /test : Re-trigger the build.

@elasticmachine
Copy link
Copy Markdown

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (4/4) 💚
Files 87.5% (7/8) 👎 -9.068
Classes 87.5% (7/8) 👎 -9.068
Methods 84.884% (73/86) 👎 -4.005
Lines 93.376% (4962/5314) 👍 3.618
Conditionals 100.0% (0/0) 💚

source: |-
def parseRawDetail(String raw) {
Pattern detailRegex = /^(.+)\((.+)\)\:\s*(.+)?$/;
Pattern detailRegex = /^([^:(]+)\((.+)\)\:\s*(.+)?$/;
Copy link
Copy Markdown
Member

@andrewkroh andrewkroh Jun 9, 2022

Choose a reason for hiding this comment

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

I don't know the answer, but I'm wondering if these are compiled on each function invocation. If they were outside the function maybe they would only be compiled once per processor execution. No need to change anything.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just tried that and it fails to compile if they are outside the function definition.

@efd6 efd6 merged commit 0cc27d7 into elastic:main Jun 9, 2022
@efd6 efd6 deleted the 3494-windows branch February 5, 2025 22:12
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/powershell: regexp considered too many characters for processing 800 command invocation details

3 participants