mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-14 12:27:09 +00:00
fix: 修复 celery 等日志文件的访问漏洞 (#5475)
Co-authored-by: xinwen <coderWen@126.com>
This commit is contained in:
parent
043d24a8f7
commit
08ed363d44
@ -2,6 +2,7 @@
|
||||
#
|
||||
import json
|
||||
import os
|
||||
import uuid
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.timezone import get_current_timezone
|
||||
@ -101,6 +102,10 @@ def get_celery_periodic_task(task_name):
|
||||
|
||||
def get_celery_task_log_path(task_id):
|
||||
task_id = str(task_id)
|
||||
try:
|
||||
uuid.UUID(task_id)
|
||||
except:
|
||||
return
|
||||
rel_path = os.path.join(task_id[0], task_id[1], task_id + '.log')
|
||||
path = os.path.join(settings.CELERY_LOG_DIR, rel_path)
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
|
@ -16,7 +16,7 @@ class CeleryLogWebsocket(JsonWebsocketConsumer):
|
||||
|
||||
def connect(self):
|
||||
user = self.scope["user"]
|
||||
if user.is_authenticated and user.is_org_admin:
|
||||
if user.is_authenticated:
|
||||
self.accept()
|
||||
else:
|
||||
self.close()
|
||||
|
Loading…
Reference in New Issue
Block a user