Skip to content

[Feature]: disable the "allow pasting" warning in chrome devtools #30425

Closed

Description

@DetachHead

🚀 Feature Request

when opening devtools and attempting to paste something into the console, it doesn't work and the following warning appears:

Warning: Don’t paste code into the DevTools Console that you don’t understand or haven’t reviewed yourself. This could allow attackers to steal your identity or take control of your computer. Please type ‘allow pasting’ below and hit Enter to allow pasting.

it would be nice if playwright could automatically disable this protection. i wasn't able to find any chrome arguments to disable it though

Example

No response

Motivation

this warning is intended to protect end users who are not programmers from being scammed, so it's not relevant to playwright users at all, who often need to paste selectors and other code snippets into the console when debugging their tests.

Activity

  1. KotlinIsland commented on Apr 19, 2024

    @KotlinIsland
    Contributor

    I wonder if Chrome for Testing fixes this already...

  2. yury-s commented on Apr 19, 2024

    @yury-s
    Member

    Please file this issue in Chromium repository, they could probably add a flag to disable the warning (and clients such as playwright could pass it) or just disable the warning when browser is controlled by automation client.

  3. mxschmitt commented on Apr 19, 2024

    @mxschmitt
    Contributor

    I asked where it was implemented: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5352652/comment/8c39f546_506c4201/

    We can try filing a bug with the suggestion from the comment if they are up for it.

  4. DetachHead commented on Apr 21, 2024

    @DetachHead
    ContributorAuthor

    Please file this issue in Chromium repository, they could probably add a flag to disable the warning (and clients such as playwright could pass it) or just disable the warning when browser is controlled by automation client.

    looks like it's already been raised: https://issues.chromium.org/issues/41491762

    I wonder if Chrome for Testing fixes this already...

    looks like it does (from the code Max Schmitt (@mxschmitt) linked):

    protected onPaste(): boolean {
      if (Root.Runtime.Runtime.queryParam('isChromeForTesting') || this.selfXssWarningDisabledSetting.get()) {
        return false;
      }
      void this.showSelfXssWarning();
      return true;
    }

    and it's documented here: https://developer.chrome.com/blog/self-xss#can_you_disable_it_for_test_automation

    i tried looking into that selfXssWarningDisabledSetting setting, but as far as i can tell there's no way to set that in the chrome flags.

    maybe it's worth re-opening #23694?

  5. wolfib commented on May 2, 2024

    @wolfib

    We've added a Chrome command line flag to disable self-XSS warnings: --unsafely-disable-devtools-self-xss-warnings (https://crbug.com/41491762 for details)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions