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

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

Closed
DetachHead opened this issue Apr 19, 2024 · 5 comments · Fixed by #30653
Closed

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

DetachHead opened this issue Apr 19, 2024 · 5 comments · Fixed by #30653

Comments

@DetachHead
Copy link
Contributor

🚀 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.

@KotlinIsland
Copy link
Contributor

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

@yury-s
Copy link
Member

yury-s commented Apr 19, 2024

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.

@yury-s yury-s closed this as completed Apr 19, 2024
@mxschmitt
Copy link
Member

mxschmitt commented Apr 19, 2024

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.

@DetachHead
Copy link
Contributor Author

DetachHead commented Apr 21, 2024

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 @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?

@wolfib
Copy link

wolfib commented May 2, 2024

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants