Replies: 3 comments
-
Hey, thanks for the message. It seems that you have installed @evilmartians/lefthook NPM package that have binaries for all platforms bundled into it (including Windows binaries). Switch to lefthook (without namespace prefix). Historically, lefthook has several NPM packages:
See #273 and #281 and |
Beta Was this translation helpful? Give feedback.
-
Thanks for the info and context! I'm like 99% sure that we had only installed the It sounds like accidentally installing It felt like something else was involved, especially since it had ended up installing under the Regardless, we're wanting to avoid future threat alerts from SentinelOne, even if they might be false positives, so we're still planning to switch to husky. We might revisit lefthook in the future, though - it seemed easy to configure while we were trying it out! Thanks! |
Beta Was this translation helpful? Give feedback.
-
A coworker found that it might've been this npx @evilmartians/lefthook line (or a similar one somewhere else) that possibly caused that package to get installed in the developer's |
Beta Was this translation helpful? Give feedback.
-
Hello,
We tried testing out lefthook for some git hooks this week, but lefthook got flagged by SentinelOne on one of our developer MacBooks as potentially malicious, from it apparently downloading a
@evilmartians/lefthook/bin/lefthook_windows_386/lefthook.exe
file.We're gonna try switching to husky instead, but I figured I'd post some details here under the assumption that it was just a bug and not actually malicious. It looks like the code might try to download a lefthook.exe if it detects that it's running on windows: https://github.com/evilmartians/lefthook/blob/master/packaging/npm-bundled/get-exe.js#L10
Details:
Laptop: MacBook Pro, 2021
Processor: Apple M1 Chip
macOS: Sonoma 14.1.1
Lefthook version: 1.5.5
Node: 18.18.0
Yarn: 3.6.3
Scan details:
lefthook@1.5.5
into our repo package.json, created a.lefthook
directory, and alefthook.yml
config fileyarn install
, and done various development in our own codelefthook install
, as far as I know/Users/developer.name/.npm/_npx/<hash>/node_modules/@evilmartians/lefthook/bin/lefthook_windows_386/lefthook.exe
I'm pretty sure this was just a false positive scan freaking out about the .exe file download on a MacBook - this lefthook project and repo appear legit to me. I don't have reproduction steps, so I created this as a discussion instead of an issue.
I'm not sure how it ended up installing
@evilmartians/lefthook
under the npx home directory - as far as I know, the developer was only runningyarn install
in the repo, and not usingnpx
. We did have a package.json script that ranlefthook install
, but the developer doesn't remember explicitly running that. We had at least 4 other developers on different MacBooks also install the dependency and it didn't seem to get flagged (so I'm assuming it didn't download the .exe for them, but I can't fully confirm), so it seems like something went funky for just one developer.It looks like the code is checking for Windows with
["win32", "cygwin"].includes(process.platform)
- maybe that ended up being true on their MacBook somehow, but I'm not sure.Also, when reporting this to our Security team, it initially sounded like another
leftpad
fiasco: we had wanted to installlefthook
, but ended up with@evilmartians/lefthook
, which sounds a bit suspicious, haha.Regardless, it seems strange that it downloaded a
lefthook_windows_386/lefthook.exe
file on an M1 MacBook. I haven't found any documentation yet that mentions M1s aren't supported, and it had looked like it was functioning correctly on a few of our M1s. Please let me know if there's any other information that would be helpful!Beta Was this translation helpful? Give feedback.
All reactions