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

Fix code scanning alert no. 370: Useless regular-expression character escape #198264

Merged
merged 5 commits into from
Nov 5, 2024

Conversation

kfirpeled
Copy link
Contributor

@kfirpeled kfirpeled commented Oct 30, 2024

Fixes https://github.com/elastic/kibana/security/code-scanning/370

To fix the problem, we need to remove the unnecessary escape sequence \- from the regular expression on line 32. This will not change the functionality of the code but will make the regular expression clearer and more maintainable.

  • In general terms, we need to ensure that only necessary escape sequences are used in regular expressions.
  • Specifically, we will update the regular expression on line 32 to remove the unnecessary escape sequence.
  • The change will be made in the file x-pack/plugins/session_view/public/methods/index.tsx.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… escape

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@kfirpeled kfirpeled added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Oct 30, 2024
@Omolola-Akinleye Omolola-Akinleye added the ci:cloud-deploy Create or update a Cloud deployment label Oct 30, 2024
@Omolola-Akinleye
Copy link
Contributor

/ci

@Omolola-Akinleye Omolola-Akinleye marked this pull request as ready for review October 30, 2024 20:16
@Omolola-Akinleye Omolola-Akinleye requested a review from a team as a code owner October 30, 2024 20:16
@Omolola-Akinleye Omolola-Akinleye marked this pull request as draft October 30, 2024 20:34
@Omolola-Akinleye Omolola-Akinleye marked this pull request as ready for review October 30, 2024 21:28
@Omolola-Akinleye Omolola-Akinleye marked this pull request as draft October 30, 2024 21:54
@Omolola-Akinleye
Copy link
Contributor

@kfirpeled Session Viewer is working fine!
image

@kfirpeled kfirpeled marked this pull request as ready for review November 4, 2024 22:49
@kfirpeled kfirpeled enabled auto-merge (squash) November 4, 2024 22:50
@elasticmachine
Copy link
Contributor

⏳ Build in-progress

History

Copy link
Contributor

@Omolola-Akinleye Omolola-Akinleye left a comment

Choose a reason for hiding this comment

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

LGTM!

