selenium - Chromium --disable-cookie-encryption 不起作用

标签 selenium google-chrome selenium-webdriver selenium-chromedriver chromium

我正在使用 Selenium 中的 Chromium(版本:83)。我从 `--disable-cookie-encryption 开始。

options.AddArgument("disable-cookie-encryption");

关于 Chromium website , 他们指的是 this list有效论据。

有一个论点:

--disable-cookie-encryption - Whether cookies stored as part of user profile are encrypted.

打开 chrome://version 后,我可以验证 chrome 是否使用 --disable-cookie-encryption 参数启动。

问题是,一旦我打开存储 cookie 的 SQLite 文件(在配置文件的 Default/Cookies 文件中),它们仍然是加密的。

我已尝试使用 Google Chrome 和 Edge,但都无法正常工作。

有什么想法吗?真的支持吗?

最佳答案

网页List of Chromium Command Line Switches仍然提到 --disable-cookie-encryption参数如下:

--disable-cookie-encryption - Whether cookies stored as part of user profile are encrypted.

此设置在 headless_shell_switches.cc 中提到并且可能仅适用于 headless 模式。

// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "headless/app/headless_shell_switches.h"

namespace headless {
namespace switches {

// The background color to be used if the page doesn't specify one. Provided as
// RGBA integer value in hex, e.g. 'ff0000ff' for red or '00000000' for
// transparent.
const char kDefaultBackgroundColor[] = "default-background-color";

// Whether cookies stored as part of user profile are encrypted.
const char kDisableCookieEncryption[] = "disable-cookie-encryption";

深入探讨

根据文章Google Chrome to encrypt HTTP cookies on desktop systems 将 cookie 保存到用户数据文件夹中的文件中。它被命名为 Cookies 并且是一个 SQLite 数据库。您可以将它加载到任何 SQLeditor 中,例如 Firefox 的 SQLite Manager 扩展,以读取由于用户的 Internet 事件而保存到本地系统的所有 cookie。

然而,有一个change在 Chromium 中如下所示:

Encrypt all stored cookies on selected operating systems.

As part of the goal of protecting private user information, this encrypts the cookie values on operating systems with user-specific crypto APIs and that do not otherwise protect this data.

Performance tests indicate a penalty of about 1ms per cookie (regardless of size) on a Mac and 0.1ms to 0.7ms (depending on the size) under Windows. This will be higher on older hardware but still insignificant.

Encrypted data is binary (with an overhead of 128 bytes on Windows) and binary data must be stored in a BLOB so only one of two fields ("value" or "encrypted_value") will have data with the other being empty. Both values, however, need to be read & written when accessing a cookie because they are marked "non null").

此更改 enforces所有桌面版本的 Google Chrome 浏览器都将在不久的将来加密存储的 cookie(而 Chrome OS 和 Android 已经使用完全加密的配置文件)。此更改仅影响在 Chrome 使用新实现更新后保存到系统中的新 cookie。现有 cookie 保持原样,而所有新 cookie 将默认由浏览器加密。


权衡

需要注意的是,加密 cookie 带来的性能下降是微不足道的。在 上为 1 ms操作系统它可能会减慢到 0.7 ms


结论

在执行最近更改的 cookie 策略后,disable-cookie-encryption 似乎不再有效。

关于selenium - Chromium --disable-cookie-encryption 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63300679/

相关文章:

Javascript 在另一个设置为间隔的函数中运行一次函数

selenium - 如何使用 Selenium WebDriver 打开新选项卡并启动链接?

javascript - 为什么 Java 中的 'executeAsyncScript (window.setTimeout (5000))' 函数会在 5 秒后等待下一个函数执行?

java - 如何在java中获取当前的maven配置文件ID

javascript - Chrome "onclick"事件问题

java - 如何通过 Java 使用 Selenium 调整元素大小?

java - Selenium - 展开元素不起作用,而折叠元素则起作用

java - 检查元素在 Selenium Java 中是否可点击

windows - Windows 上的 css objective-c hrome

google-chrome - 如何使用 puppeteer 在 "headful"chrome 中加载多个扩展?