🔒 Securing the Edge: Introducing Secrets in Wasmer Edge
We are incredibly excited to announce a significant enhancement to Wasmer Edge: the support for secure Environment variables
Syrus Akbary
Founder & CEO
July 18, 2024
Secure environment variables is a feature that many of you have been asking for, both in the Wasmer Community Discord and through social media. Today we are incredibly excited to announce that secret environment variables are now fully supported in Wasmer Edge.
The added support for secure environment variables allows:
- Enhanced Security: Reduces the risk of exposing sensitive data in your source code or public repositories.
- Compliance Ready: it will pave the way to comply with regulations like GDPR, HIPAA, which require strict data protection measures.
- Easy Integration: Works with your existing environment variables setup with a minimal learning curve.
How to use secrets
Using secrets in Wasmer Edge is incredibly easy.
Lets create a Javascript Worker that just returns the process.env
vars as JSON:
async function handler(request) {
const out = JSON.stringify({env: process.env});
return new Response(out, {
headers: { "content-type": "application/json" },
});
}
addEventListener("fetch", (fetchEvent) => {
fetchEvent.respondWith(handler(fetchEvent.request));
});
To create a JS Worker, you can simply run
wasmer app create --template=js-worker
and modify the contents ofsrc/index.js
. See https://secrets-worker-example.wasmer.app/ for a live example
The first time that you deploy the app (via wasmer deploy
), you will see that the app has no environment variables.
To attach new secrets to the app, you have two ways:
-
Using the Wasmer CLI:
wasmer app secrets create
$ wasmer app secrets create MY_SECRET THE_SECRET_VALUE
-
Using the app’s settings web UI (Go to your App → Settings → Secrets)
Once you create or update a secret (and redeploy the app), it will become available as an environment var of your application.
$ wasmer deploy
Et voilá!
In the future, we will integrate directly with secrets providers such as Doppler and Infisical, so your secrets can stay in sync with Wasmer Edge seamlessly.
We have created an in-depth guide in our docs, please don’t forget to give them a look! https://docs.wasmer.io/edge/learn/secrets
How secure are the Secret environment variables?
All secrets are encrypted in transit and at rest, both in the Wasmer backend and in Wasmer Edge.
Join Us on the Edge of Innovation
We welcome everyone to integrate Secret environment variables into their Wasmer Edge applications.
Try it out, and don’t hesitate to reach out with feedback or questions. Your input is invaluable as we continue to refine and enhance Wasmer Edge to meet the evolving needs of modern software development.
For more information visit Wasmer Edge documentation.
Stay secure and code on! 🔐
About the Author
Syrus Akbary is an enterpreneur and programmer. Specifically known for his contributions to the field of WebAssembly. He is the Founder and CEO of Wasmer, an innovative company that focuses on creating developer tools and infrastructure for running Wasm
Syrus Akbary
Founder & CEO
How to use secrets
How secure are the Secret environment variables?
Join Us on the Edge of Innovation
Read more
wasmerwasmer edgerustprojectsedgeweb scraper
Build a Web Scraper in Rust and Deploy to Wasmer Edge
RudraAugust 14, 2023