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(webhook): add new webhook.followRedirects property #4838

Merged
merged 2 commits into from
Feb 16, 2025

Conversation

dbyron-sf
Copy link
Contributor

Default to true so there's no behavior change. When false, don't follow redirects in webhook stages.

to pave the way for a new followRedirects config property.
Default to true so there's no behavior change.  When false, don't follow redirects in
webhook stages.
@@ -114,11 +114,18 @@ public ClientHttpRequestFactory webhookRequestFactory(

validateResponseSize(response, webhookProperties.getMaxResponseBytes());

if (webhookProperties.isVerifyRedirects() && response.isRedirect()) {
// verify that we are not redirecting to a restricted url
if (response.isRedirect()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So I see we have this validateRequestSize and validateResponseSize, would it make sense to move this to a method called validateAnyRedirects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We didn't decide the isRedirect method name here. It's a method on the okhttp3.Response class.

We do get to decide property names though, and I figured followRedirects was consistent with the existing verifyRedirects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aaah, I see...We could move all this logic to a separate method for handling redirect validation...yes, that makes sense.

Copy link
Contributor

@xibz xibz left a comment

Choose a reason for hiding this comment

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

Very minor comment. Mostly for consistency

@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Feb 16, 2025
@mergify mergify bot added the auto merged Merged automatically by a bot label Feb 16, 2025
@mergify mergify bot merged commit 4032c74 into spinnaker:master Feb 16, 2025
4 checks passed
@dbyron-sf dbyron-sf deleted the webhook-no-redirects branch February 16, 2025 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for merge target-release/1.37
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants