Skip to content

Commit ce8cf9e

Browse files
authored
ref(feedback): do not validate userreport email (#94664)
Feedback v2, Relay, and issues does not validate the email format. We're deciding to leave validation up to SDK devs, it's not worth dropping the whole feedback
1 parent 1d1145b commit ce8cf9e

2 files changed

Lines changed: 2 additions & 27 deletions

File tree

src/sentry/ingest/userreport.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import uuid
66
from datetime import datetime, timedelta
77

8-
from django.core.exceptions import PermissionDenied, ValidationError
9-
from django.core.validators import validate_email
8+
from django.core.exceptions import PermissionDenied
109
from django.db import IntegrityError, router
1110
from django.utils import timezone
1211

@@ -200,13 +199,11 @@ def validate_user_report(
200199
source: FeedbackCreationSource = FeedbackCreationSource.USER_REPORT_ENVELOPE,
201200
) -> tuple[bool, str | None, str | None]:
202201
"""
203-
Validates required fields, field lengths, and garbage messages. Also checks email format and that event_id is a UUID.
202+
Validates required fields, field lengths, and garbage messages. Also checks that event_id is a valid UUID. Does not raise errors.
204203
205204
Reformatting: strips whitespace from comments and dashes from event_id.
206205
207206
Returns a tuple of (should_filter, metrics_reason, display_reason). XXX: ensure metrics and outcome reasons have bounded cardinality.
208-
209-
At the moment we do not raise validation errors.
210207
"""
211208
if "comments" not in report:
212209
return True, "missing_comments", "Missing comments" # type: ignore[unreachable]
@@ -259,12 +256,6 @@ def validate_user_report(
259256
if max_email_length and len(email) > max_email_length:
260257
return True, "too_large.email", "Email Too Large"
261258

262-
try:
263-
if email:
264-
validate_email(email)
265-
except ValidationError:
266-
return True, "invalid_email", "Invalid Email"
267-
268259
try:
269260
# Validates UUID and strips dashes.
270261
report["event_id"] = uuid.UUID(report["event_id"].lower()).hex

tests/sentry/ingest/test_userreport.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,6 @@ def test_validator_should_not_filter_empty_message_without_option(set_sentry_opt
135135
assert reason is None
136136

137137

138-
@django_db_all
139-
def test_validator_should_filter_invalid_email():
140-
should_filter, tag, reason = validate_user_report(
141-
{
142-
"name": "",
143-
"email": "invalid-email",
144-
"comments": "hello",
145-
"event_id": "a49558bf9bd94e2da4c9c3dc1b5b95f7",
146-
},
147-
1,
148-
)
149-
assert should_filter is True
150-
assert tag is not None
151-
assert reason is not None
152-
153-
154138
@django_db_all
155139
def test_validator_should_not_filter_empty_email():
156140
should_filter, tag, reason = validate_user_report(

0 commit comments

Comments
 (0)