From 47bccdb0c33d549ada25dcd97f2b36143cd40a57 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 21 Jan 2023 06:30:33 +0100 Subject: [PATCH] Fix screen_name regex being too lenient --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 82e319ae..6e3ed1da 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -53,7 +53,7 @@ class User < ApplicationRecord # rubocop:disable Metrics/ClassLength foreign_key: "banned_by_id", dependent: :nullify - SCREEN_NAME_REGEX = /[a-zA-Z0-9_]/ + SCREEN_NAME_REGEX = /\A[a-zA-Z0-9_]+\z/ WEBSITE_REGEX = /https?:\/\/([A-Za-z.-]+)\/?(?:.*)/i before_validation do