Skip to content

Commit 3784a15

Browse files
committed
Merge remote-tracking branch 'origin/master' into develop
2 parents 24a6623 + 1aed0d7 commit 3784a15

File tree

45 files changed

+561
-697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+561
-697
lines changed

azure-pipelines.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,26 @@ pool:
4646

4747
stages:
4848

49+
- stage: ES_S3_UP
50+
displayName: 'Upload missing ROR ES dependencies'
51+
dependsOn: [ ]
52+
condition: and(succeeded(), ne(variables['Build.Reason'], 'Manual'))
53+
jobs:
54+
- job:
55+
steps:
56+
- script: |
57+
# Translate back env vars to avoid cyclical reference :/
58+
export aws_access_key_id=$var_aws_access_key_id
59+
export aws_secret_access_key=$var_aws_secret_access_key
60+
ci/upload_es_artifacts.sh
61+
continueOnError: true
62+
env:
63+
var_aws_access_key_id: $(aws_access_key_id)
64+
var_aws_secret_access_key: $(aws_secret_access_key)
65+
4966
- stage: OPTIONAL_CHECKS
5067
displayName: 'Optional checks'
51-
dependsOn: [ ]
68+
dependsOn: [ ES_S3_UP ]
5269
condition: and(succeeded(), ne(variables['Build.Reason'], 'Manual'))
5370
jobs:
5471
- job: CVE_CHECK
@@ -97,7 +114,7 @@ stages:
97114

98115
- stage: REQUIRED_CHECKS
99116
displayName: 'Required checks'
100-
dependsOn: [ ]
117+
dependsOn: [ ES_S3_UP ]
101118
condition: and(succeeded(), ne(variables['Build.Reason'], 'Manual'))
102119
jobs:
103120
- job:
@@ -121,7 +138,7 @@ stages:
121138

122139
- stage: TEST
123140
displayName: 'Run all tests'
124-
dependsOn: [ ]
141+
dependsOn: [ ES_S3_UP ]
125142
condition:
126143
and(
127144
succeeded(),

ci/supported-es-versions/es8x.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
8.19.7
12
8.19.6
23
8.19.5
34
8.19.4

ci/supported-es-versions/es9x.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
9.2.1
12
9.2.0
3+
9.1.7
24
9.1.6
35
9.1.5
46
9.1.4

ci/upload_es_artifacts.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set -xe
44

55
echo ">>> ($0) UPLOADING ES ARTIFACTS ..."
66

7+
./gradlew --stacktrace --info clean ror-tools:uploadArtifactsFromEsBinaries -PesVersion=9.2.1
8+
./gradlew --stacktrace --info clean ror-tools:uploadArtifactsFromEsBinaries -PesVersion=9.1.7
79
#./gradlew --stacktrace --info clean ror-tools:uploadArtifactsFromEsBinaries -PesVersion=8.9.2
810
#./gradlew --stacktrace --info clean ror-tools:uploadArtifactsFromEsBinaries -PesVersion=8.9.1
911
#./gradlew --stacktrace --info clean ror-tools:uploadArtifactsFromEsBinaries -PesVersion=8.9.0

es67x/src/main/scala/tech/beshu/ror/es/utils/ChannelInterceptingRestHandlerDecorator.scala

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package tech.beshu.ror.es.utils
1818

19+
import cats.Show
1920
import cats.implicits.*
2021
import org.apache.logging.log4j.scala.Logging
2122
import org.elasticsearch.ElasticsearchException
@@ -31,7 +32,7 @@ import tech.beshu.ror.es.utils.ThreadContextOps.createThreadContextOps
3132
import tech.beshu.ror.implicits.*
3233
import tech.beshu.ror.utils.AccessControllerHelper.doPrivileged
3334

34-
import scala.util.{Failure, Success, Try}
35+
import scala.util.Try
3536

3637
class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandler,
3738
settings: Settings)
@@ -42,23 +43,16 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
4243
}
4344

4445
override def handleRequest(request: RestRequest, channel: RestChannel, client: NodeClient): Unit = {
45-
Try {
46-
RorRestChannel.from(channel) match {
47-
case Right(rorRestChannel) =>
48-
ThreadRepo.safeSetRestChannel(rorRestChannel) {
49-
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
50-
wrapped.handleRequest(request, rorRestChannel, client)
51-
}
52-
case Left(error) =>
53-
logError(error)
54-
implicit val show = authorizationValueErrorSanitizedShow
55-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
56-
}
57-
} match {
58-
case Success(_) =>
59-
case Failure(ex) =>
60-
logger.error(s"The incoming request handling error:", ex)
61-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.INTERNAL_SERVER_ERROR, new ElasticsearchException("ROR internal error")))
46+
RorRestChannel.from(channel) match {
47+
case Right(rorRestChannel) =>
48+
ThreadRepo.safeSetRestChannel(rorRestChannel) {
49+
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
50+
wrapped.handleRequest(request, rorRestChannel, client)
51+
}
52+
case Left(error) =>
53+
logError(error)
54+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
55+
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
6256
}
6357
}
6458

@@ -99,11 +93,11 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
9993

10094
private def logError(error: AuthorizationValueError): Unit = {
10195
{
102-
implicit val show = authorizationValueErrorSanitizedShow
96+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
10397
logger.warn(s"The incoming request was malformed. Cause: ${error.show}")
10498
}
10599
if (logger.delegate.isDebugEnabled()) {
106-
implicit val show = authorizationValueErrorWithDetailsShow
100+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorWithDetailsShow
107101
logger.debug(s"Malformed request detailed cause: ${error.show}")
108102
}
109103
}

es70x/src/main/scala/tech/beshu/ror/es/utils/ChannelInterceptingRestHandlerDecorator.scala

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package tech.beshu.ror.es.utils
1818

19+
import cats.Show
1920
import cats.implicits.*
2021
import org.apache.logging.log4j.scala.Logging
2122
import org.elasticsearch.ElasticsearchException
@@ -31,7 +32,7 @@ import tech.beshu.ror.es.utils.ThreadContextOps.createThreadContextOps
3132
import tech.beshu.ror.implicits.*
3233
import tech.beshu.ror.utils.AccessControllerHelper.doPrivileged
3334

34-
import scala.util.{Failure, Success, Try}
35+
import scala.util.Try
3536

3637
class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandler,
3738
settings: Settings)
@@ -42,23 +43,16 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
4243
}
4344

4445
override def handleRequest(request: RestRequest, channel: RestChannel, client: NodeClient): Unit = {
45-
Try {
46-
RorRestChannel.from(channel) match {
47-
case Right(rorRestChannel) =>
48-
ThreadRepo.safeSetRestChannel(rorRestChannel) {
49-
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
50-
wrapped.handleRequest(request, rorRestChannel, client)
51-
}
52-
case Left(error) =>
53-
logError(error)
54-
implicit val show = authorizationValueErrorSanitizedShow
55-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
56-
}
57-
} match {
58-
case Success(_) =>
59-
case Failure(ex) =>
60-
logger.error(s"The incoming request handling error:", ex)
61-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.INTERNAL_SERVER_ERROR, new ElasticsearchException("ROR internal error")))
46+
RorRestChannel.from(channel) match {
47+
case Right(rorRestChannel) =>
48+
ThreadRepo.safeSetRestChannel(rorRestChannel) {
49+
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
50+
wrapped.handleRequest(request, rorRestChannel, client)
51+
}
52+
case Left(error) =>
53+
logError(error)
54+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
55+
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
6256
}
6357
}
6458

@@ -99,11 +93,11 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
9993

10094
private def logError(error: AuthorizationValueError): Unit = {
10195
{
102-
implicit val show = authorizationValueErrorSanitizedShow
96+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
10397
logger.warn(s"The incoming request was malformed. Cause: ${error.show}")
10498
}
10599
if (logger.delegate.isDebugEnabled()) {
106-
implicit val show = authorizationValueErrorWithDetailsShow
100+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorWithDetailsShow
107101
logger.debug(s"Malformed request detailed cause: ${error.show}")
108102
}
109103
}

es710x/src/main/scala/tech/beshu/ror/es/utils/ChannelInterceptingRestHandlerDecorator.scala

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package tech.beshu.ror.es.utils
1818

19+
import cats.Show
1920
import cats.implicits.*
2021
import org.apache.logging.log4j.scala.Logging
2122
import org.elasticsearch.ElasticsearchException
@@ -31,7 +32,7 @@ import tech.beshu.ror.implicits.*
3132
import tech.beshu.ror.utils.AccessControllerHelper.doPrivileged
3233

3334
import java.util
34-
import scala.util.{Failure, Success, Try}
35+
import scala.util.Try
3536

3637
class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandler)
3738
extends RestHandler with Logging {
@@ -41,23 +42,16 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
4142
}
4243

4344
override def handleRequest(request: RestRequest, channel: RestChannel, client: NodeClient): Unit = {
44-
Try {
45-
RorRestChannel.from(channel) match {
46-
case Right(rorRestChannel) =>
47-
ThreadRepo.safeSetRestChannel(rorRestChannel) {
48-
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
49-
wrapped.handleRequest(request, rorRestChannel, client)
50-
}
51-
case Left(error) =>
52-
logError(error)
53-
implicit val show = authorizationValueErrorSanitizedShow
54-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
55-
}
56-
} match {
57-
case Success(_) =>
58-
case Failure(ex) =>
59-
logger.error(s"The incoming request handling error:", ex)
60-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.INTERNAL_SERVER_ERROR, new ElasticsearchException("ROR internal error")))
45+
RorRestChannel.from(channel) match {
46+
case Right(rorRestChannel) =>
47+
ThreadRepo.safeSetRestChannel(rorRestChannel) {
48+
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
49+
wrapped.handleRequest(request, rorRestChannel, client)
50+
}
51+
case Left(error) =>
52+
logError(error)
53+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
54+
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
6155
}
6256
}
6357

@@ -108,11 +102,11 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
108102

109103
private def logError(error: AuthorizationValueError): Unit = {
110104
{
111-
implicit val show = authorizationValueErrorSanitizedShow
105+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
112106
logger.warn(s"The incoming request was malformed. Cause: ${error.show}")
113107
}
114108
if (logger.delegate.isDebugEnabled()) {
115-
implicit val show = authorizationValueErrorWithDetailsShow
109+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorWithDetailsShow
116110
logger.debug(s"Malformed request detailed cause: ${error.show}")
117111
}
118112
}

es711x/src/main/scala/tech/beshu/ror/es/utils/ChannelInterceptingRestHandlerDecorator.scala

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package tech.beshu.ror.es.utils
1818

19+
import cats.Show
1920
import cats.implicits.*
2021
import org.apache.logging.log4j.scala.Logging
2122
import org.elasticsearch.ElasticsearchException
@@ -31,7 +32,7 @@ import tech.beshu.ror.implicits.*
3132
import tech.beshu.ror.utils.AccessControllerHelper.doPrivileged
3233

3334
import java.util
34-
import scala.util.{Failure, Success, Try}
35+
import scala.util.Try
3536

3637
class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandler)
3738
extends RestHandler with Logging {
@@ -41,23 +42,16 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
4142
}
4243

4344
override def handleRequest(request: RestRequest, channel: RestChannel, client: NodeClient): Unit = {
44-
Try {
45-
RorRestChannel.from(channel) match {
46-
case Right(rorRestChannel) =>
47-
ThreadRepo.safeSetRestChannel(rorRestChannel) {
48-
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
49-
wrapped.handleRequest(request, rorRestChannel, client)
50-
}
51-
case Left(error) =>
52-
logError(error)
53-
implicit val show = authorizationValueErrorSanitizedShow
54-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
55-
}
56-
} match {
57-
case Success(_) =>
58-
case Failure(ex) =>
59-
logger.error(s"The incoming request handling error:", ex)
60-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.INTERNAL_SERVER_ERROR, new ElasticsearchException("ROR internal error")))
45+
RorRestChannel.from(channel) match {
46+
case Right(rorRestChannel) =>
47+
ThreadRepo.safeSetRestChannel(rorRestChannel) {
48+
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
49+
wrapped.handleRequest(request, rorRestChannel, client)
50+
}
51+
case Left(error) =>
52+
logError(error)
53+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
54+
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
6155
}
6256
}
6357

@@ -104,11 +98,11 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
10498

10599
private def logError(error: AuthorizationValueError): Unit = {
106100
{
107-
implicit val show = authorizationValueErrorSanitizedShow
101+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
108102
logger.warn(s"The incoming request was malformed. Cause: ${error.show}")
109103
}
110104
if (logger.delegate.isDebugEnabled()) {
111-
implicit val show = authorizationValueErrorWithDetailsShow
105+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorWithDetailsShow
112106
logger.debug(s"Malformed request detailed cause: ${error.show}")
113107
}
114108
}

es714x/src/main/scala/tech/beshu/ror/es/utils/ChannelInterceptingRestHandlerDecorator.scala

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package tech.beshu.ror.es.utils
1818

19+
import cats.Show
1920
import cats.implicits.*
2021
import org.apache.logging.log4j.scala.Logging
2122
import org.elasticsearch.ElasticsearchException
@@ -31,7 +32,7 @@ import tech.beshu.ror.implicits.*
3132
import tech.beshu.ror.utils.AccessControllerHelper.doPrivileged
3233

3334
import java.util
34-
import scala.util.{Failure, Success, Try}
35+
import scala.util.Try
3536

3637
class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandler)
3738
extends RestHandler with Logging {
@@ -41,23 +42,16 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
4142
}
4243

4344
override def handleRequest(request: RestRequest, channel: RestChannel, client: NodeClient): Unit = {
44-
Try {
45-
RorRestChannel.from(channel) match {
46-
case Right(rorRestChannel) =>
47-
ThreadRepo.safeSetRestChannel(rorRestChannel) {
48-
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
49-
wrapped.handleRequest(request, rorRestChannel, client)
50-
}
51-
case Left(error) =>
52-
logError(error)
53-
implicit val show = authorizationValueErrorSanitizedShow
54-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
55-
}
56-
} match {
57-
case Success(_) =>
58-
case Failure(ex) =>
59-
logger.error(s"The incoming request handling error:", ex)
60-
channel.sendResponse(new BytesRestResponse(channel, RestStatus.INTERNAL_SERVER_ERROR, new ElasticsearchException("ROR internal error")))
45+
RorRestChannel.from(channel) match {
46+
case Right(rorRestChannel) =>
47+
ThreadRepo.safeSetRestChannel(rorRestChannel) {
48+
addXpackUserAuthenticationHeaderForInCaseOfSecurityRequest(request, client)
49+
wrapped.handleRequest(request, rorRestChannel, client)
50+
}
51+
case Left(error) =>
52+
logError(error)
53+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
54+
channel.sendResponse(new BytesRestResponse(channel, RestStatus.BAD_REQUEST, new ElasticsearchException(error.show)))
6155
}
6256
}
6357

@@ -104,11 +98,11 @@ class ChannelInterceptingRestHandlerDecorator private(val underlying: RestHandle
10498

10599
private def logError(error: AuthorizationValueError): Unit = {
106100
{
107-
implicit val show = authorizationValueErrorSanitizedShow
101+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorSanitizedShow
108102
logger.warn(s"The incoming request was malformed. Cause: ${error.show}")
109103
}
110104
if (logger.delegate.isDebugEnabled()) {
111-
implicit val show = authorizationValueErrorWithDetailsShow
105+
implicit val show: Show[AuthorizationValueError] = authorizationValueErrorWithDetailsShow
112106
logger.debug(s"Malformed request detailed cause: ${error.show}")
113107
}
114108
}

0 commit comments

Comments
 (0)