librefang-git
The npx command is used to run node-gyp rebuild on a locally checked-out dependency, not to execute arbitrary remote code; the source is from the project's own repository and the action is part of a standard native Node.js addon build.
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 95%): The npx command is used to run node-gyp rebuild on a locally checked-out dependency, not to execute arbitrary remote code; the source is from the project's own repository and the action is part of a standard native Node.js addon build.
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:81
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.10.16.r38.gb14e01642c
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' 'nodejs-addon-api' 'libvips')
source=(
"${pkgbase}::git+https://github.com/librefang/librefang.git"
"librefang.sysusers"
"librefang.tmpfiles"
"librefang.service"
"librefang-desktop.desktop"
"librefang-whatsapp-gateway.service"
"feature-local-inference.md"
)
sha256sums=('SKIP'
'72663b7a008dcf86e799df777f52c56ba700849510d3fd0c8f4a9e839702dd6e'
'eb06400136cd6f6e0a57f5ee802c273c3ea05b63946c60bd9e135d079d777f10'
'cf026330b3d4c3c708bd079b15401731e1afef4f3e780c4ad286ad0d961a6d5c'
'a640db0197d001c5ae9348d57cda8092e2c8170fa27ced98d5546557fadb6d17'
'1ddb18ffdd4c4131bf9a35debfb21a61aeda8ca1be90829e0e1b10d7bf19b975'
'98941a4dedfc4081d7dbb8e9ca5f3f4bc26f9e438fc3317d438863e34053e424')
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() {
# Ensure HOME is writable for any git operations triggered by cargo or npm
mkdir -p "${srcdir}/.home"
export HOME="${srcdir}/.home"
cd "${pkgbase}"
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
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() {
export HOME="${srcdir}/.home"
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"
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"
# 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"
install -Dm644 "${srcdir}/feature-local-inference.md" \
"${pkgdir}/usr/share/doc/${pkgname}/feature-local-inference.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-10-27 00:23+++ PKGBUILD @ 2026-11-01 00:21@@ -2,13 +2,13 @@ # Contributor: SteamedFish <steamedfish@hotmail.com> pkgbase=librefang-git pkgname=("librefang-git" "librefang-desktop-git" "librefang-whatsapp-gateway-git")-pkgver=2026.7.27.r13.g1b9518fd1+pkgver=2026.10.16.r38.gb14e01642c 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')+makedepends=('rust' 'cargo' 'git' 'webkit2gtk-4.1' 'gtk3' 'nodejs' 'npm' 'pnpm' 'node-gyp' 'nodejs-addon-api' 'libvips') source=( "${pkgbase}::git+https://github.com/librefang/librefang.git" "librefang.sysusers"@@ -16,13 +16,15 @@ "librefang.service" "librefang-desktop.desktop" "librefang-whatsapp-gateway.service"+ "feature-local-inference.md" ) sha256sums=('SKIP' '72663b7a008dcf86e799df777f52c56ba700849510d3fd0c8f4a9e839702dd6e' 'eb06400136cd6f6e0a57f5ee802c273c3ea05b63946c60bd9e135d079d777f10' 'cf026330b3d4c3c708bd079b15401731e1afef4f3e780c4ad286ad0d961a6d5c' 'a640db0197d001c5ae9348d57cda8092e2c8170fa27ced98d5546557fadb6d17'- '1ddb18ffdd4c4131bf9a35debfb21a61aeda8ca1be90829e0e1b10d7bf19b975')+ '1ddb18ffdd4c4131bf9a35debfb21a61aeda8ca1be90829e0e1b10d7bf19b975'+ '98941a4dedfc4081d7dbb8e9ca5f3f4bc26f9e438fc3317d438863e34053e424') pkgver() { cd "${pkgbase}"@@ -30,20 +32,33 @@ } prepare() {+ # Ensure HOME is writable for any git operations triggered by cargo or npm+ mkdir -p "${srcdir}/.home"+ export HOME="${srcdir}/.home"++ cd "${pkgbase}" 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!)+ # 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 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/}"@@ -67,6 +82,7 @@ } check() {+ export HOME="${srcdir}/.home" cd "${pkgbase}" export RUSTUP_TOOLCHAIN=stable cargo test --frozen --release -p librefang-types --lib 2>/dev/null || true@@ -89,6 +105,7 @@ 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"@@ -118,6 +135,8 @@ 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" \Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-11-01 00:21:48 | Low | 2 |
| 2026-10-31 00:07:41 | Low | 2 |
| 2026-10-30 00:29:30 | Low | 2 |
| 2026-10-29 00:13:55 | Low | 2 |
| 2026-10-28 00:06:54 | Low | 2 |
| 2026-10-27 21:48:49 | Medium | 1 |
| 2026-10-27 00:23:28 | Low | 2 |
| 2026-10-26 00:12:40 | Low | 2 |
| 2026-10-25 00:20:48 | Low | 2 |
| 2026-10-24 00:14:55 | Low | 2 |
| 2026-10-23 00:02:19 | Low | 2 |
| 2026-10-22 00:13:10 | Low | 2 |
| 2026-10-21 00:12:50 | Low | 2 |
| 2026-10-20 00:10:31 | Low | 2 |
| 2026-10-19 00:03:55 | Low | 2 |
| 2026-10-18 00:06:55 | Low | 2 |
| 2026-10-17 00:21:55 | Low | 2 |
| 2026-10-16 00:12:47 | Low | 2 |
| 2026-10-15 00:28:05 | Low | 2 |
| 2026-10-14 00:06:47 | Low | 2 |