Skip to content

fix: address critical security vulnerabilities - #4

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782311835-security-fixes
Open

fix: address critical security vulnerabilities#4
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782311835-security-fixes

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Security audit and fixes for the proxy server. Six issues addressed:

CRITICAL — Information leakage via error responses
getReturnError(Throwable) was serializing full Java stack traces into JSON responses sent to clients, exposing internal class paths, library versions, and server internals. The WebSocket onError handler in NewBingGoGoClientWebSocket similarly embedded ex.toString() in client-facing messages. Both now log server-side only and return generic error messages to clients.

CRITICAL — SSRF via open proxy target
goUrl() accepted any URL constructed from the request path. Added a host allowlist (ALLOWED_PROXY_HOSTS = {"www.bing.com", "sydney.bing.com"}) validated before openConnection().

HIGH — No authentication
Added optional token-based auth gated by AUTH_TOKEN env var. When set, requests must include the token as ?auth_token=<val> or X-Auth-Token header. When unset, behavior is unchanged (open access).

HIGH — No rate limiting
Added per-IP sliding-window rate limiter (60 req/min) using ConcurrentHashMap<String, RateLimitEntry> with periodic cleanup. Applied to both HTTP and WebSocket endpoints.

MEDIUM — Dockerfile runs as root, leaks source
Rewrote as multi-stage build: gradle:8.0.2-jdk17 builder → eclipse-temurin:17-jre runtime with dedicated appuser. Added .dockerignore excluding .git, build artifacts, IDE configs.

MEDIUM — Insecure transitive dependency
Replaced slf4j-log4j12 (which pulls in log4j 1.x with known CVEs) with slf4j-simple.

Link to Devin session: https://app.devin.ai/sessions/d9c9a553648a4ff4b5be64a817549b82
Requested by: @oneky

- Prevent stack trace and exception detail leakage to clients
- Add SSRF protection via URL host allowlist (www.bing.com, sydney.bing.com)
- Add optional token-based authentication via AUTH_TOKEN env var
- Add per-IP rate limiting (60 req/min)
- Harden Dockerfile: multi-stage build, non-root user, .dockerignore
- Replace slf4j-log4j12 with slf4j-simple to avoid log4j 1.x CVEs

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@oneky oneky self-assigned this Jun 24, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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