teach/test/security-config.test.js
Ramon f9b2be8187
Some checks failed
dev - build & deploy naar test / build-and-deploy (push) Failing after 4s
v0.3.03-beta: versterk publieke beveiliging
2026-07-14 12:42:16 +02:00

21 lines
899 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:-127\.0\.0\.1/);
});
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"/);
});