Skip to content

Security: involvex/whatsapp-cli

Security.md

Security Policy

Supported Versions

Version Supported
1.0.x ✅ Yes

Reporting a Vulnerability

If you discover a security vulnerability, please do not open a public issue. Instead, send an email to the maintainer or use a private vulnerability disclosure channel.

How to Report

  1. Email: security@involvex.dev
  2. Private Advisory: Use GitHub's private vulnerability reporting feature

Please include:

  • Description of the vulnerability
  • Steps to reproduce
  • Potential impact
  • Suggested fix (if known)

Response Timeline

  • Initial Response: Within 48 hours
  • Detailed Assessment: Within 7 days
  • Fix Release: Within 14 days (for critical vulnerabilities)

Security Best Practices

API Keys and Credentials

This CLI may store API keys for AI providers. Follow these best practices:

  1. Never commit API keys to version control
  2. Use environment variables when possible
  3. Rotate keys regularly
  4. Use separate keys for development and production
# Example: Set API keys via environment
export OPENROUTER_API_KEY=your_key_here
export OPENAI_API_KEY=your_key_here
export GEMINI_API_KEY=your_key_here

Session Data

The WhatsApp session is stored locally in .wwebjs_auth_session/:

  • Contains: Authentication tokens for WhatsApp Web
  • Protection: Add to .gitignore
  • Cleanup: Delete directory when logging out

Protecting Session Data

# Add to .gitignore
.wwebjs_auth_session/
.whatsapp-cli-config.json
.env
*.local

Chrome/Puppeteer Security

This application uses Puppeteer to control Chrome:

  • Headless Mode: Chrome runs without visible UI
  • Sandbox Disabled: Required for some environments
  • Executable Path: Configured via environment variable

Recommended Chrome Configuration

const puppeteerOptions: LaunchOptions = {
	headless: true,
	args: [
		'--no-sandbox',
		'--disable-setuid-sandbox',
		'--disable-dev-shm-usage',
		'--disable-gpu',
		'--disable-web-security', // ⚠️ Required for WhatsApp Web
		'--disable-features=VizDisplayCompositor',
	],
}

WhatsApp Security Considerations

  • Rate Limiting: WhatsApp may block accounts that send messages too quickly
  • Account Safety: Use a dedicated test account for development
  • Message Content: Be careful with automated message content

Network Security

  • HTTPS Only: All AI provider APIs should use HTTPS
  • Proxy Support: Configure proxies if required by your environment
  • Firewall Rules: Ensure outbound connections to:
    • web.whatsapp.com (WhatsApp Web)
    • AI provider endpoints

Web UI Security

The optional web UI (--web / --no-tui) is served over plain HTTP on 127.0.0.1 by default. It is not intended to be exposed to the public internet.

Binding and network exposure

  • The web server binds to 127.0.0.1 by default (loopback only).
  • Binding to any non-loopback address prints a warning to stderr: anyone who can reach the port can read your WhatsApp messages.
  • Use --host 127.0.0.1 (default) unless you have a specific reason and understand the risk.

Pairing token

  • Every web UI URL contains a single-use pairing token: http://127.0.0.1:3178/?token=<token>.
  • The token is required on every /api/* request (via ?token= query param for SSE, x-auth-token header for mutations).
  • Treat the URL as a secret: anyone with the token can read your messages and send on your behalf.
  • The token is randomly generated per server run (24 bytes, base64url) and is not persisted across restarts.
  • apiKey values are redacted from config responses (hasApiKey boolean only) and are write-only via the API.

Request guards

  • Host/Origin validation: Non-GET requests are rejected unless the Origin header matches the server's own URL. GET requests are rejected unless the Host header is a loopback address or matches the bound host. This mitigates DNS rebinding and cross-origin request forgery.
  • Media path traversal: File downloads (/api/downloads) resolve the requested name inside the downloads directory only; traversal sequences (..) are rejected.
  • Request size limit: Upload bodies are capped (≈200 MB for media) to prevent abuse.

Vulnerability notes

  • Cross-site scripting (XSS): QR codes and messages are rendered server-side / as plain text. User-controlled message content is not inserted into HTML except via dangerouslySetInnerHTML for the server-generated QR SVG.
  • Session data: WhatsApp authentication tokens live in .wwebjs_auth_session/ — see Session Data above.

Vulnerability Types

Critical

  • Remote code execution
  • Authentication bypass
  • Session hijacking
  • Data exposure of sensitive messages

High

  • API key leakage
  • Unauthorized access to session data
  • Cross-site scripting (if web features added)

Medium

  • Denial of service
  • Information disclosure
  • Rate limiting bypass

Low

  • Minor configuration issues
  • UI inconsistencies

Security Auditing

Dependencies

# Check for vulnerable dependencies
bun audit
npm audit

# Update dependencies regularly
bun update

Code Review

  • All code changes should be reviewed
  • Use TypeScript for type safety
  • Enable ESLint with security rules
  • Run tests before deployment

Disclosure Policy

Coordinated Disclosure

  1. Reporter submits vulnerability
  2. Maintainer confirms and assesses severity
  3. Maintainer develops fix
  4. Fix is released
  5. Advisory is published (with credit)

Credits

Security researchers who report vulnerabilities will be credited in the release notes (if desired).

License

This security policy is part of the WhatsApp CLI project and follows the same MIT license.

Contact

For security-related questions not involving vulnerability disclosure, please open a GitHub Discussion with the security tag.

There aren't any published security advisories