Skip to content

Commit

Permalink
Remove WARP cert (cloudflare#5905)
Browse files Browse the repository at this point in the history
* Remove WARP cert

* Create dirty-spies-dress.md
  • Loading branch information
penalosa authored May 23, 2024
1 parent d92ee69 commit 53f22a0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 47 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-spies-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix: Remove WARP certificate injection. Instead, you should ensure that any custom certificates that are needed are included in `NODE_EXTRA_CA_CERTS`.
18 changes: 0 additions & 18 deletions packages/wrangler/Cloudflare_CA.pem

This file was deleted.

28 changes: 0 additions & 28 deletions packages/wrangler/bin/wrangler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,6 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
return;
}

let pathToCACerts = process.env.NODE_EXTRA_CA_CERTS;
if (pathToCACerts) {
// TODO:
// - should we log a warning here?
// - maybe we can generate a certificate that concatenates with ours?
//
// I do think it'll be rare that someone wants to add a cert AND
// use Cloudflare WARP, but let's wait till the situation actually
// arises before we do anything about it
} else {
const osTempDir = os.tmpdir();
const certDir = path.join(osTempDir, "wrangler-cert");
const certPath = path.join(certDir, "Cloudflare_CA.pem");
// copy cert to the system temp dir if needed
if (!fs.existsSync(certPath)) {
fs.mkdirSync(certDir, { recursive: true });
fs.writeFileSync(
certPath,
fs.readFileSync(path.join(__dirname, "../Cloudflare_CA.pem"), "utf-8")
);
}
pathToCACerts = certPath;
}

return spawn(
process.execPath,
[
Expand All @@ -63,10 +39,6 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
],
{
stdio: ["inherit", "inherit", "inherit", "ipc"],
env: {
...process.env,
NODE_EXTRA_CA_CERTS: pathToCACerts,
},
}
)
.on("exit", (code) =>
Expand Down
1 change: 0 additions & 1 deletion packages/wrangler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"wrangler-dist",
"templates",
"kv-asset-handler.js",
"Cloudflare_CA.pem",
"config-schema.json"
],
"scripts": {
Expand Down

0 comments on commit 53f22a0

Please sign in to comment.