Commit graph

1117 commits

Author SHA1 Message Date
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
Tim Vernum
f7e80e7fd2
Merge branch 'main' into feature/multi-project 2025-02-27 12:09:08 +11:00
Ryan Ernst
cee43fd7d8
Add ignore_url for setting based files entitlement (#123541)
File entitlements which read a setting may actually contain urls. This
commit adds an optional `ignore_url` property for the entitlement to
skip any values which are urls.
2025-02-26 12:41:44 -08:00
Tim Vernum
597ab8a7e9 Merge branch 'main' into multi-project 2025-02-26 17:57:01 +11:00
Ryan Ernst
8176746754
Give NamedComponentReader access to read plugins directories (#123431)
The NamedComponentReader reads a file created upon plugin installation
for stable plugins from the plugin installation dir. This commit passes
the plugins directory through to entitlements and grants server access.
2025-02-26 00:44:03 +00:00
Ryan Ernst
b5e482bc91
Enable entitlements by default (#122907)
Entitlements are almost complete. This commit enables them by default,
in preparation for 8.18/9.0.
2025-02-25 09:58:39 -08:00
Lorenzo Dematté
f929270431
Fix how we suppress logs for self-tests (#123361) 2025-02-25 14:09:30 +00:00
Lorenzo Dematté
2f0e1dabf7
Missing log4j policy (#123360) 2025-02-25 13:55:25 +01:00
Lorenzo Dematté
4f6a0e6840
[Entitlements] Follows links during FileAccessTree creation (#123357) 2025-02-25 13:39:58 +01:00
Lorenzo Dematté
12fcdd8633
Some missing entitlements preventing serverless to start (#123271) 2025-02-25 10:19:15 +01:00
Ryan Ernst
9aaf07242c
Add pidfile access for server (#123313) 2025-02-25 10:18:56 +01:00
Ryan Ernst
5b0591e04a
Consider entitlement lib as system module (#123315)
* Consider entitlement lib as system module

Entitlements sometimes needs to perform sensitive operations,
particularly within the FileAccessTree. This commit expands the
trivially allowed check to include entitlements as one of the system
modules alongside the jdk. One consequence is that the self test must be
moved outside entitlements.

* [CI] Auto commit changes from spotless

* remove old method call

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-25 09:05:36 +01:00
Ryan Ernst
1c7d17c295
Remove unnecessary temp dir access (#123314)
All modules have read/write access to the temp dir. This commit removes
unnecessarily adding the temp dir explicitly to the server policy.
2025-02-25 01:48:07 +00:00
Tim Vernum
77bf65d9af Merge main into multi-project 2025-02-25 10:33:53 +11:00
Ryan Ernst
09a3ec1fb3
Add platform property to files entitlement (#123212)
Some file paths are OS specific. This commit adds a `platform` property
to each file in a files entitlement that can be used to limit that file
to a specific platform.

Co-authored-by: Moritz Mack <mmack@apache.org>
Co-authored-by: Lorenzo Dematte <lorenzo.dematte@elastic.co>
2025-02-24 22:17:25 +00:00