Skip to content

Fix inconsistent sanitization: sanitize on output rather than input #4231

@diosmosis

Description

@diosmosis

The way in which Piwik deals w/ sanitizing user data is inconsistent: it is sometimes done on input (data is stored sanitized), sometimes on output (less frequently). For example, website names are stored in the DB sanitized and need to be unsanitized or outputted raw in HTML. Goal names are not sanitized in the DB and need to be escaped when outputting in HTML.

This should be made consistent. Additionally, security best practices recommend:

  • filter on input (e.g. cast to an integer if you expect an integer, but don't sanitize strings)
  • escape on output

Problems with the current approach:

We should try to slowly move to sanitizing on output using native escaping features of Twig or AngularJS for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TaskIndicates an issue is neither a feature nor a bug and it's purely a "technical" change.Technical debtIssues the will help to reduce technical debtc: SecurityFor issues that make Matomo more secure. Please report issues through HackerOne and not in Github.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions