Cloudflare Aegis provides dedicated egress IPs (from Cloudflare to your origin) for your layer 7 WAF and CDN services. The egress IPs are reserved exclusively for your account so that you can increase your origin security by only allowing traffic from a small list of IP addresses.
Hi guys I’m new here, I’m a total noob so excuse any wrong terms I may use. I made a chrome extension that uses AI (Anthropic API) to generate replies to reviews. So in order to protect my api key from client side code I wanted to use workers as a “middle man”. My front end would call the worker then the worker would call Anthropic and then send back the response to my front end. However I have two security issues:
Can anyone not just get the worker url from my code (chrome extension code can be downloaded) and make their own requests to the worker?
Is there a way to limit requests to the worker? Again, can someone not access the url and maliciously make like a million calls to the end point?
It’s based on usage so I’m afraid of racking up a high bill. I currently used netlify functions but after reading stories on them I want to move away. I thought AI Gateway was the savior but turns out it just for analytical purposes? As you have to add your API key
FWIW this would also be a problem if you used any other means to expose your backend (e.g. a VPS). You can try to limit the potential abuse further by requiring users to login via Google or something - and then only allowing authenticated users to hit the endpoint (validate they have a JWT or w/e you want to do). Of course people can sign in and then send millions of requests if they want to, but it makes it a bit more difficult/effort and that's generally what a lot of security is about.
I'd also recommending setting a spending limit in your Anthropic account, not sure what controls they give you, but most offer spending caps - so at least if you do get hit, it will be limited, and you can start out with a low spend if you're expecting slow and gradual uptake.
Thanks yea that’s what I was recommended, setting up proper auth. The issue isn’t with over spending on Anthropic but the worker/function. Anthropic is prepaid so if I put $10 it only uses that much and no more unless I have auto recharge on which I won’t. I’m not concerned about users abusing it but someone who can download the source code files and see the url in the code that I use to generate replies. It just seem to be a bigger problem than just putting the api key in code. Someone can use my api key but I have a limit on it.
we probably shouldn’t be generating too many… 10K simultaneous sounds like a bug of some kind for sure. we probably only spin up several hundred DOs in a 10 minute period
oh, I think I misunderstood what you meant by "your" config.. do you just mean the project config? there are many workers in my monorepo, wanted to avoid hardcoding the account id into all of them
In what way? Pages has built in CI/CD, supports advanced mode so you can pop out of the provided stuff and use it more like Worker Sites, free unlimited static asset requests, versioning/rollbacks/etc
Today we’re excited to announce that over the next year we will be working to bring together the best traits and attributes you know and love from each product into one powerful platform!
it's a little awkward right now, Pages still has a ton more stuff then normal Workers, would hardly say Worker Sites is more powerful outside of a few edge-case not supported stuff/bindings
For now I'm mostly doing my FE in Pages and my services as Workers, and just using lerna monorepo (sometimes combined with git submodules) to manage the whole thing.
@Chaika hmm, so if I wanted to build a social network on cloudflare, would that be something that would not make sense to do given the current scope of features that exist?
D1 is compatible with most SQLite’s SQL convention since it leverages SQLite’s query engine. D1 client API allows you to interact with a D1 database from within a Worker.
It depends exactly how you want to build it how you'd go about it, but I don't see any reason why it would be impossible, D1 is semi-limited though because right now it's a single javascript thread/isolate in a single location, so for dynamic social networks which aren't too cachable you might reach the limits of one + the max size of 10gb per db
they want you to scale with more DBs but doing that with a social network would be interesting, I guess could have each user in its own D1 DB but would need a lot of glue + the tooling to handle that all well/dynamically is still unreleased
SQLite Cloud offers an easy way to share single-user SQLite databases to the cloud. We offer enterprise features like advanced scaling solutions, continuous backup, ACID-compliant over multiple nodes (and multiple zones), pub/sub capabilities, powerful users/roles access control, and a javascript-based programming language to extend the built-in...
you mean instead of d1? That's basically what D1 aims to provide eventually in some ways, although I would note their storage limits are no better/probably same other arch limits to a degree if that's why you don't want to use d1
I have a CF worker (worker A) that exposes different endpoints using Hono, now I have another worker (Worker B) that needs to make a request to Worker A. Is it possible to make an RPC service binding call to a Worker A method, if so how would I achieve this, any documentation or examples appreciated.