librefang-whatsapp-gateway-git

maintainer wuxxin · 1 votes · base librefang-git · scanned 2026-08-03 00:08:14.047287
LOW
View on AUR ↗
Why flagged The npx execution is used to rebuild a native addon (better-sqlite3) from source within a vendored node_modules directory as part of the build process; it does not execute arbitrary remote code or introduce a supply-chain risk beyond normal dependency compilation.

Triggered rules

LOW AI review downgraded a static finding 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 execution is used to rebuild a native addon (better-sqlite3) from source within a vendored node_modules directory as part of the build process; it does not execute arbitrary remote code or introduce a supply-chain risk beyond normal dependency compilation.

1 higher static finding superseded - not the current verdict (shown for transparency)
MEDIUM npx/bunx/deno executes a remote package 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:102 npx node-gyp rebuild

PKGBUILD

1 offending line(s) highlighted
1# Maintainer: Wuxxin <wuxxin@gmail.com>
2# Contributor: SteamedFish <steamedfish@hotmail.com>
3pkgbase=librefang-git
4pkgname=("librefang-git" "librefang-desktop-git" "librefang-whatsapp-gateway-git")
5pkgver=2026.7.27.r13.g1b9518fd1
6pkgrel=1
7pkgdesc='LibreFang is an open-source Agent Operating System written in Rust. (GIT version with patches for local STT,TTS,IMAGE support) '
8arch=('x86_64' 'aarch64')
9url='https://github.com/librefang/librefang'
10license=('MIT' 'Apache-2.0')
11makedepends=('rust' 'cargo' 'git' 'webkit2gtk-4.1' 'gtk3' 'libayatana-appindicator' 'nodejs' 'npm' 'pnpm' 'node-gyp' 'python' 'nodejs-addon-api' 'libvips')
12source=(
13 "${pkgbase}::git+https://github.com/librefang/librefang.git"
14 "librefang.sysusers"
15 "librefang.tmpfiles"
16 "librefang.service"
17 "librefang-desktop.desktop"
18 "librefang-whatsapp-gateway.service"
19 "feature-local-stt.patch"
20 "feature-local-tts.patch"
21 "feature-local-image.patch"
22 "feature-local-inference.md"
23)
24sha256sums=('SKIP'
25 '72663b7a008dcf86e799df777f52c56ba700849510d3fd0c8f4a9e839702dd6e'
26 'eb06400136cd6f6e0a57f5ee802c273c3ea05b63946c60bd9e135d079d777f10'
27 'cf026330b3d4c3c708bd079b15401731e1afef4f3e780c4ad286ad0d961a6d5c'
28 'a640db0197d001c5ae9348d57cda8092e2c8170fa27ced98d5546557fadb6d17'
29 '1ddb18ffdd4c4131bf9a35debfb21a61aeda8ca1be90829e0e1b10d7bf19b975'
30 'aa2df1c379d02a52bf4072f3de2f6c3be0512fc3efcbb141320ba19d8fc3ca46'
31 'c4fccf730140e3cbe1c694b6f4f3b94c47b998ba76262ce50c63f578822d5918'
32 '673dc14c22aa89457a2e1684bf075b7e0ae5ecc520830529b6edcfac1e68246b'
33 '6fa3cb22d68b37cdc9605cc5c02c9095ea4ce47466e415c01dc54c7f7e81bb6a')
34
35pkgver() {
36 cd "${pkgbase}"
37 git describe --long --tags --match 'v[0-9]*' | sed 's/^v//; s/-\(beta\|alpha\|rc\)/\1/g; s/\([^-]*-g\)/r\1/; s/-/./g'
38}
39
40prepare() {
41 # Ensure HOME is writable for any git operations triggered by cargo or npm
42 mkdir -p "${srcdir}/.home"
43 export HOME="${srcdir}/.home"
44
45 cd "${pkgbase}"
46
47 # Apply local patches
48 msg2 "Applying local STT, TTS and image support patches..."
49 patch -Np1 -i "${srcdir}/feature-local-stt.patch"
50 patch -Np1 -i "${srcdir}/feature-local-tts.patch"
51 patch -Np1 -i "${srcdir}/feature-local-image.patch"
52
53 export RUSTUP_TOOLCHAIN=stable
54 cargo fetch --target "$(rustc -vV | sed -n 's/host: //p')"
55}
56
57build() {
58 # Ensure HOME is writable for any git operations triggered by cargo or npm
59 mkdir -p "${srcdir}/.home"
60 export HOME="${srcdir}/.home"
61
62 # Build React dashboard WebUI so it gets embedded in the API binary at compile-time
63 cd "${srcdir}/${pkgbase}/crates/librefang-api/dashboard"
64 pnpm install --frozen-lockfile
65 pnpm run build
66
67 # Build Rust binaries
68 cd "${srcdir}/${pkgbase}"
69 export RUSTUP_TOOLCHAIN=stable
70 export CARGO_TARGET_DIR=target
71 # Remap source paths so binaries don't embed build-specific paths
72 export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${srcdir}=/build"
73 export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${CARGO_HOME:-${HOME}/.cargo}=/vendor"
74 export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix=${RUSTUP_HOME:-${HOME}/.rustup}=/rustup"
75 # Remove -flto flags due to sqlite3 GCC compatibility issues with rust-lld
76 CFLAGS="${CFLAGS//-flto=auto/}"
77 CFLAGS="${CFLAGS//-flto/}"
78 CXXFLAGS="${CXXFLAGS//-flto=auto/}"
79 CXXFLAGS="${CXXFLAGS//-flto/}"
80 export CFLAGS CXXFLAGS
81 export CARGO_PROFILE_RELEASE_LTO=false
82 cargo build --frozen --release --bin librefang --bin librefang-desktop
83
84 # Build Node.js whatsapp-gateway.
85 # baileys depends on libsignal from git. npm >= 12 defaults allow-git to
86 # "none" and refuses to fetch it; --allow-git=root is not enough because
87 # libsignal is transitive, not in the gateway's own package.json. The
88 # lockfile also resolves it over ssh, which has no credentials here, so
89 # rewrite ssh to https (HOME is confined to ${srcdir}/.home above).
90 local _gwdir="${srcdir}/${pkgbase}/packages/whatsapp-gateway"
91 cd "${_gwdir}"
92 # makepkg pins GIT_CONFIG_GLOBAL to /dev/null, so redirect it at a writable
93 # path before configuring the rewrite.
94 export GIT_CONFIG_GLOBAL="${srcdir}/.home/.gitconfig"
95 git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
96 npm install --ignore-scripts --omit=dev --legacy-peer-deps --allow-git=all
97 # Copy system node-addon-api for compiling sharp/better-sqlite3 if needed
98 cp -r /usr/lib/node_modules/node-addon-api "${_gwdir}/node_modules/node-addon-api"
99
100 # Compile better-sqlite3 native addon
101 cd "${_gwdir}/node_modules/better-sqlite3"
102 npx node-gyp rebuild
103
104}
105
106check() {
107 cd "${pkgbase}"
108 export RUSTUP_TOOLCHAIN=stable
109 cargo test --frozen --release -p librefang-types --lib 2>/dev/null || true
110}
111
112package_librefang-git() {
113 pkgdesc='terminal interface and daemon for the LibreFang Agent OS'
114 depends=('glibc' 'openssl' 'libgcc' 'python-librefang-sdk-git')
115 optdepends=(
116 'chromium: Browser Hand support'
117 'yt-dlp: Clip Hand support'
118 'ffmpeg: Clip Hand support'
119 )
120 provides=('librefang' 'openfang')
121 conflicts=('librefang' 'openfang' 'openfang-cli' 'librefang-cli' 'librefang-cli-git')
122 replaces=('librefang-cli-git')
123 backup=('etc/librefang/env')
124
125 cd "${pkgbase}"
126 install -Dm755 "target/release/librefang" "${pkgdir}/usr/bin/librefang"
127 install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
128 install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
129 install -Dm644 "${srcdir}/feature-local-inference.md" "${pkgdir}/usr/share/doc/${pkgname}/feature-local-inference.md"
130
131 # systemd service
132 install -Dm644 "${srcdir}/librefang.service" "${pkgdir}/usr/lib/systemd/system/librefang.service"
133
134 # sysusers and tmpfiles
135 install -Dm644 "${srcdir}/librefang.sysusers" "${pkgdir}/usr/lib/sysusers.d/librefang.conf"
136 install -Dm644 "${srcdir}/librefang.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/librefang.conf"
137
138 # default environment file (empty, user-editable)
139 install -Dm644 /dev/null "${pkgdir}/etc/librefang/env"
140}
141
142package_librefang-desktop-git() {
143 pkgdesc='Desktop application for the LibreFang Agent OS'
144 depends=('glibc' 'openssl' 'libgcc' 'webkit2gtk-4.1' 'gtk3' 'cairo' 'gdk-pixbuf2' 'glib2' 'libsoup3' 'hicolor-icon-theme' 'python-librefang-sdk-git')
145 optdepends=(
146 'librefang-git: CLI companion tool'
147 'chromium: Browser Hand support'
148 'yt-dlp: Clip Hand support'
149 'ffmpeg: Clip Hand support'
150 )
151 provides=('librefang-desktop' 'openfang-gui' 'librefang-gui' 'librefang-gui-git')
152 conflicts=('librefang-desktop' 'openfang-gui' 'librefang-gui' 'librefang-gui-git')
153 replaces=('librefang-gui-git')
154
155 cd "${pkgbase}"
156 install -Dm755 "target/release/librefang-desktop" "${pkgdir}/usr/bin/librefang-desktop"
157 install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
158 install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
159 install -Dm644 "${srcdir}/feature-local-inference.md" \
160 "${pkgdir}/usr/share/doc/${pkgname}/feature-local-inference.md"
161
162 # .desktop file
163 install -Dm644 "${srcdir}/librefang-desktop.desktop" \
164 "${pkgdir}/usr/share/applications/librefang-desktop.desktop"
165
166 # icons
167 install -Dm644 "crates/librefang-desktop/icons/128x128.png" \
168 "${pkgdir}/usr/share/icons/hicolor/128x128/apps/librefang-desktop.png"
169 install -Dm644 "crates/librefang-desktop/icons/32x32.png" \
170 "${pkgdir}/usr/share/icons/hicolor/32x32/apps/librefang-desktop.png"
171 install -Dm644 "crates/librefang-desktop/icons/icon.png" \
172 "${pkgdir}/usr/share/icons/hicolor/512x512/apps/librefang-desktop.png"
173}
174
175package_librefang-whatsapp-gateway-git() {
176 pkgdesc='librefang WhatsApp gateway — QR login and bidirectional messaging'
177 depends=('nodejs' 'libvips' 'glibc' 'glib2' 'bash' 'libstdc++' 'libgcc')
178 optdepends=('librefang-git: connect gateway to the local librefang agent')
179 provides=('librefang-whatsapp-gateway' 'openfang-whatsapp-gateway')
180 conflicts=('librefang-whatsapp-gateway' 'openfang-whatsapp-gateway' 'librefang-whatsapp-gateway-git')
181
182 local _gatewaydir="${pkgdir}/usr/lib/librefang-whatsapp-gateway"
183
184 cd "${srcdir}/${pkgbase}/packages/whatsapp-gateway"
185
186 # Install package sources and vendored node_modules
187 install -dm755 "${_gatewaydir}"
188 cp -r index.js package.json node_modules lib "${_gatewaydir}/"
189
190 # Remove intermediate build folders/artifacts from better-sqlite3 and sharp to keep packages small
191 local _sqlitebuild="${_gatewaydir}/node_modules/better-sqlite3/build"
192 local _sqlitebin
193 _sqlitebin=$(find "${_sqlitebuild}/Release" -maxdepth 1 -name 'better_sqlite3.node' 2>/dev/null | head -1)
194 if [[ -n "${_sqlitebin}" ]]; then
195 cp "${_sqlitebin}" "${srcdir}/_better_sqlite3_tmp.node"
196 rm -rf "${_sqlitebuild}"
197 install -dm755 "${_sqlitebuild}/Release"
198 mv "${srcdir}/_better_sqlite3_tmp.node" "${_sqlitebuild}/Release/better_sqlite3.node"
199 fi
200
201 # Wrapper script
202 install -dm755 "${pkgdir}/usr/bin"
203 cat >"${pkgdir}/usr/bin/librefang-whatsapp-gateway" <<'EOF'
204#!/bin/sh
205exec node /usr/lib/librefang-whatsapp-gateway/index.js "$@"
206EOF
207 chmod 755 "${pkgdir}/usr/bin/librefang-whatsapp-gateway"
208
209 # systemd service
210 install -Dm644 "${srcdir}/librefang-whatsapp-gateway.service" \
211 "${pkgdir}/usr/lib/systemd/system/librefang-whatsapp-gateway.service"
212
213 install -Dm644 "${srcdir}/${pkgbase}/LICENSE" \
214 "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
215}
216

