mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-19 11:24:54 +00:00
Add some basic security testing/integration. The good news: 1. Basic security now works. Users without access to an index can't run sql queries against it. Without this change they could. 2. Document level security works! At least so far as I can tell. The work left to do: 1. Field level security doesn't work properly. I mean, it kind of works in that the field's values don't leak but it just looks like they all have null values. 2. We will need to test scrolling. 3. I've only added tests for the rest sql action. I'll need to add tests for jdbc and the CLI as well. 4. I've only added tests for `SELECT` and have ignored stuff like `DESCRIBE` and `SHOW TABLES`. Original commit: elastic/x-pack-elasticsearch@b9909bbda0
52 lines
2.0 KiB
Groovy
52 lines
2.0 KiB
Groovy
import org.elasticsearch.gradle.test.RunTask
|
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
dependencies {
|
|
testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'runtime')
|
|
testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'testArtifacts')
|
|
testCompile project(path: ':modules:reindex')
|
|
}
|
|
|
|
// NOCOMMIT we should try this on multiple nodes
|
|
|
|
integTestCluster {
|
|
plugin ':x-pack-elasticsearch:plugin'
|
|
setting 'xpack.ml.enabled', 'false'
|
|
setting 'xpack.monitoring.enabled', 'false'
|
|
extraConfigFile 'x-pack/roles.yml', 'roles.yml'
|
|
setupCommand 'setupUser#test_admin',
|
|
'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'x-pack-test-password', '-r', 'superuser'
|
|
waitCondition = { node, ant ->
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow",
|
|
dest: tmpFile.toString(),
|
|
username: 'test_admin',
|
|
password: 'x-pack-test-password',
|
|
ignoreerrors: true,
|
|
retries: 10)
|
|
return tmpFile.exists()
|
|
}
|
|
}
|
|
|
|
task run(type: RunTask) {
|
|
distribution = 'zip' // NOCOMMIT make double sure we want all the modules
|
|
plugin ':x-pack-elasticsearch:plugin'
|
|
setting 'xpack.ml.enabled', 'false'
|
|
setting 'xpack.monitoring.enabled', 'false'
|
|
extraConfigFile 'x-pack/roles.yml', 'roles.yml'
|
|
setupCommand 'setupUser#test_admin',
|
|
'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'x-pack-test-password', '-r', 'superuser'
|
|
waitCondition = { node, ant ->
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow",
|
|
dest: tmpFile.toString(),
|
|
username: 'test_admin',
|
|
password: 'x-pack-test-password',
|
|
ignoreerrors: true,
|
|
retries: 10)
|
|
return tmpFile.exists()
|
|
}
|
|
}
|