Commit Graph

34 Commits

Author SHA1 Message Date
Moritz Mack f6d233eaf0
Re-enable entitlements for various ingest tests (#130708) 2025-07-07 15:41:27 +02:00
Patrick Doyle 89f701f4c4
Bootstrap entitlements for testing (#129268)
* Fix ExceptionSerializationTests to use getCodeSource instead of getResource.

Using getResource makes this sensitive to unrelated classpath entries,
such as the entitlement bridge library, that get prepended to the classpath.

* FIx logging tests to use org.elasticsearch.index instead of root logger.

Using the root logger makes this sensitive to unrelated
logging, such as from the entitlement library.

* Fix entitlement error message by stashing the module name in ModuleEntitlements.

Taking the actual module name from the class doesn't work in tests,
where those classes are loaded from the classpath and so their module
info is misleading.

* Ignore server locations whose representative class isn't loaded

* Partial initial implementation

* System properties: testOnlyClasspath and enableForTests

* Trivially allow some packages

* DEBUG: use TreeMap in TestScopeResolver for readability

* Special case bouncycastle for security plugin

* Add CONFIG to TestPathLookup

* Add the classpath to the source path list for every plugin

* Add @WithoutEntitlements to tests that run ES nodes

* Set es.entitlement.enableForTests for all libs

* Use @WithoutEntitlements on ingest plugin tests

* Substitute ALL-UNNAMED for module name in non-modular plugins

* Add missing entitlements found by unit tests

* Comment in TestScopeResolver

* Properly compute bridge jar location for patch-module

* Call out nonServerLibs

* Don't build two TestPathLookups

* More comments for meta-tests

* Remove redundant dependencies for bridgeJarConfig.

These are alread set in ElasticsearchJavaBasePlugin.

* Add bridge+agent dependencies only if those exist.

For serverless, those project dependencies don't exist, and we'll need
to add the dependencies differently, using Maven coordinates.

* [CI] Auto commit changes from spotless

* Pass testOnlyPath in environment instead of command line.

It's typically a very very long string, which made Windows angry.

* [CI] Auto commit changes from spotless

* Split testOnlyPathString at File.pathSeparator

* Use doFirst to delay setting testOnlyPath env var

* Trivially allow jimfs (??)

* Don't enforce entitlements on internalClusterTest for now

* Replace forbidden APIs

* Match testOnlyClasspath using URI instead of String.

We already get the "needle" in the form of a URI, so this skips
a step, and has the benefit of also working on Windows.

* [CI] Auto commit changes from spotless

* More forbidden APIs

* Disable configuration cache for LegacyYamlRestTestPluginFuncTest

* Strip carriage-return characters in expected output for ReleaseNotesGeneratorTest.

The template generator also strips these, so we need to do so to make this pass
on Windows.

Note that we use replace("\r", "") where the template generator uses
replace("\\r", ""). The latter didn't work for me when I tried it on Windows,
for reasons I'm not aware of.

* Move configureEntitlements to ElasticsearchTestBasePlugin as-is

* Use matching instead of if

* Remove requireNonNull

* Remove default configuration

* Set inputs instead of dependencies

* Use test.systemProperty

* Respond to PR comments

* Disable entitlement enforcement for ScopedSettingsTests.

This test works by altering the logging on the root logger.
With entitlements enabled, that will cause additional log statements to appear,
which interferes with the test.

* Address PR comments

* Moritz's configureJavaBaseModuleOptions

* Allow for entitlements not yet enforced in serverless

* fix entitlementBridge config after rename

* drop empty file collections

* Remove workaround in LegacyYamlRestTestPluginFuncTest

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Lorenzo Dematté <lorenzo.dematte@elastic.co>
Co-authored-by: Moritz Mack <mmack@apache.org>
2025-07-02 13:44:38 -04:00
Keith Massey 3f736a7826
Updating tika to 2.9.3 (#127353) 2025-04-25 08:43:26 -05:00
Ryan Ernst 05d18a2981
Remove SecurityManager code from ingest attachment (#127291)
Now that SecurityManager is gone, there is no longer a need for a
specialized access control context for interacting with tika.
2025-04-24 06:22:10 -07:00
Lorenzo Dematté a4d7297944
Permanently switch from SecurityManager to Entitlements (#124865) (#125117)
The JDK team has completely disabled the Java SecurityManager from Java 24. Elasticsearch has always used the Java SecurityManager as an additional protection mechanism; in order to retain this second line of defense, the Elasticsearch Core/Infra team has been working on the Entitlements project.

Similar to SecurityManager, Entitlements only allow calling specific methods in the JDK when the caller has a matching policy attached. In other words, if some code (in the main Elasticsearch codebase, in a plugin/module, or in a script) attempts to perform a "privileged" operation and it is not entitled to do so, a NotEntitledException will be thrown.

This PR includes the minimal set of changes to always use Entitlements, regardless of system properties or Java version.

Relates to ES-10921
2025-03-18 18:38:45 +02:00
Patrick Doyle fd51f44e32
Silence known entitlement warnings (#124883) 2025-03-18 16:52:12 +02: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
Moritz Mack 7fd1addccf
[Entitlements] Instrument nio path (#122507) 2025-02-17 14:01:57 +01: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
Pete Gillin bc25a73543
Update `UpdateForV9` in `AttachmentProcessor` (#118186)
We are not going to make this change in V9. We may do it in V10. This
change just bumps the annotation to remind us to revisit.

Since we are living with this for a while, it seems worth improving
the documentation. This now encourages explicitly setting the option
one way or the other, since you get a warning if you omit it. It also
changes the existing examples to use true rather than false, as that's
our recommendation. And it adds a new section with an example where
it's true, and moves the content previously in a note into that
section.
2024-12-09 14:28:24 +00:00
Rene Groeschke f6ac6e1c3b
[Build] Remove deprecated BuildParams (#116984) 2024-11-22 16:30:57 +01:00
Rene Groeschke 13c8aaeffa
[Gradle] Remove static use of BuildParams (#115122)
Static fields dont do well in Gradle with configuration cache enabled.

- Use buildParams extension in build scripts
- Keep BuildParams.ci for now for easy serverless migration
-  Tweak testing doc
2024-11-15 17:58:57 +01:00
David Turner 81bd8667cb
Define owners for `UpdateForV9` annotations (#113926)
In order to better track the work needed to prepare this branch for the
major version upgrade, this commit adds a mandatory `owner` field to all
`UpdateForV9` (and `UpdateForV10`) annotations.
2024-10-02 11:37:14 +01:00
Mark Vieira a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00
Mark Vieira 4ce661cc48
Bump Elasticsearch version to 9.0.0 (#112570) 2024-09-11 09:40:11 -07:00
Jake Landis 6d20cef931
Bump Tika dependencies to 2.9.2 (#108144)
This commit bumps Tika to 2.9.2 and manually bumps the transitive versions 
to match 2.9.2's parent POM. This commit also centralizes the dependency 
versions so that you only need to look at 1 list to see the full set of dependencies 
to manually check.
2024-05-02 10:19:31 -05:00
Moritz Mack 1f5e04b721
Migrate YAML REST tests to synthetic cluster feature check (#107068)
To simplify the migration away from version based skip checks in YAML specs, 
this PR adds a synthetic version feature `gte_vX.Y.Z` for any version at or before 8.14.0.

New test specs for 8.14 or later are expected to use respective new cluster features,
or a test-only feature supplied via ESRestTestCase#createAdditionalFeatureSpecifications
if sufficient.
2024-04-11 18:22:38 +02:00
Keith Massey b418c9422c
Updating the tika version to 2.9.1 in the ingest attachment plugin (#106315) 2024-03-14 16:36:03 -05:00
Lorenzo Dematté bd4f29688d
Moved some other "poison pills" to UpdateForV9 annotation (#102287)
Follow up of #101767
Move from exception and assertions using Version.CURRENT to @UpdateForV9 annotation
2023-11-16 12:51:00 +01:00
Brian Seeders 0a95aa203b
Update ingest-attachment module to use new rest test framework (#100734) 2023-10-30 13:43:02 -04:00
Keith Massey a59180459a
Improving tika PDF handling (#101486)
Correctly handling PDF files with public key encryption in attachment processor
2023-10-30 07:41:18 -05:00
Jake Landis f3aa254b55
Bump version for commons-compress (#99633)
This commit bumps the version for commons-compress to 1.24.0.
2023-09-18 14:03:59 -05:00
Joe Gallo 8d7072c5e9
IngestService log registered processor types on startup (#95023) 2023-04-05 11:00:23 -04:00
Rory Hunter fe1083f6c5
Upgrade spotless plugin to 6.17.0 (#94994)
Fixes #82794. Upgrade the spotless plugin, which addresses the issue
around formatting `instanceof` expressions. Formatting of statements
including lambdas seems to have improved too.
2023-04-04 10:03:32 +01:00
Joe Gallo 7ae08e2257
Disable ingest-attachment logging (#93878)
Co-authored-by: Keith Massey <keith.massey@elastic.co>
2023-02-27 09:53:55 -05:00
William Chaparro e2a335c1ac
Update juniversalchardet NOTICE file to include link to source (#94097)
Per open-source working group guidance on appropriate attribution for Mozilla Public License code, adding link to MPL source.
2023-02-24 09:09:56 -05:00
Joe Gallo e1ed40671e
Upgrade tika to 2.7.0 (#93759) 2023-02-14 11:57:17 -05:00
Joe Gallo e907d89966
ingest-attachment module tika dependency versions (#93755) 2023-02-13 15:41:33 -05:00
Mark Vieira c2eda511de
Add JUnit rule based integration test cluster orchestration framework (#92379)
This commit adds a new test framework for configuring and orchestrating
test clusters for both Java and YAML REST testing. This will eventually
replace the existing "test-clusters" Gradle plugin and the build-time
cluster orchestration.
2022-12-21 15:33:46 -08:00
Keith Massey b4726ec7e5
Upgrading tika to 2.6.0 (#92104)
Upgrading tika and its dependencies.
2022-12-05 15:58:24 -05:00
Lee Hinman 4fe9fc488c
Deprecate 'remove_binary' default of false for ingest attachment processor (#90460)
This commit adds deprecation warning for when the `remove_binary`
setting is unset. In the future we want to change the default to `true`
(it is currently `false`), so this will let a user know they should be
explicit about setting this to ensure the behavior does not change in a
future (breaking) release.

Relates to #86014
2022-10-04 01:04:40 +10:30
Rene Groeschke 3909b5eaf9
Add verification metadata for dependencies (#88814)
Removing the custom dependency checksum functionality in favor of Gradle build-in dependency verification support. 

- Use sha256 in favor of sha1 as sha1 is not considered safe these days.

Closes https://github.com/elastic/elasticsearch/issues/69736
2022-08-04 09:51:16 +02:00
Keith Massey d532af3c76
Removing BouncyCastle dependencies from ingest-attachment plugin (#88031)
This removes the BouncyCastle dependencies from the ingest-attachment plugin in order to reduce the artifact size and reduce our exposure to security problems. The BouncyCastle libraries are only needed for things that we do not support anyway (decrypting PDFs for example).
2022-06-28 11:00:17 -05:00
Ryan Ernst eed8da3919
Move the ingest attachment processor to the default distribution (#87989)
The ingest attachment processor is currently available as a plugin. This
commit moves the processor to the default distribution so it is always
available.
2022-06-28 02:10:36 -04:00