aiwaf 0.1.9.2.5__tar.gz → 0.1.9.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aiwaf might be problematic. Click here for more details.
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/PKG-INFO +1 -1
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/__init__.py +1 -1
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/middleware.py +5 -7
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf.egg-info/PKG-INFO +1 -1
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/pyproject.toml +1 -1
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/setup.py +1 -1
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/LICENSE +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/README.md +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/apps.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/blacklist_manager.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/decorators.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/__init__.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/__init__.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/add_exemption.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/add_ipexemption.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/aiwaf_diagnose.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/aiwaf_list.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/aiwaf_logging.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/aiwaf_reset.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/check_dependencies.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/clear_blacklist.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/clear_cache.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/debug_csv.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/detect_and_train.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/diagnose_blocking.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/regenerate_model.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/setup_models.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/test_exemption.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/management/commands/test_exemption_fix.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/middleware_logger.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/models.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/resources/model.pkl +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/storage.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/templatetags/__init__.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/templatetags/aiwaf_tags.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/trainer.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf/utils.py +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf.egg-info/SOURCES.txt +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf.egg-info/dependency_links.txt +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf.egg-info/requires.txt +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/aiwaf.egg-info/top_level.txt +0 -0
- {aiwaf-0.1.9.2.5 → aiwaf-0.1.9.2.7}/setup.cfg +0 -0
|
@@ -85,6 +85,7 @@ class IPAndKeywordBlockMiddleware:
|
|
|
85
85
|
self.safe_prefixes = self._collect_safe_prefixes()
|
|
86
86
|
self.exempt_keywords = self._get_exempt_keywords()
|
|
87
87
|
self.legitimate_path_keywords = self._get_legitimate_path_keywords()
|
|
88
|
+
self.malicious_keywords = set(STATIC_KW) # Initialize malicious keywords
|
|
88
89
|
|
|
89
90
|
def _get_exempt_keywords(self):
|
|
90
91
|
"""Get keywords that should be exempt from blocking"""
|
|
@@ -439,6 +440,7 @@ class AIAnomalyMiddleware(MiddlewareMixin):
|
|
|
439
440
|
super().__init__(get_response)
|
|
440
441
|
# Use the safely loaded global MODEL instead of loading again
|
|
441
442
|
self.model = MODEL
|
|
443
|
+
self.malicious_keywords = set(STATIC_KW) # Initialize malicious keywords
|
|
442
444
|
|
|
443
445
|
def _is_malicious_context(self, request, keyword):
|
|
444
446
|
"""
|
|
@@ -587,13 +589,9 @@ class AIAnomalyMiddleware(MiddlewareMixin):
|
|
|
587
589
|
data = [d for d in data if now - d[0] < self.WINDOW]
|
|
588
590
|
cache.set(key, data, timeout=self.WINDOW)
|
|
589
591
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
# Only learn keywords from error responses and non-existent paths
|
|
595
|
-
# This prevents learning legitimate keywords from successful requests
|
|
596
|
-
if (response.status_code >= 400 and not known_path and not is_exempt_path(request.path)):
|
|
592
|
+
# Only learn keywords from 404 responses (not found) on non-existent paths
|
|
593
|
+
# This prevents learning from 403 (blocked IPs accessing legitimate paths) or other error codes
|
|
594
|
+
if (response.status_code == 404 and not known_path and not is_exempt_path(request.path)):
|
|
597
595
|
keyword_store = get_keyword_store()
|
|
598
596
|
# Get legitimate keywords to avoid learning them
|
|
599
597
|
from .trainer import get_legitimate_keywords
|
|
@@ -9,7 +9,7 @@ long_description = (HERE / "README.md").read_text(encoding="utf-8")
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name="aiwaf",
|
|
12
|
-
version="0.1.9.2.
|
|
12
|
+
version="0.1.9.2.7",
|
|
13
13
|
description="AI‑driven, self‑learning Web Application Firewall for Django",
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|