@kfirpeled kfirpeled merged commit ae2b382 into main Nov 5, 2024
23 checks passed
@kfirpeled kfirpeled deleted the alert-autofix-370 branch November 5, 2024 15:01
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11686816769

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 5, 2024
… escape (elastic#198264)

Fixes
[https://github.com/elastic/kibana/security/code-scanning/370](https://github.com/elastic/kibana/security/code-scanning/370)

To fix the problem, we need to remove the unnecessary escape sequence
`\-` from the regular expression on line 32. This will not change the
functionality of the code but will make the regular expression clearer
and more maintainable.

- In general terms, we need to ensure that only necessary escape
sequences are used in regular expressions.
- Specifically, we will update the regular expression on line 32 to
remove the unnecessary escape sequence.
- The change will be made in the file
`x-pack/plugins/session_view/public/methods/index.tsx`.

_Suggested fixes powered by Copilot Autofix. Review carefully before
merging._

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: @Omolola-Akinleye
(cherry picked from commit ae2b382)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 5, 2024
…racter escape (#198264) (#198999)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Fix code scanning alert no. 370: Useless regular-expression character
escape (#198264)](#198264)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kfir
Peled","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-05T15:01:20Z","message":"Fix
code scanning alert no. 370: Useless regular-expression character escape
(#198264)\n\nFixes\r\n[https://github.com/elastic/kibana/security/code-scanning/370](https://github.com/elastic/kibana/security/code-scanning/370)\r\n\r\nTo
fix the problem, we need to remove the unnecessary escape
sequence\r\n`\\-` from the regular expression on line 32. This will not
change the\r\nfunctionality of the code but will make the regular
expression clearer\r\nand more maintainable.\r\n\r\n- In general terms,
we need to ensure that only necessary escape\r\nsequences are used in
regular expressions.\r\n- Specifically, we will update the regular
expression on line 32 to\r\nremove the unnecessary escape sequence.\r\n-
The change will be made in the
file\r\n`x-pack/plugins/session_view/public/methods/index.tsx`.\r\n\r\n\r\n_Suggested
fixes powered by Copilot Autofix. Review carefully
before\r\nmerging._\r\n\r\n---------\r\n\r\nCo-authored-by: Copilot
Autofix powered by AI
<62310815+github-advanced-security[bot]@users.noreply.github.com>\r\nCo-authored-by:
kibanamachine
<[email protected]>\r\nCo-authored-by:
@Omolola-Akinleye","sha":"ae2b3827f8237a07472699cfbd442a8bc567dc34","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:cloud-deploy"],"title":"Fix
code scanning alert no. 370: Useless regular-expression character
escape","number":198264,"url":"https://github.com/elastic/kibana/pull/198264","mergeCommit":{"message":"Fix
code scanning alert no. 370: Useless regular-expression character escape
(#198264)\n\nFixes\r\n[https://github.com/elastic/kibana/security/code-scanning/370](https://github.com/elastic/kibana/security/code-scanning/370)\r\n\r\nTo
fix the problem, we need to remove the unnecessary escape
sequence\r\n`\\-` from the regular expression on line 32. This will not
change the\r\nfunctionality of the code but will make the regular
expression clearer\r\nand more maintainable.\r\n\r\n- In general terms,
we need to ensure that only necessary escape\r\nsequences are used in
regular expressions.\r\n- Specifically, we will update the regular
expression on line 32 to\r\nremove the unnecessary escape sequence.\r\n-
The change will be made in the
file\r\n`x-pack/plugins/session_view/public/methods/index.tsx`.\r\n\r\n\r\n_Suggested
fixes powered by Copilot Autofix. Review carefully
before\r\nmerging._\r\n\r\n---------\r\n\r\nCo-authored-by: Copilot
Autofix powered by AI
<62310815+github-advanced-security[bot]@users.noreply.github.com>\r\nCo-authored-by:
kibanamachine
<[email protected]>\r\nCo-authored-by:
@Omolola-Akinleye","sha":"ae2b3827f8237a07472699cfbd442a8bc567dc34"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198264","number":198264,"mergeCommit":{"message":"Fix
code scanning alert no. 370: Useless regular-expression character escape
(#198264)\n\nFixes\r\n[https://github.com/elastic/kibana/security/code-scanning/370](https://github.com/elastic/kibana/security/code-scanning/370)\r\n\r\nTo
fix the problem, we need to remove the unnecessary escape
sequence\r\n`\\-` from the regular expression on line 32. This will not
change the\r\nfunctionality of the code but will make the regular
expression clearer\r\nand more maintainable.\r\n\r\n- In general terms,
we need to ensure that only necessary escape\r\nsequences are used in
regular expressions.\r\n- Specifically, we will update the regular
expression on line 32 to\r\nremove the unnecessary escape sequence.\r\n-
The change will be made in the
file\r\n`x-pack/plugins/session_view/public/methods/index.tsx`.\r\n\r\n\r\n_Suggested
fixes powered by Copilot Autofix. Review carefully
before\r\nmerging._\r\n\r\n---------\r\n\r\nCo-authored-by: Copilot
Autofix powered by AI
<62310815+github-advanced-security[bot]@users.noreply.github.com>\r\nCo-authored-by:
kibanamachine
<[email protected]>\r\nCo-authored-by:
@Omolola-Akinleye","sha":"ae2b3827f8237a07472699cfbd442a8bc567dc34"}}]}]
BACKPORT-->

Co-authored-by: Kfir Peled <[email protected]>
mgadewoll pushed a commit to mgadewoll/kibana that referenced this pull request Nov 7, 2024
… escape (elastic#198264)

Fixes
[https://github.com/elastic/kibana/security/code-scanning/370](https://github.com/elastic/kibana/security/code-scanning/370)

To fix the problem, we need to remove the unnecessary escape sequence
`\-` from the regular expression on line 32. This will not change the
functionality of the code but will make the regular expression clearer
and more maintainable.

- In general terms, we need to ensure that only necessary escape
sequences are used in regular expressions.
- Specifically, we will update the regular expression on line 32 to
remove the unnecessary escape sequence.
- The change will be made in the file
`x-pack/plugins/session_view/public/methods/index.tsx`.


_Suggested fixes powered by Copilot Autofix. Review carefully before
merging._

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: @Omolola-Akinleye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) ci:cloud-deploy Create or update a Cloud deployment release_note:skip Skip the PR/issue when compiling release notes v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants