Commit Graph

147 Commits

Author SHA1 Message Date
Mark Vieira 398b0147a7
Upgrade Gradle wrapper to 7.5.1 (#88918) 2022-08-08 12:34:58 -07:00
Artem Prigoda 2a03ac35a6
Fix compilation in the rescore plugin (#89004)
Add source fallback operation when looking up a the factor field added in #88735

Resolves #88985
2022-08-01 21:05:57 +02:00
Rene Groeschke 98b789c940
Update to to Gradle wrapper 7.5 (#85141)
This updates the gradle wrapper to a 7.5

Fixes #85123
2022-07-19 08:12:19 +02:00
Ryan Ernst 6084b9d321
Fix rest example plugin (#87923)
This is a followup to
https://github.com/elastic/elasticsearch/pull/87504, to fix the example
plugin that used BytesRestResponse.
2022-06-22 08:57:00 -07:00
Albert Zaharovits 346abf9816
Improve "Has Privilege" performance for boolean-only response (#86685)
Boolean-only privilege checks, i.e. the ones currently used in the
"profile has privilege" API, now benefit from a performance improvement,
because the check will now stop upon first encountering a privilege that
is NOT granted over a resource (and return `false` overall). Previously,
all the privileges were always checked over all the resources in order
to assemble a comprehensive response with all the privileges that are
not granted.
2022-05-24 11:41:20 -04:00
Albert Zaharovits 3d4234e80e
Has privileges API for profiles (#85898)
This introduces a new Security API `_security/profile/_has_privileges`
that can be used to verify which Users have the requested privileges,
given their associated User Profiles. Multiple profile uids can be specified
in a single has privileges request.

This is analogous to the existing Has privileges API. It also uses the same
format for specifying the privileges to be checked, and should be used in
the same situations (ie to run an authorization preflight check or to verify
privileges over application resources). However, unlike the existing
has privilege API, this can be used to check the privileges of multiple
users (not only of the currently authenticated one), but the users must
have an existing profile, and the response is binary only (either it has or
it does not have the requested privileges).
Calling this API requires the `manage_user_profile` cluster privilege.
2022-05-06 09:54:34 +03:00
Yang Wang 286cb2b26c
[Test] Replace removed User methods (#86422)
Another refactor leftover.

Relates: #86246 Resolves: #86421
2022-05-04 08:36:36 -04:00
Yang Wang 210ce86663
[Test] Fix authentication creation in example project (#86385)
In #86206, we closed down Authentication constructors to favour
dedicated convenient methods for instantiation. The constructor usages
in the example project were however left out (another refactor fallout).

Relates: #86206
Resolves: #86378
2022-05-03 20:28:01 +10:00
Rene Groeschke 177b0fa47f
Mute failing example project (#86379)
Exclude example project to unblock PR checks till #86378 is addressed.
2022-05-03 05:15:29 -04:00
Rene Groeschke 3381fcd6d7
Update gradle wrapper to 7.4.2 (#85608) 2022-04-01 07:06:27 -04:00
Rene Groeschke 3e6bd7f538
Update Gradle enterprise plugin (#85216)
Also fix common GE configuration in plugins example build
2022-03-22 16:29:02 +01:00
Mark Vieira bc9e2e95c0
Update Gradle wrapper to 7.4.1 (#84841) 2022-03-10 09:17:09 -08:00
Rene Groeschke ccc18d7f73
Update gradle wrapper to 7.4 (#81963)
* Make ForbiddenApisPrecommitPlugin plugin Gradle 8.0 compatible
* Fix deprecations on ignoring empty folders for task inputs
* Update Gradle wrapper to 7.4 GA
2022-02-14 09:48:54 +01:00
Przemyslaw Gomulka 037261356e
Convert 'id' and '_id' values in REST API tests to strings (#82681)
Follow-up from #77144 (comment) with converting id/_id to always be strings instead of integers. This makes the type value in the Elasticsearch specification be only string instead of string | number.

this change was generated using following command on ubuntu
find . -type f -name "*.yml" -print0 | xargs -0 sed -i -r 's/([^a-zA-Z0-9_\.]id|[^a-zA-Z0-9_]_id):(\s*)([0-9]+)/\1:\2"\3"/g'
2022-02-10 09:14:17 +01:00
Rory Hunter 5f98acc04b
Fix compilation issues in example-plugins (#83258)
Commit 051e1d6c3c broke a couple of the
example plugins project, so get them working again.
2022-01-28 08:49:42 -05:00
Mark Vieira b7acb44af3
Reintroduce full index compatible testing of full cluster restart (#82506) 2022-01-13 10:58:13 -08:00
Mary Gouseti 4499050341
Use pattern matching for instanceof in plugins through qa, server/internalClusterTest (#82161) 2022-01-12 11:34:15 +01:00
Rene Groeschke 5280a17285
Update gradle wrapper to 7.3.3 (#82057)
Keep gradle version up to date
2021-12-23 06:57:43 -05:00
Chris Hegarty a2bc4854b5
Fix split package org.elasticsearch.client (#82010)
Fixes split packages between server and the LLRC (and HLRC), by renaming
the server package to a more appropriate name that represents the fact
that is in an internal client. That is, rename server's
org.elasticsearch.client to org.elasticsearch.client.internal.
2021-12-22 17:43:04 +00:00
Rene Groeschke da89f82024
Update gradle wrappers to 7.3.2 (#81798)
Keep our build up to date with latest gradle releases
2021-12-17 14:44:35 +01:00
Rene Groeschke 350fe2d21f
Fix classpath for example build integration tests (#81837)
This fixes two classpath issues for integration tests in the example
build

1. adds log4j to the runtime classpath where needed
2. removes exclude of jakarta json which was added as a workaround for

https://github.com/elastic/elasticsearch-java/issues/47
2021-12-16 17:08:24 -05:00
Rene Groeschke 7a1f35dd3e
Update gradle wrapper for plugin examples (#81435) 2021-12-07 16:10:44 +01:00
Mark Vieira 06d7e1682e
Bump source compatibility version to Java 17 (#80851) 2021-12-06 10:58:56 -08:00
Mark Vieira 533b534b87
Replace usages with HLRC in plugin examples with new client (#80786) 2021-11-17 09:15:52 -08:00
Mark Vieira c6cdbf8686
Fix references to moved classes in plugin examples (#80736) 2021-11-15 13:03:23 -08:00
Ryan Ernst 208d575e43
Remove Joda dependency (#79007)
This commit removes the dependency on the Joda library. It removes
many remaining references to joda, though not all because some comments
are worthwhile for historical reasoning.
2021-10-13 17:37:31 -07:00
Chris Hegarty 20c9f756d2
Fix split package org.elasticsearch.common.xcontent (#78831)
Fix the split package org.elasticsearch.common.xcontent, between server and the x-content lib. Move the x-content lib exported package from org.elasticsearch.common.xcontent to org.elasticsearch.xcontent ( following the naming convention of similar libraries ). Removing split packages is a prerequisite to modularization.
2021-10-08 17:14:26 +01:00
Nikola Grcevski 23b74b0e59
[TEST] Use persistent settings in YML tests (#78480)
Use persistent instead of transient settings for various REST
YML tests, because we are deprecating the transient cluster
settings.
2021-09-30 10:59:58 -04:00
Mark Vieira a9ae3136eb
Remove example-plugins included build (#78408) 2021-09-28 14:31:21 -07:00
Tim Vernum 29486b9b56
Short circuit authorization for child actions (#77221)
This commit detects a specific case when a child action (e.g. a shard
level action, or a phased action) acts on the same indices (or a
subset of the indices) or that parent request, and we can retain the
original authorization result.

The optimization is only effective for the invocation of the child
action on the same node as the parent - if the transport action needs
to be executed on a remote node then that authorization will not be
optimized and will perform the full check as existed before this
change.

This change is primarily benefitial for actions where a single parent
action on a coordinating node triggers the execution of multiple
children (e.g. a child action per shard) as it allows the
coordinating node to trigger those action and allow the load
to be passed to the remote nodes as quickly as possible rather than
having authorization on the coordinating node become a bottleneck.
2021-09-25 09:12:50 +10:00
Rene Groeschke 6ef13abe81
Do not create unused testCluster (#77581)
* Do not create unused testCluster

This avoids creating test clusters that are not required during the build.
We use lazy configuration here on testClusters and only instantiate them as theyre

* Do not fail on run task (debug)

* Create more test cluster lazy

* Make more test cluster lazy

* Avoid creating unused testcluster

* Fix PluginBuildPlugin

* Fix disabling geo db download

* Fix cluster setup in repository-multi-version

* Polishing

* Fix issue with irretic groovy ogic

* Fix bwc tests

* Fix more bwcTests

* Fix more bwc tests

* Fix more bwc tests

* Fix more bwc tests

* Fix typo

* Minor polishing

* Fix rolling upgrade tests

* Fix cluster config in sql qa mixedcluster project

* Fix more bwc tests

* Clean up before review

* Document test cluster usage

* Api polising after Review

provide useCluster(Provider) method to TestClusterAware

Ideally we take this a step further and realize those test clusters only on use.
But out of scope of this PR.

* Allow gradle provider as value for nonSystemProperties

* Some simplification on test configuration

* Fix typo in rest test config

* Fix more typos

* Fix another typo

* Fix more typos
2021-09-23 03:45:59 -04:00
Mark Vieira b7c7bede4e
Ensure example plugin projects don't use stale artifacts (#78218)
This is a follow up to #78140 and fixes a few instances where the build
was resolving artifacts from our snapshot Maven repository insteady of
using project dependency substitutions from the included build. To
ensure we don't miss these going forward, when building in a composite
we omit the snapshot repo definition altogether, which would instead
result in an error during dependency resolution.
2021-09-22 15:09:44 -07:00
Mark Vieira 979f297f12
Isolate example plugins projects from main Elasticsearch build (#78140) 2021-09-22 12:01:26 -07:00
Mark Vieira 2393eaf6df
Introduce external build-tools JavaRestTestPlugin (#77603)
* Add external build tools JavaRestTestPlugin

* Fix integration test

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-09-13 14:10:22 -04:00
Rory Hunter e55edf937a
Fix shadowed variables in various places - part 1 (#77555)
Part of #19752.

Fix a number of locations where local variables or parameters are shadowing a field
that is defined in the same class.
2021-09-13 13:48:46 +01:00
Rene Groeschke 35ec6f348c
Introduce simple public yaml-rest-test plugin (#76554)
This introduces a basic public yaml rest test plugin that is supposed to be used by external 
elasticsearch plugin authors. This is driven by #76215

- Rename yaml-rest-test to intern-yaml-rest-test
- Use public yaml plugin in example plugins

Co-authored-by: Mark Vieira <portugee@gmail.com>
2021-08-31 08:45:52 +02:00
Stuart Tettemer 6c02a6c657
Script: Fields API for Sort and Score scripts (#75863)
Adds minimal fields API support to sort and score scripts.

Example: `field('myfield').getValue(123)` where `123` is the default if the field has no values.

Refs: #61388
2021-08-04 10:11:12 -05:00
Rene Groeschke b79dd52c1b
Cleanup QA projects build scripts (#74428)
Aiming for configuring less during the build,
this removes non required configuration from qa build scripts that do not
contain any sources. We also remove a few non required afterEvaluate hooks
2021-06-23 11:35:47 +02:00
Ryan Ernst 63012c8a40
Move ParseField to o.e.c.xcontent (#73923)
ParseField is part of the x-content lib, yet it doesn't exist under the
same root package as the rest of the lib. This commit moves the class to
the appropriate package.

relates #73784
2021-06-08 13:32:14 -07:00
Ryan Ernst 68817d7ca2
Rename o.e.common in libs/core to o.e.core (#73909)
When libs/core was created, several classes were moved from server's
o.e.common package, but they were not moved to a new package. Split
packages need to go away long term, so that Elasticsearch can even think
about modularization. This commit moves all the classes under o.e.common
in core to o.e.core.

relates #73784
2021-06-08 09:53:28 -07:00
Tamara Braun 35584d9fdd
Make RBACEngine.resolveAuthorizedIndicesFromRole Return Set for Lookups (#72598)
This changes the result of AuthorizationEngine.loadAuthorizedIndices
(and dependent methods) from List<String> to Set<String>.

This has the following performance benefits:
1. `contains` checks are faster
2.  RBACEngine always formed this collections as a Set, so this
    change reduces unnecessary copying.

An additional performance improvement was added when resolve authorized
index names for data streams.
2021-05-26 16:25:53 +10:00
Rene Groeschke e609e07cfe
Remove internal build logic from public build tool plugins (#72470)
Extract usage of internal API from TestClustersPlugin and PluginBuildPlugin and related plugins and build logic

This includes a refactoring of ElasticsearchDistribution to handle types
better in a way we can differentiate between supported Elasticsearch
Distribution types supported in TestCkustersPlugin and types only supported
in internal plugins.

It also introduces a set of internal versions of public plugins.

As part of this we also generate the plugin descriptors now.

As a follow up on this we can actually move these public used classes into 
an extra project (declared as included build)

We keep LoggedExec and VersionProperties effectively public And workaround for RestTestBase
2021-05-06 14:02:35 +02:00
Rene Groeschke 5bcd02cb4d
Restructure build tools java packages (#72030)
Related to #71593 we move all build logic that is for elasticsearch build only into
the org.elasticsearch.gradle.internal* packages

This makes it clearer if build logic is considered to be used by external projects
Ultimately we want to only expose TestCluster and PluginBuildPlugin logic
to third party plugin authors.

This is a very first step towards that direction.
2021-04-26 14:53:55 +02:00
Lyudmila Fokina 3b0b7941ae
Warn users if security is implicitly disabled (#70114)
* Warn users if security is implicitly disabled

Elasticsearch has security features implicitly disabled by default for
Basic and Trial licenses, unless explicitly set in the configuration
file.
This may be good for onboarding, but it also lead to unintended insecure
 clusters.
 This change introduces clear warnings when security features are
 implicitly disabled.
 - a warning header in each REST response if security is implicitly
 disabled;
 - a log message during cluster boot.
2021-04-13 18:33:41 +02:00
Mark Vieira dabf857548
Remove integration testing using OSS distribution (#69153) 2021-02-17 13:57:04 -08:00
Mark Vieira a92a647b9f Update sources with new SSPL+Elastic-2.0 license headers
As per the new licensing change for Elasticsearch and Kibana this commit
moves existing Apache 2.0 licensed source code to the new dual license
SSPL+Elastic license 2.0. In addition, existing x-pack code now uses
the new version 2.0 of the Elastic license. Full changes include:

 - Updating LICENSE and NOTICE files throughout the code base, as well
   as those packaged in our published artifacts
 - Update IDE integration to now use the new license header on newly
   created source files
 - Remove references to the "OSS" distribution from our documentation
 - Update build time verification checks to no longer allow Apache 2.0
   license header in Elasticsearch source code
 - Replace all existing Apache 2.0 license headers for non-xpack code
   with updated header (vendored code with Apache 2.0 headers obviously
   remains the same).
 - Replace all Elastic license 1.0 headers with new 2.0 header in xpack.
2021-02-02 16:10:53 -08:00
Julie Tibshirani 5852fbedf5
Rename QueryShardContext -> SearchExecutionContext. (#67490)
We decided to rename `QueryShardContext` to clarify that it supports all parts
of search request execution. Before there was confusion over whether it should
only be used for building queries, or maybe only used in the query phase. This
PR also updates the javadocs.

Closes #64740.
2021-01-14 09:11:59 -08:00
Ioannis Kakavas bd873698bc
Ensure CI is run in FIPS 140 approved only mode (#64024)
We were depending on the BouncyCastle FIPS own mechanics to set
itself in approved only mode since we run with the Security
Manager enabled. The check during startup seems to happen before we
set our restrictive SecurityManager though in
org.elasticsearch.bootstrap.Elasticsearch , and this means that
BCFIPS would not be in approved only mode, unless explicitly
configured so.

This commit sets the appropriate JVM property to explicitly set
BCFIPS in approved only mode in CI and adds tests to ensure that we
will be running with BCFIPS in approved only mode when we expect to.
It also sets xpack.security.fips_mode.enabled to true for all test clusters
used in fips mode and sets the distribution to the default one. It adds a
password to the elasticsearch keystore for all test clusters that run in fips
mode.
Moreover, it changes a few unit tests where we would use bcrypt even in
FIPS 140 mode. These would still pass since we are bundling our own
bcrypt implementation, but are now changed to use FIPS 140 approved
algorithms instead for better coverage.

It also addresses a number of tests that would fail in approved only mode
Mainly:

    Tests that use PBKDF2 with a password less than 112 bits (14char). We
    elected to change the passwords used everywhere to be at least 14
    characters long instead of mandating
    the use of pbkdf2_stretch because both pbkdf2 and
    pbkdf2_stretch are supported and allowed in fips mode and it makes sense
    to test with both. We could possibly figure out the password algorithm used
    for each test and adjust password length accordingly only for pbkdf2 but
    there is little value in that. It's good practice to use strong passwords so if
    our docs and tests use longer passwords, then it's for the best. The approach
    is brittle as there is no guarantee that the next test that will be added won't
    use a short password, so we add some testing documentation too.
    This leaves us with a possible coverage gap since we do support passwords
    as short as 6 characters but we only test with > 14 chars but the
    validation itself was not tested even before. Tests can be added in a followup,
    outside of fips related context.

    Tests that use a PKCS12 keystore and were not already muted.

    Tests that depend on running test clusters with a basic license or
    using the OSS distribution as FIPS 140 support is not available in
    neither of these.

Finally, it adds some information around FIPS 140 testing in our testing
documentation reference so that developers can hopefully keep in
mind fips 140 related intricacies when writing/changing docs.
2020-12-23 21:00:49 +02:00
Martijn Laarman e31e3dea32
Add `visibility` the to rest-spec-api (#56104) 2020-12-14 12:23:28 +01:00
Rene Groeschke defaa93902
Avoid tasks materialized during configuration phase (#65922)
* Avoid tasks materialized during configuration phase
* Fix RestTestFromSnippet testRoot setup
2020-12-12 16:14:17 +01:00