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

fix(xp-treatment,plugin): Fix treatment service and plugin's method of initiating management service client #89

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

deadlycoconuts
Copy link
Contributor

@deadlycoconuts deadlycoconuts commented Jan 21, 2025

What this PR does / why we need it:
In the XP plugin manager, the Management Service client is always initialised with a Google client, meaning that it always expects a Google service account's or user's credentials to always be present for authenticating all outgoing requests from the plugin. Failing to configure either of these will cause the plugin manager to fail at start up since the Google client cannot be initialised properly. This PR removes the need of any Google credentials and instead allows the Management Service client to be started up with a default HTTP client.

In a somewhat similar fashion, the XP Treatment Service also attempts to initialise a Google client with the aforementioned credentials (and fails at start up if they aren't configured) if the ManagementService.AuthorizationEnabled config is set to true. This is problematic in two ways, the first is similar to what is described above - if there aren't any Google credentials configured, the application would simply fail at start up, and the second is with the inconsistent naming/usage of the AuthorizationEnabled field. Across all the CaraML products (including the XP Management Service), authorization is handled by a separate enforcer layer that determines the permissions associated with a certain user/request but in the XP Treatment Service, this is taken to mean authentication instead, since the initialisation of the Google client only serves to append identity-specific headers to identify the sender of all outgoing requests. This PR thus also refactors away the ManagementService.AuthorizationEnabled field and instead just attempts to initialise a Google client but if that fails, uses a regular default HTTP client instead.

Which issue(s) this PR fixes:
Fixes #

@deadlycoconuts deadlycoconuts added the bug Something isn't working label Jan 21, 2025
@deadlycoconuts deadlycoconuts self-assigned this Jan 21, 2025
@deadlycoconuts deadlycoconuts marked this pull request as ready for review January 21, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant