owasp zap config v9 #15

Merged
pm merged 2 commits from teste-bloqueio into main 2026-06-13 09:30:21 +00:00
Showing only changes of commit 7c7a2efd61 - Show all commits
+7 -2
View File
@@ -52,7 +52,13 @@ describe('Enterprise Application Flow & API Validation', () => {
const response = await request(app).post('/api/contact').send(invalidPayload);
expect(response.status).toBe(400);
expect(response.body).toHaveProperty('error', 'Email and message are required.');
// ==========================================
// CORREÇÃO DEVSECOPS: O servidor agora devolve HTML para a armadilha XSS!
// Lemos o response.text (HTML) em vez do response.body (JSON)
// ==========================================
expect(response.text).toContain('Erro de Validação');
expect(response.text).toContain('John'); // Garante que o input foi refletido na página (a vulnerabilidade XSS)
});
it('Should process request, return 200 OK, and invoke SMTP transporter with valid data', async () => {
@@ -70,7 +76,6 @@ it('Should process request, return 200 OK, and invoke SMTP transporter with vali
expect(response.status).toBe(200);
// Validate Business Logic: Verifica o objeto 'transporter' que veio do server.js
// Como este objeto é o que injetámos no server, ele já é o mock!
expect(transporter.sendMail).toHaveBeenCalledTimes(1);
});
});