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: validate --host flag for IP address #124

Merged
merged 3 commits into from
Sep 19, 2024

Conversation

abuchanan-airbyte
Copy link
Collaborator

image

Since this validation happens before the telemetry.Wrap call, this should eliminate this category of errors from our error tracking.

@abuchanan-airbyte abuchanan-airbyte requested a review from a team as a code owner September 18, 2024 20:09
}

for _, host := range i.Host {
if regexp.MustCompile(`\d+\.\d+\.\d+\.\d+`).MatchString(host) {
Copy link
Member

Choose a reason for hiding this comment

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

We should replace this with the net.ParseIP method, as that also supports ipv6 ip addresses.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice, great idea

@abuchanan-airbyte
Copy link
Collaborator Author

@colesnodgrass I added more validation. I noted the error messages in the logs actually provide a regex pattern, which covers more ground than just looking for IP addresses.

The tests I added are examples that come from error logs in the telemetry.

@abuchanan-airbyte abuchanan-airbyte merged commit f4db29a into main Sep 19, 2024
2 checks passed
@abuchanan-airbyte abuchanan-airbyte deleted the abuch/validate-host-flag branch September 19, 2024 16:53
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