Files
evig/scripts/ci/security-dependency-smoke.mjs
Cato 9a7210f196 chore(email): remove the dead Brevo SMTP fallback (#694)
Production's SMTP credential has answered "Login denied" since at least
2026-09-05, so every send that "fell back" to it delivered nothing while the
code reported a provider. Mail now goes through Resend (@bitbaum/mail-kit),
or Listmonk when enabled with Resend behind it; a Resend failure is reported
as { success: false } instead of handed to a relay that cannot log in.

Removes transporter.ts, the Brevo probe script, EMAIL_* env, the nodemailer
dependency and its override, and rewrites the email docs to match.
2026-11-10 10:14:57 +01:00

70 lines
2.6 KiB
JavaScript

import { createServer } from 'node:http';
import { test } from 'node:test';
import assert from 'node:assert/strict';
import puppeteer from 'puppeteer';
// Puppeteer's upstream update replaces chromium-bidi's vulnerable Zod 3 path.
// Drive BiDi itself, rather than proving only that the default CDP path starts.
test(
'updated Puppeteer and BiDi schemas can navigate and evaluate in Chromium',
{ timeout: 60_000 },
async () => {
const server = createServer((_request, response) =>
response.end('<h1>Compatibility fixture</h1>'),
);
await new Promise((done) => server.listen(0, '127.0.0.1', done));
let browser;
try {
browser = await puppeteer.launch({
protocol: 'webDriverBiDi',
headless: true,
...(process.env.BROWSER_EXECUTABLE
? { executablePath: process.env.BROWSER_EXECUTABLE }
: {}),
args: ['--no-sandbox'],
});
const page = await browser.newPage();
await page.goto(`http://127.0.0.1:${server.address().port}`);
assert.equal(
await page.evaluate(() => document.querySelector('h1').textContent),
'Compatibility fixture',
);
await page.close();
} finally {
await browser?.close();
await new Promise((done) => server.close(done));
}
},
);
test('the publishing renderer still produces accessible math with patched KaTeX', async () => {
const { renderMath } = await import('bip-kit/react');
for (const tex of ['x^2 + y^2 = z^2', String.raw`\frac{1}{2}`, String.raw`\sum_{n=1}^{10} n`]) {
const html = await renderMath(tex, true);
assert.ok(html, 'Installed math peer must render instead of falling back silently');
assert.match(html, /katex-mathml/);
assert.match(html, /<math/);
}
const unsafe = await renderMath(String.raw`\href{javascript:alert(1)}{click}`, false);
assert.ok(unsafe);
assert.doesNotMatch(unsafe, /href=["']javascript:/);
});
test('patched diagram sanitizer keeps formatting and removes executable markup', async () => {
const { createRequire } = await import('node:module');
const { JSDOM } = await import('jsdom');
const requireFromDiagram = createRequire(import.meta.resolve('mermaid'));
const createDOMPurify = requireFromDiagram('dompurify');
const dom = new JSDOM('');
try {
const sanitize = createDOMPurify(dom.window);
const html = sanitize.sanitize(
'<p><strong>Kept</strong><img src="x" onerror="alert(1)"></p><svg><a href="javascript:alert(1)">Unsafe link</a></svg>',
);
assert.match(html, /<strong>Kept<\/strong>/);
assert.doesNotMatch(html, /onerror|javascript:/);
} finally {
dom.window.close();
}
});