Repository navigation
bridgelint: check avatar hashes, media info, GIF capabilities and dropped decode errors - #4
Merged
Conversation
…pped decode errors
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.
Four rules for bugs that came up in GroupMe's launch QA. Each fires on the GroupMe code from before the fixes, and they're general enough to apply to other bridges.
bridgev2.Avatarbuilt in the function with a non-constantMXCand noHash. bridgev2 skips the update when the hash is unchanged and an MXC is set (portal.updateAvatar,ghost.UpdateAvatar), so avatar changes after the first are lost.m.imagecapabilities that acceptimage/gifwhen nothing in the package usesevent.CapMsgGIF. Clients only enable the GIF picker withfi.mau.gif.Infoon any path to the end of the function, using the CFG. Content passed to another function is skipped.json.Unmarshal/Decode/proto.Unmarshalfailure whose branch is only a barereturn.continueisn't flagged, because loops often skip rows of other shapes on purpose.Rules for avatars or content passed in from elsewhere stay quiet. A constant MXC is exempt from MC001: it's a fixed avatar, so it never needs an update to get through.
Sweep
I ran it over 31 bridge repos: every
bridgev2.NetworkConnectorrepo in mautrix/beeper, plus discord@megadiscord and groupme-lib, minus line, snapchat, codex and mautrix/go. After exempting constant MXCs (ai-bridge's fixed default assistant avatar), every remaining finding is a real bug:pkg/connector/chatinfo.go:52assigns a direct media MXC to an avatar with no hash.pkg/connector/client.go:234returns a direct media avatar with no hash.real_time_handler.go:26and:124. These are the same silent drop that lib#1 fixed for line 62, still present in two other push handlers.directMediaContent.go vetandgo test ./rulespass. staticcheck isn't installed in this environment.Tag
@indentto continue the conversation here.