Closed tigerinus closed 3 years ago
like this one:https://github.com/JanDeDobbeleer/oh-my-posh/issues/218 @JanDeDobbeleer already submitted the binary for review. Any status?
PS: Sophos endpoint here(corporate laptop) and neverd had any warning.
@tigerinus @lnu no, they closed that without notice. I'll see if I can reach out directly. The only way to bypass that today (doesn't happen everywhere) is to exclude it from Defender.
I can confirm this, for me, it has started a few days before.
How did you solve it? I have tried to add C:\Program Files\WindowsPowerShell\Modules\oh-my-posh\3.147.0\oh-my-posh.psm1
file and C:\Program Files\WindowsPowerShell\Modules\oh-my-posh
folder to the Defender's exclusion file/folder, but it did not help.
For now, I have added powershell.exe
as an exclusion process, but this is not a good solution.
@lnu correct
@silverqx @tigerinus I submitted another request, additionally it seems related to this issue.
Yea, it looks like there are many false positives, in that particular issue the reporter describes that command like this [Reflection.Assembly]::LoadFrom($assemblyPath)
causes false positive, in the oh-my-posh
project following line causes the false positive:
Invoke-Expression (& $poshCommand --init --shell=pwsh --config="$config")
I was thinking about trying to change this call, simply try to use another syntax 🤔, I didn't try it, don't have much time.
Still have powershell.exe
in the exclusion list 🙃 @JanDeDobbeleer
I'll leave this open to keep track of it myself.
As per the analysis:
Analyst comments: The warning you experienced indicates that the application had not established reputation with the Microsoft Defender SmartScreen Application Reputation feature at that time. We can confirm that the application "posh-windows-amd64-3.exe" (sha256 – “ec350d7b6b8c5553a419425a98a0fa8a5d7d5a2f51b08743c421204168bdb14f”) has since established reputation and attempting to download or run the application should no longer show any warnings. Please note, however, that the submitted files are not signed using a valid digital certificate. Unsigned files will have to establish reputation each time a new version is released. Application Reputation warnings are meant to indicate when applications do not have known positive reputation. This doesn’t mean that the application is malicious, only that it is “unknown.” Users can still proceed to download and run the application. If establishing reputation immediately is critical, you may want to consider investing in an EV Authenticode certificate. A valid EV Authenticode certificate can immediately establish reputation with SmartScreen reputation services even if no prior reputation exists. In order to be considered a valid EV certificate, the certificate must be issued by a Certificate Authority that is authorized by the Microsoft Trusted Root Certificate Program and recognized as an Extended Validation issuer.
I'll see if code signing is an option. Haven't looked at this in 10 years 😅
EDIT: the cert is at least €299/year. So unless OSS becomes sustainable, that's not going to happen.
Perhaps sigstore can be helpful in this effort someday.
The mission of sigstore is to make it easy for developers to sign releases and for users to verify them. You can think of it like Let’s Encrypt for Code Signing.
If this code is actually the problem:
Invoke-Expression (& $poshCommand --init --shell=pwsh --config="$config")
I would recommend trying to just drop the Invoke-Expression
-- far as I can tell, that is entirely an unnecessary part of the command.
I tried something like this now:
& $poshCommand --init --shell=pwsh --config="$config" | Invoke-Expression
It works, but afterwards I removed powershell.exe
from defender exclusion list and even original line is not detected false positive anymore.
@silverqx so this is working when invoked like that?
@vexx32 that statement is incorrect as it actually outputs Powershell code which needs to be interpreted. Otherwise you get that string value.
Defender doesn't detect it as positive anymore. @JanDeDobbeleer
@vexx32 that statement is incorrect as it actually outputs Powershell code which needs to be interpreted. Otherwise you get that string value.
Fair enough! In that case you might want to manually construct a [scriptblock]
from the output and invoke it rather than using Invoke-Expression... but yeah, it might be some code that is output from that which is what Defender's really objecting to. Hard to say.
@tigerinus @silverqx the latest version swaps every occurrence of Invoke-Expression
with the piped version. Curious to see if that would impact something.
The pipe version should work the same as is described in docs.
If suppose for now with the adjusted init scripts and docs we can close this for the time being?
Defender doesn't detect it, so the issue has been solved.
I've just installed oh-my-posh using:
winget install JanDeDobbeleer.OhMyPosh
When I invoke:
oh-my-posh --init --shell pwsh --config myconfig.json " | invoke-expression
it fails to run, and I see that McAfee has quarantined the exe.
It should be reported to McAfee, when something calls xyz | Invoke-Expression
it does not mean that it is malicious, I'm pretty sure that there is nothing malicious.
It's not complaining about Invoke-Expression as far as I can see. It's the oh-my-posh exe that gets quarantined.
it 2022 and Issue still lingers
@Jkudjo thanks for reminding me what year it is. One would indeed forget with everything which is going on in the world.
I am unable to install oh-my-posh on windows after excluding the folder too
@anaskhan28 I don't understand what you mean by that. Can you explain in a bit more detail?
after downloading oh-my-posh I ran it but it is not working so I thought it is happening because of windows defender then I exclude the path of oh-my-posh and runs it again still it's not working.. any idea why
@anaskhan28 can you share the exact steps you're taking when saying "making it run"? Might be good to join the Discord to get a conversation going.
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Prerequisites
CONTRIBUTING
guideDescription
Environment
Steps to Reproduce
powershell
Expected behavior:
oh-my-posh
gets imported successfullyActual behavior:
Customized Theme