Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(profile-ui): r1-m2 assert handoff response security headers
Josué9d8c722e98e7
diff --git a/profile-ui/test/desktopAppRoute.test.ts b/profile-ui/test/desktopAppRoute.test.tsindex 2fa81461c..0653ba13e 100644--- a/profile-ui/test/desktopAppRoute.test.ts+++ b/profile-ui/test/desktopAppRoute.test.ts@@ -9,11 +9,30 @@ const routeContext = {}),}+function extractCspScriptNonce(policy: string | null): string {+ assert.ok(policy, 'expected Content-Security-Policy header')+ const match = policy.match(/script-src 'nonce-([^']+)'/)+ assert.ok(match?.[1], 'expected script-src nonce in Content-Security-Policy header')+ return match[1]+}++function extractHtmlScriptNonce(body: string): string {+ const match = body.match(/<script nonce="([^"]+)">/)+ assert.ok(match?.[1], 'expected script nonce in desktop handoff HTML')+ return match[1]+}+test('desktop app handoff leaves an omitted path to the recipe default', async () => {const response = await GET(new Request('https://profile.example/open/apps/ns/app'), routeContext)const body = await response.text()+ const cspNonce = extractCspScriptNonce(response.headers.get('content-security-policy'))+ const htmlNonce = extractHtmlScriptNonce(body)assert.equal(response.status, 200)+ assert.equal(response.headers.get('cache-control'), 'no-store')+ assert.equal(response.headers.get('referrer-policy'), 'no-referrer')+ assert.equal(response.headers.get('x-content-type-options'), 'nosniff')+ assert.equal(htmlNonce, cspNonce)assert.match(body, /evenfire:\/\/app\/sandbox-recipes\/agentic-task-board/)assert.doesNotMatch(body, /[?&]path=/)assert.match(body, /Open app in Evenfire/)@@ -26,6 +45,7 @@ test('desktop app handoff rejects dot-segment routes with hardened error headersconst response = await GET(request, routeContext)assert.equal(response.status, 400)+ assert.equal(response.headers.get('cache-control'), 'no-store')assert.equal(response.headers.get('referrer-policy'), 'no-referrer')assert.equal(response.headers.get('x-content-type-options'), 'nosniff')})