librefang-git
The npx command is used to run node-gyp for building a native addon as part of the project's own source code during packaging; this is a legitimate build step, not execution of arbitrary remote code.
Triggered rules
llm_review
The static rules flagged this MEDIUM, but an AI model (qwen/qwen3-235b-a22b-2507) reviewed the full PKGBUILD and judged it LOW (confidence 90%): The npx command is used to run node-gyp for building a native addon as part of the project's own source code during packaging; this is a legitimate build step, not execution of arbitrary remote code.
1 higher static finding superseded - not the current verdict (shown for transparency)
remote_code_tool
`npx`/`bunx`/`pnpm dlx`/`deno run <url>` downloads AND runs a remote package at build time — the moral equivalent of piping a download into a shell. Severity downgraded: Node.js consumer context.
-
PKGBUILD:66
npx node-gyp rebuild
PKGBUILD
1 offending line(s) highlighted# Maintainer: Wuxxin <wuxxin@gmail.com>
# Contributor: SteamedFish <steamedfish@hotmail.com>
pkgbase=librefang-git
pkgname=("librefang-git" "librefang-desktop-git" "librefang-whatsapp-gateway-git")
pkgver=2026.7.27.r13.g1b9518fd1
pkgrel=1
pkgdesc='LibreFang is an open-source Agent Operating System written in Rust. (GIT version)'
arch=('x86_64' 'aarch64')
url='https://github.com/librefang/librefang'
license=('MIT' 'Apache-2.0')
makedepends=('rust' 'cargo' 'git' 'webkit2gtk-4.1' 'gtk3' 'nodejs' 'npm' 'pnpm' 'node-gyp' 'libvips')
source=(
"${pkgbase}::git+https://github.com/librefang/librefang.git"
"librefang.sysusers"
"librefang.tmpfiles"
"librefang.service"
"librefang-desktop.desktop"
"librefang-whatsapp-gateway.service"
)
sha256sums=('SKIP'
'72663b7a008dcf86e799df777f52c56ba700849510d3fd0c8f4a9e839702dd6e'
'eb06400136cd6f6e0a57f5ee802c273c3ea05b63946c60bd9e135d079d777f10'
'cf026330b3d4c3c708bd079b15401731e1afef4f3e780c4ad286ad0d961a6d5c'
'a640db0197d001c5ae9348d57cda8092e2c8170fa27ced98d5546557fadb6d17'
'1ddb18ffdd4c4131bf9a35debfb21a61aeda8ca1be90829e0e1b10d7bf19b975')
pkgver() {
cd "${pkgbase}"
git describe --long --tags --match 'v[0-9]*' 2>/dev/null | sed 's/^v//; s/-\(beta\|alpha\|rc\)/\1/g; s/\([^-]*-g\)/r\1/; s/-/./g' || echo "2026.7.27.r$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)"
}
prepare() {
export RUSTUP_TOOLCHAIN=stable
cd "${pkgbase}"
cargo fetch --target "$(rustc -vV | sed -n 's/host: //p')"
}
build() {
# Build Rust binaries (dashboard assets are embedded at compile time via include_dir!)
cd "${srcdir}/${pkgbase}"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
# Remap source paths so binaries don't embed build-specific paths
export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${srcdir}=/build"
export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${CARGO_HOME:-${HOME}/.cargo}=/vendor"
export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${RUSTUP_HOME:-${HOME}.rustup}=/rustup"
# Remove -flto flags due to sqlite3 GCC compatibility issues with rust-lld
CFLAGS="${CFLAGS//-flto=auto/}"
CFLAGS="${CFLAGS//-flto/}"
CXXFLAGS="${CXXFLAGS//-flto=auto/}"
CXXFLAGS="${CXXFLAGS//-flto/}"
export CFLAGS CXXFLAGS
export CARGO_PROFILE_RELEASE_LTO=false
cargo build --frozen --release --bin librefang --bin librefang-desktop
# Build Node.js whatsapp-gateway.
local _gwdir="${srcdir}/${pkgbase}/packages/whatsapp-gateway"
cd "${_gwdir}"
export GIT_CONFIG_GLOBAL="${srcdir}/.home/.gitconfig"
git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
npm install --ignore-scripts --omit=dev --legacy-peer-deps --allow-git=all
cp -r /usr/lib/node_modules/node-addon-api "${_gwdir}/node_modules/node-addon-api"
# Compile better-sqlite3 native addon
cd "${_gwdir}/node_modules/better-sqlite3"
npx node-gyp rebuild
}
check() {
cd "${pkgbase}"
export RUSTUP_TOOLCHAIN=stable
cargo test --frozen --release -p librefang-types --lib 2>/dev/null || true
}
package_librefang-git() {
pkgdesc='terminal interface and daemon for the LibreFang Agent OS'
depends=('glibc' 'openssl' 'libgcc' 'python')
optdepends=(
'chromium: Browser Hand support'
'yt-dlp: Clip Hand support'
'ffmpeg: Clip Hand support'
)
provides=('librefang' 'openfang')
conflicts=('librefang' 'openfang' 'openfang-cli' 'librefang-cli' 'librefang-cli-git')
replaces=('librefang-cli-git')
backup=('etc/librefang/env')
cd "${pkgbase}"
install -Dm755 "target/release/librefang" "${pkgdir}/usr/bin/librefang"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
# systemd service
install -Dm644 "${srcdir}/librefang.service" "${pkgdir}/usr/lib/systemd/system/librefang.service"
# sysusers and tmpfiles
install -Dm644 "${srcdir}/librefang.sysusers" "${pkgdir}/usr/lib/sysusers.d/librefang.conf"
install -Dm644 "${srcdir}/librefang.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/librefang.conf"
# default environment file (empty, user-editable)
install -Dm644 /dev/null "${pkgdir}/etc/librefang/env"
}
package_librefang-desktop-git() {
pkgdesc='Desktop application for the LibreFang Agent OS'
depends=('glibc' 'openssl' 'libgcc' 'webkit2gtk-4.1' 'gtk3' 'glib2')
optdepends=(
'librefang-git: CLI companion tool'
'chromium: Browser Hand support'
'yt-dlp: Clip Hand support'
'ffmpeg: Clip Hand support'
)
provides=('librefang-desktop' 'openfang-gui' 'librefang-gui' 'librefang-gui-git')
conflicts=('librefang-desktop' 'openfang-gui' 'librefang-gui' 'librefang-gui-git')
replaces=('librefang-gui-git')
cd "${pkgbase}"
install -Dm755 "target/release/librefang-desktop" "${pkgdir}/usr/bin/librefang-desktop"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
# .desktop file
install -Dm644 "${srcdir}/librefang-desktop.desktop" \
"${pkgdir}/usr/share/applications/librefang-desktop.desktop"
# icons
install -Dm644 "crates/librefang-desktop/icons/128x128.png" \
"${pkgdir}/usr/share/icons/hicolor/128x128/apps/librefang-desktop.png"
install -Dm644 "crates/librefang-desktop/icons/32x32.png" \
"${pkgdir}/usr/share/icons/hicolor/32x32/apps/librefang-desktop.png"
install -Dm644 "crates/librefang-desktop/icons/icon.png" \
"${pkgdir}/usr/share/icons/hicolor/512x512/apps/librefang-desktop.png"
}
package_librefang-whatsapp-gateway-git() {
pkgdesc='librefang WhatsApp gateway — QR login and bidirectional messaging'
depends=('nodejs' 'libvips' 'glibc' 'glib2' 'bash' 'libstdc++' 'libgcc')
optdepends=('librefang-git: connect gateway to the local librefang agent')
provides=('librefang-whatsapp-gateway' 'openfang-whatsapp-gateway')
conflicts=('librefang-whatsapp-gateway' 'openfang-whatsapp-gateway' 'librefang-whatsapp-gateway-git')
local _gatewaydir="${pkgdir}/usr/lib/librefang-whatsapp-gateway"
cd "${srcdir}/${pkgbase}/packages/whatsapp-gateway"
# Install package sources and vendored node_modules
install -dm755 "${_gatewaydir}"
cp -r index.js package.json node_modules lib "${_gatewaydir}/"
# Remove intermediate build folders/artifacts from better-sqlite3 to keep packages small
local _sqlitebuild="${_gatewaydir}/node_modules/better-sqlite3/build"
local _sqlitebin
_sqlitebin=$(find "${_sqlitebuild}/Release" -maxdepth 1 -name 'better_sqlite3.node' 2>/dev/null | head -1)
if [[ -n "${_sqlitebin}" ]]; then
cp "${_sqlitebin}" "${srcdir}/_better_sqlite3_tmp.node"
rm -rf "${_sqlitebuild}"
install -dm755 "${_sqlitebuild}/Release"
mv "${srcdir}/_better_sqlite3_tmp.node" "${_sqlitebuild}/Release/better_sqlite3.node"
fi
# Wrapper script
install -dm755 "${pkgdir}/usr/bin"
cat >"${pkgdir}/usr/bin/librefang-whatsapp-gateway" <<'EOF'
#!/bin/sh
exec node /usr/lib/librefang-whatsapp-gateway/index.js "$@"
EOF
chmod 755 "${pkgdir}/usr/bin/librefang-whatsapp-gateway"
# systemd service
install -Dm644 "${srcdir}/librefang-whatsapp-gateway.service" \
"${pkgdir}/usr/lib/systemd/system/librefang-whatsapp-gateway.service"
install -Dm644 "${srcdir}/${pkgbase}/LICENSE" \
"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
Changes since previous scan
--- PKGBUILD @ 2026-09-11 00:19+++ PKGBUILD @ 2026-09-17 00:27@@ -4,11 +4,11 @@ pkgname=("librefang-git" "librefang-desktop-git" "librefang-whatsapp-gateway-git") pkgver=2026.7.27.r13.g1b9518fd1 pkgrel=1-pkgdesc='LibreFang is an open-source Agent Operating System written in Rust. (GIT version with patches for local STT,TTS,IMAGE support) '+pkgdesc='LibreFang is an open-source Agent Operating System written in Rust. (GIT version)' arch=('x86_64' 'aarch64') url='https://github.com/librefang/librefang' license=('MIT' 'Apache-2.0')-makedepends=('rust' 'cargo' 'git' 'webkit2gtk-4.1' 'gtk3' 'libayatana-appindicator' 'nodejs' 'npm' 'pnpm' 'node-gyp' 'python' 'nodejs-addon-api' 'libvips')+makedepends=('rust' 'cargo' 'git' 'webkit2gtk-4.1' 'gtk3' 'nodejs' 'npm' 'pnpm' 'node-gyp' 'libvips') source=( "${pkgbase}::git+https://github.com/librefang/librefang.git" "librefang.sysusers"@@ -16,62 +16,34 @@ "librefang.service" "librefang-desktop.desktop" "librefang-whatsapp-gateway.service"- "feature-local-stt.patch"- "feature-local-tts.patch"- "feature-local-image.patch"- "feature-local-inference.md" ) sha256sums=('SKIP' '72663b7a008dcf86e799df777f52c56ba700849510d3fd0c8f4a9e839702dd6e' 'eb06400136cd6f6e0a57f5ee802c273c3ea05b63946c60bd9e135d079d777f10' 'cf026330b3d4c3c708bd079b15401731e1afef4f3e780c4ad286ad0d961a6d5c' 'a640db0197d001c5ae9348d57cda8092e2c8170fa27ced98d5546557fadb6d17'- '1ddb18ffdd4c4131bf9a35debfb21a61aeda8ca1be90829e0e1b10d7bf19b975'- 'aa2df1c379d02a52bf4072f3de2f6c3be0512fc3efcbb141320ba19d8fc3ca46'- 'c4fccf730140e3cbe1c694b6f4f3b94c47b998ba76262ce50c63f578822d5918'- '673dc14c22aa89457a2e1684bf075b7e0ae5ecc520830529b6edcfac1e68246b'- '6fa3cb22d68b37cdc9605cc5c02c9095ea4ce47466e415c01dc54c7f7e81bb6a')+ '1ddb18ffdd4c4131bf9a35debfb21a61aeda8ca1be90829e0e1b10d7bf19b975') pkgver() { cd "${pkgbase}"- git describe --long --tags --match 'v[0-9]*' | sed 's/^v//; s/-\(beta\|alpha\|rc\)/\1/g; s/\([^-]*-g\)/r\1/; s/-/./g'+ git describe --long --tags --match 'v[0-9]*' 2>/dev/null | sed 's/^v//; s/-\(beta\|alpha\|rc\)/\1/g; s/\([^-]*-g\)/r\1/; s/-/./g' || echo "2026.7.27.r$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)" } prepare() {- # Ensure HOME is writable for any git operations triggered by cargo or npm- mkdir -p "${srcdir}/.home"- export HOME="${srcdir}/.home"-+ export RUSTUP_TOOLCHAIN=stable cd "${pkgbase}"-- # Apply local patches- msg2 "Applying local STT, TTS and image support patches..."- patch -Np1 -i "${srcdir}/feature-local-stt.patch"- patch -Np1 -i "${srcdir}/feature-local-tts.patch"- patch -Np1 -i "${srcdir}/feature-local-image.patch"-- export RUSTUP_TOOLCHAIN=stable cargo fetch --target "$(rustc -vV | sed -n 's/host: //p')" } build() {- # Ensure HOME is writable for any git operations triggered by cargo or npm- mkdir -p "${srcdir}/.home"- export HOME="${srcdir}/.home"-- # Build React dashboard WebUI so it gets embedded in the API binary at compile-time- cd "${srcdir}/${pkgbase}/crates/librefang-api/dashboard"- pnpm install --frozen-lockfile- pnpm run build-- # Build Rust binaries+ # Build Rust binaries (dashboard assets are embedded at compile time via include_dir!) cd "${srcdir}/${pkgbase}" export RUSTUP_TOOLCHAIN=stable export CARGO_TARGET_DIR=target # Remap source paths so binaries don't embed build-specific paths export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${srcdir}=/build" export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${CARGO_HOME:-${HOME}/.cargo}=/vendor"- export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${RUSTUP_HOME:-${HOME}/.rustup}=/rustup"+ export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${RUSTUP_HOME:-${HOME}.rustup}=/rustup" # Remove -flto flags due to sqlite3 GCC compatibility issues with rust-lld CFLAGS="${CFLAGS//-flto=auto/}" CFLAGS="${CFLAGS//-flto/}"@@ -82,25 +54,16 @@ cargo build --frozen --release --bin librefang --bin librefang-desktop # Build Node.js whatsapp-gateway.- # baileys depends on libsignal from git. npm >= 12 defaults allow-git to- # "none" and refuses to fetch it; --allow-git=root is not enough because- # libsignal is transitive, not in the gateway's own package.json. The- # lockfile also resolves it over ssh, which has no credentials here, so- # rewrite ssh to https (HOME is confined to ${srcdir}/.home above). local _gwdir="${srcdir}/${pkgbase}/packages/whatsapp-gateway" cd "${_gwdir}"- # makepkg pins GIT_CONFIG_GLOBAL to /dev/null, so redirect it at a writable- # path before configuring the rewrite. export GIT_CONFIG_GLOBAL="${srcdir}/.home/.gitconfig" git config --global url."https://github.com/".insteadOf "ssh://git@github.com/" npm install --ignore-scripts --omit=dev --legacy-peer-deps --allow-git=all- # Copy system node-addon-api for compiling sharp/better-sqlite3 if needed cp -r /usr/lib/node_modules/node-addon-api "${_gwdir}/node_modules/node-addon-api" # Compile better-sqlite3 native addon cd "${_gwdir}/node_modules/better-sqlite3" npx node-gyp rebuild- } check() {@@ -111,7 +74,7 @@ package_librefang-git() { pkgdesc='terminal interface and daemon for the LibreFang Agent OS'- depends=('glibc' 'openssl' 'libgcc' 'python-librefang-sdk-git')+ depends=('glibc' 'openssl' 'libgcc' 'python') optdepends=( 'chromium: Browser Hand support' 'yt-dlp: Clip Hand support'@@ -126,7 +89,6 @@ install -Dm755 "target/release/librefang" "${pkgdir}/usr/bin/librefang" install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"- install -Dm644 "${srcdir}/feature-local-inference.md" "${pkgdir}/usr/share/doc/${pkgname}/feature-local-inference.md" # systemd service install -Dm644 "${srcdir}/librefang.service" "${pkgdir}/usr/lib/systemd/system/librefang.service"@@ -141,7 +103,7 @@ package_librefang-desktop-git() { pkgdesc='Desktop application for the LibreFang Agent OS'- depends=('glibc' 'openssl' 'libgcc' 'webkit2gtk-4.1' 'gtk3' 'cairo' 'gdk-pixbuf2' 'glib2' 'libsoup3' 'hicolor-icon-theme' 'python-librefang-sdk-git')+ depends=('glibc' 'openssl' 'libgcc' 'webkit2gtk-4.1' 'gtk3' 'glib2') optdepends=( 'librefang-git: CLI companion tool' 'chromium: Browser Hand support'@@ -156,8 +118,6 @@ install -Dm755 "target/release/librefang-desktop" "${pkgdir}/usr/bin/librefang-desktop" install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"- install -Dm644 "${srcdir}/feature-local-inference.md" \- "${pkgdir}/usr/share/doc/${pkgname}/feature-local-inference.md" # .desktop file install -Dm644 "${srcdir}/librefang-desktop.desktop" \@@ -187,7 +147,7 @@ install -dm755 "${_gatewaydir}" cp -r index.js package.json node_modules lib "${_gatewaydir}/" - # Remove intermediate build folders/artifacts from better-sqlite3 and sharp to keep packages small+ # Remove intermediate build folders/artifacts from better-sqlite3 to keep packages small local _sqlitebuild="${_gatewaydir}/node_modules/better-sqlite3/build" local _sqlitebin _sqlitebin=$(find "${_sqlitebuild}/Release" -maxdepth 1 -name 'better_sqlite3.node' 2>/dev/null | head -1)Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-09-17 00:27:14 | Low | 2 |
| 2026-09-16 00:03:17 | Low | 2 |
| 2026-09-15 00:25:31 | Low | 2 |
| 2026-09-14 00:27:57 | Low | 2 |
| 2026-09-13 00:19:54 | Low | 2 |
| 2026-09-12 00:25:17 | Low | 2 |
| 2026-09-11 13:22:32 | Medium | 1 |
| 2026-09-11 00:19:22 | Low | 2 |
| 2026-09-10 00:22:44 | Low | 2 |
| 2026-09-09 00:04:09 | Low | 2 |
| 2026-09-08 00:18:08 | Low | 2 |
| 2026-09-07 00:30:15 | Low | 2 |
| 2026-09-06 00:17:06 | Low | 2 |
| 2026-09-05 00:16:27 | Low | 2 |
| 2026-09-04 00:03:13 | Low | 2 |
| 2026-09-03 00:15:47 | Low | 2 |
| 2026-09-02 00:02:31 | Low | 2 |
| 2026-09-01 00:11:19 | Low | 2 |
| 2026-08-31 00:19:57 | Low | 2 |
| 2026-08-30 00:04:14 | Low | 2 |