celery / django-celery-results

Celery result back end with django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaking change: task_name no longer set on TaskResult

ahosie opened this issue · comments

django-celery-results no longer sets the value of TaskResult.task_name as of v2.4.0.
This change was made purportedly to resolve a security issue and/or to fix an inconsistency with the implementation versus documentation.

For anyone else that encounters this, you might be able to resolve by setting the Django config property:

# This belongs in settings.py for your project
CELERY_RESULT_EXTENDED = True

If your app is instantiating the celery worker at runtime (e.g. a test runner), you can override the config like so:

app = Celery('mytestapp', broker='memory://')
app.config_from_object(dict(result_extended=True))

Keep in mind that this will re-introduce the security issue that #315/v2.4.0 was intended to fix.

Maintainers: please note that if you patch this to restore previous behaviour of the task_name, in a new minor release, it may not get picked up by people like me who use dependabot to keep libraries up to date.

this was already discussed #326 (comment)

this was already discussed #326 (comment)

Somehow missed this closed issue when I was searching. Apologies.

In my opinion this issue should remain opened - the change in 2.4.0 represents an undocumented regression. It will likely break a bunch of applications, and possibly in subtle ways that won't be found for a while.

Removing the the task_name in goes beyond addressing the security vuln identified in storing arguments, (which is debatable as a vuln in the first place).

Note: the Celery v3/v4 documentation does not contain:

result_extended
Enables extended task result attributes (name, args, kwargs, worker, retries, queue, delivery_info) to be written to backend.

This behaviour is absolutely a change, as indicated by the large number of issues been raised in the last month, and is not covered in the release notes for django-celery-results, nor any of the "what's new" pages for Celery.