alfresco-audit-share icon indicating copy to clipboard operation
alfresco-audit-share copied to clipboard

Request body malformed

Open dsx76 opened this issue 5 years ago โ€ข 0 comments

Hello,

We found an issue with some request body (payload) while using AuditShare. The payload catched by AuditShare contains gibberish characters when it's send to alfresco server.

As an example, when updating a folder's metadata (action audited with AuditShare) which contains cyrillic characters, the description was modified as such for the Test folder : descriptionrusse

In this case, the form update's request body use correct encoding from Browser to Share server where as from Share to Alfresco back the request body is malformed and contains ???????????.

As we use US-ASCII encoding on alfresco server while the request body is UTF-8 encoded, this issue seems to be coming from an altered request body with wrong encoding. US-ASCII does not support the word ะฟั€ะธะผะตั‚ั‹ so it's converted to ???????????.

This issue seems to come from the RequestWrapper class which use JVM encoding setting (Default Charset) of alfresco hosting server instead of using request body encoding at these lines :

StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer);
return writer.toString();
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(stringRequest.getBytes());

Affected versions :

  • Alfresco Enterprise 5.2.3
  • AuditShare 1.5.8

Regards.

dsx76 avatar Mar 08 '19 14:03 dsx76