Skip to content

Add CodeQL query: WebClient.create without idle timeout (java/vertx/webclient-missing-idle-timeout) - #21

Draft
carlspring with Copilot wants to merge 2 commits into
masterfrom
copilot/implement-codeql-rule-webclient-idletimeout
Draft

Add CodeQL query: WebClient.create without idle timeout (java/vertx/webclient-missing-idle-timeout)#21
carlspring with Copilot wants to merge 2 commits into
masterfrom
copilot/implement-codeql-rule-webclient-idletimeout

Conversation

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Implements a new CodeQL rule detecting WebClient.create calls that omit a WebClientOptions with an explicit setIdleTimeout, which can leave connections hanging indefinitely and exhaust resources.

Query (WebClientMissingIdleTimeout.ql)

Flags two cases:

  • WebClient.create(vertx) — no WebClientOptions passed at all
  • WebClient.create(vertx, options) — options passed but setIdleTimeout never called on the variable
// Flagged — no options, no idle timeout
WebClient client = WebClient.create(vertx);

// Safe — explicit idle timeout set
WebClientOptions options = new WebClientOptions()
        .setIdleTimeout(30)
        .setIdleTimeoutUnit(TimeUnit.SECONDS);
WebClient client = WebClient.create(vertx, options);

Metadata: @id java/vertx/webclient-missing-idle-timeout, severity warning, security-severity 5.0.

Supporting files

  • .qhelp — help file with overview, recommendation, and annotated examples
  • Example Java sources — insecure/secure samples referenced from the help file (src/main/ql/java/.../webclient/)
  • Test stubs — minimal WebClient and WebClientOptions stubs under src/test/ql/test/stubs/io/vertx/ext/web/client/
  • Test caseInsecureWebClient.java (expected alert) and SecureWebClient.java (no alert) with .qlref, .expected, and options files

Co-authored-by: carlspring <1436265+carlspring@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement CodeQL rule for WebClient.create without setIdleTimeout Add CodeQL query: WebClient.create without idle timeout (java/vertx/webclient-missing-idle-timeout) Aug 4, 2026
Copilot AI requested a review from carlspring August 4, 2026 00:33
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.

Implement a CodeQL rule for cases where WebClient.create is used without setting a WebClientOptions with an explicit setIdleTimeout

2 participants