GuardianUnivalle-Benito-Yucra 0.1.22__py3-none-any.whl → 0.1.24__py3-none-any.whl

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 GuardianUnivalle-Benito-Yucra might be problematic. Click here for more details.

@@ -60,16 +60,24 @@ def get_client_ip(request):
60
60
 
61
61
  class SQLIDefenseMiddleware(MiddlewareMixin):
62
62
  def process_request(self, request):
63
- # Excluir paths
63
+ # 1️⃣ Excluir rutas primero
64
64
  exempt_paths = getattr(settings, "SQLI_DEFENSE_EXEMPT_PATHS", [])
65
65
  if any(request.path.startswith(p) for p in exempt_paths):
66
- return None
66
+ return None # No analizar payload
67
+
68
+ # 2️⃣ Verificar si viene de un origin confiable (Netlify u otros frontends)
69
+ trusted_origins = getattr(settings, "SQLI_DEFENSE_TRUSTED_ORIGINS", [])
70
+ request_origin = request.META.get("HTTP_ORIGIN", "")
71
+ if request_origin in trusted_origins:
72
+ return None # Permitir solicitud confiable
67
73
 
74
+ # 3️⃣ Verificar IP confiable
68
75
  client_ip = get_client_ip(request)
69
76
  trusted_ips = getattr(settings, "SQLI_DEFENSE_TRUSTED_IPS", [])
70
77
  if client_ip in trusted_ips:
71
78
  return None
72
79
 
80
+ # 4️⃣ Analizar payload
73
81
  text = extract_payload_text(request)
74
82
  if not text:
75
83
  return None
@@ -83,8 +91,9 @@ class SQLIDefenseMiddleware(MiddlewareMixin):
83
91
  "payload": text,
84
92
  }
85
93
  logger.warning(
86
- f"Ataque SQL detectado desde IP {client_ip}: {descripcion}, payload: {text}"
94
+ f"Ataque SQL detectado desde IP {client_ip}, origin {request_origin}: {descripcion}, payload: {text}"
87
95
  )
96
+
88
97
  return None
89
98
 
90
99
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GuardianUnivalle-Benito-Yucra
3
- Version: 0.1.22
3
+ Version: 0.1.24
4
4
  Summary: Middleware y detectores de seguridad (SQLi, XSS, CSRF, DoS, Keylogger) para Django/Flask
5
5
  Author-email: Andres Benito Calle Yucra <benitoandrescalle035@gmail.com>
6
6
  License: MIT
@@ -7,14 +7,14 @@ GuardianUnivalle_Benito_Yucra/criptografia/kdf.py,sha256=_sbepEY1qHEKga0ExrX2WRg
7
7
  GuardianUnivalle_Benito_Yucra/detectores/detector_csrf.py,sha256=EAYfLkHuxGC5rXSu4mZJ4yZDCbwBpTX8xZWGKz7i5wA,692
8
8
  GuardianUnivalle_Benito_Yucra/detectores/detector_dos.py,sha256=lMWmCw6nccCEnek53nVjpoBCeiBqLdrSXxqRuI7VP2I,696
9
9
  GuardianUnivalle_Benito_Yucra/detectores/detector_keylogger.py,sha256=rEDG-Q_R56OsG2ypfHVBK7erolYjdvATnAxB3yvPXts,729
10
- GuardianUnivalle_Benito_Yucra/detectores/detector_sql.py,sha256=v1Z82Bzyhg7PNFzUOJDuufJUC0KvZ4b9DZTW4qajz00,4217
10
+ GuardianUnivalle_Benito_Yucra/detectores/detector_sql.py,sha256=cr2nsMZFE3gExT5hSpZMee_lnQE1Dfx7UpG1bWJBqDA,4699
11
11
  GuardianUnivalle_Benito_Yucra/detectores/detector_xss.py,sha256=66V_xuxNOZEwluvWOT4-6pk5MJ3zWE1IwcVkBl7MZSg,719
12
12
  GuardianUnivalle_Benito_Yucra/middleware_web/middleware_web.py,sha256=23pLLYqliUoMrIC6ZEwz3hKXeDjWfHSm9vYPWGmDDik,495
13
13
  GuardianUnivalle_Benito_Yucra/mitigacion/limitador_peticion.py,sha256=ipMOebYhql-6mSyHs0ddYXOcXq9w8P_IXLlpiIqGncw,246
14
14
  GuardianUnivalle_Benito_Yucra/mitigacion/lista_bloqueo.py,sha256=6AYWII4mrmwCLHCvGTyoBxR4Oasr4raSHpFbVjqn7d8,193
15
15
  GuardianUnivalle_Benito_Yucra/puntuacion/puntuacion_amenaza.py,sha256=Wx5XfcII4oweLvZsTBEJ7kUc9pMpP5-36RfI5C5KJXo,561
16
- guardianunivalle_benito_yucra-0.1.22.dist-info/licenses/LICENSE,sha256=5e4IdL542v1E8Ft0A24GZjrxZeTsVK7XrS3mZEUhPtM,37
17
- guardianunivalle_benito_yucra-0.1.22.dist-info/METADATA,sha256=h3ClBPXiWTINUZjI3N4pLYVZuHR3LIZm8VML-QQs1MI,1893
18
- guardianunivalle_benito_yucra-0.1.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- guardianunivalle_benito_yucra-0.1.22.dist-info/top_level.txt,sha256=HTWfZM64WAV_QYr5cnXnLuabQt92dvlxqlR3pCwpbDQ,30
20
- guardianunivalle_benito_yucra-0.1.22.dist-info/RECORD,,
16
+ guardianunivalle_benito_yucra-0.1.24.dist-info/licenses/LICENSE,sha256=5e4IdL542v1E8Ft0A24GZjrxZeTsVK7XrS3mZEUhPtM,37
17
+ guardianunivalle_benito_yucra-0.1.24.dist-info/METADATA,sha256=f7Q3VI8EoANrNcCwOsVno3zybSqMfmha9WvUATWOYb0,1893
18
+ guardianunivalle_benito_yucra-0.1.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ guardianunivalle_benito_yucra-0.1.24.dist-info/top_level.txt,sha256=HTWfZM64WAV_QYr5cnXnLuabQt92dvlxqlR3pCwpbDQ,30
20
+ guardianunivalle_benito_yucra-0.1.24.dist-info/RECORD,,