Skip to content

Ensure HTML safety of new HSET/HMGET diffs cache

What does this MR do?

Before this change, that's what we'd see in the Changes tab when the cache were primed and hset_redis_diff_caching feature flag ON:

Screen_Shot_2019-12-09_at_13.14.41

Note the HTML being rendered instead processed.

That's a similar problem we solved in the discussions diff highlight. Therefore, I've extracted a safe_init_from_hash for being used in both places.

That happens because we're not using the Rails cache store layer (and using Redis directly), and Redis doesn't force a HTML-safe string when fetching it back, so we need to force it.

Closes #39104 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports