Skip to content

security: bump axios to 1.18.1 and harden Tauri spawn_api_process - #15336

Merged
remibettan merged 5 commits into
realsenseai:developmentfrom
remibettan:security-axios-tauri-fix
Jul 5, 2026
Merged

remibettan merged 5 commits into
realsenseai:developmentfrom
remibettan:security-axios-tauri-fix

Conversation

@remibettan

Copy link
Copy Markdown
Contributor

Overview

Alternative to #15321. Same intent — bump axios in the react-viewer and tighten the Tauri spawn_api_process guardrails — with corrected version pin, accurate fix notes, and cleanup of a tautological check and a misleading comment.

Changes

wrappers/rest-api/tools/react-viewer/package.json — bump axios 1.16.0 → 1.18.1 (npm latest).

Fixes picked up on the way:

  • 1.17.0 — own-property guards on socketPath / params / paramsSerializer reads (prototype-pollution → SSRF hardening).
  • 1.18.0 — strip caller-specified sensitive headers on cross-origin redirects (prevents API-key leak); reject malformed http(s): URLs missing //.
  • 1.18.1 — make AxiosError#cause non-enumerable to avoid circular JSON failures; guard socket.setKeepAlive for proxy-agent streams.

Note on #15321: the two CVEs cited there (CVE-2026-44494, CVE-2026-44492) were both already fixed in 1.16.0, so they don't apply to what we were pinned at. The real reasons to bump are the fixes above.

wrappers/rest-api/tools/react-viewer/src-tauri/src/main.rs — add path/port sanity checks at the top of spawn_api_process:

  • reject non-existent path
  • reject relative path
  • reject privileged port (< 1024)

Framing note (vs. #15321): Command::new(path) in Rust does not invoke a shell — it execves the binary directly with no argv parsing — so this is defense-in-depth against misconfiguration, not shell-injection mitigation. The comment is worded accordingly.

Also dropped the port > 65535 branch from that check: port: u16 already caps at 65535, so the comparison is unreachable (and rustc may warn unused_comparisons).

Type

  • Security: dependency update + input validation hardening

Bump `axios` from 1.16.0 to 1.18.1 (npm latest) in the react-viewer,
picking up upstream security-relevant fixes released since 1.16.0:

- 1.17.0: own-property guards on socketPath, params, and paramsSerializer
  reads (prototype-pollution -> SSRF hardening).
- 1.18.0: strip caller-specified sensitive headers on cross-origin redirects
  (prevents API-key leak); reject malformed http(s) URLs missing "//".
- 1.18.1: make AxiosError#cause non-enumerable to avoid circular JSON
  failures; guard socket.setKeepAlive for proxy-agent streams.

Also add path and port sanity checks at the top of spawn_api_process in
src-tauri/src/main.rs so a missing, relative, or privileged-port
misconfiguration fails fast with a clear error instead of surfacing as a
downstream Command::spawn failure. Command::new(path) execs the binary
directly with no shell, so this is defense-in-depth against
misconfiguration, not shell-injection mitigation.

@sysrsbuild-gh-agentic sysrsbuild-gh-agentic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated review by rs-agentic bot

Reviewed PR #15336 against the copilot-instructions guidelines. Found 2 bugs and 2 enhancement notes inline. Additionally:

  • Missing package-lock.json: see inline comment on package.json.
  • No tests for the new spawn_api_process validation logic. The function is gated by #[cfg(not(debug_assertions))] which makes unit-testing harder, but an integration/smoke test or a dedicated #[cfg(test)] helper that calls the validation path with bad inputs and asserts the expected Err variants would be a clear improvement and is consistent with the project's testing culture.

See inline comments for details.

Replace separate exists() + is_absolute() checks with a single
canonicalize() call. This resolves the regression where the relative
PathBuf fallbacks returned by find_api_executable (e.g.
"realsense_api/...", "../build/tauri-resources/...") would be rejected
by the is_absolute() guard, breaking the dev/release fallback path.

Also expand the privileged-port error to explain the accepted range.
Re-run of `npm install` in wrappers/rest-api/tools/react-viewer/ to
keep package-lock.json in sync with the axios bump in the previous
commit. Only the axios entry changes (version, resolved URL, integrity).
@Nir-Az
Nir-Az self-requested a review July 2, 2026 12:41
@remibettan
remibettan merged commit 1a52723 into realsenseai:development Jul 5, 2026
29 checks passed
@remibettan
remibettan deleted the security-axios-tauri-fix branch July 7, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants