Skip to content

Commit 71cbcb2

Browse files
Add Content Security Policy (#24)
1 parent 6fa8820 commit 71cbcb2

File tree

4 files changed

+234
-2
lines changed

4 files changed

+234
-2
lines changed

package-lock.json

Lines changed: 218 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"typescript": "~5.6.3",
6161
"vfonts": "^0.0.3",
6262
"vite": "^5.4.10",
63+
"vite-plugin-csp-guard": "^1.1.3",
6364
"vitest": "^2.1.4",
6465
"vue-tsc": "^2.1.10"
6566
},

vite.config.ts renamed to vite.config.mts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
import { fileURLToPath, URL } from "node:url";
22
import vue from "@vitejs/plugin-vue";
33
import { defineConfig } from "vite";
4+
import csp from "vite-plugin-csp-guard";
45

56
// https://vitejs.dev/config/
67
export default defineConfig({
7-
plugins: [vue()],
8+
plugins: [
9+
vue(),
10+
csp({
11+
dev: {
12+
run: true,
13+
outlierSupport: ["vue"],
14+
},
15+
policy: {
16+
"style-src-elem": ["'unsafe-inline'"],
17+
"img-src": ["data:"],
18+
},
19+
}),
20+
],
821
build: {
922
target: "es2022",
1023
},

vitest.config.ts renamed to vitest.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { fileURLToPath } from "node:url";
22
import { configDefaults, defineConfig, mergeConfig } from "vitest/config";
3-
import viteConfig from "./vite.config";
3+
import viteConfig from "./vite.config.mjs";
44

55
export default mergeConfig(
66
viteConfig,

0 commit comments

Comments
 (0)