Skip to content

Commit

Permalink
Merge branch 'main' into feature/extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanL1997 committed Aug 9, 2023
2 parents 30cf5b1 + 46989b5 commit 493b53f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 23 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ updates:
interval: "weekly"
commit-message:
prefix: "dependabot:"
ignore:
# For all packages, ignore all major versions to minimize breaking issues
- dependency-name: "*"
update-types: ["version-update:semver-major"]
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
backport:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -25,6 +26,5 @@ jobs:
uses: VachaShah/[email protected]
with:
github_token: ${{ steps.github_app_token.outputs.token }}
branch_name: backport/backport-${{ github.event.number }}
head_template: backport/backport-<%= number %>-to-<%= base %>
failure_labels: backport-failed
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ jobs:
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: github/codeql-action/init@v1
- uses: github/codeql-action/init@v2
with:
languages: java
- run: ./gradlew clean build -Dbuild.snapshot=false -x test -x integrationTest
- uses: github/codeql-action/analyze@v1
- run: ./gradlew clean assemble
- uses: github/codeql-action/analyze@v2

build-artifact-names:
runs-on: ubuntu-latest
Expand Down
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ plugins {
id 'idea'
id 'jacoco'
id 'maven-publish'
id 'com.diffplug.spotless' version '6.19.0'
id 'com.diffplug.spotless' version '6.20.0'
id 'checkstyle'
id 'com.netflix.nebula.ospackage' version "11.3.0"
id "org.gradle.test-retry" version "1.5.4"
Expand Down Expand Up @@ -420,7 +420,7 @@ configurations {
resolutionStrategy {
force 'commons-codec:commons-codec:1.16.0'
force 'org.slf4j:slf4j-api:1.7.30'
force 'org.scala-lang:scala-library:2.13.9'
force 'org.scala-lang:scala-library:2.13.11'
force "com.fasterxml.jackson:jackson-bom:${versions.jackson}"
force "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
force "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${versions.jackson}"
Expand All @@ -432,7 +432,7 @@ configurations {
force "io.netty:netty-transport-native-unix-common:${versions.netty}"
force "org.apache.bcel:bcel:6.7.0" // This line should be removed once Spotbugs is upgraded to 4.7.4
force "com.github.luben:zstd-jni:${versions.zstd}"
force "org.xerial.snappy:snappy-java:1.1.10.1"
force "org.xerial.snappy:snappy-java:1.1.10.3"
force "com.google.guava:guava:${guava_version}"
}
}
Expand Down Expand Up @@ -511,7 +511,7 @@ dependencies {

//JSON path
implementation 'com.jayway.jsonpath:json-path:2.8.0'
implementation 'net.minidev:json-smart:2.4.11'
implementation 'net.minidev:json-smart:2.5.0'

implementation "org.apache.kafka:kafka-clients:${kafka_version}"

Expand Down Expand Up @@ -565,7 +565,7 @@ dependencies {
runtimeOnly 'io.dropwizard.metrics:metrics-core:4.2.19'
runtimeOnly 'org.slf4j:slf4j-api:1.7.30'
runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}"
runtimeOnly 'org.xerial.snappy:snappy-java:1.1.10.1'
runtimeOnly 'org.xerial.snappy:snappy-java:1.1.10.3'
runtimeOnly 'org.codehaus.woodstox:stax2-api:4.2.1'
runtimeOnly "org.glassfish.jaxb:txw2:${jaxb_version}"
runtimeOnly 'com.fasterxml.woodstox:woodstox-core:6.4.0'
Expand Down Expand Up @@ -614,7 +614,7 @@ dependencies {
testRuntimeOnly ('org.springframework:spring-core:5.3.27') {
exclude(group:'org.springframework', module: 'spring-jcl' )
}
testRuntimeOnly 'org.scala-lang:scala-library:2.13.9'
testRuntimeOnly 'org.scala-lang:scala-library:2.13.11'
testRuntimeOnly 'com.yammer.metrics:metrics-core:2.2.0'
testRuntimeOnly 'com.typesafe.scala-logging:scala-logging_3:3.9.5'
testRuntimeOnly 'org.apache.zookeeper:zookeeper:3.7.1'
Expand All @@ -627,7 +627,7 @@ dependencies {
compileOnly "org.opensearch:opensearch:${opensearch_version}"

//integration test framework:
integrationTestImplementation('com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.7.1') {
integrationTestImplementation('com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.1') {
exclude(group: 'junit', module: 'junit')
}
integrationTestImplementation 'junit:junit:4.13.2'
Expand Down
7 changes: 1 addition & 6 deletions scripts/integtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function usage() {
echo -e "-v OPENSEARCH_VERSION\t, no defaults"
echo -e "-n SNAPSHOT\t, defaults to false"
echo -e "-m CLUSTER_NAME\t, defaults to docker-cluster"
echo -e "-u COMMON_UTILS_VERSION\t, defaults to 3.0.0.0-SNAPSHOT"
echo "--------------------------------------------------------------------------"
}

Expand Down Expand Up @@ -99,12 +98,8 @@ if [ -z "$CLUSTER_NAME" ]
then
CLUSTER_NAME="docker-cluster"
fi
if [ -z "$COMMON_UTILS_VERSION" ]
then
COMMON_UTILS_VERSION="3.0.0.0-SNAPSHOT"
fi

USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'`
PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'`

./gradlew integTestRemote -Dtests.rest.cluster="$BIND_ADDRESS:$BIND_PORT" -Dtests.cluster="$BIND_ADDRESS:$BIND_PORT" -Dsecurity_enabled=$SECURITY_ENABLED -Dtests.clustername=$CLUSTER_NAME -Dhttps=true -Duser=$USERNAME -Dpassword=$PASSWORD -Dcommon_utils.version=$COMMON_UTILS_VERSION
./gradlew integTestRemote -Dtests.rest.cluster="$BIND_ADDRESS:$BIND_PORT" -Dtests.cluster="$BIND_ADDRESS:$BIND_PORT" -Dsecurity_enabled=$SECURITY_ENABLED -Dtests.clustername=$CLUSTER_NAME -Dhttps=true -Duser=$USERNAME -Dpassword=$PASSWORD
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.util.regex.Pattern;

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.greenrobot.eventbus.Subscribe;
Expand Down Expand Up @@ -202,12 +201,12 @@ public boolean isInitialized() {
return configModel != null && configModel.getSecurityRoles() != null && dcm != null;
}

private void setUserInfoInThreadContext(User user, Set<String> mappedRoles) {
private void setUserInfoInThreadContext(User user) {
if (threadContext.getTransient(OPENDISTRO_SECURITY_USER_INFO_THREAD_CONTEXT) == null) {
StringJoiner joiner = new StringJoiner("|");
joiner.add(user.getName());
joiner.add(String.join(",", user.getRoles()));
joiner.add(String.join(",", Sets.union(user.getSecurityRoles(), mappedRoles)));
joiner.add(String.join(",", user.getSecurityRoles()));
String requestedTenant = user.getRequestedTenant();
if (!Strings.isNullOrEmpty(requestedTenant)) {
joiner.add(requestedTenant);
Expand Down Expand Up @@ -260,9 +259,9 @@ public PrivilegesEvaluatorResponse evaluate(
presponse.resolvedSecurityRoles.addAll(mappedRoles);
final SecurityRoles securityRoles = getSecurityRoles(mappedRoles);

setUserInfoInThreadContext(user, mappedRoles);
// Add the security roles for this user so that they can be used for DLS parameter substitution.
user.addSecurityRoles(mappedRoles);
setUserInfoInThreadContext(user);

final boolean isDebugEnabled = log.isDebugEnabled();
if (isDebugEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,12 @@ private void deleteTestsDataDirectory() throws IOException {
Files.walkFileTree(testsDataDir.toPath(), new SimpleFileVisitor<>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
System.out.println("Deleting file " + file.getFileName());
Files.delete(file);
return FileVisitResult.CONTINUE;
}

@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
System.out.println("Deleting directory " + dir.getFileName());
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
Expand Down

0 comments on commit 493b53f

Please sign in to comment.