Skip to content

Limit team name length and content - #6617

Open
apata wants to merge 2 commits into
masterfrom
limit-team-name
Open

Limit team name length and content#6617
apata wants to merge 2 commits into
masterfrom
limit-team-name

Conversation

@apata

@apata apata commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Changes

Limits team name length and forbids names like buy stuff at https://spam.example.com. Depends on #6616

Tests

  • Automated tests have been added

Changelog

  • Entry has been added to changelog

Documentation

  • This change does not need a documentation update

Dark mode

  • This PR does not change the UI

@apata
apata requested a review from a team August 25, 2026 07:41
changeset
|> validate_length(:name, max: @max_name_length)
|> validate_length(:name, count: :bytes, max: @max_name_bytes)
|> validate_change(:name, fn :name, name ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate_format?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, didn't know about that utility. Checked and we could use it, but I'd prefer not to.

The pattern ~r/^(?!.*:\/\/)/s scales linearly (some patterns don't, including another one I tried before), but it's still 400x times slower according to local tests than String.contains?.

The input to this is uncontrolled and the change / format validator runs even if the change is already determined to be over max length, so expensive pattern + long input -> wasted server resources.

@subscription_accept_traffic_until_offset_days 30

@max_name_length 50
# `teams.name` is a varchar(255), which counts code points. Capping bytes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to keep varchar(255)? Can't we migrate to varchar(50) and get everything trimmed automatically?

Otherwise, what's the plan for existing long team names?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's so few team names longer than 50 characters that out of those, the spammy ones can be deleted manually and the legit ones can stay.

The only reason to limit length to 50 is to make spamming less attractive, and non-spammy long names are not actually a problem. Column migration seems heavy. How would we present that change to CE users?

Base automatically changed from fix-team-setup to master August 26, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants