Skip to content

Commit

Permalink
Fix #651: Potential Netty memory leak when calling callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
banterCZ committed Aug 10, 2023
1 parent f7105d3 commit 62718da
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
17 changes: 10 additions & 7 deletions docs/Configuration-Properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ The PowerAuth Server uses the following public configuration properties:

## HTTP Configuration

| Property | Default | Note |
|---|---|---|
| `powerauth.service.http.proxy.enabled` | `false` | Whether proxy is enabled for outgoing HTTP requests |
| `powerauth.service.http.proxy.host` | `127.0.0.1` | Proxy host for outgoing HTTP requests |
| `powerauth.service.http.proxy.port` | `8080` | Proxy port for outgoing HTTP requests |
| `powerauth.service.http.proxy.username` | `_emtpy_` | Proxy username for outgoing HTTP requests |
| `powerauth.service.http.proxy.password` | `_empty_` | Proxy password for outgoing HTTP requests |
| Property | Default | Note |
|---------------------------------------------------|-------------|-----------------------------------------------------|
| `powerauth.service.http.proxy.enabled` | `false` | Whether proxy is enabled for outgoing HTTP requests |
| `powerauth.service.http.proxy.host` | `127.0.0.1` | Proxy host for outgoing HTTP requests |
| `powerauth.service.http.proxy.port` | `8080` | Proxy port for outgoing HTTP requests |
| `powerauth.service.http.proxy.username` | `_emtpy_` | Proxy username for outgoing HTTP requests |
| `powerauth.service.http.proxy.password` | `_empty_` | Proxy password for outgoing HTTP requests |
| `powerauth.service.http.connection.timeout` | `5s` | HTTP connection timeout |
| `powerauth.service.http.response.timeout` | `60s` | HTTP response timeout |
| `powerauth.service.http.connection.max-idle-time` | `200s` | HTTP max idle time |

## Spring Vault Configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import jakarta.annotation.PostConstruct;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.time.DurationMin;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
Expand All @@ -45,6 +47,8 @@
@Configuration
@ConfigurationProperties("ext")
@Validated
@Getter
@Setter
public class PowerAuthServiceConfiguration {

/**
Expand Down Expand Up @@ -208,6 +212,18 @@ public class PowerAuthServiceConfiguration {
@Value("${powerauth.service.http.connection.timeout}")
private Duration httpConnectionTimeout;

/**
* HTTP response timeout.
*/
@Value("${powerauth.service.http.response.timeout}")
private Duration httpResponseTimeout;

/**
* HTTP connection max idle time.
*/
@Value("${powerauth.service.http.connection.max-idle-time}")
private Duration httpMaxIdleTime;

/**
* Specifies the validity duration of token timestamps, checked before token validation.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,12 @@ private RestClient initializeRestClient(CallbackUrlEntity callbackUrlEntity) thr
if (configuration.getHttpConnectionTimeout() != null) {
builder.connectionTimeout(configuration.getHttpConnectionTimeout());
}
if (configuration.getHttpResponseTimeout() != null) {
builder.responseTimeout(configuration.getHttpResponseTimeout());
}
if (configuration.getHttpMaxIdleTime() != null) {
builder.maxIdleTime(configuration.getHttpMaxIdleTime());
}
if (configuration.getHttpProxyEnabled()) {
final DefaultRestClient.ProxyBuilder proxyBuilder = builder.proxy().host(configuration.getHttpProxyHost()).port(configuration.getHttpProxyPort());
if (configuration.getHttpProxyUsername() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ powerauth.service.http.proxy.port=8080
powerauth.service.http.proxy.username=
powerauth.service.http.proxy.password=

# HTTP Connection Timeout in ISO-8601 duration format PTnHnMn.nS
powerauth.service.http.connection.timeout=PT5S
# HTTP Connection Configuration
powerauth.service.http.connection.timeout=5s
powerauth.service.http.response.timeout=60s
powerauth.service.http.connection.max-idle-time=200s

# Token Timestamp Validity in ISO-8601 duration format PTnHnMn.nS
powerauth.service.token.timestamp.validity=PT2H
Expand Down

0 comments on commit 62718da

Please sign in to comment.