Problem/Motivation
This is a follow-up to: #2990723-14: Security improvement for l() function.
Current implementation of the CommonXssUnitTest::testBadProtocolStripping() does only check if javascript: protocol is stripped. It doesn't check all allowed protocols whether they are kept or stripped (for example telnet). We have a variable filter_allowed_protocols which whitelists more protocols to be allowed.
FilterUnitTestCase::testUrlFilter() is already doing such extended check. It would be great to introduce this extended protocol testing also to the CommonXssUnitTest::testBadProtocolStripping() test.
Steps to reproduce
Proposed resolution
Add an array of strings with various protocols (similar to what is used in the FilterUnitTestCase::testUrlFilter()) to test the stripping by the drupal_strip_dangerous_protocols() completely. Include at least all allowed protocols.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3308471-2.patch | 2.21 KB | poker10 |
Comments
Comment #2
poker10 commentedAdded a list of all allowed and two disallowed protocols to the test.
Comment #3
mcdruid commentedSimilar test in D10:
https://git.drupalcode.org/project/drupal/-/blob/10.0.9/core/modules/fil...
This LGTM, thanks!
Comment #5
poker10 commentedCommitted, thanks!