Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
drupal_get_messages() calls SafeMarkup::set() which is meant to be for internal use only.
Proposed resolution
Remove the call by refactoring the code.- If refactoring is not possible, thoroughly document where the string is coming from and why it is safe, and why SafeMarkup::set() is required.
Remaining tasks
Evaluate whether the string can be refactored to one of the formats outlined in this change record: https://www.drupal.org/node/2311123- Identify whether there is existing automated test coverage for the sanitization of the string. If there is, list the test in the issue summary. If there isn't, add an automated test for it.
- If the string cannot be refactored, the SafeMarkup::set() usage needs to be thoroughly audited and documented.
Manual testing steps (for XSS and double escaping)
Not necessary, we are only adding documentation.
User interface changes
N/A
API changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#1 | document-2501451-1.patch | 856 bytes | star-szr |
Comments
Comment #1
star-szrThis one is legitimate, only marking strings as safe if they passed SafeMarkup::isSafe() in the previous request.
Comment #2
joelpittetBeauty, thanks for adding the @see drupal_set_message()
Comment #4
xjmI smiled at "let autoescape do its thing", but decided I'm in favor of that wording. :) This call is an intentional part of the API for
drupal_set_message()
so referencing that function makes that intent clear.This issue only changes documentation (and is part of resolving a critical), so per https://www.drupal.org/core/beta-changes, this can be completed any time during the Drupal 8 beta phase. Committed and pushed to 8.0.x. Thanks!