Skip to content

Commit f3f6a8b

Browse files
authored
Add CSP protection on uploaded files (#1304)
Add CSP
1 parent 04707e4 commit f3f6a8b

File tree

2 files changed

+4
-0
lines changed
  • src/routes
    • conversation/[id]/output/[sha256]
    • settings/(nav)/assistants/[assistantId]/avatar.jpg

2 files changed

+4
-0
lines changed

src/routes/conversation/[id]/output/[sha256]/+server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export const GET: RequestHandler = async ({ locals, params }) => {
4444
return new Response(Buffer.from(value, "base64"), {
4545
headers: {
4646
"Content-Type": mime ?? "application/octet-stream",
47+
"Content-Security-Policy":
48+
"default-src 'none'; script-src 'none'; style-src 'none'; sandbox;",
4749
},
4850
});
4951
};

src/routes/settings/(nav)/assistants/[assistantId]/avatar.jpg/+server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export const GET: RequestHandler = async ({ params }) => {
3737
return new Response(content, {
3838
headers: {
3939
"Content-Type": "image/jpeg",
40+
"Content-Security-Policy":
41+
"default-src 'none'; script-src 'none'; style-src 'none'; sandbox;",
4042
},
4143
});
4244
};

0 commit comments

Comments
 (0)