Open marcphilipp opened 6 years ago
I know that it's the maximum length for a TEXT
column. That doesn't solve the problem that such messages are stored in a corrupted way in the database. ejabberd_http_ws
does not check max_stanza_size
. Thus, I have no way of preventing them from being stored in the first place. Once they are stored the MAM response is wrong. It only sends the messages that were not corrupted, but the count
of the fin
element in the IQ result includes the corrupted messages.
So, this might actually be two issues:
mod_mam_sql
should not store messages that will corrupt the archive
table.ejabberd_http_ws
needs a way to limit the maximum stanza sizeI'd appreciate any pointer how to workaround or fix the issue.
Well, how do you suggest to resolve the first point? We have a ton of databases with their limitations, it's really a burden to check all these stupid restrictions. I think you just need to change the type of the field, or use "right" database: https://www.postgresql.org/docs/current/static/datatype-character.html which doesn't have these silly limitations. Regarding the second point, it's on my todo list to fix it. I will leave the issue opened until I fix it.
how do you suggest to resolve the first point?
How about a config option for mod_mam
? max_message_size
or something along those lines?
I think you just need to change the type of the field, or use "right" database
I think allowing huge messages might cause a security vulnerability so I'd rather not go that route.
Regarding the second point, it's on my todo to fix it. I will leave the issue opened until I fix it.
Sounds good, thanks! 🙂
How about a config option for mod_mam? max_message_size or something along those lines?
How about asking MySQL developers to return an error on field overflow instead of truncating? Just like this is done in Postgres (for integer overflow).
Fair enough. I'll leave you to it. 😉
ejabberd_http_ws
not checking max_stanza_size
sounds like a worth reporting bug on its own.
@prefiks: What do you think?
17.09
CentOS
source
When receiving messages with long bodies,
mod_mam_sql
inserts them into the databasearchive
(MySQL in our case). Both thexml
and thetxt
columns are cut off after 65535 characters. Thus, when loading them in a subsequent MAM query, thexml
column contains invalid XML. Themax_stanza_size
option is set to 65535 onejabberd_c2s
but I'm not sure it's used for the websocket transport.