Skip to content

Fix critical security vulnerabilities (IDOR, SSRF, XSS) - #62

Merged
mojoro merged 5 commits into
mainfrom
fix/critical-security-fixes
Mar 25, 2026
Merged

Fix critical security vulnerabilities (IDOR, SSRF, XSS)#62
mojoro merged 5 commits into
mainfrom
fix/critical-security-fixes

Conversation

@mojoro

@mojoro mojoro commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes 4 critical security vulnerabilities identified during a full codebase audit:

  • IDOR in 5 server actionstoggleSaveJob, ignoreJob, unignoreJob, updateJobNotes, and createApplication verified profile ownership but mutated jobs using only where: { id: jobId }, allowing any authenticated user to modify another user's jobs. Fixed by scoping all mutations to profileId.
  • SSRF in /api/jobs/extract — Server fetched any user-supplied URL with no validation beyond ^https?://. Added isPrivateHostname() to block private/reserved IP ranges (10.x, 172.16-31.x, 192.168.x, 169.254.x, 127.x), localhost, .local, and .internal.
  • XSS via unsanitized markdownJobDescription rendered scraped job descriptions (attacker-controlled content) without sanitization. Added rehype-sanitize to the Markdown renderer.
  • API key exposure riskopenrouter.ts contained OPENROUTER_API_KEY but lacked a server-only guard. Added import "server-only" to fail the build if accidentally imported by a client component.

Also includes docs/audit-findings.md — a comprehensive 60-finding audit document covering security, performance, data syncing, redundancies, and inconsistencies, with exact file locations and fix instructions for future sessions.

Test plan

  • Verify dashboard feed actions (save, ignore, unignore, notes) still work for the owning user
  • Verify pipeline application creation works
  • Verify job import via URL still works for public URLs
  • Verify job import rejects http://localhost, http://169.254.169.254, http://10.0.0.1
  • Verify job description markdown renders correctly (no broken formatting from sanitization)
  • Verify pnpm tsc --noEmit passes
  • Verify build succeeds on Vercel preview

@vercel

vercel Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shortlist Ready Ready Preview, Comment Mar 25, 2026 1:37pm

@mojoro
mojoro merged commit b77ef52 into main Mar 25, 2026
6 checks passed
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