Repository navigation
Fix Discord embed author name length validation using wrong limit - #74940
Merged
Merged
Conversation
DiscordCommonHandler.validate_embed checked the author name against a 2048-character limit, but Discord's embed author name limit is 256 (and the error message already says "256 or fewer characters"). The 2048 was copied from the footer-text check, where 2048 is correct. As a result an author name of 257-2048 characters passed local validation and was only rejected later by Discord's API with a less helpful error. The existing regression test used a 2049-character name, which happened to exceed even the wrong bound and so never caught the defect; tighten it to 257 to match the 256 limit, consistent with the sibling title and field-name cases. Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>
28 of 93 tasks
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.
Why
DiscordCommonHandler.validate_embedchecks the embed author name against a> 2048limit, but Discord's documented embed author-name limit is 256 — and the error message on the very next line already says "256 or fewer characters":The
2048was copied from the footer-text check directly above (where2048is correct). Every sibling 256-char check (title, fieldname) correctly uses> 256; onlyauthor.namewas wrong.validate_embedexists to reject oversized embeds locally with a clear message before the webhook call. With the wrong bound, an author name of 257–2048 characters silently passes local validation and is instead rejected downstream by Discord's API with a less helpful error — defeating the purpose of the local check and contradicting both the function's own error text and the Discord embed-limits spec it cites.What
> 2048→> 256for the author name.Tests
The existing parametrized
fail-on-author-namecase used"t" * 2049, which exceeds even the buggy2048bound and so never exercised the defect. Tightened to"t" * 257(limit + 1), matching the sibling 256-limit cases. Verified fail-on-revert on the realvalidate_embed: a 257-char name is rejected only after the fix (256 is accepted at the boundary); reverted, the 257-char name passes.