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

(GH-188) Filter current environment variables #189

Merged
merged 1 commit into from
Jun 24, 2022

Conversation

chelnak
Copy link
Contributor

@chelnak chelnak commented Jun 23, 2022

When Protected Event Logging and PowerShell Script Block logging are enabled together the SystemRoot environment variable is a requirement.

If it is removed as part of the environment purge it causes the PowerShell process to crash, therefore breaking the pipe between Ruby and the remote PowerShell session.

This PR fixes the issue by creating a filtered list of environment variables which does not include the SystemRoot environment variable.

This list can then be purged safely.

Closes #188

@chelnak chelnak added the bug Something isn't working label Jun 23, 2022
@chelnak chelnak requested a review from a team as a code owner June 23, 2022 15:52
@chelnak chelnak self-assigned this Jun 23, 2022
When Protected Event Logging and PowerShell Script Block logging are
enabled together the SystemRoot environment variable is a requirement.

If it is removed as part of the environment purge it causes the
PowerShell process to crash, therefore breaking the pipe between Ruby
and the remote PowerShell session.

This commit fixes the issue by creating a filtered list of environment
variables which does not include the SystemRoot environment variable.

This list can then be purged safely.
Copy link
Member

@david22swan david22swan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Though my powershell is not perfect

@LukasAud LukasAud merged commit 6f1f0c2 into main Jun 24, 2022
@chelnak chelnak deleted the GH-188-fix_environment_reset branch September 15, 2022 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Protected Event Logging is breaking execution
3 participants