-
Notifications
You must be signed in to change notification settings - Fork 87
Add CSP #7990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CSP #7990
Changes from 9 commits
78a476f
754f013
cba168e
c3140f4
95187e2
e71f3d5
0b1f9ec
432f1ed
041b19a
e269311
650e23a
6a0ee0e
f9df83a
a247591
4aa2656
8cdac65
786f6b3
ab8e2b4
131b2dc
bdcc9c3
6e63c50
bc50b73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import version from 'vite-plugin-package-version' | |
import topLevelAwait from 'vite-plugin-top-level-await' | ||
import viteTsconfigPaths from 'vite-tsconfig-paths' | ||
import { configDefaults, defineConfig } from 'vitest/config' | ||
import { indexHtmlCsp } from './vite.base.config' | ||
|
||
export default defineConfig(({ command, mode }) => { | ||
const runMillion = process.env.RUN_MILLION | ||
|
@@ -77,6 +78,14 @@ export default defineConfig(({ command, mode }) => { | |
}, | ||
plugins: [ | ||
react(), | ||
indexHtmlCsp( | ||
// production means it was build using `vite build` | ||
mode == 'production' | ||
? process.env.VITE_KITTYCAD_BASE_DOMAIN === 'dev.zoo.dev' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will likely be the first place logic is tied to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would happen if someone changes the BASE_DOMAIN during runtime, would these HTML headers be bricked? Someone that builds a production binary is allowed to point the base domain to any domain. Localhost, dev, zoogov.dev and production. If this bricks that workflow we are going to need a new approach. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BASE_DOMAIN is only for vercel essentially. mode == 'produciton' is my way to detect if we build on vercel right now. So probably changing that would be required. The CSP does not allow connecting to gov or localhost right now, so either we adapt the CSP or include them in a certain configuration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the vercel detection and also only enabled CSP for "production" builds in web |
||
? 'vercel-preview' | ||
: 'vercel-production' | ||
: 'local' | ||
), | ||
viteTsconfigPaths(), | ||
eslint(), | ||
version(), | ||
|
Uh oh!
There was an error while loading. Please reload this page.