Skip to content

fix: WhatsApp auth - command injection, wrong endpoint, 422 handling#1

Merged
dandaka merged 3 commits intodandaka:mainfrom
greirson:fix/command-injection-whatsapp-auth
Mar 17, 2026
Merged

fix: WhatsApp auth - command injection, wrong endpoint, 422 handling#1
dandaka merged 3 commits intodandaka:mainfrom
greirson:fix/command-injection-whatsapp-auth

Conversation

@greirson
Copy link
Contributor

Summary

  • Eliminate command injection in QR code display: replace shell-interpolated exec() with Bun.spawn() using argv array and stdin Blob. QR data from WAHA HTTP response no longer passes through a shell.
  • Fix WAHA QR endpoint path: use /api/{session}/auth/qr?format=raw instead of non-existent /api/sessions/{session}/auth/qr.
  • Handle WAHA 422 status: treat 422 (session already started) the same as 409 so the auth flow continues instead of crashing.

Test plan

  • Verified QR code renders in terminal with live WAHA container
  • Confirmed main branch fails on both the 422 and 404 issues
  • Confirmed fix branch passes both scenarios
  • bun test passes (138 tests, 0 failures)

Replace shell-interpolated exec() with Bun.spawn() using argv array
and stdin Blob. QR data from the WAHA HTTP response no longer passes
through a shell, preventing injection via crafted QR values.
WAHA returns 422 (not just 409) when a session is already running.
Treat both as non-fatal so the auth flow continues to QR display.
Use /api/{session}/auth/qr?format=raw instead of the non-existent
/api/sessions/{session}/auth/qr path. Matches current WAHA API docs.
@dandaka dandaka merged commit d2a6e32 into dandaka:main Mar 17, 2026
@dandaka
Copy link
Owner

dandaka commented Mar 17, 2026

Thanks @greirson! Clean fixes all around — the command injection fix is especially important. Merging.

@dandaka
Copy link
Owner

dandaka commented Mar 17, 2026

by the way did you able to test WA integration? I have drafted the implementation, but has not connected yet :)

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.

2 participants