sanic-security 1.13.4__py3-none-any.whl → 1.13.5__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.
- sanic_security/authentication.py +12 -11
- {sanic_security-1.13.4.dist-info → sanic_security-1.13.5.dist-info}/METADATA +1 -1
- {sanic_security-1.13.4.dist-info → sanic_security-1.13.5.dist-info}/RECORD +6 -6
- {sanic_security-1.13.4.dist-info → sanic_security-1.13.5.dist-info}/LICENSE +0 -0
- {sanic_security-1.13.4.dist-info → sanic_security-1.13.5.dist-info}/WHEEL +0 -0
- {sanic_security-1.13.4.dist-info → sanic_security-1.13.5.dist-info}/top_level.txt +0 -0
sanic_security/authentication.py
CHANGED
@@ -293,34 +293,33 @@ def initialize_security(app: Sanic, create_root=True) -> None:
|
|
293
293
|
|
294
294
|
@app.on_response
|
295
295
|
async def response_handler_middleware(request, response):
|
296
|
-
secure_headers.set_headers(response)
|
297
296
|
if hasattr(request.ctx, "authentication_session"):
|
298
|
-
|
299
|
-
if authentication_session.is_refresh:
|
300
|
-
authentication_session.encode(response)
|
297
|
+
secure_headers.set_headers(response)
|
298
|
+
if request.ctx.authentication_session.is_refresh:
|
299
|
+
request.ctx.authentication_session.encode(response)
|
301
300
|
|
302
301
|
@app.listener("before_server_start")
|
303
302
|
async def audit_configuration(app, loop):
|
304
303
|
if security_config.SECRET == DEFAULT_CONFIG["SECRET"]:
|
305
|
-
warnings.warn("Secret should be changed from default.", AuditWarning)
|
304
|
+
warnings.warn("Secret should be changed from default.", AuditWarning, 2)
|
306
305
|
if not security_config.SESSION_HTTPONLY:
|
307
|
-
warnings.warn("HttpOnly should be enabled.", AuditWarning)
|
306
|
+
warnings.warn("HttpOnly should be enabled.", AuditWarning, 2)
|
308
307
|
if not security_config.SESSION_SECURE:
|
309
|
-
warnings.warn("Secure should be enabled.", AuditWarning)
|
308
|
+
warnings.warn("Secure should be enabled.", AuditWarning, 2)
|
310
309
|
if (
|
311
310
|
not security_config.SESSION_SAMESITE
|
312
311
|
or security_config.SESSION_SAMESITE.lower() == "none"
|
313
312
|
):
|
314
|
-
warnings.warn("SameSite should not be none.", AuditWarning)
|
313
|
+
warnings.warn("SameSite should not be none.", AuditWarning, 2)
|
315
314
|
if not security_config.SESSION_DOMAIN:
|
316
|
-
warnings.warn("Domain should not be none.", AuditWarning)
|
315
|
+
warnings.warn("Domain should not be none.", AuditWarning, 2)
|
317
316
|
if (
|
318
317
|
create_root
|
319
318
|
and security_config.INITIAL_ADMIN_EMAIL
|
320
319
|
== DEFAULT_CONFIG["INITIAL_ADMIN_EMAIL"]
|
321
320
|
):
|
322
321
|
warnings.warn(
|
323
|
-
"Initial admin email should be changed from default.", AuditWarning
|
322
|
+
"Initial admin email should be changed from default.", AuditWarning, 2
|
324
323
|
)
|
325
324
|
if (
|
326
325
|
create_root
|
@@ -328,7 +327,9 @@ def initialize_security(app: Sanic, create_root=True) -> None:
|
|
328
327
|
== DEFAULT_CONFIG["INITIAL_ADMIN_PASSWORD"]
|
329
328
|
):
|
330
329
|
warnings.warn(
|
331
|
-
"Initial admin password should be changed from default.",
|
330
|
+
"Initial admin password should be changed from default.",
|
331
|
+
AuditWarning,
|
332
|
+
2,
|
332
333
|
)
|
333
334
|
|
334
335
|
@app.listener("before_server_start")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
sanic_security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
sanic_security/authentication.py,sha256=
|
2
|
+
sanic_security/authentication.py,sha256=SbPFze7s86xDsKOwoy37nGB8xffK3pSHGnmGUdlnexA,13225
|
3
3
|
sanic_security/authorization.py,sha256=ddJWqGJbFIqII5pUW5SxI7h4EyVB-EhrbGM7jsQutOI,7559
|
4
4
|
sanic_security/configuration.py,sha256=h-Kh4PalJpjbDcZvVHCzxX5l-GnldP3Fr8OlgGCZNHY,5680
|
5
5
|
sanic_security/exceptions.py,sha256=JiCaBR2kjE1Cj0fc_08y-32fqJJXa_1UCw205T4_RTY,5493
|
@@ -9,8 +9,8 @@ sanic_security/verification.py,sha256=js2PkqJU6o46atslJ76n-_cYoY5iz5fbyiV0OFwoyS
|
|
9
9
|
sanic_security/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
sanic_security/test/server.py,sha256=Rh_L12HPCfagvAyqkHziBD1C4WHAKZ9ht4mTCpX2Yik,12240
|
11
11
|
sanic_security/test/tests.py,sha256=bW5fHJfsCrg8eBmcSqVMLm0R5XRL1ou-XJJRgz09GOE,21993
|
12
|
-
sanic_security-1.13.
|
13
|
-
sanic_security-1.13.
|
14
|
-
sanic_security-1.13.
|
15
|
-
sanic_security-1.13.
|
16
|
-
sanic_security-1.13.
|
12
|
+
sanic_security-1.13.5.dist-info/LICENSE,sha256=sXlJs9_mG-dCkPfWsDnuzydJWagS82E2gYtkVH9enHA,1100
|
13
|
+
sanic_security-1.13.5.dist-info/METADATA,sha256=WBdJdWbBOUphyj-RaEioPjEl8ksycafckhJTF2COCQU,24248
|
14
|
+
sanic_security-1.13.5.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
15
|
+
sanic_security-1.13.5.dist-info/top_level.txt,sha256=ZybkhHXSjfzhmv8XeqLvnNmLmv21Z0oPX6Ep4DJN8b0,15
|
16
|
+
sanic_security-1.13.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|