Changes since previous scan

--- PKGBUILD @ 2026-07-29 00:25
+++ PKGBUILD @ 2026-08-03 00:08
@@ -2,7 +2,7 @@
# Contributor: SteamedFish <steamedfish@hotmail.com>
pkgbase=librefang-git
pkgname=("librefang-git" "librefang-desktop-git" "librefang-whatsapp-gateway-git")
-pkgver=2026.6.29.r9.g83ee2627b
+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) '
arch=('x86_64' 'aarch64')
@@ -27,9 +27,9 @@
'cf026330b3d4c3c708bd079b15401731e1afef4f3e780c4ad286ad0d961a6d5c'
'a640db0197d001c5ae9348d57cda8092e2c8170fa27ced98d5546557fadb6d17'
'1ddb18ffdd4c4131bf9a35debfb21a61aeda8ca1be90829e0e1b10d7bf19b975'
- '0e4ccc9ec9d34b0c765f1fac33a8e22949ef19fc05148fe18c1dad78718dcbc4'
- '8d8e5722dcdbe7821e9375018076cebfcc5d30a7b8e646623714190dd0d1383e'
- '6226943a917e31ea998fdf9626a8d67aff17541491b62c58ce12c4f679c6d187'
+ 'aa2df1c379d02a52bf4072f3de2f6c3be0512fc3efcbb141320ba19d8fc3ca46'
+ 'c4fccf730140e3cbe1c694b6f4f3b94c47b998ba76262ce50c63f578822d5918'
+ '673dc14c22aa89457a2e1684bf075b7e0ae5ecc520830529b6edcfac1e68246b'
'6fa3cb22d68b37cdc9605cc5c02c9095ea4ce47466e415c01dc54c7f7e81bb6a')
pkgver() {
@@ -81,10 +81,19 @@
export CARGO_PROFILE_RELEASE_LTO=false
cargo build --frozen --release --bin librefang --bin librefang-desktop
- # Build Node.js whatsapp-gateway
+ # 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}"
- npm install --ignore-scripts --omit=dev --legacy-peer-deps
+ # 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"

Scan history

Scanned at (UTC)SeverityRules
2026-08-03 00:08:14 LOW 2
2026-08-02 00:16:08 LOW 2
2026-08-01 00:11:18 LOW 2
2026-07-31 00:14:10 LOW 2
2026-07-30 00:17:23 LOW 2
2026-07-29 13:11:48 MEDIUM 1
2026-07-29 00:25:53 LOW 2
2026-07-28 00:07:28 LOW 2
2026-07-27 00:24:32 LOW 2
2026-07-26 00:07:32 LOW 2
2026-07-25 00:13:44 LOW 2
2026-07-24 00:02:28 LOW 2
2026-07-23 00:14:47 LOW 2
2026-07-22 00:29:32 LOW 2
2026-07-21 00:24:15 LOW 2
2026-07-20 00:19:49 LOW 2
2026-07-19 00:17:08 LOW 2
2026-07-18 00:14:48 LOW 2
2026-07-17 00:06:16 LOW 2
2026-07-16 00:05:41 LOW 2

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion