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

[Bug]: Multiple backslashes are breaking the settings search. #26945

Closed
NiranjanaBinoy opened this issue Sep 5, 2024 · 1 comment
Closed
Assignees
Labels
regression-main Regression bug that was found on main branch, but not yet present in production Sev2-normal Normal severity; minor loss of service or inconvenience. team-extension-platform type-bug

Comments

@NiranjanaBinoy
Copy link
Contributor

Describe the bug

The app breaks if we enter more than two back-slash (\) while performing search in the settings.

Expected behavior

The application should not break.

Screenshots/Recordings

Screen.Recording.2024-09-05.at.11.36.15.AM.mov

Steps to reproduce

  1. Go to settings page.
  2. In the search bar, enter three back-slack \\\
  3. The app will break.

Error messages or log output

No response

Detection stage

On the development branch

Version

12.1.2

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

No response

Severity

No response

@NiranjanaBinoy NiranjanaBinoy added type-bug Sev2-normal Normal severity; minor loss of service or inconvenience. labels Sep 5, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by severity Sep 5, 2024
@metamaskbot metamaskbot added the regression-main Regression bug that was found on main branch, but not yet present in production label Sep 5, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by team Sep 19, 2024
@DDDDDanica
Copy link
Contributor

Fix in #27432

@github-project-automation github-project-automation bot moved this from To be fixed to Fixed in Bugs by team Sep 26, 2024
@DDDDDanica DDDDDanica self-assigned this Sep 26, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 2, 2024
… search (#27432)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

In JavaScript, backslashes are used as escape characters in strings and
regular expressions, which can cause issues when an unescaped backslash
is present in a user input. To handle this, we'll need to escape any
special characters in the user input before constructing the regular
expression.

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27432?quickstart=1)

## **Related issues**

Fixes: #27428,
#26945

## **Manual testing steps**

1. Go to settings
2. type foo\
3. press enter should not crash

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**


https://github.com/user-attachments/assets/fb7336e9-7e41-4571-ae84-64c5ef5c3398


<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-main Regression bug that was found on main branch, but not yet present in production Sev2-normal Normal severity; minor loss of service or inconvenience. team-extension-platform type-bug
Projects
Archived in project
Development

No branches or pull requests

4 participants