Skip to content

Commit

Permalink
Fix code scanning alert no. 370: Useless regular-expression character…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
3 people authored Nov 5, 2024
1 parent e04d214 commit ae2b382
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions x-pack/plugins/session_view/public/methods/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ const SUPPORTED_PACKAGES = [
CLOUD_DEFEND_DATA_SOURCE,
AUDITBEAT_DATA_SOURCE,
];
const INDEX_REGEX = new RegExp(
`([a-z0-9_-]+\:)?[a-z0-9\-.]*(${SUPPORTED_PACKAGES.join('|')})`,
'i'
);
const INDEX_REGEX = new RegExp(`([a-z0-9_-]+\:)?[a-z0-9-.]*(${SUPPORTED_PACKAGES.join('|')})`, 'i');

export const DEFAULT_INDEX = 'logs-*';
export const CLOUD_DEFEND_INDEX = 'logs-cloud_defend.*';
Expand Down

0 comments on commit ae2b382

Please sign in to comment.