Files
computer-playbook/roles/web-app-openwebui/files/playwright/test-csp.js
kevinveenbirkenbachandClaude Opus 4.8 da1d846310 fix(openwebui): source CANONICAL_DOMAIN from onion-aware domain lookup
The applications lookup returns the raw domains map that never receives
onion injection, so on an onion node CANONICAL_DOMAIN stayed clearnet
while the app itself rode onion (SOCKS proxy set). isOnionTarget() then
returned false: onion skips never fired and timeout scaling stayed at
clearnet levels. lookup('domain') resolves through the injected map and
is byte-identical on clearnet (single-entry canonical).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-14 19:35:00 +02:00

35 lines
1.1 KiB
JavaScript

const { test, expect } = require("@playwright/test");
const {
assertCspMetaParity,
assertCspResponseHeader,
expectNoCspViolations,
gotoOnion,
} = require("./personas");
exports.register = function (shared) {
test("openwebui enforces Content-Security-Policy and exposes canonical domain from domain lookup", async ({
page,
}) => {
const diagnostics = shared.attachDiagnostics(page);
const response = await gotoOnion(page, `${shared.env.openwebuiBaseUrl}/`);
expect(response, "Expected openwebui landing response").toBeTruthy();
expect(
response.status(),
"Expected openwebui landing response to be successful"
).toBeLessThan(400);
const directives = assertCspResponseHeader(response, "openwebui landing");
await assertCspMetaParity(page, directives, "openwebui landing");
const documentUrl = response.url();
expect(
documentUrl.includes(shared.env.canonicalDomain),
`Expected canonical domain "${shared.env.canonicalDomain}" to back the openwebui URL`
).toBe(true);
await expectNoCspViolations(page, diagnostics, "openwebui landing");
});
};