Gitleaks Validation #25
@@ -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;
|
||||||
|
|||||||
@@ -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}`);
|
|
||||||
});*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
|
|||||||
Reference in New Issue
Block a user