oracle / oracle/oci-java-sdk

SessionTokenAuthenticationDetailsProvider httpClient resource leak

Open
#652 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

SDK
Dominant language
Java
Stars
243
Forks
171
Avg merge
30m
Merged PRs (30d)
4

Description

We're using SessionTokenAuthenticationDetailsProvider for our local development and testing, Noticed that httpClient is not closed during refreshSessionToken.

The snippet causing the leak is as below. Kindly enclose within try or close the http client. Thanks.

`public synchronized boolean refreshSessionToken() {
com.oracle.bmc.Service service =
Services.serviceBuilder().serviceName("auth").serviceEndpointPrefix("auth").build();
String endpoint = Region.formatDefaultRegionEndpoint(service, region);
LOG.debug(
"Refreshing session token, refresh endpoint: {}/v1/authentication/refresh",
endpoint);

    try {
        HttpClient httpClient =
                HttpProvider.getDefault()
                        .newBuilder()
                        .baseUri(endpoint)
                        .registerRequestInterceptor(
                                Priorities.AUTHENTICATION,
                                new AuthnClientFilter(
                                        DefaultRequestSigner.createRequestSigner(this),
                                        Collections.emptyMap()))
                        .build();

        SessionTokenRefreshRequest request =
                new SessionTokenRefreshRequest((this.sessionToken));`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SessionTokenAuthenticationDetailsProvider.refreshSessionToken(), focusing on the HttpClient created through HttpProvider.getDefault(). Trace the refresh flow and ensure the client is closed when the operation finishes, including failure paths; done means the refresh no longer leaks the HTTP resource.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authentication
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.