owasp zap config v10
DevSecOps Enterprise Pipeline / security-gate-and-deploy (pull_request) Successful in 43s

This commit is contained in:
pm
2026-06-13 10:29:03 +01:00
parent 5805011296
commit 7c7a2efd61
+8 -3
View File
@@ -52,10 +52,16 @@ 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 () => {
it('Should process request, return 200 OK, and invoke SMTP transporter with valid data', async () => {
const validPayload = {
firstName: 'Jane',
lastName: 'Doe',
@@ -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);
});
});