Graylog2 / Graylog2/graylog-plugin-integrations

Incorrect injection of builders in AWS service classes

Open
#680 0 comments 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
Java
Stars
17
Forks
14
PR merge metrics
No merged PRs in 30d

Description

## Description
It appears that the injection of the `IamClientBuilder`, `KinesisClientBuilder` and `CloudWatchLogsClientBuilder` in [Integrations AWS Service classes](https://github.com/Graylog2/graylog-plugin-integrations/blob/572efeda585a8061c4030794a1034f9c82db11bc/src/main/java/org/graylog/integrations/aws/service/) is currently being done incorrectly. In the current implementation, a single instance of the builders is injected and reused for each client creation. I suppose this has no actual symptoms (unless there is some edge case I am not seeing), since the config properties are re-written each time the client is instantiated.

See example in [CloudWatchService](https://github.com/Graylog2/graylog-plugin-integrations/blob/572efeda585a8061c4030794a1034f9c82db11bc/src/main/java/org/graylog/integrations/aws/service/CloudWatchService.java#L58)

See [here](https://github.com/Graylog2/graylog-plugin-integrations/blob/572efeda585a8061c4030794a1034f9c82db11bc/src/main/java/org/graylog/integrations/IntegrationsModule.java#L134) for the registration of the builders.

I suggest that the change the constructors to instead inject a `Provider<>` or factory class instead that creates a new builder each time one is needed instead of reusing the same one.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.