Fix the comments link and markdown rendering issue #47
+1
−5
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.
Summary
The card with links in the comments was not opening inside the boards. Error when opening the card with a link on the hub in the console:
This is because of the
Content-Security-Policy
Policy in webapp. This policy restricts the use of unsafe javascript methods likenew Functions()
, which can be exploited in injection attacks.Before we were using the board markdown renderer which was working fine, but due to Respect display name configuration PR the boards now use the Markdown renderer from the web app (Channels).
The current Markdown renderer includes a custom link rendering function:
the link function in the above custom Markdown renderer contributed to the unsafe-eval CSP error, specifically due to the inline
onclick
function. Theonclick
attribute in the rendered HTML attempts to execute JavaScript inline. CSP policies typically disallow inline scripts unless explicitly permitted using a CSP directive like 'unsafe-inline'.Removing the
onclick
should fix this issue. Anywaystarget='_blank'
will always open the link in a new tab.Also, there was a markdown rendering issue in the comments inside the cards. This was also fixed in this PR.
Ticket Link
https://mattermost.atlassian.net/browse/MM-62243
Before:
After: