Search code examples
google-chromewebsecurity

How to enable web security in Chrome after disabling it?


I did the __disable-web-security in Terminal on Mac. Do I need to enable it again? Or does it enable by itself after restart?

If I need to enable it again, how do I do that? I searched everywhere, but didn't find.


Solution

  • Go to chrome://version and look at the Command Line. If the command line argument is still there, you should restart chrome and then launch it normally (without the flag).

    A bit more context: "Flag" refers to two slightly different concepts in Chrome:

    1. Any command line argument that starts with a -- (as opposed to an argument that names a URL or a file, for example).
    2. The list of toggles available at chrome://flags.

    Any arguments added manually to the command line will only persist until you quit Chrome. On the other hand, the toggles set at chrome://flags will persist until they are reset. (To further blur this, invoking chrome://restart will preserve the command line flags.)

    This particular flag makes its presence fairly obvious, with a banner:

    You are using an unsupported command-line flag: --disable-web-security. Stability and security will suffer.

    So it should hopefully be clear whether the flag is present (and also why this is the sort of flag that can't be persisted at chrome://flags).

    The flags set in #2 are delimited in Chrome's command line by the --flags-switches-begin--flags-switches-end section. Arguments outside of that section are coming from somewhere other than chrome://flags (namely, from the command line, except in the case of Chrome OS and Android, which have their own startup procedures).