Skip to content

escape modifier on variables with nofilter has no effect when auto-escaping is enabled #1188

Description

@turtlexiv

PR #1030 introduced changes to the escape modifier to prevent double-escaping when auto-escaping is enabled.

However, this change also applies to template variables where the nofilter flag is used. This results in the counter-intuitive behavior that explicitly calling the escape modifier when using nofilter has no effect. In our use cases, we use nofilter combined with an explicit escape when we're applying HTML-producing modifiers to unescaped data; for example, {$description|escape|nl2br nofilter}. The net result of this change is 5.4.0 introducing immediate security issues in our application.

This behavior is not reflected in the documentation at https://www.smarty.net/docs/en/language.modifier.escape.tpl or https://smarty-php.github.io/smarty/stable/designers/language-modifiers/language-modifier-escape/, nor is the new force option.

When using nofilter, explicit uses of escape probably should apply.

Thoughts @Amaury ?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions