New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dist): Add limit validation #1386
feat(dist): Add limit validation #1386
Conversation
Make sure we limit the lenght of the incoming distribution name, which should not be longer than 64 characters, which is enforced on the DB side. This change just adds the validation as closer to the user as possible.
} else if v.len() > 64 { | ||
Err( | ||
"Invalid distribution name. Distribution name must not be longer than 64 characters." | ||
.to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets me thinking, how do we handle unicode characters? They might exceed string length 64 even if the number of characters is lower. I assume that the limit enforced on sentry side is applied to the number of characters, not the number of bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good point! On the relay side we use bytecount::num_chars and check the actual bytes. We might want to do here similar.
Looks good. Can you update unicode handling mentioned above? As for lint errors, they should be resolved on master now. |
@kamilogorek done, PTAL! |
I've canceled the CI since there is a test which does not progress. This test is stuck on my mac laptop as well:
|
No worries, fixed it |
Make sure we limit the length of the incoming distribution name, which should not be longer than 64 characters, which is enforced on the DB side.
This change just adds the validation as closer to the user as possible.
related: getsentry/relay#1556