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

Adding additional protocol handlers to URI.AllowedSchemes #374

Open
iainhenderson opened this issue May 16, 2023 · 6 comments
Open

Adding additional protocol handlers to URI.AllowedSchemes #374

iainhenderson opened this issue May 16, 2023 · 6 comments

Comments

@iainhenderson
Copy link

It looks like a few fairly popular protocol handlers are being stripped out by purifier. Could URI.AllowedSchemes be extended to allow options for:

  • sms:
  • callto:
  • fax:
@pyres01
Copy link

pyres01 commented May 16, 2023 via email

@maxfenton
Copy link

Yeah, we need sms: in our HTMLPurifier configs

@ezyang
Copy link
Owner

ezyang commented Feb 24, 2024

ok, send a pr

@maxfenton
Copy link

maxfenton commented Apr 2, 2024

@ezyang What permissions would I need to add a PR?

I have a feature branch that duplicates the tel: tests for sms: in:

  • tests/HTMLPurifier/AttrDef/URITest.php
  • tests/HTMLPurifier/URIFilter/MakeAbsoluteTest.php
  • tests/HTMLPurifier/URIParserTest.php
  • tests/HTMLPurifier/URISchemeTest.php

and essentially duplicates library/HTMLPurifier/URIScheme/tel.php as library/HTMLPurifier/URIScheme/sms.php with the class name HTMLPurifier_URIScheme_sms and the header comment:

/**
 * Validates sms (for text messaging).
 *
 * The relevant specification for this protocol is RFC 5724,
 * but this class normalizes phone numbers like HTMLPurifier_URIScheme_tel
 * so that they only include (possibly) a leading plus, and then any
 * number of digits and x'es.
 * 
 * Note this does not yet handle the full test case of:
 * href="sms:+19999999999?&body=Hello%2520I%252C%2520have%2527a%2520question%25"
 */

I might be missing an addition needed to URI.AllowedSchemes

@pyres01
Copy link

pyres01 commented Apr 2, 2024 via email

@ezyang
Copy link
Owner

ezyang commented Apr 5, 2024

Just open a PR from a branch on your fork

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

No branches or pull requests

4 participants