mandiant / VM-Packages

Chocolatey packages supporting the analysis environment projects FLARE-VM & Commando VM.
Apache License 2.0
123 stars 61 forks source link

Bypass annoying chrome pop-ups #978

Closed emtuls closed 2 months ago

emtuls commented 2 months ago

This fixes https://github.com/mandiant/VM-Packages/issues/977

emtuls commented 2 months ago

This is a bit frustrating that it is erroring out, but I think I finally found the issue.

It looks like the Windows-2019 and Windows-2022 both have up to date Chrome installs, and because "chrome is already installed", we are receiving an MSI installer error. https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md#browsers-and-drivers https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#browsers-and-drivers

We might just need to add this one to the exceptions list. If you test it locally, it should work.

emtuls commented 2 months ago

I've added googlechrome.vm to the excludedPackages in ci.yml for now, until we decide how we may want to handle it based on https://github.com/mandiant/VM-Packages/issues/929 or if there is any other idea that might work.

Once we determine how to handle that for windows-terminal, assuming we go the route of adding things to exclude_tests in test_install.ps1, should we also add this as well, in case it fails for daily.yml?

Though if we do this in the current state, it would cause an issue for testing locally...so like I suggested in https://github.com/mandiant/VM-Packages/issues/929#issuecomment-2046285482, I think we should add a new parameter to determine if an environment string is passed in (like windows-2019 or windows-2022) and only filter if one is passed in, otherwise we just test like normal.

Ana06 commented 2 months ago

This is a nice idea @emtuls!

It looks like the Windows-2019 and Windows-2022 both have up to date Chrome installs, and because "chrome is already installed", we are receiving an MSI installer error.

I think the error is already in the test suite, see today's daily: https://github.com/mandiant/VM-Packages/actions/runs/8625498921/job/23642184219#step:3:1758

Ana06 commented 2 months ago

I am not able to reproduce the error locally. do you @emtuls? In any case, I think instead of ignoring testing, we should ignore the error and ensure that the Chrome executable is present.

emtuls commented 2 months ago

Locally it shouldn't have an issue, since it is not already installed on your system, whereas it is already installed on the windows-2019/2022 images that github actions run on.

I think I've found out how to do it properly. There's a -ErrorAction SilentlyContinue for Install-ChocolateyInstallPackage

Ana06 commented 2 months ago

@emtuls

Locally it shouldn't have an issue, since it is not already installed on your system,

What I meant is that I tried to install google chrome in several ways locally and then installing the packages to try to replicate the GH setup and I was not able to reproduce the error.

I think using -ErrorAction SilentlyContinue and checking if chrome is installed afterwards is the way to go.

emtuls commented 2 months ago

@emtuls

Locally it shouldn't have an issue, since it is not already installed on your system,

What I meant is that I tried to install google chrome in several ways locally and then installing the packages to try to replicate the GH setup and I was not able to reproduce the error.

I think using -ErrorAction SilentlyContinue and checking if chrome is installed afterwards is the way to go.

Interesting...That was the conclusion I arrived at based on searching the error on the internet, though it could be many things, but it was something that someone mentioned, and I did notice that the Github Action VM's already had it installed. 😬

I'd have to play around with it some more to really try to narrow it down better. I wish I could access the Github Action VM to test from there.

Ana06 commented 2 months ago

@emtuls

I wish I could access the Github Action VM to test from there.

You can debug GH actions in several ways. I like to run them in my own fork with logging enabled. Another alternatives are to use the debugging with ssh action or Act.