Commit Graph

1131 Commits

Author SHA1 Message Date
Ryan Ernst 60ad8ba744
Remove custom SecurityManager (#127778)
Since SecurityManager is no longer used, the custom subclass of
SecurityManager, SecureSM, is no longer needed.
2025-05-06 16:16:46 -07:00
Ryan Ernst b78ac7c94c
Remove PrivilegedOperations (#127726)
With the SecurityManager gone, the PrivilegedOperations class is no
longer needed, these operations can be called directly.
2025-05-06 10:50:49 -07:00
Lorenzo Dematté 79ee234721
Extract hardcoded entitlements creation to a separate class (#127698)
Moving creation of hardcoded entitlements (server policy + APM agent) to a separate class
2025-05-05 19:43:41 +02:00
Lorenzo Dematté f90b01597c
Move FilesEntitlements validation to a separate class (#127703)
Moves FilesEntitlements validation to a separate class. This is the final PR to make EntitlementsInitialization a simpler "orchestrator" of the various steps in the initialization phase.
2025-05-05 17:41:22 +02:00
Lorenzo Dematté 23ab059252
[Entitlements] Extract instrumentation initialization to a separate class (#127702) 2025-05-05 16:08:18 +02:00
Ankit Sethi 94854b3a3f
Remove dangling spaces wherever found. (#127475)
* Remove dandling spaces wherever found.

This PR addresses #117067 , a report about unexpected spaces breaking message parsers built by customers. I used the regex `(\. \")(?![A-Z(a-z_0-9-;<%\/\.+ \t\n]+)` to detect such instances and clean up. In one case, a minor code improvement helps add optional spaces as necessary for a multi-sentence error message.

* fix test

* Update docs/changelog/127475.yaml

* correct logic

* fix test

* fix tests

* fix tests

* fix tests

* Update docs/changelog/127475.yaml

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/action/TransportGetInferenceModelAction.java

Co-authored-by: Slobodan Adamović <slobodanadamovic@users.noreply.github.com>

* Update libs/x-content/src/main/java/org/elasticsearch/xcontent/ObjectParser.java

Co-authored-by: Slobodan Adamović <slobodanadamovic@users.noreply.github.com>

* correctly reference issue

* Update docs/changelog/127475.yaml

---------

Co-authored-by: Slobodan Adamović <slobodanadamovic@users.noreply.github.com>
2025-05-01 10:33:54 -05:00
Benjamin Trent 74faf47121
New bulk scorer for binary quantized vectors via optimized scalar quantization (#127189)
* New bulk scorer for binary quantized vectors via optimized scalar quantization

* fixing headers

* fixing tests
2025-04-29 07:42:08 -04:00
Lorenzo Dematté e9bedf1184
[Entitlements] Small docs fixes (#127323) 2025-04-24 18:11:18 +02:00
Simon Cooper c5ada66410
Copy Lucene99FlatVectorsReader allowing direct IO to be specified directly (#125921)
We want to use DirectIO to access raw vector data randomly so it doesn't load everything into the page cache
2025-04-24 11:00:30 +01:00
Lorenzo Dematté 002fef75ff
[Entitlements] Fix: consider case sensitiveness differences (#126990)
Our path comparison for file access is string based, due to the fact that we need to support Paths created for different file systems/platforms.
However, Windows files and paths are (sort of) case insensitive.
This PR fixes the problem by abstracting String comparison operations and making them case sensitive or not based on the host OS.
2025-04-23 20:23:45 +02:00
Benjamin Trent 059f91c90c
Panama vector accelerated optimized scalar quantization (#127118)
* Adds accelerates optimized scalar quantization with vectorized functions

* Adding benchmark

* Update docs/changelog/127118.yaml

* adjusting benchmark and delta
2025-04-23 12:51:04 -04:00
Patrick Doyle 4d929ca986
Clean up PolicyManager and ScopeResolver tests (#127115)
* Simplify PolicyManagerTests

* Clean and simplify ScopeResolverTests
2025-04-23 08:57:57 -04:00
Ryan Ernst b5e92db171
Remove security manager from tests (#127087)
Now that entitlements are always used, there is no need to run tests
with security manager (a future enhancement will run tests with
entitlements). This commit removes setting up security manager from
tests.
2025-04-22 18:08:09 +02:00
Lorenzo Dematté 73d31533c6
[Entitlements] Improve FileAccessTree logging (#127050)
We already had logging in FileAccessTree as result of debugging the \\pipe\ failures a while ago; this PR slightly improves the logs to provide more information.
2025-04-22 16:39:36 +02:00
Lorenzo Dematté 02493f35f3
Add package-info.java and javadocs to document Entitlements design and implementation (#127023)
Design and implementation of Entitlement with this level of detail needs to stay close to the code, and take advantage of javadoc features like linking and class-references to help us with refactorings and future code changes.

The bulk of the information went into the package-info file for the main library, but I split up some parts and referenced them from the main doc, where I thought it made sense (mainly: the bridge sub-project for some implementation details, PolicyManager, EntitlementInitialization and FileAccessTree); this way they still can be reached from the "overview" while being closer to where the information really belongs.

Relates to ES-11284
2025-04-22 10:46:20 +02:00
Patrick Doyle 15c2c467e7
Refactor: ScopeResolver (#126921)
* Fix: use getScopeName consistently

* Rename PolicyManagerTests method

* Refacor: simplify PluginsResolver.create

* Change PluginsResolver to ScopeResolver

* Move boot layer test to ScopeResolverTests

* [CI] Auto commit changes from spotless

* Rename PolicyScope

* Add ComponentKind enum

* Package private componentName field

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-04-21 17:35:10 +02:00
Jack Conradson 1234f97031
Refactor file path resolution for entitlements (#127040)
This change refactors the known directory resolution such as modules, 
plugins, lib, etc. into a PathLookup. This is one of the steps towards 
allowing unit tests to provide their own PathLookup for resolution so 
we can enable entitlements there.

ES-11584
2025-04-21 06:53:56 -07:00
Ryan Ernst 0d2bc75301
Make sure SM isn't running alongside entitlements tests (#127082)
closes #127077
2025-04-19 02:37:13 +02:00
Lorenzo Dematté 69f6520b0c
[Entitlements] Validation checks on paths (#126852)
With this PR we restrict the paths we allow access to, forbidding plugins to specify/request entitlements for reading or writing to specific protected directories.

I added this validation to EntitlementInitialization, as I wanted to fail fast and this is the earliest occurrence where we have all we need: PathLookup to resolve relative paths, policies (for plugins, server, agents) and the Paths for the specific directories we want to protect.

Relates to ES-10918
2025-04-18 15:36:07 +02:00
Lorenzo Dematté 115062c643
Fix vec_caps to test for OS support too (on x64) (#126911)
On x64, we are testing if we support vector capabilities (1 = "basic" = AVX2, 2 = "advanced" = AVX-512) in order to enable and choose a native implementation for some vector functions, using CPUID.

However, under some circumstances, this is not sufficient: the OS on which we are running also needs to support AVX/AVX2 etc; basically, it needs to acknowledge it knows about the additional register and that it is able to handle them e.g. in context switches. To do that we need to a) test if the CPU has xsave feature and b) use the xgetbv to test if the OS set it (declaring it supports AVX/AVX2/etc).

In most cases this is not needed, as all modern OSes do that, but for some virtualized situations (hypervisors, emulators, etc.) all the component along the chain must support it, and in some cases this is not a given.

This PR introduces a change to the x64 version of vec_caps to check for OS support too, and a warning on the Java side in case the CPU supports vector capabilities but those are not enabled at OS level.

Tested by passing noxsave to my linux box kernel boot options, and ensuring that the avx flags "disappear" from /proc/cpuinfo, and we fall back to the "no native vector" case.

Fixes #126809
2025-04-16 16:06:46 +02:00
Ryan Ernst 6174acdc39
Workaround max name limit imposed by Jackson 2.17 (#126806)
In Jackson 2.15 a maximum string length of 50k characters was
introduced. We worked around that by override the length to max int on
all parsers created by xcontent. Jackson 2.17 introduced a similar limit
on field names. This commit mimics the workaround for string length by
overriding the max name length to be unlimited.

relates #58952
2025-04-15 11:40:27 -07:00
Ryan Ernst bf53927d71
Remove unnecessary network entitlements from server (#126799)
These entitlements should not be necessary. Server does not directly
create any outbound connections, and netty is not a dependency of server
so it should not exist within the server policy.
2025-04-15 11:39:29 -07:00
Simon Cooper 1f249c74eb
Tweak the delta used for vector scorer tests (#126849)
New panama operations in Lucene 10.2 change the results we get from vector operations slightly
2025-04-15 15:46:23 +01:00
Ignacio Vera ffdfcec334
Upgrade to Lucene 10.2.0 (#126594)
This commit upgrade Elasticsearch to lucene 10.2.0
2025-04-14 13:50:52 +02:00
Patrick Doyle e4b7b06d1b
Reword Suppress a Benign Warning section (#126546) 2025-04-11 14:51:34 -04:00
Ryan Ernst 2986d738c6
Simplify entitlement rest test discovery (#125449)
This commit cleans up how entitlement test methods are discovered. It
also adds another robustness check to ensure an annotation doesn't exist
on a private method.
2025-04-09 07:24:17 -07:00
Ryan Ernst 3bac50e818
Use logs dir as working directory (#124966)
In the unexpected case that Elasticsearch dies due to a segfault or
other similar native issue, a core dump is useful in diagnosing the
problem. Yet core dumps are written to the working directory, which is
read-only for most installations of Elasticsearch. This commit changes
the working directory to the logs dir which should always be writeable.
2025-04-09 07:07:11 -07:00
Lorenzo Dematté e52288d330
[Entitlements] Expand and update README (#125395)
This PR expands the README for the entitlements package; it adds information for Elasticsearch developers on how the system is structured, how to build policies, what to do when new code "does not work" because it's bumping into a NotEntitledException, and how to apply a policy patch in case of an emergency.
2025-04-04 08:17:44 +01:00
Lorenzo Dematté e4ce993c16
[Entitlements] Fix PolicyUtils and PolicyUtilsTests on Windows (#126185)
This PR fixes 2 issues discovered around PolicyUtils (and PolicyUtilsTests) when running CI on Windows:
- in tests, absolute paths like always are different, this fix updates the tests to account for the difference.
- on Windows, Files.move was failing because we were parsing the Entitlement policy but not closing the stream in a timely manner. This causes plugin installation (and related CI tests) to fail 70% of the time. Fixed by closing the stream properly

Fixes #126176
2025-04-03 18:02:17 +01:00
Omri Cohen 856ee3a177
Support explicit Z/M attributes using WKT geometry (#125896) 2025-04-03 17:00:12 +02:00
Lorenzo Dematté 40dd91b800
[Entitlements] Replace Permissions with Entitlements in InstallPluginAction (#125207)
This PR replaces the parsing and formatting of SecurityManager policies with the parsing and formatting of Entitlements policy during plugin installation.

Relates to ES-10923
2025-04-02 11:03:27 +01:00
Patrick Doyle a90b314ffd
Put the not-entitled message in the log (#126072) 2025-04-01 21:09:47 +01:00
Patrick Doyle b8c70ae36d
Custom getCallerClass in entitlement bridge (#125139) 2025-04-01 14:45:12 -04:00
Jack Conradson 0e5bd3cbf3
Add exclusive file entitlement for settings (#125272)
Adds changes to ensure the correct caller's module is checked for exclusive file settings.
2025-03-31 14:54:14 -07:00
Ryan Ernst 425cb70d50
Return null from transformer when not transforming (#125961)
The transform API for instrumentation should return null when no
transformation occurs. This commit fixes our entitlement transformer to
return null instead of the original buffer.

closes #125920
2025-03-31 18:09:11 +01:00
Simon Cooper 7f1203e472
Add panama implementations of byte-bit and float-bit script operations (#124722) 2025-03-25 13:59:11 +00:00
Patrick Doyle 474563fbac
Unmute entitlements unit tests (#125217) 2025-03-24 17:52:16 +02:00
Simon Cooper da9ed5ae41
Re-enable SIMD operations on JDK 24 (#125484) 2025-03-24 13:13:15 +00:00
Simon Cooper 2ba9e9f8ed
Panama implementation of painless float-byte vector ops (#123270) 2025-03-24 10:30:52 +00:00
Armin Braun 50437e79d3
Cleanup missing use of StandardCharsets (#125424)
Random annoyance that I figured, I'd just fix globally:
We can do a bit of a cleaner job when doing byte <-> string conversion here and there.
2025-03-21 20:10:15 +01:00
Ryan Ernst 02f12c8e83
Move remaining check methods in RestEntitlementsCheckAction (#125351)
All future check methods should be found reflectively with the
EntitlementTest annotation.
2025-03-21 21:00:39 +02:00
Patrick Doyle e0611260c5
Use ALL-UNNAMED for the unnamed module in warnings (#125317)
* Use ALL-UNNAMED for the unnamed module in warnings

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-20 17:02:57 -04:00
Ryan Ernst 80db28e5b1
Split out jvm and operating system actions in entitlement tests (#125122)
This is part of continued cleanup to remove actions from
RestEntitlementCheckAction.
2025-03-20 18:59:52 +02:00
Lorenzo Dematté ae0b2963d2
[Entitlements] Add an option to perform bytecode verification during instrumentation (#124404)
Using ASM CheckClassAdapter was key to diagnose the issue we had with incorrect signatures for some check methods.
In this PR I polished up the code I used to pinpoint the issue, and made it available via a system property so it can be turned on if we need it (and it's always on for Entitlements IT tests too).

It is also turned on in case we get VerifyErrors during retransformClasses early in the Entitlement agent bootstrap: retransformClasses runs in the native part of the JVM, so the VerifyError it produces is not so readable (e.g. it lacks a full stack trace and a description); in case this happens, we re-apply the transformation with verification turned on to get a meaningful error before dying.
2025-03-19 16:02:01 +02:00
Arpad Kiraly 30dd38bc97
Remove @UpdateForV9 annotation (#125024)
* Delete libs/core/src/main/java/org/elasticsearch/core/UpdateForV9.java

* Remove UpdateForV9 annotation in ConsumeProcessor.java
2025-03-18 12:52:18 +01:00
Lorenzo Dematté d20528b27c
[Entitlements] Uniform server and plugins policy patching (#125011)
With #124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too.

This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
2025-03-18 09:27:54 +00:00
Lorenzo Dematté ef3b835a0f
[Entitlelments] Server policy patching via system property (#124904)
This PR adds a mechanism to patch the server layer policy by merging entitlements from a policy provided via a system property (merge, not replace).
2025-03-17 12:00:08 +01:00
Patrick Doyle 359743baab
Use child loggers broadly in PolicyManager (#124896)
* Use child loggers broadly in PolicyManager

* Pass ModuleEntitlements to notEntitled

* Store logger name instead of object.

Some of our unit tests check for equality of `ModuleEntitlements` objects,
and they are entitled to do so (no pun intended).

* Alright, let's cache 'em

* Memoize at point of creation, not point of use

* Explanatory comments
2025-03-15 01:30:06 +00:00
Patrick Doyle 190bd9311a
Include stack trace in Not Entitled warning (#124895)
* Include stack trace in Not Entitled warning

* Remove redundant log message text
2025-03-14 19:20:33 +00:00
Lorenzo Dematté b76048ddd2
add load_native_libraries entitlement to java.desktop (#124852)
The ingest-attachment module uses Tika to parse some content; Tika in turn uses some libraries from java.desktop to perform its tasks.

In turn, the JDK loads one (or more) native libraries for its implementation as part of class initialization. This means we need to grant load_native_libraries to java.desktop so that because AWT can load libraries for itself.
2025-03-14 18:51:13 +01:00
Lorenzo Dematté e0c4c4de20
[Entitlements] Allow policy overrides via system properties (#124489)
This PR adds the ability to override entitlement policies for Elasticsearch plugins and modules via a system property.

The system property is in the form es.entitlements.policy.<plugin name>, and accepts a versioned policy:

versions:
  - version1
  - versionN
policy:
  <a standard entitlement policy>

For example:

versions:
  - 9.1.0
policy:
  ALL-UNNAMED:
    - set_https_connection_properties
    - outbound_network
    - files:
      - relative_path: ".config/gcloud"
        relative_to: home
        mode: read

The versioned policy needs to be base64 encoded. For example, to pass the above policy to a test cluster via gradle run:

./gradlew run --debug-jvm -Dtests.jvm.argline="-Des.entitlements.policy.repository-gcs=dmVyc2lvbnM6CiAgLSA5LjEuMApwb2xpY3k6CiAgQUxMLVVOTkFNRUQ6CiAgICAtIHNldF9odHRwc19jb25uZWN0aW9uX3Byb3BlcnRpZXMKICAgIC0gb3V0Ym91bmRfbmV0d29yawogICAgLSBmaWxlczoKICAgICAgLSByZWxhdGl2ZV9wYXRoOiAiLmNvbmZpZy9nY2xvdWQiCiAgICAgICAgcmVsYXRpdmVfdG86IGhvbWUKICAgICAgICBtb2RlOiByZWFkCg=="

The versions listed in the policy are string-matched against Build.version().current(); it is possible to specify any number of versions. If the list is empty/there is no versions field, the policy is assumed to match any Elasticsearch versions.

The override policy specified for any given plugin replaces the embedded policy for that plugin. See how EntitlementsAllowedViaOverrideIT replaces an empty policy for the entitlement-test-plugin with a policy that allows load_native_libraries and access to files in the test read_dir.

Also tested manually with an override with a different version, with an override with an invalid policy and with a valid override (see command above).

Relates to ES-11009
2025-03-14 09:33:08 +01:00
Matt Culbreth b9ec8fd35e
Remove @UpdateForV9 annotations from Security code (#123176) 2025-03-12 18:32:37 -04:00
Moritz Mack c41caeb6cd
Enable FIPS entitlements based on `org.bouncycastle.fips.approved_only`. (#124577)
When enabling FIPS `javax.net.ssl.trustStore` is not necessarily set.
This change adds FIPS entitlements based on
`org.bouncycastle.fips.approved_only=true`, which enforces usage of FIPS
approved functionality only.

Additionally, this PR grants read access to a custom trust store if
provided via `javax.net.ssl.trustStore`, otherwise read access to the
default JDK trust store is granted.

Relates to ES-11025.
2025-03-12 19:54:48 +11:00
Lorenzo Dematté 37a363050e
[Entitlements] Add support for IT tests of always allowed actions (take 2) (#124429)
Writing tests for #123861, turns out that #124195 is not enough.
We really need new IT test cases for "always allowed" actions: in order to be sure they are allowed, we need to setup the plugin with no policy.
This PR adds test cases for that, plus the support for writing test functions that accept one Environment parameter: many test paths we test and allow/deny are relative to paths in Environment, so it's useful to have access to it (see readAccessConfigDirectory as an example)
2025-03-12 09:44:30 +01:00
Lorenzo Dematté d844c6a847
[Entitlements] Exclude `java.desktop` from system modules (#124563)
* exclude java.desktop from system modules

* add IT test
2025-03-12 08:34:52 +01:00
Patrick Doyle 5112dbbb3b
Reduce noise from NotEntitledException logging (#124511)
* Refactor: findRequestingFrame

* INFO instead of WARN for NotEntitledException.

Some of these are expected, so an INFO seems more appropriate.

The stack trace tends to attract attention even when entitlements are not the
cause of a problem, so let's avoid the stack trace, but still include stack
frame info from the frame of interest.

* Use child loggers for Not Entitled logs

* Use warn, and include compoenent name

* Fix ALL_UNNAMED

* Mute entitlement warnings from repositories

* PR feedback

* Common out the Not Entitled prefix.

We're alerting on this, so let's not rely on every caller of notEntitled to remember it.
2025-03-11 15:50:31 -04:00
Moritz Mack c26d195120
Rethrow NoSuchFileException if encountering an invalid symlink when checking file entitlements (#124483)
This will rethrow the `NoSuchFileException` when encountering an invalid
symbolic link when following links during file (read) entitlement
checks.

Relates to https://github.com/elastic/elasticsearch/pull/124133
(ES-11019)
2025-03-11 20:38:03 +11:00
Ryan Ernst 3149640a93
Ignore ordering in policy manager exclulsive tests (#124488) 2025-03-10 09:46:51 -07:00
Lorenzo Dematté a2b0d96778
fix file tests to work across multiple invocations (#124412) 2025-03-10 16:58:04 +01:00
Lorenzo Dematté 958352f12b
Fix FileAccessTreeTests#testDuplicateExclusivePaths to work on windows (#124430) 2025-03-10 16:20:17 +01:00
Moritz Mack 7cec9489c2
Fix entitlement checks for relative links (#124133) 2025-03-10 13:45:46 +01:00
Lorenzo Dematté a15aee6274
[Entitlements] Add URLConnection instrumentation for jar protocol (#123861)
Follows #123824

Relates to ES-10994
2025-03-09 09:30:42 +01:00
Lorenzo Dematté ab9ec4cf6f
Make NotEntitledException inherit from AccessControlException for compatibility purposes (#124321)
Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces #123984
2025-03-08 16:17:30 +01:00
Lorenzo Dematté 4981c15a95
[Entitlements] Add support for IT testing always allowed actions (#124195) 2025-03-08 16:03:16 +01:00
Ryan Ernst 7e1195dc9a
Add exclusive access files for security module (#123676)
This commit fills out missing entitlements for the security module.
Specifically they are config files which require exclusive access.
2025-03-08 07:02:36 -08:00
Lorenzo Dematté 155e7d5592
[Entitlements] Use the correct format for the `EntitlementInstrumented` annotation descriptor (#124310) 2025-03-08 08:59:32 +01:00
Lorenzo Dematté b663616aa2
[Entitlements] Fix AbstractDelegateHttpsURLConnection "this" parameter type (#124304)
Our check methods injected by the instrumenter receive "this" as the second parameter.
For internal classes like AbstractDelegateHttpsURLConnection we generally use a base type; in this case we were using javax.net.ssl.HttpsURLConnection, which is incorrect as AbstractDelegateHttpsURLConnection derives from java.net.HttpURLConnection.
This was not failing in our tests because we don't actually use that parameter in that check function.

Also, it was not failing on transform, just on retransformClasses, and only in JDK 24. Apparently, JDK 24 introduced new validation there (to be confirmed).

And it was failing just on cloud as the APM agent there (which is loaded before our agent) connects to a https endpoint - our IT tests, and ./gradlew run --with-apm-server, use a http endpoint. Using https makes the JVM load AbstractDelegateHttpsURLConnection, making it one of the classes we need to retransform, triggering the VerifyError.
2025-03-07 13:41:47 +01:00
Lorenzo Dematté e3c953f799
[Entitlements] Allow read access to a plugin's directory (#124111) 2025-03-07 08:31:33 +01:00
Niels Bauman 20e186a252
Make enrich project-aware (#124099)
Makes the execution and use of enrich policies project-aware.
Note: this does not make the enrich cache project-aware. That is to be
handled in a follow-up PR.
2025-03-06 19:20:46 +01:00
Lorenzo Dematté cce1333744
[Entitlements] MailToURLConnection instrumentation (#123829) 2025-03-06 09:52:15 -05:00
Rene Groeschke 496c38e5a5
Reapply "Update Gradle wrapper to 8.13 (#122421)" (#123889) (#123896)
This reverts commit 36660f2e5f.
2025-03-05 08:02:13 +01:00
Lorenzo Dematté 67d0dd4df2
[Entitlements] Add URLConnection instrumentation for file protocol (#123824) 2025-03-05 07:36:55 +01:00
Patrick Doyle bef762f4dc
Remove duplicate exclusive paths (#124023)
* Remove duplicate exclusive paths

* Normalize paths in tests to support Windows

* Remove withMode
2025-03-04 23:44:08 +01:00
Mark Vieira cc08d1d2a6
Add inbound_network entitlement to repository-hdfs plugin (#123907) 2025-03-04 09:24:54 -08:00
Lorenzo Dematté 8f5de85d16
Make NotEntitledException inherit from SecurityException for compatibility purposes (#123984) 2025-03-04 15:34:13 +01:00
Nikolaj Volgushev 66a7c9f0de
Drop `TLS_RSA` ciphers from default cipher suites for JDK 24 (#123600)
This PR adjusts the list of supported ciphers to reflect ciphers
available in JDK 24. 

JDK 24 [drops](https://bugs.openjdk.org/browse/JDK-8245545) support for
`TLS_RSA` suites. These ciphers will no longer be supported in
Elasticsearch with a bundled JDK with version >= 24. JDK's of lower
versions will continue to support to dropped ciphers. 

I will follow up this PR with a separate docs PR.
2025-03-04 23:21:49 +11:00
David Turner 4e00998cf2
Add `@UpdateForV9` for `ReferenceDocs` (#123928)
The docs system is very different in v9 so we must update
`ReferenceDocs` to generate links that are not broken.
2025-03-04 07:38:20 +00:00
Lorenzo Dematté 4f2f1bc2a7
[Entitlements] Add URLConnection instrumentation for ftp, http and https protocols (#123802) 2025-03-04 08:35:14 +01:00
Lorenzo Dematté c663e3ded8
Add missing APM entitlements (#123462) 2025-03-04 08:32:59 +01:00
Jack Conradson 3e2597f49b
remove duplicate paths in FileAccessTree (#123776)
Co-authored-by: Lorenzo Dematté <lorenzo.dematte@elastic.co>
Co-authored-by: Patrick Doyle <810052+prdoyle@users.noreply.github.com>
2025-03-03 20:56:18 +00:00
Ryan Ernst 4841f43e88
Grant read access to the config dir (#123882)
This matches what Security Manager permissions Elasticsearch had for all
plugins.
2025-03-03 19:43:41 +00:00
Rene Groeschke 36660f2e5f
Revert "Update Gradle wrapper to 8.13 (#122421)" (#123889)
This reverts commit e19b2264af.
2025-03-03 15:51:07 +01:00
Lorenzo Dematté 31b3f7dc9c
Fix PolicyManagerTests testFilesEntitlementsWithExclusive failing (#123856) 2025-03-03 14:11:07 +00:00
Rene Groeschke e19b2264af
Update Gradle wrapper to 8.13 (#122421)
* Fix Gradle Deprecation warning as declaring an is- property with a Boolean type has been deprecated.
* Make use of new layout.settingsFolder api to address some cross project references
* Fix buildParams snapshot check for multiprojet projects
2025-03-03 14:10:00 +01:00
Arpad Kiraly 196e083502
Remove @UpdateForV9 usages that are related to security manager removal (#123690)
* Remove @UpdateForV9 annotation in RuntimeVersionFeature

Re ES-10338 the Core/Infra team agreed that this is not blocked on security manager removal. We should go ahead and remove these 2 instances of the @UpdateForV9 annotation, the code will be cleaned up soon with the removal of Security Manager.

* Remove @UpdateForV9 annotation from SystemJvmOptions

re ES-10338 the Core/Infra team agreed this is not blocked on security manager removal. We should go ahead and remove this instance of the @UpdateForV9 annotation.
2025-03-03 11:34:46 +01:00
Simon Cooper 82668b40f4
Add basic implementations of float-byte script comparisons (#122381)
Add implementations of `cosineSimilarity` and `dotProduct` to query byte vector fields using float vectors
2025-03-03 09:38:37 +00:00
Lorenzo Dematté dbac70eed5
[Entitlements] Fix FileAccessTree paths ordering (#123689) 2025-03-03 09:05:00 +01:00
Lorenzo Dematté 678738acc0
[Entitlements] Add URLConnection instrumentation (#123503) 2025-03-03 08:40:53 +01:00
Ryan Ernst eace6a1071
Remove ignoreUrl file setting property (#123718)
Urls may make the FileAccessTree invalid. This commit removes the flag
for filtering urls, instead always filtering them.
2025-03-02 19:29:45 +00:00
Ryan Ernst 39a2e88964
Set root logger level for CLIs (#123742)
All CLIs in elasticsearch support command line flags for controlling the
output level. When --silent is used, the expectation is that normal
logging is omitted. Yet the log4j logger is still configured to output
error level logs. This commit sets the appropriate log level for log4j
depending on the Terminal log level.
2025-03-02 17:55:09 +00:00
Lorenzo Dematté b3464275ce
[Entitlements] Add a check for filesystem mismatch (#123744) 2025-02-28 23:10:08 +00:00
Ryan Ernst dcb0eb606f
More flexible settings pattern (#123746)
This commit reworks the settings globs to be more useable. Primarily it
expands the values so that the settings may be lists, iterating over
each value. Additionally it simplifies the function to also allow
non-glob settings so that this single method may be used to lookup all
values for a given setting pattern, whether it contains a glob or not.
2025-02-28 20:02:50 +00:00
Ryan Ernst 71f72b9b91
Consolidate path setting files entitlements to config (#123649)
The setting based paths could be either absolute or relative, and they
are always relative to the config dir. This commit renames the
path_setting to make it clear it is related to config, and removes the
relative variant.
2025-02-28 01:38:51 +00:00
Nikolaj Volgushev a77626368f
Handle `NotEntitledException` in SSL file utils (#123491)
SSL file utils currently only handle security manager access control
exceptions around file read checks. This PR extends these to support
entitlement checks as well. 

There is no easy way to unit test this since we can't run unit tests
with entitlements enabled (for now). The PR includes a REST test
instead. 

Relates: https://github.com/elastic/elasticsearch/issues/121960
2025-02-28 00:06:09 +11:00
Armin Braun 43f3032db8
Inline some methods into Releasables (#123273)
Bit of a random find. Looks like we're effectively spending something
like ~0.5% of the total CPU time on resolving virtual calls for these
methods. Inlining `IOUtils` reduces their size quite a bit, removes
dead-code for rethrowing `IOException` that is never actually thrown
and hopefully as a result improve compilation a little here.
2025-02-27 12:09:36 +01:00
Moritz Mack 32826974e4
Add missing APM agent entitlements (#123575)
Add missing APM agent entitlements
2025-02-27 21:02:56 +11:00
Tim Vernum 1d3106f288 Merge branch 'feature/multi-project' 2025-02-27 19:51:21 +11:00
Patrick Doyle a9e27a9eaa
More entitlements for bouncycastle (#123548) 2025-02-27 09:08:36 +01:00
Tim Vernum 783ce7a0d2
Merge branch 'main' into feature/multi-project 2025-02-27 15:33:46 +11:00
Jack Conradson 3e3dfa4fb7
Add an exclusive parameter for files entitlements (#123087)
This adds an exclusive parameter for FilesEntitlement where a path can be made exclusive for a certain 
module. Should two modules attempt to both specify the same path as exclusive an exception is 
thrown.
2025-02-26 17:35:47 -08:00