[APM] Update non auth endpoints with authz info (#206289)

## Summary

Closes https://github.com/elastic/kibana/issues/206252


As part of the Authz migration, we updated the endpoints that didn’t
have any authorization restrictions to match the
[documentation](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization#opting-out-of-authorization-for-specific-routes)
requirements.
This commit is contained in:
Irene Blanco 2025-01-13 10:25:27 +01:00 committed by GitHub
parent f77dc3d043
commit b328fe89c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,7 +36,13 @@ function throwNotFoundIfFleetMigrationNotAvailable(featureFlags: ApmFeatureFlags
const hasFleetDataRoute = createApmServerRoute({
endpoint: 'GET /internal/apm/fleet/has_apm_policies',
options: { tags: [] },
security: {
authz: {
enabled: false,
reason:
"It's being used in the tutorial page, so it needs to be available for users even if they don't have APM permissions.",
},
},
handler: async ({ core, plugins }): Promise<{ hasApmPolicies: boolean }> => {
const fleetPluginStart = await plugins.fleet?.start();
if (!fleetPluginStart) {
@ -53,7 +59,13 @@ const hasFleetDataRoute = createApmServerRoute({
const fleetAgentsRoute = createApmServerRoute({
endpoint: 'GET /internal/apm/fleet/agents',
options: { tags: [] },
security: {
authz: {
enabled: false,
reason:
"It's being used in the tutorial page, so it needs to be available for users even if they don't have APM permissions.",
},
},
handler: async ({ core, plugins }): Promise<FleetAgentResponse> => {
return getFleetAgents({
coreStart: await core.start(),
@ -182,7 +194,13 @@ const createCloudApmPackagePolicyRoute = createApmServerRoute({
const javaAgentVersions = createApmServerRoute({
endpoint: 'GET /internal/apm/fleet/java_agent_versions',
options: { tags: [] },
security: {
authz: {
enabled: false,
reason:
'It returns static information stored in a public file in https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/maven-metadata.xml',
},
},
handler: async (): Promise<{ versions: string[] | undefined }> => {
const versions = await getJavaAgentVersionsFromRegistry();
return {