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

exception catch in vm.common.psm1 may not be working #753

Open
Ana06 opened this issue Nov 24, 2023 · 2 comments
Open

exception catch in vm.common.psm1 may not be working #753

Ana06 opened this issue Nov 24, 2023 · 2 comments
Labels
🐛 bug Something isn't working ❔ discussion Further discussion is needed

Comments

@Ana06
Copy link
Member

Ana06 commented Nov 24, 2023

Details

At the beginning of packages/common.vm/tools/vm.common/vm.common.psm1, we set $ErrorActionPreference = 'Stop' and we do the same at the beginning of many packages. Isn't this causing that the catch when an exception occurs is not executed as the program immediately exits? @MalwareMechanic you introduced some of this exception handling to render errors better in the logs. Do you have more insight here?

@Ana06 Ana06 added ❔ discussion Further discussion is needed 🐛 bug Something isn't working labels Nov 24, 2023
@Ana06
Copy link
Member Author

Ana06 commented Nov 24, 2023

Related: When a registry-item in the configuration fails to be added, the rest of registry items are also not added. It seems the exception is catched in VM-Apply-Configurations instead of in VM-Update-Registry-Value, which is where we would like it to be catched.

I think we need to give the error action a thought.

@mandiant/commando-vm this affects Commando-VM as well.

@day1player
Copy link
Contributor

Yeah I have definitely noticed some inconsistencies with what would effectively be VM-Write-Log not actually writing anything to the log, so this is probably the cause. I agree we should look into this since the purpose of maintaining our own logs outside of choco was to have good and actionable info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working ❔ discussion Further discussion is needed
Projects
None yet
Development

No branches or pull requests

2 participants