LPgenerator / django-db-mailer

Django module to easily send emails/sms/tts/push using django templates stored on database and managed through the Django Admin
https://github.com/LPgenerator/django-db-mailer
GNU General Public License v2.0
255 stars 81 forks source link

deserialize for queue #120

Closed maxclax closed 6 years ago

maxclax commented 6 years ago

I have project with config celery as here http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html

` BROKER_URL = 'redis://redis:6379' CELERY_RESULT_BACKEND = 'redis://redis:6379' CELERY_ACCEPT_CONTENT = ['application/json'] CELERY_TASK_SERIALIZER = 'pickle' CELERY_RESULT_SERIALIZER = 'json' CELERY_IGNORE_RESULT = True CELERY_TIMEZONE = TIME_ZONE CELERY_ACKS_LATE = True CELERYD_PREFETCH_MULTIPLIER = 1

from kombu import Exchange, Queue, binding from kombu.serialization import registry registry.enable('pickle')

CELERY_QUEUES = ( Queue('high', Exchange('high'), routing_key='high'), Queue('normal', Exchange('normal'), routing_key='normal'), Queue('low', Exchange('low'), routing_key='low'), )

CELERY_DEFAULT_QUEUE = 'normal' CELERY_DEFAULT_EXCHANGE = 'normal' CELERY_DEFAULT_ROUTING_KEY = 'normal'

CELERYBEAT_SCHEDULE = {} CELERY_ROUTES = {} `

but when I send task to any Queue I have next error

kombu.exceptions.ContentDisallowed: Refusing to deserialize untrusted content of type pickle (application/x-python-serialize) [2018-09-28 07:45:07,599: WARNING/MainProcess] Restoring 1 unacknowledged message(s)

I can't understand what fix it? Maybe my config is not correct. I don't use djcelery

maxclax commented 6 years ago

OH! for Celery from 4 need use C_FORCE_ROOT

Running a worker with superuser privileges when the worker accepts messages serialized with pickle is a very bad idea!