Normalize Mastodon handle into profile URL and reject dangerous schemas.#1776
Merged
Conversation
…URI schemes. This isn't actually abusable by a user right now because the link is `target="_blank"` which removes all ability to use the `javascript:` schema in modern browsers, but I figure it's best to be safe here just in case.
marcoroth
approved these changes
Jun 7, 2026
marcoroth
left a comment
Member
There was a problem hiding this comment.
Thank you for the fix @connorshea!
Also good to know there wasn't really a way for this the be actually dangerous in production 🙌🏼
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.
Description
AI Disclosure: Changeset generated with Claude Code, reviewed and tested by me.
This isn't actually realistically abusable by an attacker right now because the link is
target="_blank"which removes all ability to use thejavascript:schema in modern browsers, but I figure it's best to be safe here just in case.This normalizes the Mastodon URL on user profiles to prevent any URLs outside the normal
http/httpsschema. It still allows the@username@mastodon.hostformat as well.Screenshots
Previously I was able to set the value to a malicious javascript command, but it will not save that to the database anymore after this PR:
But normal usernames/URLs continue to work fine:
Testing Steps
@name@host.comformat, ensure the user page renders and the link works correctly.javascript:alert(document.cookie), see that it gets reset to blank string.References
N/A