-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(feedback): enforce a max message size from all sources (#79326)
Closes #76298 Closes [SENTRY-3B86](https://sentry.sentry.io/issues/5552524761/) Decided on a limit of 4096, generously below the LLM request, postgres, and kafka size limits described in the ticket. Messages that are too large will be truncated (or rejected, for crash report modal) and skip spam detection, auto-marking as spam. Includes a small refactor of `create_feedback.py`, moving stuff around and commenting a bit. ~~Renamed `auto_ignore_spam_feedback` to `set_feedback_ignored`.~~
- Loading branch information
Showing
11 changed files
with
256 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
33 changes: 33 additions & 0 deletions
33
src/sentry/migrations/0778_userreport_comments_max_length.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 5.1.1 on 2024-10-17 23:33 | ||
|
||
from django.db import migrations, models | ||
|
||
from sentry.new_migrations.migrations import CheckedMigration | ||
|
||
|
||
class Migration(CheckedMigration): | ||
# This flag is used to mark that a migration shouldn't be automatically run in production. | ||
# This should only be used for operations where it's safe to run the migration after your | ||
# code has deployed. So this should not be used for most operations that alter the schema | ||
# of a table. | ||
# Here are some things that make sense to mark as post deployment: | ||
# - Large data migrations. Typically we want these to be run manually so that they can be | ||
# monitored and not block the deploy for a long period of time while they run. | ||
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to | ||
# run this outside deployments so that we don't block them. Note that while adding an index | ||
# is a schema change, it's completely safe to run the operation after the code has deployed. | ||
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment | ||
|
||
is_post_deployment = False | ||
|
||
dependencies = [ | ||
("sentry", "0777_add_related_name_to_dashboard_permissions"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="userreport", | ||
name="comments", | ||
field=models.TextField(max_length=4096), | ||
), | ||
] |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,14 +58,16 @@ | |
|
||
class UserReportForm(forms.ModelForm): | ||
name = forms.CharField( | ||
max_length=128, widget=forms.TextInput(attrs={"placeholder": _("Jane Bloggs")}) | ||
max_length=UserReport._meta.get_field("name").max_length, | ||
widget=forms.TextInput(attrs={"placeholder": _("Jane Bloggs")}), | ||
) | ||
email = forms.EmailField( | ||
max_length=75, | ||
max_length=UserReport._meta.get_field("email").max_length, | ||
widget=forms.TextInput(attrs={"placeholder": _("[email protected]"), "type": "email"}), | ||
) | ||
comments = forms.CharField( | ||
widget=forms.Textarea(attrs={"placeholder": _("I clicked on 'X' and then hit 'Confirm'")}) | ||
max_length=UserReport._meta.get_field("comments").max_length, | ||
widget=forms.Textarea(attrs={"placeholder": _("I clicked on 'X' and then hit 'Confirm'")}), | ||
) | ||
|
||
class Meta: | ||
|
Oops, something went wrong.