Sorting: fix crash from secret unit GUIDs used as cache keys#143
Open
Krathe82 wants to merge 1 commit into
Open
Sorting: fix crash from secret unit GUIDs used as cache keys#143Krathe82 wants to merge 1 commit into
Krathe82 wants to merge 1 commit into
Conversation
UnitGUID can return a secret value in 12.0 (e.g. M+ encounters), and a secret cannot be used as a Lua table key. Two sort caches keyed by GUID were unguarded and could throw "cannot be indexed with secret keys": - Sort.UnitCache (role cache): fall back to the unit token when the GUID is inaccessible, mirroring the StatusIcons AFK-cache fix. - SecureSort.inspectQueue: skip queuing/handling units whose GUID is secret. The queue is matched back against the INSPECT_READY GUID, so a unit-token fallback would never match and would leak entries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
UnitGUIDcan return a secret value in 12.0 (e.g. M+ encounters), and a secret value cannot be used as a Lua table key — using one throwsattempted to perform indexed assignment on a table that cannot be indexed with secret keys. Two sort caches keyed by GUID were unguarded:Sort.UnitCache(role cache)SecureSort.inspectQueueThis is the same crash class as the AFK-cache fix in #141, in a different code path.
Fix
Sort.UnitCache— fall back to the unit token when the GUID is inaccessible (canaccessvalue(guid) and guid or unit), mirroring the StatusIcons AFK-cache fix. The token is a plain string and stable for the session.SecureSort.inspectQueue— skip queuing/handling units whose GUID is secret. The queue is matched back against the GUID delivered byINSPECT_READY, so a unit-token fallback would never match and would leak entries; skipping is the correct guard there.