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

Prevent search suggestions from clipboard text #25118

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Aug 14, 2024

fix brave/brave-browser#40415

It's hard to know whether current omnibox input is from clipboard past.
So, prevent search suggestion if current input is same with clipboard text.

Resolves

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

BraveSearchProviderTest.DontSendClipboardTextToSuggest

  1. Enable search Improve search suggestions in brave://settings/search
  2. Copy any text(we call it text1) to clipboard
  3. Paste it in omnibox and check search suggestions are not visible for text
  4. Copy another text(text2) to clipboard to clear text1 from clipboard
  5. Manually type text1 to clipboard and check search suggestions are visible

@simonhong simonhong self-assigned this Aug 14, 2024
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@simonhong simonhong force-pushed the prevent_search_suggestions_from_clipboard branch 2 times, most recently from b5edd71 to 8055e66 Compare August 14, 2024 07:23
@simonhong simonhong force-pushed the prevent_search_suggestions_from_clipboard branch 3 times, most recently from 0177e61 to a48ac46 Compare August 14, 2024 12:24
@simonhong simonhong marked this pull request as ready for review August 14, 2024 13:59
@simonhong simonhong requested a review from a team as a code owner August 14, 2024 14:00
@simonhong
Copy link
Member Author

@brave/sec-team PTAL!

@simonhong simonhong force-pushed the prevent_search_suggestions_from_clipboard branch from a48ac46 to c2a0315 Compare August 15, 2024 00:25
@simonhong simonhong force-pushed the prevent_search_suggestions_from_clipboard branch from c2a0315 to 3224805 Compare August 15, 2024 06:30
@simonhong simonhong force-pushed the prevent_search_suggestions_from_clipboard branch from 3224805 to eef7417 Compare August 15, 2024 06:35
fix brave/brave-browser#40415

It's hard to know whether current omnibox input is from clipboard past.
So, prevent search suggestions if current input is same with clipboard text.
@simonhong simonhong force-pushed the prevent_search_suggestions_from_clipboard branch from eef7417 to 855cd92 Compare August 15, 2024 06:40
@simonhong simonhong merged commit 95e47c1 into master Aug 15, 2024
21 checks passed
@simonhong simonhong deleted the prevent_search_suggestions_from_clipboard branch August 15, 2024 07:44
@github-actions github-actions bot added this to the 1.71.x - Nightly milestone Aug 15, 2024
simonhong added a commit that referenced this pull request Sep 4, 2024
…clipboard

Prevent search suggestions from clipboard text
@LaurenWags
Copy link
Member

LaurenWags commented Sep 5, 2024

Verified with

Brave | 1.71.58 Chromium: 128.0.6613.120 (Official Build) nightly (x86_64)
-- | --
Revision | 7a3a37ed14fd65ec58c192c3f10aba7ac70cebaa
OS | macOS Version 13.6.9 (Build 22G830)

Using 1.69.162 Chromium: 128.0.6613.120 with "Improve search suggestions" enabled under brave://settings/search, reproduced copy/pasted text into the omnibox showing search suggestions.

  1. Using 1.69.162, enabled search Improve search suggestions in brave://settings/search
Screenshot 2024-09-05 at 9 37 44 AM
  1. Copied any text(we call it text1) to clipboard
  2. Paste it in omnibox and saw search suggestions were visible for text1:
Screenshot 2024-09-05 at 9 38 05 AM

Using 1.71.58 Chromium: 128.0.6613.120, verified test plan from #25118 (comment). Confirmed copy/pasted text into the omnibox does not show search suggestions.

  1. Confirmed Show search suggestions was enabled under brave://settings/search (as I'm in a region with Brave Search as default)
Screenshot 2024-09-05 at 9 44 58 AM
  1. Copied text (we call it text1) to clipboard
  2. Pasted text in omnibox and confirmed search suggestions are not visible for text1
Screenshot 2024-09-05 at 9 45 24 AM
  1. Copied other text (text2) to clipboard to clear text1 from clipboard
  2. Manually typed text1 to clipboard and confirmed search suggestions are visible
Screenshot 2024-09-05 at 9 45 42 AM

kjozwiak pushed a commit that referenced this pull request Sep 6, 2024
* Uplift of #25161 (squashed) to beta

* Merge pull request #25099 from brave/rename_to_show_search_suggestions

Renamed to `Show search suggestions` in search engine settings

* Merge pull request #25118 from brave/prevent_search_suggestions_from_clipboard

Prevent search suggestions from clipboard text

* Merge pull request #25243 from brave/prevent_search_suggestions_for_suspicious_query

Improve query check before sending to search suggestions server

---------

Co-authored-by: Simon Hong <shong@brave.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent search suggestions from displaying when copy/pasting into the omnibar
6 participants