Skip to content
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

Merged
merged 4 commits into from Nov 7, 2022

Conversation

olksdr
Copy link
Contributor

@olksdr olksdr commented Nov 4, 2022

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

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.
@olksdr olksdr requested review from kamilogorek and a team November 4, 2022 10:28
@olksdr olksdr self-assigned this Nov 4, 2022
} else if v.len() > 64 {
Err(
"Invalid distribution name. Distribution name must not be longer than 64 characters."
.to_string(),
Copy link
Member

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.

Copy link
Contributor Author

@olksdr olksdr Nov 4, 2022

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.

@kamilogorek
Copy link
Contributor

Looks good. Can you update unicode handling mentioned above? As for lint errors, they should be resolved on master now.

@olksdr olksdr requested a review from jjbayer November 7, 2022 16:10
@olksdr
Copy link
Contributor Author

olksdr commented Nov 7, 2022

@kamilogorek done, PTAL!

@olksdr
Copy link
Contributor Author

olksdr commented Nov 7, 2022

I've canceled the CI since there is a test which does not progress.

This test is stuck on my mac laptop as well:

test integration::send_event::command_send_event_raw has been running for over 60 seconds

@kamilogorek kamilogorek enabled auto-merge (squash) November 7, 2022 16:47
@kamilogorek
Copy link
Contributor

No worries, fixed it

@kamilogorek kamilogorek merged commit 04ab49d into master Nov 7, 2022
@kamilogorek kamilogorek deleted the feat/add-limit-varification-to-distribution branch November 7, 2022 20:25
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.

None yet

3 participants