Skip to content

Commit

Permalink
update readme & demo csp for vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
IslamZaoui committed Sep 29, 2024
1 parent 95cf27f commit 27f21a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const handle = sequence(
headers: {
...
}
}),
}).handle,
yourOtherHandle
);
```
Expand All @@ -78,9 +78,9 @@ import { securityHeaders } from '@islamzaoui/securekit';
export const handle = securityHeaders({
headers: {
'Access-Control-Allow-Origin': 'https://yoursite.com',
'x-sveltekit-page': null, // this will be deleted
'x-sveltekit-page': null, // this will be deleted from response haeders
},
});
}).handle;
```

## Content Security Policy header
Expand All @@ -98,6 +98,9 @@ your can use `csp` option in `securityHeaders` to set the `Content-Security-Poli
import { securityHeaders } from '@islamzaoui/securekit';

export const handle = securityHeaders({
headers:{
...
},
csp: {
directives: {
'script-src': ["'self'",'https://example.com'],
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
<div class="contents">%sveltekit.body%</div>
</body>
</html>
8 changes: 4 additions & 4 deletions apps/demo/src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ export const handle = securityHeaders({
directives: {
'base-uri': ["'self'"],
'child-src': ["'self'"],
'connect-src': ["'self'", 'ws://localhost:*'],
'connect-src': ["'self'", 'ws://localhost:*', "wss://ws-us3.pusher.com", "https://sockjs-us3.pusher.com"],
'img-src': ["'self'", 'data:'],
'font-src': ["'self'", 'data:'],
'form-action': ["'self'"],
'frame-ancestors': ["'self'"],
'frame-src': ["'self'"],
'frame-src': ["'self'", 'https://vercel.live'],
'manifest-src': ["'self'"],
'media-src': ["'self'", 'data:'],
'object-src': ["'none'"],
'style-src': ["'self'"],
'style-src': ["'self'", "'unsafe-inline'", "https://vercel.live"],
'default-src': ["'self'", origin],
'script-src': ["'self'"],
'script-src': ["'self'", 'https://vercel.live'],
'worker-src': ["'self'"]
}
},
Expand Down

0 comments on commit 27f21a8

Please sign in to comment.