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:
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
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
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 🤖