Skip to content

Commit

Permalink
refactor: 🔒 Improve security of frontend with nonce, CSP and security…
Browse files Browse the repository at this point in the history
… headers
  • Loading branch information
CPlusPatch committed May 5, 2024
1 parent 8eaccb3 commit 74425cd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Binary file modified bun.lockb
Binary file not shown.
23 changes: 21 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,29 @@ export default defineNuxtConfig({
"nuxt-headlessui",
"@nuxt/fonts",
"nuxt-icon",
"@vee-validate/nuxt",
//"nuxt-shiki",
"@vee-validate/nuxt",
"nuxt-security",
],

security: {
headers: {
// Nuxt DevTools
crossOriginEmbedderPolicy:
process.env.NODE_ENV === "development"
? "unsafe-none"
: "require-corp",
contentSecurityPolicy: {
"img-src": ["'self'", "data:", "https:"],
"script-src": ["'nonce-{{nonce}}'", "'strict-dynamic'"],
},
xFrameOptions: "DENY",
},
rateLimiter: {
headers: true,
tokensPerInterval: 300,
interval: 300000,
},
},
app: {
head: {
link: [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"nuxt": "^3.11.2",
"nuxt-headlessui": "^1.2.0",
"nuxt-icon": "^0.6.10",
"nuxt-security": "^1.4.3",
"nuxt-shiki": "^0.3.0",
"shiki": "^1.3.0",
"vue": "^3.4.21",
Expand Down

0 comments on commit 74425cd

Please sign in to comment.