Skip to content

Uri validator bug #376

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

Merged
merged 2 commits into from
Jan 20, 2023
Merged

Uri validator bug #376

merged 2 commits into from
Jan 20, 2023

Conversation

tebriel
Copy link
Contributor

@tebriel tebriel commented Jan 18, 2023

Fixes #375 which outlined a bug with the new config validation.

The splunk.hec.uri can be either a single URI or a comma-separated list. This PR updates the config validation to split the URI on , like we do in configuration processing, and then use the first URI to validate.

I think this could potentially run into edge cases where you've mixed http and https URIs in the splunk.hec.uri setting, though if you're doing this maybe you don't really want validation anyways.

Added a test case which errored before the change and passed after, hopefully this is sufficient to un-break v2.1.0.

/cc @deep-splunk @harshit-splunk

@tebriel tebriel marked this pull request as draft January 18, 2023 20:46
@tebriel tebriel temporarily deployed to workflow-approval January 18, 2023 20:56 — with GitHub Actions Inactive
@tebriel tebriel marked this pull request as ready for review January 18, 2023 20:56
@VihasMakwana
Copy link
Contributor

LGTM!

@github-actions
Copy link

Unit Test Results

161 tests   161 ✔️  38s ⏱️
  23 suites      0 💤
  23 files        0

Results for commit b006847.

@hvaghani221
Copy link
Contributor

Thank you @tebriel for finding and fixing the bug. We had multiple support cases where customers had an issue with splunk configurations and logs were not doing a great job of finding it. So, we decided to add pre-validation to those configurations. It will allow the detection of these issues ASAP. But it looks like we have missed this one.

Now that we have found this bug, there is a chance that there will be more bugs as well. What do you think about making validation configurable as a user?

@tebriel
Copy link
Contributor Author

tebriel commented Jan 19, 2023

@harshit-splunk that was my first thought when I saw this bug, either a non-creating API for connector/validate which takes the JSON or a flag of validate={true,false} in the URL parameters to be able to skip the validation if I feel like it's not doing the right thing.

I haven't written Java professionally before, so this is just me copying the style of other bits of code and cobbling them together. I could take a stab at the validate query parameter but I'm not sure if one of the maintainers would be able to do so better/faster.

@tebriel
Copy link
Contributor Author

tebriel commented Jan 19, 2023

After looking at the SinkConnector Java class and remembering that we're being called through Kafka-Connect, I don't know that there is a direct way to avoid validation. I think for a separate PR someone could add a new splunk connector configuration value of splunk.configuration.validate and then the validate function could either do its thing or skip validation entirely. For now, I think it's probably enough to merge this bugfix and plan out that feature in a separate release.

@VihasMakwana
Copy link
Contributor

After looking at the SinkConnector Java class and remembering that we're being called through Kafka-Connect, I don't know that there is a direct way to avoid validation. I think for a separate PR someone could add a new splunk connector configuration value of splunk.configuration.validate and then the validate function could either do its thing or skip validation entirely. For now, I think it's probably enough to merge this bugfix and plan out that feature in a separate release.

Yes, we'll create a separate PR for that feature i.e. to make validations configurable.
Thanks for your findings ;)

@hvaghani221 hvaghani221 merged commit 63c3545 into splunk:develop Jan 20, 2023
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.

Bug in new Connector Validation
3 participants