How to disallow pickle serialization in celery

前端 未结 3 1645
刺人心
刺人心 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:18

    Now that Celery supports configuration on a per-app basis, there is a cleaner way to restrict the content that a consumer will execute.

    c = celery.Celery()
    c.conf.update(CELERY_ACCEPT_CONTENT = ['json'])
    

    See the Celery docs on security for details, and for more advanced security options, such as signing content.

提交回复
热议问题