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

HttpClient builder - setReadTimeout() missing #105

Open
dawidg-doyen opened this issue Oct 31, 2023 · 1 comment
Open

HttpClient builder - setReadTimeout() missing #105

dawidg-doyen opened this issue Oct 31, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@dawidg-doyen
Copy link
Contributor

Hi

I've been developing some vuln detectors / plugins.
It seems that HttpClient is currently missing setReadTimeout() method as I wasn't able to set it via:

this.httpClient = httpClient.modify().setReadTimeout(Duration.ofSeconds(15)).build();

As some services take longer to respond, or to process user input, it is important to have the option to increase read timeouts to prevent false positives when attempting to exploit RCE issues etc.

I found the following reference to this issue within Tsunami scanner code in

tsunami-security-scanner/common/src/main/java/com/google/tsunami/common/net/http/OkHttpHttpClient.java:

  // TODO(b/145315535): add more configurable options into the builder.
  public static class OkHttpHttpClientBuilder extends Builder<OkHttpHttpClient> {
    private final OkHttpClient okHttpClient;

So it appears that this issue is already being tracked under 145315535 somewhere.

Thanks
Dawid

@maoning maoning self-assigned this Nov 8, 2023
@maoning
Copy link
Collaborator

maoning commented Nov 8, 2023

Hi Dawid,

This was a leftover artifact from my incomplete cleanup, thank you for spotting it. I wanted to collapse all the okhttpclient timeouts into a single timeout "ConnectionTimeout" to keep the API simple so that it is easier for users to configure tsunami as well as easier to switch to a different httpclient in the future. Currently all the timeouts inside okhttpclient are set to the same value as what's defined by the connection timeouts.

            .callTimeout(Duration.ofSeconds(connectTimeoutSeconds))
            .connectTimeout(Duration.ofSeconds(connectTimeoutSeconds))
            .readTimeout(Duration.ofSeconds(connectTimeoutSeconds))
            .writeTimeout(Duration.ofSeconds(connectTimeoutSeconds))

We currently set the timeout to 180s for production tsunami runs.

Let me know if you think there's a strong reason to make different types of timeout configurable as a tsunami user. Otherwise I will remove the Read & Write timeout options from tsunami cli, and only keep the connection timeout option to remove the confusion.

@tooryx tooryx added the enhancement New feature or request label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants