Skip to content

build: update all dependencies and fix device id command injection - #260

Merged
3alpha merged 8 commits into
masterfrom
chore/update-dependencies
Nov 25, 2026
Merged

3alpha merged 8 commits into
masterfrom
chore/update-dependencies

Conversation

@3alpha

@3alpha 3alpha commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What type of PR is this?

Bug fix
Other (dependency and toolchain upgrade)

What does this PR do? Why is it needed?

Brings every dependency up to date, clears all open Dependabot alerts, and fixes the bugs found along the way. No new features. Each commit stands on its own:

  1. fix(openvpn): run commands without a shell and validate device ids. Device ids received over the unauthenticated RPC API (reachable from dncore_network) were interpolated into shell commands and PKI file paths, allowing command execution as root in the privileged VPN container. Commands now run through execFile, and ids containing path separators, whitespace or a leading - are rejected. This commit builds and passes tests on the old toolchain, so it can be cherry-picked on its own.

  2. fix: device removal, internal IP env and credentials responses.

    • vpncli rm / removeDevice threw ENOENT in the current production image because easy-rsa already moves revoked files, so the device's share tokens were never deleted.
    • The internal IP was read from INTERNAL_IP instead of _DAPPNODE_GLOBAL_INTERNAL_IP, so the global env was never used.
    • The credentials server destroyed the socket after writing an error response.
    • The client-connect guard used substring matching on the IP (127.0.0.10 passed).
    • The client-connect hook logged the url module instead of the URL.
  3. build: backend and image to Node 24 and Alpine 3.24.

    • Backend: TypeScript 3.9 → 6.0, express 5, yargs 18, ESLint 10 (flat config), mocha 12 (via tsx), chai 6, sinon 22.
    • got, lodash, ip (unpatched advisory), dargs and chalk are replaced with Node built-ins.
    • Image: Alpine 3.12 → 3.24, which brings Node 24, OpenVPN 2.4 → 2.7.9 and easy-rsa → 3.2.5. ovpn_initpki uses the current --genkey secret syntax. modclean and the native build toolchain were dropped (all deps are pure JS).
    • Removed the unused coveralls/nyc coverage script and the stray src/index.ts debug server.
  4. style: Prettier 3 formatting of files that had no other changes.

  5. build(ui): create-react-app → Vite. CRA is deprecated and pulled in most of the advisories.

    • React 16 → 19, Bootstrap 4 → 5. vite-plugin-singlefile replaces injectToHtml.js and still produces one self-contained HTML file.
    • Bootstrap 4 link and gutter styles are kept, so old vs new screenshots are pixel-identical.
    • Removed dead code: platform instruction pages, icons, a MemoryRouter redirect that rendered nothing, and a service worker the credentials server can never serve. Also removed the unused gh-pages / source-map-explorer scripts.
  6. ci: actions v7, Node 24, plus a UI lint/test/build job. The build workflow now sets Node explicitly because @dappnode/dappnodesdk requires Node 22.13 or later.

  7. fix(openvpn): only act on listed devices and reject glob names. The PKI keeps the CA and server keys next to the device keys, so reading or resetting credentials for a non-device id reached them. getClient and resetDevice now require the id to be in the device list, and names containing * ? [ ] , are rejected.

  8. build(ui): target es2017. The previous build was ES5 and Vite defaults to recent browsers only; share links are opened on arbitrary devices.

yarn audit reports 0 vulnerabilities in both src and ui_openvpn. mocha's glob / minimatch are pinned via resolutions to clear its dev-only advisories.

How can be tested?

What was run locally:

  • src: yarn lint && yarn build && yarn test (48 tests, including new ones for id validation and shell-free execution). ui_openvpn: yarn lint && yarn test && yarn build (4 tests, including a decrypt round trip against the backend's encryption scheme).
  • In-place upgrade. Ran the current master image on fresh volumes, added and revoked devices, and created a share link. Then started this image on the same volumes. Everything worked on the old PKI: ls, print, add, rm, reset, re-adding a previously revoked name, and the admin link persisted by the old image.
  • Real OpenVPN 2.7 client. It connected and passed traffic, the client-connect hook marked the link as used, and a revoked certificate was rejected via the CRL.
  • Fresh install. easy-rsa 3.2.5 initialises the PKI, and certificate lifetime stays at 825 days as before.
  • Browser. Headless Chromium opened a real share link: the page decrypted the file and the downloaded .ovpn matched vpncli print byte for byte.
  • Injection attempts. Malicious ids sent over /rpc are rejected, and ids with shell metacharacters that pass validation are handled literally.

To reproduce the upgrade test: build the image, start it with the volumes of an existing install, then check vpncli ls, connect an existing client, and add, reset and remove a device.

Other notes for review

Device ids received over the unauthenticated RPC API were interpolated
into shell commands and PKI file paths, allowing root command execution
from any container on dncore_network. Commands now run through execFile
and ids with path separators, whitespace or a leading dash are rejected.
Removing a device threw ENOENT because easy-rsa already moves revoked
files, so its share tokens were never deleted. The internal IP is now
read from _DAPPNODE_GLOBAL_INTERNAL_IP, the credentials server no longer
destroys the socket after an error response, the client-connect guard
matches loopback exactly and its hook logs the right URL.
Updates every backend dependency to its latest release (TypeScript 6.0,
express 5, yargs 18, ESLint 10, mocha 12, chai 6, sinon 22) and replaces
got, lodash, ip, dargs and chalk with Node built-ins. The image moves to
Alpine 3.24 (Node 24, OpenVPN 2.7, easy-rsa 3.2).
Create React App is deprecated and pulled in most of the open advisories.
The UI now builds with Vite into a single self-contained HTML file and
runs on React 19 and Bootstrap 5, with Bootstrap 4 link and gutter styles
kept so it renders identically. Unused platform pages, icons, router
redirect and service worker are removed.
The dappnodesdk now requires Node 22.13 or later, so the build workflow
sets up Node explicitly. The UI is linted, tested and built in CI.
@3alpha
3alpha requested a review from a team as a code owner November 25, 2026 18:24
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Dappnode bot has built and pinned the built packages to an IPFS node, for commit: 1c957a8

This is a development version and should only be installed for testing purposes.

  1. Package vpn.dnp.dappnode.eth

Install link

Hash: /ipfs/QmeepjdmHeuqBowrHjib6YG4uVbUe8fb57eRWPaYXrK2na

(by dappnodebot/build-action)

The PKI keeps the CA and server keys next to the device keys, so asking
for the credentials of "ca" or the server name returned their private
keys, and resetting the server name replaced its certificate. Reading
and resetting now require a listed device, and names with glob
characters or commas are rejected.
Vite defaults to browsers from the last couple of years, while the
previous build was ES5. Share links are opened on arbitrary devices.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant