teach/test/security-config.test.js
Ramon 6097d7c9f1
All checks were successful
dev - build & deploy naar test / build-and-deploy (push) Successful in 17s
v0.3.06-beta: herstel bereikbaarheid via Pangolin
2026-07-14 13:26:15 +02:00

21 lines
897 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
test('productieconfig gebruikt secure cookies en begrensde proxy trust', async () => {
const compose = await readFile('deploy/compose.deploy.yaml', 'utf8');
assert.match(compose, /COOKIE_SECURE: "true"/);
assert.match(compose, /TRUST_PROXY_HOPS:/);
assert.match(compose, /WEB_BIND_IP:-0\.0\.0\.0/);
});
test('nginx behoudt het publieke forwarded protocol', async () => {
const nginx = await readFile('deploy/nginx.conf', 'utf8');
assert.match(nginx, /http_x_forwarded_proto/);
assert.match(nginx, /X-Forwarded-Proto \$teach_forwarded_proto/);
});
test('client bewaart geen bearer-token meer', async () => {
const core = await readFile('public/js/core.js', 'utf8');
assert.doesNotMatch(core, /headers\.Authorization|localStorage\.setItem\("teach\.token"/);
});