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

Update powershell command for hostname detection to avoid profiles and logo that could break detection #851

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

trentm
Copy link
Member

@trentm trentm commented Mar 5, 2024

If a Windows system has a powershell profile that emits output, then it
could pollute the output used to read the hostname value. Likewise with
the powershell logo output, though I don't know if/when that logo
appears -- it does not in apm-agent-nodejs' CI tests.

Refs: elastic/apm-agent-nodejs#3899

Powershell CLI options are documented here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_exe?view=powershell-5.1

…d logo that could break detection

If a Windows system has a powershell profile that emits output, then it
could pollute the output used to read the hostname value. Likewise with
the powershell logo output, though I don't know if/when that logo
appears -- it does not in apm-agent-nodejs' CI tests.

Refs: elastic/apm-agent-nodejs#3899
@trentm trentm self-assigned this Mar 5, 2024
@trentm trentm requested a review from a team as a code owner March 5, 2024 00:16
@trentm trentm requested review from SylvainJuge and removed request for a team March 5, 2024 00:16
@trentm
Copy link
Member Author

trentm commented Mar 5, 2024

@SylvainJuge I think the Node.js and Java agents are the only ones that use this powershell command in their code for Windows hostname detection.

@SylvainJuge
Copy link
Member

I've opened a draft PR to implement this in the Java agent : elastic/apm-agent-java#3556, if adding those extra parameters do not cause a regression that's probably enough for us to merge it and validate this spec change (unless you have a better way to test for it).

@trentm trentm merged commit 44f3ba3 into main Mar 12, 2024
2 checks passed
@trentm trentm deleted the trentm/powershell-nologo-etc branch March 12, 2024 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants