Commit graph

3397 commits

Author SHA1 Message Date
Niels Bauman
19a4ed0188
Remove test dependencies on cluster state API master waiting (#129118)
As preparation for running the cluster state API on the local node, we
need to update these tests that currently depend on that API running on
(and waiting for) the master node.

Relates #127212
2025-06-16 16:04:39 +02:00
Richard Dennehy
63da93d4c3
Delegated authorization using Microsoft Graph (SDK) (#128396)
* Delegated authorization using Microsoft Graph (SDK)
---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Johannes Freden Jansson <johannes.freden@elastic.co>
Co-authored-by: Johannes Fredén <109296772+jfreden@users.noreply.github.com>
2025-06-12 11:03:32 +02:00
Rene Groeschke
71de00c3ce
Update Gradle wrapper to 8.14.2 (#129179) 2025-06-11 16:40:05 +02:00
Jordan Powers
de40ac45d1
Move Text class to libs/xcontent (#128780)
This PR is a precursor to #126492.

It does three things:
1. Move org.elasticsearch.common.text.Text from :server to
   org.elasticsearch.xcontent.Text in :libs:x-content.
2. Refactor the Text class to use a new EncodedBytes record instead of
   the elasticsearch BytesReference.
3. Add the XContentString interface, with the Text class implementing
   that interface.

These changes were originally implemented in #127666 and #128316,
however they were reverted in #128484 due to problems caused by the
mutable nature of java ByteBuffers. This is resolved by instead using a
new immutable EncodedBytes record.
2025-06-04 11:22:03 -07:00
Rene Groeschke
2856923ef0
[Gradle] Use variant aware resolution for deps on hfds-fixture (#128860)
This reworks the dependency resolution for hdfs fixture dependencies to use gradles variant aware dependency resolution instead of relying on outgoing configuration names.
2025-06-04 11:47:26 +03:00
Rene Groeschke
657f5ffe53
Update Gradle wrapper to 8.14.1 (#128438)
Update Gradle wrapper to 8.14.1
2025-05-30 12:23:06 +02:00
Yang Wang
6bc1452b43
Make repositories project aware (#128285)
Pass project-id explicitly to repository factory and make it part of the
repository interface.

Relates: ES-11839
2025-05-28 17:29:39 +10:00
Patrick Doyle
7690f4667e
Revert changes to Text class (#128483) (#128484)
* Revert "Fix the Text class package change in example plugins (#128316)"

This reverts commit cc486480e3.

* Revert "Update Text class to use native java ByteBuffer (#127666)"

This reverts commit db0c3c7a28.

Co-authored-by: Lorenzo Dematté <lorenzo.dematte@elastic.co>
2025-05-27 18:37:43 +10:00
Lorenzo Dematté
cc486480e3
Fix the Text class package change in example plugins (#128316) 2025-05-22 18:36:26 +02:00
Jim Ferenczi
54af815ad9
Refactor SourceProvider creation to consistently use MappingLookup (#128213)
This change updates the code to always create SourceProvider instances via MappingLookup, avoiding direct exposure to the underlying source format (synthetic or stored).
It also aligns source filtering behaviour between SourceProvider and SourceLoader, ensuring consistent application of filters.

This change is needed to enable source filtering to occur earlier in the fetch phase, for example, when constructing a synthetic source.
2025-05-22 14:45:13 +01:00
Ryan Ernst
79d3aa8277
Remove doPrivileged from plugins (#127996)
This commit continues the work of removing SecurityManager related code
by removing doPrivileged calls from Elasticsearch plugins.
2025-05-21 09:00:24 -07:00
Johannes Fredén
acc8ae74af
Add Microsoft Graph Delegated Authorization Realm Plugin (#127910)
* Add Microsoft Graph Delegated Authorization Realm Plugin

* Update docs/changelog/127910.yaml
2025-05-19 14:15:28 +02:00
Rene Groeschke
9b1815c84a
[Build] Update Develocity Plugin to 4.0.1 (#128053)
After updating Develocity to 2015.1.3 we can also update the according plugin
2025-05-13 21:37:44 -07:00
Ryan Ernst
22a52a9c64
Remove security manager policy files (#127727)
Now that security manager is gone, the policy files are no longer
needed. This commit removes the server, test and plugin specific policy
files
2025-05-06 19:37:46 +02:00
Rene Groeschke
a2e580fb60
Update Gradle wrapper to 8.14 (#126519)
* Fix PatternSetFactory incompatibility
* Update ospackage plugin
* Remove ambigious method definitions
* Cleanup verification metadata
* Some cleanup on unused methods and attributes
2025-05-06 13:00:15 +02:00
Mariusz Józala
d4045e2152
[Test] Use version range for elasticsearch-java (#127398)
Snapshot builds of elasticsearch-java are no longer available.
Using the current major highest version should be safe according to the
compatibility guarantees described on https://github.com/elastic/elasticsearch-java?tab=readme-ov-file#compatibility

Repo https://snapshots.elastic.co/maven/ is no longer needed in a
composite build. Previously it was only used to provide snapshot version
 of `elasticsearch-java` client which is no longer available in snapshot
  version. We keep the https://snapshots.elastic.co/maven/ repo to be
  used when for non-composite builds when any other dependencies
  snapshot versions can be fetched.
2025-05-05 13:58:17 +02:00
Simon Cooper
83300ea1f1
Return 400 BAD_REQUEST when a field scorer references a missing field (#127229)
Currently it returns 5xx, when it's entirely an error in the request
2025-04-29 16:58:42 +01:00
Oleksandr Kolomiiets
26e2261132
Remove legacy block loader test infrastructure (#127273) 2025-04-25 10:26:27 -07: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é
2697a3a872
Patcher for AWS SDKv2 locale-dependent formatting (#126326)
AWS SDK v2 has a bug (aws/aws-sdk-java-v2#5968) where PathResolver uses locale-dependent formatting.

This PR adds a patcher to the discovery-ec2 build process to replace calls to String.format(<format>, <args>) with String.format(Locale.ROOT, <format>, <args>).

Relates to ES-11279
2025-04-15 12:49:56 +02:00
Ryan Ernst
83ce15ae06
Make TransportRequest an interface (#126733)
In order to support a future TransportRequest variant that accepts the
response type, TransportRequest needs to be an interface. This commit
adds AbstractTransportRequest as a concrete implementation and makes
TransportRequest a simple interface that joints together the parent
interfaces from TransportMessage.

Note that this was done entirely in Intellij using structural find and
replace.
2025-04-14 14:22:28 -07:00
David Turner
7239540c91
Replace region with regionSupplier in all AWS tests (#126285)
Rather than hard-coding a region name we should always auto-generate it
randomly during test execution. This commit replaces the remaining fixed
`String` arguments with a `Supplier<String>` argument to enable this.
2025-04-05 02:27:28 +11:00
David Turner
279498d810
Remove spurious NOMERGE comment (#126231)
Left-over from #122062
2025-04-04 03:46:07 +11: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
David Turner
2d4fb76267
Improve randomIdentifier usage in AWS tests (#125775)
Adds prefixes to various randomly-generated values to make it easier to
pin down where they're coming from in debugging sessions. Also forces
the STS expiry time to be rendered in UTC.
2025-03-28 18:33:05 +11:00
David Turner
36c14bf3a5
Validate region/service in DynamicAwsCredentials (#125671)
Following on from #125559, we can validate the region and service name
in tests that use `DynamicAwsCredentials` too.
2025-03-27 06:14:40 +00:00
Mark Vieira
930b4ab995
Convert remaining plugin projects to new test clusters framework (#125626) 2025-03-26 13:44:07 -07:00
David Turner
8d649f2f07
Validate AWS signer region and service in tests (#125559)
Extends the predicate in `AwsCredentialsUtils` to verify that we are
using a proper AWS v4 signature complete with the correct region and
service, rather than just looking for the access key as a substring.
2025-03-26 02:53:21 +11:00
Yang Wang
6c04abc68c
Fix compilation and tests for customAuthzEngine (#125469)
Relates: #123812
2025-03-24 12:03:06 +11: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
Nikolaj Volgushev
c58ac456b8
Failure Store Access Authorization (#123986)
This PR implements authorization logic for failure store access. It
builds on https://github.com/elastic/elasticsearch/pull/122715.

Access to the failure store is granted by two privileges:
`read_failure_store` and `manage_failure_store`. Either of these
privileges lets a user access a failure store via the `::failures`
selector, as well as access its backing failure indices. 
`read_failure_store` grants read access (for example to search documents
in a failure store), `manage_failure_store` grants access to write
operations, such as rollover. Users with only `read` or `manage` on a
data stream do not get failure store access. Vice versa, users with
`read_failure_store` and `manage_failure_store` do not get access to
regular data in a data stream. 

The PR implements this by making authorization logic selector-aware. It
involves two main changes:

1. Index permission groups now compare the selector under which an index resource is accessed to the selector associated with the group.
2. The `AuthorizedIndices` interface likewise uses selectors to decide which indices to treat as authorized. This part of the change requires a sizable refactor and changes to the interface. 

The high-level behavior for selector-aware search is as follows:

For a user with `read_failure_store` over data stream `logs`:

- `POST /logs::failures/_search` returns the documents in the failure store.
- `POST /logs/_search` returns a 403.
- `POST /logs/_search?ignore_unavailable=true` and `POST /*/_search` return an empty result.

Similarly, for a user with `read` over data stream `logs`:

- `POST /logs::failures/_search` returns a 403.
- `POST /logs/_search` returns documents in the data stream.
- `POST /logs::failures/_search?ignore_unavailable=true` and `POST /*::failures/_search` return an empty result.

A user with both `read` and `read_failure_store` over data stream `logs`
gets access to both `POST /logs::failures/_search` and `POST
/logs/_search`.

The index privilege `all` automatically grants access to both data and
the failures store, as well as all hypothetical future selectors. 

Resolves: ES-10873
2025-03-20 20:10:16 +11:00
Rene Groeschke
6f7a206a8a
Update Gradle Enterprise Plugin (Develocity) to 3.19.2 (#125137)
with develocity updated to 2024.3.4 we are unblocked on updating the gradle enterprise plugin
2025-03-19 19:19:54 +01:00
David Turner
23769da8e3
Work around testFilterByTags failure (#125109)
A SDK bug[^1] means that these values sometimes don't parse as an
integer. We don't need them to do so in order to pass the test, so this
commit relaxes the test to accept any string.

Closes #125090 Closes #125166

[^1]: https://github.com/aws/aws-sdk-java-v2/issues/5968
2025-03-20 02:49:54 +11:00
Patrick Doyle
fd51f44e32
Silence known entitlement warnings (#124883) 2025-03-18 16:52:12 +02:00
David Turner
a2d98e44a1
Upgrade discovery-ec2 to AWS SDK v2 (#122062) 2025-03-18 19:38:16 +11:00
Rene Groeschke
ae569def9c
[Build] Require reason for usesDefaultDistribution (#124707)
This makes using usesDefaultDistribution in our test setup for explicit by requiring a reason why it's needed.
This is helpful as part of revisiting the need for all those usages in our code base.
2025-03-17 08:25:39 +01:00
Lorenzo Dematté
a753d4392a
Revert "missing file entitlement used by google-http-client for oauth2 (#123985)" (#124329)
This reverts commit 404c9e6290.
2025-03-08 23:17:53 +01:00
Armin Braun
b1c75d1868
Move some security APIs to using promises in place of callbacks (#123812)
We have some incredibly deep callstacks in security that seem to visibly
raise context switch costs, make profiling more complicated and
generally make the code rather hard to follow.
Since the methods adjusted here return a result synchronously we can
both save overhead and make things a little easier to follow by using
promises as returns in place of consuming callbacks.
2025-03-05 12:08:29 +01:00
Rene Groeschke
cfa98f30e5
Fix configuration cache compatibility issues (#124073)
- for running :plugins:discovery-ec2:check
- checking if in idea in build scan background action
2025-03-05 21:06:31 +11: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
Mark Vieira
cc08d1d2a6
Add inbound_network entitlement to repository-hdfs plugin (#123907) 2025-03-04 09:24:54 -08:00
Lorenzo Dematté
404c9e6290
missing file entitlement used by google-http-client for oauth2 (#123985) 2025-03-04 16:06:44 +01:00
Tim Vernum
23e5c15590
Fix custom authz engine for multi-project (#123937) 2025-03-04 01:21:07 +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
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
Lorenzo Dematté
678738acc0
[Entitlements] Add URLConnection instrumentation (#123503) 2025-03-03 08:40:53 +01:00
Lorenzo Dematté
850d48a944
Missing policies for netty, discovery-azure and repository-s3 (#123696) 2025-03-02 22:34:38 +01:00
Tim Vernum
4f918a81b9 Merge main into multi-project 2025-02-20 12:17:12 +11:00
Lorenzo Dematté
20b829fc14
[Entitlements] Add check functions for NIO Files (#122591) 2025-02-19 21:55:06 +01:00
Lorenzo Dematté
340a2ceb29
Fix hdfs-related IT tests for java24 (#122044) 2025-02-19 18:27:09 +01:00