ZCS-10594/TSS-18404: Fix for emails not displaying correctly. #2
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.
Problem:
Reported glassdoor E-mails not displaying correctly in the classic UI.
Analysis:
In the classic UI, investigated why the links as displayed in the screenshots are coming over the edge and the
CSS
rules are not getting applied to it. Found that the actual issue for the Glassdoor e-mails in the classic UI is causing due to the followingmedia queries
in the style tag:When I tried to remove the above code and imported the Mimes, all the new imported mimes were getting rendered properly. Looked into the
antisamy.xml
file and the tag and attribute policies related to style and media. I tried changing and removing the policies related to it but there was no effect of those.antisamy
to1.6.3
but still having the same issue.antisamy
with latest version oforg.apache.xml.serialize
but having the same issue.LSSerializer
which comes bundled withXerces
after serialisation it's giving the same output.The problem is causing not because of the
OWASP
but it's in theantisamy
library during theserialization
. Duringsanitization
, the above media queries were not removed but while theantisamy
library tries to perform theserialization
of the document fragment those media queries are getting stripped off. Forserialization
antisamy
is dependent on another third-party library which is causing the issueorg.apache.xml.serialize.HTMLSerializer.
This is reported and accepted as a bug in the
antisamy
library, so anything which comes ahead of the@
symbol gets stripped out.Reported Bug
I have also updated the bug as per our issue.
In the
org.owasp.validator.html.scan.AntiSamyDOMScanner
class, I was having the expected string prior toserialization
and after theorg.apache.xml.serialize.HTMLSerializer
has done theserialization
to theDocumentFragment
whatever it was after the@
symbol got stripped off in the style tag.Fix: Introduces an
if-else
condition to selectively serialize theDocumentFragment
only if doesn't contain any@
symbol otherwise append it to theStringWriter
, which seems to fix our issue until we get a fix for bug fromantisamy
. Also, looking for anHTMLSerializer
which can handle the media queries in the style sheet.Testing Done:
CSS
is displaying properly after the fix.Related PRs:
Zimbra/zm-mailbox
ZimbraOS/zm-mailbox