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

[Cases] [104932] Remove newline characters from summary field and add tests #113571

Merged
merged 3 commits into from
Oct 1, 2021
Merged

[Cases] [104932] Remove newline characters from summary field and add tests #113571

merged 3 commits into from
Oct 1, 2021

Conversation

jamster10
Copy link
Contributor

@jamster10 jamster10 commented Sep 30, 2021

Issue: #104932

Summary

Prevent summary field from having newline characters and extraneous spaces by trimming and removing said characters.

Description with multlines
Screen Shot 2021-09-30 at 3 10 19 PM

Jira ticket summary created from multiline rule description ({{context.rule.description}})
image (1)

Release notes

Reformatting Jira summary field to be one line

@jamster10 jamster10 added release_note:fix v8.0.0 Team:Threat Hunting Security Solution Threat Hunting Team auto-backport Deprecated - use backport:version if exact versions are needed v7.16.0 v7.15.1 Team:Threat Hunting:Cases labels Sep 30, 2021
@jamster10 jamster10 requested a review from cnasikas September 30, 2021 20:27
@jamster10 jamster10 self-assigned this Sep 30, 2021
@jamster10 jamster10 requested a review from a team as a code owner September 30, 2021 20:27
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-cases (Team:Threat Hunting:Cases)

@jamster10 jamster10 linked an issue Sep 30, 2021 that may be closed by this pull request
@jamster10
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

LGTM

const trimAndRemoveNewlines = (str: string) =>
str
.split(/[\n\r]/gm)
.filter((item) => !isEmpty(item.trim()))
Copy link
Member

Choose a reason for hiding this comment

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

nit: if we swap the two operations we can get away with the second trim call.

.map((item) => item.trim())
.filter((item) => !isEmpty(item))

Copy link
Contributor

Choose a reason for hiding this comment

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

good point, @jamster10 I'd add Christos' suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorted 👌

Copy link
Member

@cnasikas cnasikas left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@cnasikas cnasikas changed the title [case] [104932] Remove newline characters from summary field and add tests [Cases] [104932] Remove newline characters from summary field and add tests Oct 1, 2021
@jamster10
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

  • 💚 Build #156905 succeeded f4e468bee5403a822e940edbcd82dbc9d56c534b

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jamster10

@jamster10 jamster10 merged commit 9437e8d into elastic:master Oct 1, 2021
@jamster10 jamster10 deleted the 104932-Jira-action-fail-bug branch October 1, 2021 20:03
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Oct 1, 2021
… tests (elastic#113571)

* [104932] Remove newline characters from summary field and add tests

* PR fix

Co-authored-by: Kristof-Pierre Cummings <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Oct 1, 2021
… tests (elastic#113571)

* [104932] Remove newline characters from summary field and add tests

* PR fix

Co-authored-by: Kristof-Pierre Cummings <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x
7.15

The backport PRs will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Oct 1, 2021
… tests (#113571) (#113669)

* [104932] Remove newline characters from summary field and add tests

* PR fix

Co-authored-by: Kristof-Pierre Cummings <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kristof C <[email protected]>
Co-authored-by: Kristof-Pierre Cummings <[email protected]>
kibanamachine added a commit that referenced this pull request Oct 1, 2021
… tests (#113571) (#113668)

* [104932] Remove newline characters from summary field and add tests

* PR fix

Co-authored-by: Kristof-Pierre Cummings <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kristof C <[email protected]>
Co-authored-by: Kristof-Pierre Cummings <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:fix Team:Threat Hunting Security Solution Threat Hunting Team v7.15.1 v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Actions] Jira action fails when newline symbol is in summary
6 participants