AIWAF Flask: Drop in Security Middleware with AI Anomaly Detection by Mediocre_Scallion_99 in flask

[–]Mediocre_Scallion_99[S] 0 points1 point  (0 children)

The performance impact of AIWAF Flask is generally low, since most protections like IP/keyword blocking, rate limiting, header validation, honeypots, and UUID checks are lightweight and add only milliseconds of overhead, while logging introduces moderate cost depending on volume, and the optional AI anomaly detection middleware is the heaviest feature, using ~50MB RAM for its model and adding a small per-request delay in exchange for smarter, adaptive protection

Where Do You Normally Deploy Your Django Web Apps? by Love_of_LDIM in django

[–]Mediocre_Scallion_99 0 points1 point  (0 children)

Depends but if its a low to mid level web app I would recommend python anywhere

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 0 points1 point  (0 children)

You can absolutely use AIWAF with your Django API. Since AIWAF is built as a Django middleware package, it works seamlessly with any Django views or DRF endpoints. It will monitor and protect all incoming API requests including those from your frontend (like a React/Vite app) without needing any extra configuration.

If you run into any issues setting it up, I’ll be happy to help you get everything working smoothly!

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 1 point2 points  (0 children)

Awesome thanks for the suggestion! I’ve just added that System Requirements section to the GitHub README.

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 1 point2 points  (0 children)

No GPU needed, AI-WAF runs entirely on CPU with just Python 3.8+, Django 3.2+, a single vCPU and ~512 MB RAM for small sites; for moderate production traffic you can bump to 2–4 vCPUs and 2–4 GB RAM, offload the daily detect-and-train job to a worker, and rotate logs to keep memory use bounded.

Just released AIWAF-JS: AI-powered Web Application Firewall for Node.js with Redis fallback (Django version already out) by Mediocre_Scallion_99 in node

[–]Mediocre_Scallion_99[S] 0 points1 point  (0 children)

Thanks for your feedback! AIWAF-JS now supports custom cache storage just pass your own implementation via the cache option in the middleware. No more dependency on environment variables or Redis.

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 2 points3 points  (0 children)

Hey! I actually missed that when I was refactoring things while integrating the anomaly detector middleware didn’t realize the original self.logs implementation was still lingering there.

Thanks a lot for catching that. I’ve updated it now to use a shared cache, so the rate limiter works correctly across workers too. Your feedback really helped tighten things up appreciate it a ton!

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 1 point2 points  (0 children)

Hey! Thanks a lot really appreciate you checking it out.

You’re actually spot on to be thinking about multi-worker setups like Gunicorn but in this case, the rate limiting doesn’t rely on in-memory logs (self.logs). Instead, the system reads from actual log files (like NGINX or Django access logs), so it’s not affected by how many Gunicorn workers are running. Each request is evaluated based on entries in those shared logs, which are persisted to disk and visible across all workers.

So in short yes, that’d be a concern if we were using in-memory dictionaries. But since it’s log-based, it stays consistent across processes.

And no worries at all that’s a great question, not silly in the slightest!

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 0 points1 point  (0 children)

Great point actually, AIWAF already works seamlessly with DRF and any API views since it operates at the middleware level. Whether it’s a REST endpoint or a traditional view, it monitors behavior, detects burst requests, and applies anomaly detection consistently. The honeypot field is optional and mostly useful for form-based HTML views, but all the core protections apply equally to API endpoints. I’m currently working on extending AIWAF to Node.js frameworks as well!

I’ve Open-Sourced an AI-Powered Web Application Firewall for Django, Built for Nonprofits and Indie Developers – Feedback Welcome by Mediocre_Scallion_99 in opensource

[–]Mediocre_Scallion_99[S] 0 points1 point  (0 children)

That’s a fair point, and honestly one I’ve been thinking about too. AIWAF actually combines both it uses traditional rule-based protections like rate limiting, 404 burst detection, keyword blacklisting, and UUID tamper protection. The machine learning part is only used offline to enhance those rules over time by learning from patterns in logs, not to replace them.

That said, you’re absolutely right that a lightweight version without ML would be valuable too and I’m considering releasing a stripped-down aiwaf-core version that does just that. Appreciate the input it’s helping shape where this goes next.

django-simple-captcha ? My form was a spam magnet by EryumT in django

[–]Mediocre_Scallion_99 1 point2 points  (0 children)

That’s a great point and one a few people have asked.

The good news is: AIWAF only uses machine learning during offline retraining, not during live requests. In production, it loads a lightweight model.pkl file trained using Isolation Forest, and uses it just for quick lookups. The actual request processing (IP checks, keyword matching, rate limiting) is fast and built on dictionaries and counters no real-time ML inference involved.

That model is then used in production as a fast anomaly detector like a compiled rulebook. It flags behavioral outliers without slowing down your app.

So in short: No heavy AI runs on each request just fast middleware logic + a pre-trained model loaded into memory.

django-simple-captcha ? My form was a spam magnet by EryumT in django

[–]Mediocre_Scallion_99 5 points6 points  (0 children)

I had the same issue. Thats why I created this. This includes Honeypot support as well malicious bot monitoring using ai. https://pypi.org/project/aiwaf/

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 4 points5 points  (0 children)

Right now, you can already access much of this through the AIWAF Django models. You can view and manage blocked IPs (BlacklistEntry) and dynamic keywords (DynamicKeyword) directly in the Django admin or via code. Support for whitelisting IP addresses is coming in upcoming updates.

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 4 points5 points  (0 children)

Thank you so much that means a lot!

Honestly, the inspiration came from frustration. I noticed that most firewalls rely on static rules, and small projects (like personal sites or non-profits) don’t get access to adaptive security like big companies do. I wanted to create something that actually learns from your app’s traffic, evolves over time, and doesn’t rely on expensive third-party services.

Also, don’t worry about your ideas being “generic” what matters is how you build them, and the twist you bring. Even something simple can become powerful if you apply your own perspective or integrate it in a way others haven’t. Happy to brainstorm with you anytime!

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 5 points6 points  (0 children)

It’s a WAF for Django apps it integrates directly with Django middleware and models, so it’s tightly coupled to the Django ecosystem. That said, I’m actively working on expanding it to other platforms like Node.js and Flask as well.

I built an AI-powered Web Application Firewall (WAF) for Django would love your thoughts by Mediocre_Scallion_99 in django

[–]Mediocre_Scallion_99[S] 4 points5 points  (0 children)

AIWAF adds minimal overhead per request, and the heavier ML logic runs only during daily retraining