Why is the new chrome webdriver suspiciously dumping my cookies?

65 Views Asked by At

I updated my nuget package "Selenium.WebDriver.ChromeDriver by jsakamoto" to version 117.0.5938.9200

Now when I create the driver to control chrome.

It dumps my browser's cookies into sqlite files called "C" and "C-journal":

enter image description here

The path of the files created are:

D:\my-programs\C

D:\my-programs\C-journal

My program resides in:

D:\my-programs\C#\my-thing\my-thing\bin\Debug\my-thing.exe

My chrome profile resides in:

D:\my-programs\C#\my-thing\my-thing\bin\Debug\my-chrome-profile

I set a breakpoint and confirmed that the files are created when I execute this line:

tempDriver = new ChromeDriver(service, chromeOptions);

Here is a screenshot of the "C" file loaded into a sqlite viewer:

enter image description here

My cookies were never automatically dumped to file in previous versions of "Selenium.WebDriver.ChromeDriver".

Is this something malicious?

Recently the chrome driver executable was no longer being provided by chromium.org and provided new json endpoints for updating. Dunno if that is related to this issue.

Edit: I renamed C# to Cz# and now the files created are called Cz and Cz-journal so thats probably how it picks the file name.

Edit2: The params

private IWebDriver CreateDriver()
{
    ChromeOptions chromeOptions;

    IWebDriver tempDriver = null;


    string uniqueId = "my-program-" + Environment.TickCount;

    string myExtensionPath = Environment.CurrentDirectory + "\\my-stuff\\my-extension";

    string extensionId = settings.GetValue("extension id");

    try
    {
        chromeOptions = new ChromeOptions();

        if (cbHideBrowser.Checked == true)
        {
            chromeOptions.AddArgument("--window-position=-10000,0");
            chromeOptions.AddArgument("--window-size=1920,1080");
        }
        else
        {
            chromeOptions.AddArgument("--window-position=-1920,0");
            chromeOptions.AddArgument("--window-size=1920,1080");
        }

        chromeOptions.AddArgument(uniqueId);
        chromeOptions.AddArgument("--disable-infobars");
        chromeOptions.AddArgument("--user-data-dir=" + Path.GetFullPath("my-chrome-profile"));
        chromeOptions.AddArgument("--my-program");
        chromeOptions.AddArgument("--process-per-site");
        chromeOptions.AddArgument(@"--load-extension=" + myExtensionPath + "," + Environment.CurrentDirectory + "\\uBlock-Origin-development-build_v1.24.5.4");
        chromeOptions.AddArgument(@"--allowlisted-extension-id=" + extensionId);

        chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);
        chromeOptions.AddUserProfilePreference("download.directory_upgrade", true);
        chromeOptions.AddUserProfilePreference("download.default_directory", Environment.CurrentDirectory + "\\myfiles");

        chromeOptions.BinaryLocation = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";

        ChromeDriverService service = ChromeDriverService.CreateDefaultService();

        service.HideCommandPromptWindow = cbHideBrowser.Checked;

        tempDriver = new ChromeDriver(service, chromeOptions);
        
        if (cbHideBrowser.Checked == true)
        {
            processId = GetProcessIdByCommandLineArg(uniqueId);

            Process p = Process.GetProcessById(processId);

            ShowWindow(p.MainWindowHandle, 0);
        }

    }
    catch (Exception x)
    {

    }
    
    return tempDriver;
}
0

There are 0 best solutions below