← Code-Übersicht

policy.test.js

Pfad: wetell-headless/policy.test.js

Ext: js

Größe: 495 Bytes

Geändert: 2026-07-16 17:10:12+02

'use strict';

const test = require('node:test');
const assert = require('node:assert/strict');
const { allowedUrl } = require('./policy');

test('allows exact Wetell https host', () => {
    assert.equal(allowedUrl('/invoice.pdf'), 'https://mein.wetell.de/invoice.pdf');
});

for (const value of ['http://mein.wetell.de/x', 'https://127.0.0.1/x', 'file:///etc/passwd', 'https://evil.example/x']) {
    test(`blocks ${value}`, () => assert.throws(() => allowedUrl(value), /url_not_allowed/));
}