Skip to content

[18.0][FIX] dms: Always b64encode contents from messages - #502

Open
houzefa-abba wants to merge 1 commit into
OCA:18.0from
houzefa-abba:dms-always-b64encode
Open

[18.0][FIX] dms: Always b64encode contents from messages#502
houzefa-abba wants to merge 1 commit into
OCA:18.0from
houzefa-abba:dms-always-b64encode

Conversation

@houzefa-abba

Copy link
Copy Markdown
Member

Previous implementation was failing to convert strings to base64, which is the case when we receive plain HTML encoded as base64; as shown in mail02.eml.

This in turn lead to inconsistencies when saving/reading these contents afterwards, as the rest of the code always assumes dms.file::content contains base64 data.

This was falling through cracks because although the resulting data is invalid base64, the b64decode impl in python 3.12/3.13 is lax enough it would ignore failures in this case because our test string is "base64-ish" enough.

However, when running Odoo on Debian with the patch https://sources.debian.org/patches/python3.13/3.13.5-2+deb13u3/CVE-2026-3446.patch/ applied, this test on mail02.eml produced errors in dms.file::_inverse_content when trying to b64decode:

<class 'binascii.Error'> Invalid base64-encoded string: number of data characters (429) cannot be 1 more than a multiple of 4

@houzefa-abba houzefa-abba changed the title [18.0] [FIX] dms: Always b64encode contents from messages [18.0][FIX] dms: Always b64encode contents from messages Aug 6, 2026
Previous implementation was failing to convert strings to base64, which
is the case when we receive plain HTML encoded as base64; as shown in
mail02.eml.

This in turn lead to inconsistencies when saving/reading these contents
afterwards, as the rest of the code always assumes dms.file::content
contains base64 data.

This was falling through cracks because although the resulting data is
invalid base64, the b64decode impl in python 3.12/3.13 is lax enough it
would ignore failures in this case because our test string is
"base64-ish" enough.

However, when running Odoo on Debian with the patch
https://sources.debian.org/patches/python3.13/3.13.5-2+deb13u3/CVE-2026-3446.patch/
applied, this test on mail02.eml produced errors in
dms.file::_inverse_content when trying to b64decode:

> <class 'binascii.Error'> Invalid base64-encoded string: number of data characters (429) cannot be 1 more than a multiple of 4
@houzefa-abba
houzefa-abba force-pushed the dms-always-b64encode branch from 32e3d0b to 02f8a2a Compare August 7, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants