Non-Key-Value Tags cause AttributeError
Rixxan opened this issue · 4 comments
Tags in Messages that are not simple key-value tags (Such as the draft/bot tag in unrealircd) cause an AttributeError to be thrown due to out-of-spec handling of tagged messages.
Reference to example breaking tag: https://github.com/unrealircd/unrealircd/blob/893bf864f6c616e891d84916d27e342c252f31aa/src/modules/bot-tag.c (Added to message as the tag draft/bot;
) will cause an exception that is not properly handled and cause the bot to lock up.
Environment:
- Daemon: Unrealircd 6
- Python Version: 3.8.10
- OS: Ubuntu 20.04 LTS
Able to reproduce in isolation, I am testing a fix.
Looks like the processing logic for empty tags / tags lacking a value is incorrect.
Pydle sets empty tags to the value True
.
The problem arises when the following logic, which evaluates escape sequences, attempts to operate over these empty tags.
That logic assumes the value is a string, but its a boolean in this case.
A solution here would be to skip escape sequence processing in this scenario.
Reading into the Tag specification,
Implementations MUST interpret empty tag values (e.g. foo=) as equivalent to missing tag values (e.g. foo)
Pydle cannot set missing tag values to boolean True
, since that would diverge from the behavior of the missing case.
A solution here would be, as per the spec, interpret missing as empty and assign a value of ""
.
This would change pydle behavior, although It should be reverse compatible as long as downstreams only depend on the truthiness checks.
Duplicate of #148
I will orchestrate a release today containing this fix.