Skip to content

Commit

Permalink
Add CSP protection on uploaded files (#1304)
Browse files Browse the repository at this point in the history
Add CSP
  • Loading branch information
nsarrazin authored Jul 1, 2024
1 parent 04707e4 commit f3f6a8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/routes/conversation/[id]/output/[sha256]/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export const GET: RequestHandler = async ({ locals, params }) => {
return new Response(Buffer.from(value, "base64"), {
headers: {
"Content-Type": mime ?? "application/octet-stream",
"Content-Security-Policy":
"default-src 'none'; script-src 'none'; style-src 'none'; sandbox;",
},
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const GET: RequestHandler = async ({ params }) => {
return new Response(content, {
headers: {
"Content-Type": "image/jpeg",
"Content-Security-Policy":
"default-src 'none'; script-src 'none'; style-src 'none'; sandbox;",
},
});
};

0 comments on commit f3f6a8b

Please sign in to comment.