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

[APM] ensure rum_allow_origins setting only saves valid YAML strings #128704

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

ogupte
Copy link
Contributor

@ogupte ogupte commented Mar 29, 2022

Closes #128703.

Ensures that the text values set in the rum_allow_origins setting (apm-server.rum.allow_origins) will be checked if they are valid YAML strings and then wrapped in quotes if not. This fixes the bug #121934 (in the short term) that would fail when the user attempts to migrate from classic indices / standalong APM server to a fleet-managed APM server agent policy. The fix validates and updates the settings values only when a user attempts the migration.

Screen Shot 2022-03-28 at 9 23 09 PM
Screen Shot 2022-03-28 at 9 22 59 PM

@ogupte ogupte requested a review from a team as a code owner March 29, 2022 01:25
@botelastic botelastic bot added the Team:APM - DEPRECATED Use Team:obs-ux-infra_services. label Mar 29, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@@ -65,7 +66,7 @@ export async function createCloudApmPackgePolicy({
savedObjectsClient,
esClient,
mergedAPMPackagePolicy,
{ force: true, bumpRevision: true }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures the package policy ID is set correct. There was a bug previously in #128496 .

@@ -73,6 +72,9 @@ function getApmPackageInputVars({
}): Record<string, { type: string; value: any }> {
const overrideValues: Record<string, any> = {
url: cloudPluginSetup?.apm?.url, // overrides 'apm-server.url' to be the cloud APM host
rum_allow_origins: ensureValidMultiText(
apmServerSchema[INPUT_VAR_NAME_TO_SCHEMA_PATH.rum_allow_origins]
), // fixes issue where "*" needs to be wrapped in quotes to be parsed as a YAML string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is specific to rum_allow_origins since it's the only type: "text", multi: true input var that accepts wildcard string values (allows all origins). But we could apply this to all similar values if we want to.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@MiriamAparicio MiriamAparicio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ogupte for doing this and for the comments to help us understand the changes 🌟

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 128704 or prevent reminders by adding the backport:skip label.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 31, 2022
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 128704 or prevent reminders by adding the backport:skip label.

@spalger spalger added the backport:skip This commit does not require backporting label Apr 1, 2022
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:fix Team:APM - DEPRECATED Use Team:obs-ux-infra_services. v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] ensure rum_allow_origins setting only saves valid YAML strings
6 participants