Commit graph

1076 commits

Author SHA1 Message Date
Lorenzo Dematté
61e9a226b9
[Entitlements] Relax check in IT tests for FIPS environments (#120463) 2025-01-22 10:14:13 +01:00
Moritz Mack
f1447fe821
[Entitlements] Instrument write access to System properties (#120357)
Instrument write access to System properties by means of the `WriteSystemPropertiesEntitlement`.
`System.setProperties(Properties)` is always denied.

Part of #ES-10359
2025-01-21 18:07:40 +01:00
Lorenzo Dematté
3fa2415db8
[Entitlements] Move some checks that use version-specific API (#120397) 2025-01-21 08:38:20 +01:00
Niels Bauman
6c7d2d285b Merge main into multi-project 2025-01-21 11:04:37 +10:00
Lorenzo Dematté
cd86b3b497
[Entitlements] Refactor Network Entitlement (#120391) 2025-01-20 18:29:32 +01:00
Yang Wang
7a1f5c5d4f Merge main into multi-project 2025-01-20 11:17:40 +11:00
Jack Conradson
45e80f55be
Add PolicyValdidationException for entitlements (#120225)
This adds a new exception called PolicyValdidationException. This exception is intended to be used during construction of entitlements that require parsing additional arguments. This allows PolicyParser to give improved error messaging about a specific entitlement that may have failed during the parsing process.
2025-01-17 10:34:53 -08:00
Lorenzo Dematté
a397fe9291
[Entitlements] Network access checks for NIO classes (#120138) 2025-01-17 11:54:27 +01:00
Lorenzo Dematté
cbb7c24ada
[Entitlements] Network access checks for miscellanea (#120262) 2025-01-17 09:48:22 +01:00
Tim Vernum
552cec7ff0 Merge revision 34059c9dbd into multi-project 2025-01-17 16:32:15 +11:00
Craig Taverner
40c34cd896
Optimize ST_EXTENT_AGG for geo_shape and cartesian_shape (#119889)
Support for `ST_EXTENT_AGG` was added in https://github.com/elastic/elasticsearch/pull/118829, and then partially optimized in https://github.com/elastic/elasticsearch/pull/118829. This optimization worked only for cartesian_shape fields, and worked by extracting the Extent from the doc-values and re-encoding it as a WKB `BBOX` geometry. This does not work for geo_shape, where we need to retain all 6 integers stored in the doc-values, in order to perform the datelline choice only at reduce time during the final phase of the aggregation.

Since both geo_shape and cartesian_shape perform the aggregations using integers, and the original Extent values in the doc-values are integers, this PR expands the previous optimization by:
* Saving all Extent values into a multi-valued field in an IntBlock for both cartesian_shape and geo_shape
* Simplifying the logic around merging intermediate states for all cases (geo/cartesian and grouped and non-grouped aggs)
* Widening test cases for testing more combinations of aggregations and types, and fixing a few bugs found
* Enhancing cartesian extent to convert from 6 ints to 4 ints at block loading time (for efficiency)
* Fixing bugs in both cartesian and geo extents for generating intermediate state with missing groups (flaky tests in serverless)
* Moved the int order to always match Rectangle for 4-int and Extent for 6-int cases (improved internal consistency)

Since the PR already changed the meaning of the invalid/infinite values of the intermediate state integers, it was already not compatible with the previous cluster versions. We disabled mixed-cluster testing to prevent errors as a result of that. This leaves us the opportunity to make further changes that are mixed-cluster incompatible, hence the decision to perform this consistency update now.
2025-01-16 19:43:51 +01:00
Lorenzo Dematté
46a8e69dd6
[Entitlements] Introducing runtime version-specific checks in IT tests (#120265) 2025-01-16 15:50:41 +01:00
Simon Cooper
5a70623d8d Merge remote-tracking branch 'upstream-main/main' into merge-main-16-01-25 2025-01-16 09:23:46 +00:00
Lorenzo Dematté
1848d6bb93
[Entitlements] Network access checks on Sockets (#120093) 2025-01-15 22:01:56 +01:00
Lorenzo Dematté
19965d5794
Removing unneeded check on SSLSession#getSessionContext (#120191) 2025-01-15 15:32:59 +01:00
Lorenzo Dematté
1be9253779
[Entitlements] Network entitlement classes + Datagram socket check functions (#119735) 2025-01-14 09:08:15 +01:00
Lorenzo Dematté
d3a1d9b509
Add "always denied" network access checks (#119867) 2025-01-13 09:26:55 +01:00
Tim Vernum
280fcb1a57 Merge main into multi-project 2025-01-09 19:39:24 +11:00
Lorenzo Dematté
78890e9312
Reintroduce entitlement check on System.exit (#119757) 2025-01-08 18:30:07 +01:00
Tim Vernum
60010f991e Merge main into multi-project 2025-01-08 13:02:38 +11:00
Patrick Doyle
6484f94614
Entitlements for JDK-wide global state changes (#119592)
* Refactor: separate check method name vs signature parsing

* Cosmetic: change checker comment format

* Entitlements for JDK-wide global state

* [CI] Auto commit changes from spotless

* Comment explaining entitlement add-exports

* @SuppressForbidden

* Refactor: rename dummy subclases

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-08 01:12:27 +00:00
Yang Wang
e1151ef1ba Merge main into multi-project 2025-01-06 13:30:02 +11:00
Patrick Doyle
8ed9a5a825
Entitlement bootstrap self-test (#119376)
* Entitlement bootstrap self-test

* Add a permitted action to self-test

* Refactor: Move integrity checks to record constructors

* Self-test javadocs
2025-01-03 17:33:42 +00:00
Patrick Doyle
4eefc6d73b
Convert a few entitlements to records (#118705)
* Convert a few entitlements to records

* Make SetHttpsConnectionPropertiesEntitlement a record and fix tests
2025-01-03 17:12:44 +00:00
Jack Conradson
7297390378
Add entitlement checks for java.lang.ClassLoader (#119027)
This commit adds an entitlement for creating a classloader.
2025-01-02 21:55:00 +00:00
Lorenzo Dematté
5df57fda72
[Entitlements] Add set_https_connection_properties entitlement and checks (#118577) 2025-01-02 16:06:37 +01:00
Tim Vernum
8bf5c2d0cb Merge main into multi-project 2024-12-31 15:41:30 +11:00
Tim Vernum
4ff691f066 Merge revision 7fb6ca447a into multi-project 2024-12-31 15:41:02 +11:00
Patrick Doyle
401220868a
Mandatory class name (#118626)
* Use $$ for static check methods

* Always use class name from checker method name

* Spotless

* Varargs assertParseCheckerMethodSignatureThrows

* Remove hasReceiver again

* Spotless

* Cosmetic changes

* Change to new check method naming convention
2024-12-30 21:57:38 +00:00
Patrick Doyle
7c46556e21
Grant all entitlements to system modules (#119168)
* Grant all entitlements to system modules

* [CI] Auto commit changes from spotless

* Make NO_ENTITLEMENTS_MODULE non-null

* Initialize NO_ENTITLEMENTS_MODULE with @BeforeClass.

Looks like @WithoutSecurityManager doesn't work with static initializers.

* Move check to public method

* Logging adjustments

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2024-12-30 17:35:26 +00:00
Rene Groeschke
ba61f8c7f7
Update Gradle wrapper to 8.12 (#118683)
This updates the gradle wrapper to 8.12

We addressed deprecation warnings due to the update that includes:

- Fix change in TestOutputEvent api
- Fix deprecation in groovy syntax
- Use latest ospackage plugin containing our fix
- Remove project usages at execution time
- Fix deprecated project references in repository-old-versions
2024-12-30 15:34:24 +01:00
Rene Groeschke
5278159987
Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300) (#119325)
* Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300)

The original PR (#118894) has broken serverless.

* Fix gitinfo plugin for serverless usage

* Update buildscan git revision reference
2024-12-30 08:54:42 +01:00
Mark Vieira
9d0f08bedf
Revert "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300)
This reverts commit f9c6a6c0b2.
2024-12-27 10:05:53 +11:00
Armin Braun
e94f145350
Fix a bunch of non-final static fields (#119185)
Fixing almost all missing `final` spots, who knows maybe we get a small speedup from
some constant folding here and there.
2024-12-26 19:14:36 +01:00
Niels Bauman
3738202979 Merge main into multi-project 2024-12-24 18:26:13 +01:00
Rene Groeschke
f9c6a6c0b2
[Build] Do not invalidate configuration cache when branch is switched (#118894)
* [Build] Do not invalidate configuration cache when branch is switched
* Update build tools tests
* Update GitInfoValueSource.java
2024-12-23 14:51:33 +00:00
Yang Wang
e790688377 Merge main into multi-project 2024-12-22 19:36:33 +11:00
Patrick Doyle
730441855c
Add missing ProcessBuilder.start entitlements test (#119100) 2024-12-19 10:20:55 -08:00
Ryan Ernst
21bcc314c4
Limit which classes are retransformed (#118786)
During entitlements initialization the transformer is added to
instrumenation after some classes are already loaded. Currently we end
up force loading (though not initializing) all classes that want to
transform. This commit simplifies the retransform to only apply to
classes which we know are already loaded by the jdk, which
Instrumentation provides.
2024-12-19 08:59:23 -08:00
Yang Wang
f7791a0f5f Merge main into multi-project 2024-12-19 14:36:37 +11:00
Patrick Doyle
c3a59bb965
Process execution checks and IT tests (#119010)
* Process creation checks and IT tests

* Remove process queries; only forbid execution
2024-12-18 23:06:52 +00:00
Patrick Doyle
9cc362b966
Entitlements: More robust frame skipping (#118983)
* More robust frame skipping

* Cosmetic improvements for clarity

* Explicit set of runtime classes

* Pass entitlements runtime module to PolicyManager ctor

* Use the term "entitlements module" and filter instead of dropWhile

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2024-12-18 19:08:51 +00:00
Tim Vernum
affd6dfb5b Merge revision ce2a7dee86 into multi-project 2024-12-16 00:11:08 +11:00
Ryan Ernst
b456e16c7d
Simplify instrumenter and tests (#118493)
This commit simplifies the entitlements instrumentation service and
instrumenter a bit. It especially removes some repetition in the
instrumenter tests.
2024-12-13 23:23:37 +00:00
Lorenzo Dematté
5411b93d49
Entitlements tools: public callers finder (#116257)
* WIP: Tool to find all public caller from a starting list of (JDK) methods.

* Add public-callers-finder tool, extract common stuff to common module

* Adjustments to visibility/functions and classes and modules to print out

* Spotless

* Missing gradle configuration

* Add details in README as requested in PR

* Update ASM version

* Including protected methods
2024-12-13 10:24:54 -05:00
Lorenzo Dematté
1bad1cf6b2
Implementing the correct exit functions (Runtime) (#118657) 2024-12-13 16:21:42 +01:00
Gal Lalouche
2be4cd983f
ESQL: Support ST_EXTENT_AGG (#117451)
This PR adds support for ST_EXTENT_AGG aggregation, i.e., computing a bounding box over a set of points/shapes (Cartesian or geo). Note the difference between this aggregation and the already implemented scalar function ST_EXTENT.

This isn't a very efficient implementation, and future PRs will attempt to read these extents directly from the doc values.
We currently always use longitude wrapping, i.e., we may wrap around the dateline for a smaller bounding box. Future PRs will let the user control this behavior.
Fixes #104659.
2024-12-13 12:41:24 +02:00
Yang Wang
fda1fa19d4 Merge main into multi-project 2024-12-13 12:15:25 +11:00
Lorenzo Dematté
f3dc0bdd50
[Entitlements] Differentiate between ES modules and plugins (external) (#117973) 2024-12-12 13:10:56 +01:00
Lorenzo Dematté
95315cc08c
Building scope -> entitlements map during PolicyManager initialization (#118070) 2024-12-12 09:28:58 +01:00