Skip to content

fix(integrations): Catch decoding errors in MS Teams install serializer#117666

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix-msteams-decode-error
Open

fix(integrations): Catch decoding errors in MS Teams install serializer#117666
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix-msteams-decode-error

Conversation

@sentry

@sentry sentry Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The MsTeamsInstallSerializer.validate() method was not robust enough to handle malformed signed_params input. Specifically, the unsign() utility function, which performs urlsafe_b64decode().decode(), could raise UnicodeDecodeError or binascii.Error if the input was not valid base64 or not valid UTF-8 after decoding. These exceptions were not caught, leading to an uncaught 500 Internal Server Error instead of a user-friendly 400 Bad Request with a validation message.

This change updates the validate() method to catch UnicodeDecodeError and binascii.Error alongside BadSignature. When these exceptions occur, a serializers.ValidationError("Invalid installation link") is raised, providing a consistent and expected error response for invalid input.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes SENTRY-5QMK

@sentry sentry Bot requested a review from a team as a code owner June 15, 2026 10:39
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants