Skip to content

Potential fix for code scanning alert no. 1: Regular expression injection#20

Open
eschultink wants to merge 1 commit intomainfrom
alert-autofix-1
Open

Potential fix for code scanning alert no. 1: Regular expression injection#20
eschultink wants to merge 1 commit intomainfrom
alert-autofix-1

Conversation

@eschultink
Copy link
Member

Potential fix for https://github.com/Worklytics/datastore-backup/security/code-scanning/1

To fix the issue, we need to sanitize the bucketPrefix variable before using it in the new RegExp constructor. The best way to achieve this is by using a library like lodash to escape special characters in the user-provided input. Specifically, we can use the _.escapeRegExp function to sanitize bucketPrefix before constructing the regular expression.

Changes will be made in the index.js file:

  1. Import the _.escapeRegExp function from lodash.
  2. Apply _.escapeRegExp to bucketPrefix before passing it to the new RegExp constructor.

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

…tion

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@eschultink eschultink marked this pull request as ready for review February 9, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant