Skip to content

Commit ece9b5b

Browse files
fix(core): remove shellapi from winapi featureset to minimize AV false positives (#34208)
## Current Behavior There's a chance that windows can falsely flag our native binaries as a threat. We do not use the shellapi feature from winapi. ## Expected Behavior We hope that removing this API doesn't break things, and the threat messaging goes away ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes ##34186 --------- Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
1 parent 5142079 commit ece9b5b

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/nx/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ static_assertions = "1.1"
7171
wrap-ansi = "0.1"
7272

7373
[target.'cfg(windows)'.dependencies]
74-
winapi = { version = "0.3", features = ["fileapi", "psapi", "shellapi"] }
74+
winapi = { version = "0.3", features = ["fileapi", "psapi"] }
75+
76+
[target.'cfg(windows)'.build-dependencies]
77+
winres = "0.1"
7578

7679
[target.'cfg(all(not(windows), not(target_family = "wasm")))'.dependencies]
7780
mio = "1.0"

packages/nx/build.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,26 @@ extern crate napi_build;
22

33
fn main() {
44
napi_build::setup();
5+
6+
// Embed Windows resource metadata to establish binary legitimacy
7+
// and reduce false positive detections from security software
8+
#[cfg(windows)]
9+
{
10+
let mut res = winres::WindowsResource::new();
11+
res.set("ProductName", "Nx")
12+
.set(
13+
"FileDescription",
14+
"Nx Native Module - High-performance build system operations",
15+
)
16+
.set("CompanyName", "Nx")
17+
.set("LegalCopyright", "Copyright (c) Nrwl. MIT License.")
18+
.set("OriginalFilename", "nx.node")
19+
.set("InternalName", "nx");
20+
21+
if let Err(e) = res.compile() {
22+
// Don't fail the build if resource compilation fails
23+
// (e.g., when cross-compiling from non-Windows)
24+
eprintln!("cargo:warning=Failed to compile Windows resources: {}", e);
25+
}
26+
}
527
}

0 commit comments

Comments
 (0)