runtime-node icon indicating copy to clipboard operation
runtime-node copied to clipboard

Protecting CloudFlare Workers

Open nicolaspapp opened this issue 4 months ago • 9 comments

Hi there, I am looking to set up my Zen Firewall App at Aikido. I am going through the documentation, but I do not find any option for my current stack that consists of:

  • CloudFlare Workers (similar to AWS Lambda)
  • itty-router for routing.

Can you provide details on how I can initialize Zen with this stack? Thanks

nicolaspapp avatar Aug 06 '25 19:08 nicolaspapp

Hi @nicolaspapp , Sadly Zen does not support Cloudflare workers. Reasons for this are that we are still working on ESM support and that Cloudflare workers are not fully compatible with Node.js. We might support it in the future, but it is not planned right now. Which features would you like to use the most? Are you using a bundler like esbuild?

timokoessler avatar Aug 06 '25 19:08 timokoessler

We have an Aikido Subscription, and I was interested in setting up Zen to scan my API endpoints. But I think I can try Aikidio AI instead.

nicolaspapp avatar Aug 07 '25 13:08 nicolaspapp

@nicolaspapp We usually reply faster on Intercom! So you were planning to use Zen for generating an OpenAPI spec for scanning your API? We indeed have an alternative way, using AI, to generate an OpenAPI spec from your code. Try it out and let us know!

hansott avatar Aug 07 '25 14:08 hansott

Yeah, I´m going through that one now, and so far so good with the AI option! Adding WAF with Zen seemed like an interesting choice for us to consider, hence why I opened the issue.

nicolaspapp avatar Aug 07 '25 18:08 nicolaspapp

@timokoessler, to get back to your question, I am not using esbuild. I am also using nodejs compatibility flag, so it might just work. I can give it a try, I just need some help on how I can manually pass the token since the way Cloudflare handles env variables is somewhat different.

nicolaspapp avatar Aug 07 '25 23:08 nicolaspapp

It will sadly not work without code changes on our side. Are you using CJS (require) or ESM (import) at runtime?

timokoessler avatar Aug 08 '25 07:08 timokoessler

I'm using ESM

nicolaspapp avatar Aug 08 '25 11:08 nicolaspapp

According to this page, Cloudflare workers sadly do not implement the Node.js built-in module node:module, that we will heavily rely on for the upcoming ESM support. So it is unfortunately very unlikely that we can support this setup in the near future.

timokoessler avatar Aug 08 '25 11:08 timokoessler

+1 on this

Wuemeli avatar Sep 12 '25 17:09 Wuemeli