Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7780
What this PR does / why we need it?
In community/source builds that set neither
MAXKB_HMAC_SIGNED_SERIALIZER_SECRET_KEYnor
MAXKB_SECRET_KEY(and ship noxpack), the Celery HMAC serializer falls backto
uuid.uuid7(), which returns auuid.UUIDobject. Bothsecure_dumps()andsecure_loads()call.encode()on that value, so every task publish/consume raisesAttributeError: 'UUID' object has no attribute 'encode'. The dispatch site swallowsthe exception, so documents stay at "pending / 0 segments" with no visible error.
Reported in #7780 against source HEAD
2ac52b3; the same code is onv2andv3.Summary of your change
One line in
apps/ops/celery/hmac_signed_serializer.py:str(uuid.uuid7())insteadof a bare
uuid.UUIDas the fallback secret. No other file, dependency, config key,schema or runtime path changes. When either env var is set, or
xpackoverrides thekey, behaviour is unchanged. This PR targets
v3, the branch used by recent merges;the file blob is identical on
v2andv3.Please indicate you've done the following:
Not checked: I did not run the MaxKB Django/Celery test suite (that stack and
uuid-utils/kombuare not available in my Windows environment). Equivalentlocal evidence is under Evidence below. No test file is added: this module has
no unit-test directory and the change is a single fallback expression.
No docs impact: no new setting is introduced and the two existing env vars are unchanged.
What Problem This Solves
All Celery tasks fail to be delivered on a source-built community deployment with
default configuration, because the signing key is not a string.
User Impact
Document uploads, vectorisation and any other queued work silently stay pending.
After this change the fallback key is a valid string and task signing works out of
the box; users who already configure a secret see no difference at all.
Why This Change Was Made
hmac.new()needsbytes;.encode()only exists onstr. The smallest correctfix is to convert the generated UUID at the point where it is used as a default,
matching the reporter's suggested fix in #7780. I deliberately did not add a new
setting, change the
xpackoverride, or introduce startup validation, because thoseare separate design decisions and this PR is scoped to the reported failure.
Evidence
Local verification (Python 3.13, standard library only), loading the real file
with only
uuid_utils.compatandkombu.serializationstubbed andxpackforcedabsent.
uuid.UUIDfrom the stdlib is the same typeuuid_utils.compat.uuid7()returns.
AttributeError: 'UUID' object has no attribute 'encode'at
secure_dumps()._local_secret_keyisstr;secure_dumps()returns58 bytes and
secure_loads()round-trips the original object.MAXKB_HMAC_SIGNED_SERIALIZER_SECRET_KEY=dev-secret, base andpatched both produce
strkeys and an identical 58-byte signed payload.ast.parseandcompilepass on the patched file; exactly 1 line changed;UTF-8 without BOM, LF only.
Limitations: no Django / Celery / Redis /
uuid-utils/komburuntime here, so thefull product suite and an end-to-end worker round trip were not run. The
verification is at the serializer module level. CI on this PR is the first full run.