Skip to content

Commit dbf074a

Browse files
ldemattegeorgewallace
authored andcommitted
Add missing APM entitlements (elastic#123462)
1 parent 176015c commit dbf074a

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement;
3535
import org.elasticsearch.entitlement.runtime.policy.entitlements.ReadStoreAttributesEntitlement;
3636
import org.elasticsearch.entitlement.runtime.policy.entitlements.SetHttpsConnectionPropertiesEntitlement;
37+
import org.elasticsearch.entitlement.runtime.policy.entitlements.WriteSystemPropertiesEntitlement;
3738

3839
import java.lang.instrument.Instrumentation;
3940
import java.lang.reflect.Constructor;
@@ -262,15 +263,17 @@ private static PolicyManager createPolicyManager() {
262263
var serverPolicy = new Policy("server", serverScopes);
263264
// agents run without a module, so this is a special hack for the apm agent
264265
// this should be removed once https://github.com/elastic/elasticsearch/issues/109335 is completed
266+
// See also modules/apm/src/main/plugin-metadata/entitlement-policy.yaml
265267
List<Entitlement> agentEntitlements = List.of(
266268
new CreateClassLoaderEntitlement(),
267269
new ManageThreadsEntitlement(),
268270
new SetHttpsConnectionPropertiesEntitlement(),
269271
new OutboundNetworkEntitlement(),
272+
new WriteSystemPropertiesEntitlement(Set.of("AsyncProfiler.safemode")),
273+
new LoadNativeLibrariesEntitlement(),
270274
new FilesEntitlement(
271275
List.of(
272-
FileData.ofPath(Path.of("/co/elastic/apm/agent/"), READ),
273-
FileData.ofPath(Path.of("/agent/co/elastic/apm/agent/"), READ),
276+
FileData.ofPath(bootstrapArgs.logsDir(), READ_WRITE),
274277
FileData.ofPath(Path.of("/proc/meminfo"), READ),
275278
FileData.ofPath(Path.of("/sys/fs/cgroup/"), READ)
276279
)

modules/apm/src/main/plugin-metadata/entitlement-policy.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,3 @@ org.elasticsearch.telemetry.apm:
8383
- elastic.apm.application_packages
8484
- elastic.apm.stack_trace_limit
8585
- elastic.apm.span_stack_trace_min_duration
86-
elastic.apm.agent:
87-
- set_https_connection_properties
88-
- write_system_properties:
89-
properties:
90-
- AsyncProfiler.safemode
91-
- load_native_libraries

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,6 @@ tests:
290290
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
291291
method: testEnrichExplosionManyMatches
292292
issue: https://github.com/elastic/elasticsearch/issues/122913
293-
- class: org.elasticsearch.test.apmintegration.TracesApmIT
294-
method: testApmIntegration
295-
issue: https://github.com/elastic/elasticsearch/issues/122129
296293
- class: org.elasticsearch.repositories.gcs.GoogleCloudStorageServiceTests
297294
method: testClientsAreNotSharedAcrossRepositories
298295
issue: https://github.com/elastic/elasticsearch/issues/123090

0 commit comments

Comments
 (0)