📄 SKILL.md

← Vault

name: documentos-vps-debug

description: Debug and recover DocCorretor (documentos.rochasalesseguros.com.br) when Docker container is corrupted or failing on VPS.

tags:

- vps

- docker

- tanstack-start

- documentacao


DocCorretor VPS Debug & Recovery

Context

DocCorretor (documentos.rochasalesseguros.com.br) deployed on VPS at 31.97.243.106.

Critical Security Issues in API Routes

upload-document.ts (SQL Injection)

The route at /var/www/documentos2/app/src/routes/api/public/upload-document.ts uses raw SQL string interpolation with user-controlled values (clientId, originalName, category). Must use Supabase JS client's .insert() or parameterized queries instead.

delete-document.ts (Path Traversal)

The route at /var/www/documentos2/app/src/routes/api/public/delete-document.ts uses storagePath directly from request body without sanitizing .. path sequences. Attacker with valid JWT can delete arbitrary files on server.

clients/$id.tsx (No Authorization Check)

Route fetches documents by client_id without verifying the client belongs to the authenticated user. Any user can access any client's documents via direct URL manipulation.