The vulnerability, identified as GHSA-hw87-6jcq-9f8q, allowed authenticated users to bypass the PostEditTimeLimit for non-message fields in Mattermost posts. This meant that while the message of a post could not be edited after the configured time limit, other attributes such as file attachments, properties (props), and the pinned status could still be modified. This occurred because the API endpoints responsible for updating posts did not consistently enforce the time limit across all mutable fields.
The analysis of the patch, specifically commit abc3ec4eedddf1c37900f3b8c154b9749635177e, reveals the exact locations of the vulnerability. The functions updatePost, patchPost, saveIsPinnedPost, and restorePostVersion in server/channels/api4/post.go were all found to have incomplete or missing time limit checks.
updatePost and patchPost only checked the time limit if the message of the post was being changed.
saveIsPinnedPost had no time limit check at all, allowing posts to be pinned or unpinned indefinitely.
restorePostVersion only considered the message when checking permissions, allowing other attributes to be changed by restoring a previous version.
The patch rectifies these issues by introducing a new helper function, postEditTimeLimitExpired, and applying it consistently across all the vulnerable functions. The checks are expanded to cover not just the message, but also FileIds, Props, and IsPinned status, ensuring that no part of a post can be modified after the edit time limit has expired. Any attempt to do so will now result in a permissions_time_limit.app_error.