Skip to content
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

fix: strip env variables from CDN build #2919

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/cdn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The `public` folder is hosted at `cdn.f36.contentful.com`.

Run `npm run serve` to start the server locally

## Updating the Geist font to the latest version
### Updating the Geist font to the latest version

> [!IMPORTANT]
> Do not remove, rename or overwrite old versions of the font.
Expand All @@ -16,3 +16,7 @@ Run `npm run serve` to start the server locally
1. Rename the files to include the version: `geist-(mono|sans)-x.x.x.woff2`
1. Create a PR and wait for review
1. Merge the PR. The files are automatically deployed to the CDN

### Build Script

The server is compiled with `js-compute-runtime input.js output.wasm`. The compiled `.wasm` file inlines all environment variables. This is a security risk as the binary might contain api keys. With `env -i`, the server is compiled with a new environment without any environment variables.
2 changes: 1 addition & 1 deletion packages/cdn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"scripts": {
"deploy": "fastly compute deploy",
"prebuild": "npx compute-js-static-publish --build-static",
"build": "js-compute-runtime ./src/index.js ./bin/main.wasm",
"build": "env -i $(which node) ./node_modules/.bin/js-compute-runtime ./src/index.js ./bin/main.wasm",
"serve": "fastly compute serve"
}
}
Loading