Problem/Motivation

SA-CORE-2026-001's tests from the private issue have not yet been added to core.

Proposed resolution

Add the tests.

Remaining tasks

NR.

Issue fork drupal-3633288

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

xjm created an issue. See original summary.

xjm’s picture

On porting this over from the private issue, I noticed the following:

                'text' => '<script data-attack>alert("💥")</script>',
                'onclick' => 'alert("💥 onclick attack");',

(and similar).

For the purposes of this issue, that may well provide the necessary test coverage. We should for sure revert SA-CORE-2026-001 locally and check, including documenting exactly how it fails when that's reverted.

In general, however, when we test XSS, we should use payloads that do not contain HTML special characters.

For example, alert(String.fromCharCode(88,83,83)) can still achieve XSS in cases where alert("XSS") doesn't. Some naïve XSS sanitization will escape the " to a &quot;, which results in invalid HTML and therefore no attack. But the same simple escaping will not catch the quote-free payload.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Reverted the commit from https://git.drupalcode.org/project/drupal/-/commit/bba7977d9c35c010d826e...
Applied the MR and ran the test and got

Behat\Mink\Exception\ExpectationException: An element matching css "script[data-attack]" appears on this page, but it should not.
/var/www/html/vendor/behat/mink/src/WebAssert.php:888
/var/www/html/vendor/behat/mink/src/WebAssert.php:492
/var/www/html/core/modules/system/tests/src/FunctionalJavascript/ModalRendererTest.php:72

Random, this is a large test. Would it be worth a follow up to breakout some? Happy to make that for a first time contribution

LGTM though.

alexpott’s picture

Version: main » 11.5.x-dev
Status: Reviewed & tested by the community » Fixed

Backported to 11.5.x to keep test coverage aligned and 11.x security tested.

Thanks @xjm for doing the work of updating the commit credit.

Committed and pushed 7312a1251af to main and f600cefad54 to 12.0.x and d8a9a813369 to 11.x and 557f6081842 to 11.5.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • alexpott committed 557f6081 on 11.5.x
    task: #3633288 Add test coverage for SA-CORE-2026-001
    
    By: xjm
    By:...

  • alexpott committed d8a9a813 on 11.x
    task: #3633288 Add test coverage for SA-CORE-2026-001
    
    By: xjm
    By:...

  • alexpott committed f600cefa on 12.0.x
    task: #3633288 Add test coverage for SA-CORE-2026-001
    
    By: xjm
    By:...

  • alexpott committed 7312a125 on main
    task: #3633288 Add test coverage for SA-CORE-2026-001
    
    By: xjm
    By:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.