How to disallow pickle serialization in celery

前端 未结 3 1656
刺人心
刺人心 2021-02-01 13:41

Celery defaults to using pickle as its serialization method for tasks. As noted in the FAQ, this represents a security hole. Celery allows you to configure how tasks get seria

3条回答
  •  梦谈多话
    2021-02-01 14:14

    I was getting "ContentDisallowed: Refusing to deserialize untrusted content of type pickle (application/x-python-serialize)"

    having:

    CELERY_ACCEPT_CONTENT = ['json']
    

    wasn't enough... I had to also add the followings to settings:

    CELERY_TASK_SERIALIZER = 'json'
    CELERY_RESULT_SERIALIZER = 'json'
    

提交回复
热议问题