Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8891: xml link validator in rich text does not allow to use "tel:" links #244

Conversation

vidarl
Copy link
Member

@vidarl vidarl commented Sep 18, 2024

Question Answer
JIRA issue IBX-8891
Bug/Improvement yes
New feature no
Target version 3.3, 4.6, main
BC breaks no
Tests pass no
Doc needed no

This is an attempt to fix ibexa-sa-2024-005-persistent-xss-in-richtext without touching original docbook schema.
However, there are some challenges, see review comment by author

TODO:

  • Implement feature / fix a bug.
  • Implement tests.
  • Fix new code according to Coding Standards ($ composer fix-cs).
  • Ask for Code Review.

<a:documentation>Identifies a link target with a URI</a:documentation>
<choice>
<data type="string">
<param name="pattern">(https?://|mailto:|ezcontent://|ezlocation://|ezremote://|ezurl://|tel:|/|#).+</param>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original fix for ibexa-sa-2024-005-persistent-xss-in-richtext also checks for the existence of &lt;, &gt; and '&quot;

In order to check for this in the reg-ex, I need to use Negative Lookahead, but adding (?!foobar) in the regex is not accepted by the schema validator, ie:
<param name="pattern">(?!.*foobar)(https?://|mailto:|ezcontent://|ezlocation://|ezremote://|ezurl://|tel:|/|#).+</param>-

It returns erros like:

Validation of XML content failed: Fatal error in 0:0: failed to compile: xmlFAParseAtom: expecting ')'
Validation of XML content failed: Fatal error in 0:0: failed to compile: xmlFAParseRegExp: extra characters

regex engine do not support lookahead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for &lt;, &gt; and '&quot; is uneeded as urls are correctly URL encoded when sent to front-end anyway

@vidarl
Copy link
Member Author

vidarl commented Sep 19, 2024

@vidarl vidarl closed this Sep 19, 2024
@vidarl vidarl deleted the IBX-8891_XML_link_validator_in_rich-text_does_not_allow_to_use_tel_links branch September 19, 2024 08:12
@vidarl
Copy link
Member Author

vidarl commented Sep 19, 2024

Created #245 which updates schematron schema instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants