This commit is contained in:
2025-05-25 19:02:18 +00:00
parent 5b33623c2d
commit 4c9fd22a86
20 changed files with 1551 additions and 1451 deletions

View File

@ -18,29 +18,22 @@ tap.test('setup - start SMTP server with TLS', async () => {
});
tap.test('CSEC-01: TLS Verification - should reject invalid certificates by default', async () => {
let errorCaught = false;
// Create client with strict certificate checking (default)
const strictClient = createSmtpClient({
host: testServer.hostname,
port: testServer.port,
secure: true,
connectionTimeout: 5000,
tls: {
rejectUnauthorized: true // Default should be true
}
});
try {
// Create client with strict certificate checking (default)
const strictClient = createSmtpClient({
host: testServer.hostname,
port: testServer.port,
secure: true,
connectionTimeout: 5000,
tls: {
rejectUnauthorized: true // Default should be true
}
});
await strictClient.verify();
} catch (error: any) {
errorCaught = true;
expect(error).toBeInstanceOf(Error);
// Should fail due to self-signed certificate
console.log('✅ Self-signed certificate rejected:', error.message);
}
const result = await strictClient.verify();
expect(errorCaught).toBeTrue();
// Should fail due to self-signed certificate
expect(result).toBeFalse();
console.log('✅ Self-signed certificate rejected as expected');
});
tap.test('CSEC-01: TLS Verification - should accept valid certificates', async () => {