Compare commits
39 Commits
3bfccdeca6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4395cd8c8c | |||
| 1e22422604 | |||
| 1521ef231b | |||
| cb11ad05f9 | |||
| 560e5ea94a | |||
| 0815a45c93 | |||
| 211d03189a | |||
| 48c768ef00 | |||
| c897cd4858 | |||
| 5e09e812c3 | |||
| 0133159c0f | |||
| 9e582170dc | |||
| 09f3c5c97b | |||
| f8a53f0d2f | |||
| 9cf7b1b4d1 | |||
| f386e25432 | |||
| a213cc9482 | |||
| c63239e7ee | |||
| 35260c3717 | |||
| a6a7f3b0b5 | |||
| 0d221313e9 | |||
| 5929b935c1 | |||
| 414ebd29ad | |||
| 2ddbf37ca2 | |||
| e9e243ee42 | |||
| fd94417c8d | |||
| 6fc77e5569 | |||
| c7e505765a | |||
| 4fc7cb055f | |||
| fb337cfe01 | |||
| 021e844a4a | |||
| 1b301f879c | |||
| f354755871 | |||
| 3f46bbebf7 | |||
| 139ef63129 | |||
| 21123e6149 | |||
| 6e36250d69 | |||
| ad08cda20e | |||
| f7f382965c |
@@ -46,7 +46,6 @@ jobs:
|
|||||||
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
|
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
|
||||||
|
|
||||||
- name: 5. Dynamic Security Scan (OWASP ZAP)
|
- name: 5. Dynamic Security Scan (OWASP ZAP)
|
||||||
# REMOVIDO o "if: github.event_name == 'push'". Agora o ZAP corre SEMPRE (nos PRs e nos Merges)!
|
|
||||||
run: |
|
run: |
|
||||||
echo ">>> 1. Limpeza profunda do ambiente..."
|
echo ">>> 1. Limpeza profunda do ambiente..."
|
||||||
docker rm -f apex-sandbox zap-scanner || true
|
docker rm -f apex-sandbox zap-scanner || true
|
||||||
@@ -96,17 +95,32 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: 6. Production Deployment
|
- name: 6. Deploy em Produção (SSH)
|
||||||
# MANTIDO: O deploy para a Produção SÓ pode acontecer num push/merge direto para a main!
|
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
run: |
|
uses: appleboy/ssh-action@master
|
||||||
docker rm -f portal-corporativo || true
|
with:
|
||||||
docker run -d -p 3000:3000 --name portal-corporativo apex-solutions:latest
|
host: ${{ secrets.SSH_HOST }}
|
||||||
sleep 5
|
username: ${{ secrets.SSH_USER }}
|
||||||
docker cp qatests/report.html portal-corporativo:/usr/src/app/frontend/zap-report.html || true
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
script: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo ">>> 1. A navegar para a pasta do projeto no servidor..."
|
||||||
|
cd /storage/docker/website-secure
|
||||||
|
|
||||||
|
echo ">>> 2. A transferir o código aprovado (git pull)..."
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
|
echo ">>> 3. A compilar a imagem Docker de Produção..."
|
||||||
|
docker build -f backend/Dockerfile -t apex-solutions:prod .
|
||||||
|
|
||||||
|
echo ">>> 4. A substituir o contentor em execução..."
|
||||||
|
docker rm -f portal-corporativo || true
|
||||||
|
docker run -d -p 3000:3000 --name portal-corporativo --restart unless-stopped apex-solutions:prod
|
||||||
|
|
||||||
|
echo "✅ Deploy concluído com sucesso! A aplicação está no ar."
|
||||||
|
|
||||||
- name: 7. Archive ZAP Report
|
- name: 7. Archive ZAP Report
|
||||||
# ALTERADO: Usamos apenas always(). Queremos ver o relatório independentemente de ser PR ou Push.
|
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
+5
-18
@@ -13,31 +13,18 @@ app.use(cors());
|
|||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Serve a pasta frontend
|
// Serve a pasta frontend
|
||||||
app.use(express.static(path.join(__dirname, '../frontend'), { extensions: ['html'] }));
|
app.use(express.static(path.join(__dirname, '../frontend'), { extensions: ['html'] }));
|
||||||
|
|
||||||
// Rotas das 4 páginas estáticas
|
// Rotas das páginas estáticas (A rota '/' original foi comentada para não dar conflito com a do ZAP)
|
||||||
app.get('/', (req, res) => res.sendFile(path.join(__dirname, '../frontend/index.html')));
|
// app.get('/', (req, res) => res.sendFile(path.join(__dirname, '../frontend/index.html')));
|
||||||
app.get('/about', (req, res) => res.sendFile(path.join(__dirname, '../frontend/about.html')));
|
app.get('/about', (req, res) => res.sendFile(path.join(__dirname, '../frontend/about.html')));
|
||||||
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')));
|
||||||
|
|
||||||
// ==========================================
|
// O eval() FOI REMOVIDO DAQUI PARA O SONARQUBE NÃO BLOQUEAR!
|
||||||
// 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>
|
|
||||||
`);
|
|
||||||
});*/
|
|
||||||
|
|
||||||
// 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;
|
||||||
|
|||||||
+3
-3
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Home | Apex Solutions branch sec</title>
|
<title>Home | Apex Solutions</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<style>
|
<style>
|
||||||
html { scroll-behavior: smooth; } /* Animação suave ao clicar no link de serviços */
|
html { scroll-behavior: smooth; } /* Animação suave ao clicar no link de serviços */
|
||||||
@@ -33,10 +33,10 @@
|
|||||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-24 lg:py-32">
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-24 lg:py-32">
|
||||||
<h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl">
|
<h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl">
|
||||||
<span class="block">Innovative Solutions for</span>
|
<span class="block">Innovative Solutions for</span>
|
||||||
<span class="block text-blue-600">Modern Businesses</span>
|
<span class="block text-blue-600">Modern website-secure</span>
|
||||||
</h1>
|
</h1>
|
||||||
<p class="mt-6 max-w-2xl text-lg text-gray-500 leading-relaxed">
|
<p class="mt-6 max-w-2xl text-lg text-gray-500 leading-relaxed">
|
||||||
At Apex Solutions, we deliver high-quality business consulting, technology services, and strategic insights. We help organizations across the globe achieve their goals through operational excellence and digital transformation.
|
ISTEC - ERSI
|
||||||
</p>
|
</p>
|
||||||
<div class="mt-10 flex gap-4">
|
<div class="mt-10 flex gap-4">
|
||||||
<a href="#services" class="px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700">Explore Services</a>
|
<a href="#services" class="px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700">Explore Services</a>
|
||||||
|
|||||||
Generated
-37
@@ -11,7 +11,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"lodash": "4.17.15",
|
|
||||||
"nodemailer": "^8.0.11"
|
"nodemailer": "^8.0.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -1308,9 +1307,6 @@
|
|||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1325,9 +1321,6 @@
|
|||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1342,9 +1335,6 @@
|
|||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1359,9 +1349,6 @@
|
|||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1376,9 +1363,6 @@
|
|||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1393,9 +1377,6 @@
|
|||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1410,9 +1391,6 @@
|
|||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1427,9 +1405,6 @@
|
|||||||
"s390x"
|
"s390x"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1444,9 +1419,6 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1461,9 +1433,6 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -3900,12 +3869,6 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lodash": {
|
|
||||||
"version": "4.17.15",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/lru-cache": {
|
"node_modules/lru-cache": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"nodemailer": "^8.0.11"
|
"nodemailer": "^8.0.11"
|
||||||
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jest": "^30.4.2",
|
"jest": "^30.4.2",
|
||||||
|
|||||||
@@ -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