Skip to content

Conversation

@yaira2
Copy link
Member

@yaira2 yaira2 commented Nov 16, 2025

Resolved / Related Issues

This is a new approach to solving #12139 and replaces the solution implemented in #14101. This PR adds back the code removed in #14101 and instead skips the USERNAME environment variable when getting the Machine variables.

Prevents the USERNAME environment variable from being set for child processes to avoid issues where files are executed as the SYSTEM user. Addresses problem described in issue #12139.
@yaira2 yaira2 added the ready for review Pull requests that are ready for review label Nov 16, 2025
string key = (string)ent.Key;

// Skip USERNAME to avoid issues where files were executed as SYSTEM user (#12139)
if (key == "USERNAME")
Copy link
Member

Choose a reason for hiding this comment

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

Use the ordinal case ignoring string comparison.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does it make a difference here?

Copy link
Member

Choose a reason for hiding this comment

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

== differentiates A and a but OrdinalIgnoreCase doesn't.

Copy link
Member

Choose a reason for hiding this comment

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

just in case

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I know, this variable is always uppercase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Pull requests that are ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants