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

Remove unnecessary IpSchema #2175

Merged
merged 1 commit into from
Dec 5, 2024
Merged

Remove unnecessary IpSchema #2175

merged 1 commit into from
Dec 5, 2024

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Dec 5, 2024

Summary

We validate the IP address in order to prevent Account creation abuse using our IpSchema. However, this schema re-exports a native zod method, with no custom adjustments.

This removes the IpSchema, using the validation method directly instead.

Changes

  • Remove IpSchema and associated test.

@iamacook iamacook self-assigned this Dec 5, 2024
@iamacook iamacook requested a review from a team as a code owner December 5, 2024 07:20
const { success: isValidIp } = IpSchema.safeParse(clientIp);
if (!clientIp || !isValidIp) {
const { success: isValidIp } = z.string().ip().safeParse(clientIp);
if (!isValidIp) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clientIp check is not needed as a falsy value will fail validation.

@iamacook iamacook merged commit 7b55a0e into main Dec 5, 2024
20 checks passed
@iamacook iamacook deleted the remove-ip-schema branch December 5, 2024 10:29
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.

2 participants