All Good Validation
DevSecOps Enterprise Pipeline / security-gate-and-deploy (pull_request) Successful in 1m30s

This commit is contained in:
pm
2026-06-16 01:24:40 +01:00
parent 0d221313e9
commit a6a7f3b0b5
2 changed files with 0 additions and 33 deletions
-24
View File
@@ -22,31 +22,7 @@ app.get('/about', (req, res) => res.sendFile(path.join(__dirname, '../frontend/a
app.get('/careers', (req, res) => res.sendFile(path.join(__dirname, '../frontend/careers.html'))); app.get('/careers', (req, res) => res.sendFile(path.join(__dirname, '../frontend/careers.html')));
app.get('/contact', (req, res) => res.sendFile(path.join(__dirname, '../frontend/contact.html'))); app.get('/contact', (req, res) => res.sendFile(path.join(__dirname, '../frontend/contact.html')));
// ==========================================
// VULNERÁVEL (OWASP ZAP)
// ==========================================
/*app.get('/api/search', (req, res) => {
const termo = req.query.q || '';
// A vulnerabilidade crítica: devolver o input diretamente no HTML
res.send(`
<html>
<head><title>Resultados</title></head>
<body>
<h1>Resultados para: ${termo}</h1>
<a href="/">Voltar</a>
</body>
</html>
`);
});*/
app.get('/api/calculate', (req, res) => {
const mathExpression = req.query.expr || '2+2';
// VULNERABILIDADE CRÍTICA: O eval() executa qualquer código cego que o utilizador envie
const result = eval(mathExpression);
res.json({ result: result });
});
// Configuração do transporte de E-mail (Mocks de teste vs Produção) // Configuração do transporte de E-mail (Mocks de teste vs Produção)
let transporter; let transporter;
-9
View File
@@ -36,15 +36,6 @@ describe('Enterprise Application Flow & API Validation', () => {
expect(response.status).toBe(404); expect(response.status).toBe(404);
}); });
// OWASP ZAP (/api/search)
/* it('Should reflect the search query in the HTML response (/api/search) - Vulnerable to XSS', async () => {
const maliciousPayload = '<script>alert("ZAP")</script>';
const response = await request(app).get(`/api/search?q=${maliciousPayload}`);
expect(response.status).toBe(200);
// Verifica se o payload é refletido exatamente como entrou (confirmando a vulnerabilidade)
expect(response.text).toContain(`Resultados para: ${maliciousPayload}`);
});*/
}); });
// ========================================== // ==========================================