mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-18 19:05:06 +00:00
This fixes the `lenient` parameter to be `missingClasses`. I will remove this boolean and we can handle them via the normal whitelist. It also adds a check for sheisty classes (jar hell with the jdk). This is inspired by the lucene "sheisty" classes check, but it has false positives. This check is more evil, it validates every class file against the extension classloader as a resource, to see if it exists there. If so: jar hell. This jar hell is a problem for several reasons: 1. causes insanely-hard-to-debug problems (like bugs in forbidden-apis) 2. hides problems (like internal api access) 3. the code you think is executing, is not really executing 4. security permissions are not what you think they are 5. brings in unnecessary dependencies 6. its jar hell The more difficult problems are stuff like jython, where these classes are simply 'uberjared' directly in, so you cant just fix them by removing a bogus dependency. And there is a legit reason for them to do that, they want to support java 1.4.
138 lines
5.2 KiB
Groovy
138 lines
5.2 KiB
Groovy
/*
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
* license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright
|
|
* ownership. Elasticsearch licenses this file to you under
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
* not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
import com.carrotsearch.gradle.junit4.RandomizedTestingTask
|
|
import org.elasticsearch.gradle.BuildPlugin
|
|
import org.elasticsearch.gradle.test.RestSpecHack
|
|
|
|
apply plugin: 'elasticsearch.build'
|
|
apply plugin: 'com.bmuschko.nexus'
|
|
apply plugin: 'nebula.optional-base'
|
|
|
|
archivesBaseName = 'elasticsearch'
|
|
|
|
dependencies {
|
|
|
|
// lucene
|
|
compile "org.apache.lucene:lucene-core:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-analyzers-common:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-backward-codecs:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-grouping:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-highlighter:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-join:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-memory:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-misc:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-queries:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-queryparser:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-sandbox:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-spatial:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
|
|
compile "org.apache.lucene:lucene-suggest:${versions.lucene}"
|
|
|
|
compile 'org.elasticsearch:securesm:1.0'
|
|
|
|
// utilities
|
|
compile 'commons-cli:commons-cli:1.3.1'
|
|
compile 'com.carrotsearch:hppc:0.7.1'
|
|
|
|
// time handling, remove with java 8 time
|
|
compile 'joda-time:joda-time:2.8.2'
|
|
// joda 2.0 moved to using volatile fields for datetime
|
|
// When updating to a new version, make sure to update our copy of BaseDateTime
|
|
compile 'org.joda:joda-convert:1.2'
|
|
|
|
// json and yaml
|
|
compile "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
|
|
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${versions.jackson}"
|
|
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}"
|
|
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}"
|
|
|
|
// network stack
|
|
compile 'io.netty:netty:3.10.5.Final'
|
|
// percentiles aggregation
|
|
compile 'com.tdunning:t-digest:3.0'
|
|
// precentil ranks aggregation
|
|
compile 'org.hdrhistogram:HdrHistogram:2.1.6'
|
|
|
|
// lucene spatial
|
|
compile "com.spatial4j:spatial4j:${versions.spatial4j}", optional
|
|
compile "com.vividsolutions:jts:${versions.jts}", optional
|
|
|
|
// logging
|
|
compile "log4j:log4j:${versions.log4j}", optional
|
|
compile "log4j:apache-log4j-extras:${versions.log4j}", optional
|
|
compile "org.slf4j:slf4j-api:${versions.slf4j}", optional
|
|
|
|
compile "net.java.dev.jna:jna:${versions.jna}", optional
|
|
|
|
if (isEclipse == false || project.path == ":core-tests") {
|
|
testCompile("org.elasticsearch:test-framework:${version}") {
|
|
// tests use the locally compiled version of core
|
|
exclude group: 'org.elasticsearch', module: 'elasticsearch'
|
|
}
|
|
}
|
|
}
|
|
|
|
if (isEclipse) {
|
|
// in eclipse the project is under a fake root, we need to change around the source sets
|
|
sourceSets {
|
|
if (project.path == ":core") {
|
|
main.java.srcDirs = ['java']
|
|
main.resources.srcDirs = ['resources']
|
|
} else {
|
|
test.java.srcDirs = ['java']
|
|
test.resources.srcDirs = ['resources']
|
|
}
|
|
}
|
|
}
|
|
|
|
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked"
|
|
compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked"
|
|
|
|
forbiddenPatterns {
|
|
exclude '**/*.json'
|
|
exclude '**/*.jmx'
|
|
exclude '**/org/elasticsearch/cluster/routing/shard_routes.txt'
|
|
}
|
|
|
|
// classes are missing, e.g. org.jboss.marshalling.Marshaller
|
|
thirdPartyAudit.missingClasses = true
|
|
// uses internal sun ssl classes!
|
|
thirdPartyAudit.excludes = [
|
|
// uses internal java api: sun.security.x509 (X509CertInfo, X509CertImpl, X500Name)
|
|
'org.jboss.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator',
|
|
]
|
|
|
|
// dependency license are currently checked in distribution
|
|
dependencyLicenses.enabled = false
|
|
|
|
if (isEclipse == false || project.path == ":core-tests") {
|
|
task integTest(type: RandomizedTestingTask,
|
|
group: JavaBasePlugin.VERIFICATION_GROUP,
|
|
description: 'Multi-node tests',
|
|
dependsOn: test.dependsOn) {
|
|
configure(BuildPlugin.commonTestConfig(project))
|
|
classpath = project.test.classpath
|
|
testClassesDir = project.test.testClassesDir
|
|
include '**/*IT.class'
|
|
}
|
|
check.dependsOn integTest
|
|
integTest.mustRunAfter test
|
|
}
|