Skip to content

Commit

Permalink
Add suppression for all removal warnings (opensearch-project#1828)
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <petern@amazon.com>
  • Loading branch information
peternied authored May 23, 2022
1 parent e27659d commit 1f88d86
Show file tree
Hide file tree
Showing 33 changed files with 60 additions and 2 deletions.
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ tasks.withType(Checkstyle) {
}
}

tasks.withType(JavaCompile) {
configure(options) {
options.compilerArgs << '-Xlint:removal' << '-Werror'
}
}

spotless {
java {
// note: you can use an empty string for all the imports you didn't specify explicitly, and '\\#` prefix for static imports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public AbstractHTTPJwtAuthenticator(Settings settings, Path configPath) {
}

@Override
@SuppressWarnings("removal")
public AuthCredentials extractCredentials(RestRequest request, ThreadContext context)
throws OpenSearchSecurityException {
final SecurityManager sm = System.getSecurityManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public HTTPJwtAuthenticator(final Settings settings, final Path configPath) {


@Override
@SuppressWarnings("removal")
public AuthCredentials extractCredentials(RestRequest request, ThreadContext context) throws OpenSearchSecurityException {
final SecurityManager sm = System.getSecurityManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class HTTPSpnegoAuthenticator implements HTTPAuthenticator {
private Set<String> acceptorPrincipal;
private Path acceptorKeyTabPath;

@SuppressWarnings("removal")
public HTTPSpnegoAuthenticator(final Settings settings, final Path configPath) {
super();
try {
Expand Down Expand Up @@ -165,6 +166,7 @@ public Void run() {
}

@Override
@SuppressWarnings("removal")
public AuthCredentials extractCredentials(final RestRequest request, ThreadContext threadContext) {
final SecurityManager sm = System.getSecurityManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class AuthTokenProcessorHandler {

}

@SuppressWarnings("removal")
boolean handle(RestRequest restRequest, RestChannel restChannel) throws Exception {
try {
final SecurityManager sm = System.getSecurityManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ public void destroy() {
}
}

@SuppressWarnings("removal")
static void ensureOpenSamlInitialization() {
if (openSamlInitialized) {
return;
Expand Down Expand Up @@ -299,6 +300,7 @@ public Void run() throws InitializationException {
}
}

@SuppressWarnings("removal")
private MetadataResolver createMetadataResolver(final Settings settings, final Path configPath)
throws Exception {
final AbstractMetadataResolver metadataResolver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class Saml2SettingsProvider {
this.spSignaturePrivateKey = spSignaturePrivateKey;
}

@SuppressWarnings("removal")
Saml2Settings get() throws SamlConfigException {
try {
HashMap<String, Object> configProperties = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class SamlFilesystemMetadataResolver extends FilesystemMetadataResolver {
}

@Override
@SuppressWarnings("removal")
protected byte[] fetchMetadata() throws ResolverException {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class SamlHTTPMetadataResolver extends HTTPMetadataResolver {
}

@Override
@SuppressWarnings("removal")
protected byte[] fetchMetadata() throws ResolverException {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() {
Expand All @@ -64,6 +65,7 @@ private static SettingsBasedSSLConfigurator.SSLConfig getSSLConfig(Settings sett
return new SettingsBasedSSLConfigurator(settings, configPath, "idp").buildSSLConfig();
}

@SuppressWarnings("removal")
private static HttpClient createHttpClient(Settings settings, Path configPath) throws Exception {
try {
final SecurityManager sm = System.getSecurityManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public LDAPAuthorizationBackend(final Settings settings, final Path configPath)
this.userBaseSettings = LDAPAuthenticationBackend.getUserBaseSettings(settings);
}

@SuppressWarnings("removal")
public static void checkConnection(final ConnectionConfig connectionConfig, String bindDn, byte[] password) throws Exception {

final SecurityManager sm = System.getSecurityManager();
Expand Down Expand Up @@ -146,6 +147,7 @@ public Void run() throws Exception {

}

@SuppressWarnings("removal")
public static Connection getConnection(final Settings settings, final Path configPath) throws Exception {

final SecurityManager sm = System.getSecurityManager();
Expand Down Expand Up @@ -201,7 +203,7 @@ private static List<Map.Entry<String, Settings>> convertOldStyleSettingsToNewSty
return Collections.singletonList(result.entrySet().iterator().next());
}

@SuppressWarnings("unchecked")
@SuppressWarnings("removal")
private static void checkConnection0(final ConnectionConfig connectionConfig, String bindDn, byte[] password, final ClassLoader cl,
final boolean needRestore) throws KeyStoreException, NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, LdapException {
Expand Down Expand Up @@ -244,7 +246,6 @@ public Void run() throws Exception {
}
}

@SuppressWarnings("unchecked")
private static Connection getConnection0(final Settings settings, final Path configPath, final ClassLoader cl,
final boolean needRestore) throws KeyStoreException, NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, LdapException {
Expand Down Expand Up @@ -477,6 +478,7 @@ private void restoreClassLoader() {
};
}

@SuppressWarnings("removal")
private static void restoreClassLoader0(final ClassLoader cl) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
public class LdapHelper {

private static SearchFilter ALL = new SearchFilter("(objectClass=*)");
@SuppressWarnings("removal")
public static List<LdapEntry> search(final Connection conn, final String unescapedDn, SearchFilter filter,
final SearchScope searchScope) throws LdapException {

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/amazon/dlic/auth/ldap/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private Utils() {

}

@SuppressWarnings("removal")
public static void unbindAndCloseSilently(final Connection connection) {
if (connection == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public LDAPAuthenticationBackend2(final Settings settings, final Path configPath
}

@Override
@SuppressWarnings("removal")
public User authenticate(final AuthCredentials credentials) throws OpenSearchSecurityException {
final SecurityManager sm = System.getSecurityManager();

Expand Down Expand Up @@ -184,6 +185,7 @@ public String getType() {
return "ldap";
}

@SuppressWarnings("removal")
@Override
public boolean exists(final User user) {
final SecurityManager sm = System.getSecurityManager();
Expand Down Expand Up @@ -230,6 +232,7 @@ private boolean exists0(final User user) {
}
}

@SuppressWarnings("removal")
private void authenticateByLdapServer(final Connection connection, final String dn, byte[] password)
throws LdapException {
final SecurityManager sm = System.getSecurityManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private static List<Map.Entry<String, Settings>> convertOldStyleSettingsToNewSty
return Collections.singletonList(result.entrySet().iterator().next());
}

@SuppressWarnings("removal")
@Override
public void fillRoles(final User user, final AuthCredentials optionalAuthCreds)
throws OpenSearchSecurityException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class MakeJava9Happy {
private static ClassLoader classLoader;
private static boolean isJava9OrHigher = PlatformDependent.javaVersion() >= 9;;

@SuppressWarnings("removal")
static ClassLoader getClassLoader() {
if (!isJava9OrHigher) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public JndiProviderConfig getProviderConfig() {
}

@Override
@SuppressWarnings("removal")
public ProviderConnection create() throws LdapException {
final SecurityManager sm = System.getSecurityManager();

Expand Down Expand Up @@ -121,6 +122,7 @@ public PrivilegedProviderConnection(ProviderConnection delegate, JndiProviderCon
this.jndiProviderConfig = jndiProviderConfig;
}

@SuppressWarnings("removal")
public Response<Void> bind(BindRequest request) throws LdapException {
final SecurityManager sm = System.getSecurityManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public static <T> T getOrDefault(Map<String, Object> properties, String key, T d
return value != null ? value : defaultValue;
}

@SuppressWarnings("removal")
public static <T> T readTree(JsonNode node, Class<T> clazz) throws IOException {

final SecurityManager sm = System.getSecurityManager();
Expand All @@ -120,6 +121,7 @@ public T run() throws Exception {
}
}

@SuppressWarnings("removal")
public static <T> T readValue(String string, Class<T> clazz) throws IOException {

final SecurityManager sm = System.getSecurityManager();
Expand All @@ -140,6 +142,7 @@ public T run() throws Exception {
}
}

@SuppressWarnings("removal")
public static JsonNode readTree(String string) throws IOException {

final SecurityManager sm = System.getSecurityManager();
Expand All @@ -160,6 +163,7 @@ public JsonNode run() throws Exception {
}
}

@SuppressWarnings("removal")
public static String writeValueAsString(Object value, boolean omitDefaults) throws JsonProcessingException {

final SecurityManager sm = System.getSecurityManager();
Expand All @@ -181,6 +185,7 @@ public String run() throws Exception {

}

@SuppressWarnings("removal")
public static <T> T readValue(String string, TypeReference<T> tr) throws IOException {

final SecurityManager sm = System.getSecurityManager();
Expand All @@ -202,6 +207,7 @@ public T run() throws Exception {

}

@SuppressWarnings("removal")
public static <T> T readValue(String string, JavaType jt) throws IOException {

final SecurityManager sm = System.getSecurityManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static void inject(final InjectableValues.Std injectableValues) {
nonValidatingObjectMapper.setInjectableValues(injectableValues);
}

@SuppressWarnings("removal")
public static <T> T readValue(String string, JavaType jt) throws IOException {

final SecurityManager sm = System.getSecurityManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ private static boolean isSslCertReloadEnabled(final Settings settings) {
return settings.getAsBoolean(ConfigConstants.SECURITY_SSL_CERT_RELOAD_ENABLED, false);
}

@SuppressWarnings("removal")
public OpenSearchSecurityPlugin(final Settings settings, final Path configPath) {
super(settings, configPath, isDisabled(settings));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

import static org.opensearch.common.xcontent.DeprecationHandler.THROW_UNSUPPORTED_OPERATION;


public abstract class AbstractAuditLog implements AuditLog {
protected final Logger log = LogManager.getLogger(this.getClass());

Expand Down Expand Up @@ -508,6 +509,7 @@ public void logDocumentDeleted(ShardId shardId, Delete delete, DeleteResult resu
save(msg);
}

@SuppressWarnings("removal")
protected void logExternalConfig() {

final ComplianceConfig complianceConfig = getComplianceConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public AuditLogImpl(final Settings settings,
this(settings, configPath, clientProvider, threadPool, resolver, clusterService, null);
}

@SuppressWarnings("removal")
public AuditLogImpl(final Settings settings,
final Path configPath,
final Client clientProvider,
Expand Down Expand Up @@ -103,6 +104,7 @@ private Boolean removeShutdownHook() {
}

@Override
@SuppressWarnings("removal")
public void close() throws IOException {

log.info("Closing {}", getClass().getSimpleName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class KafkaSink extends AuditLogSink {
private Producer<Long, String> producer;
private String topicName;

@SuppressWarnings("removal")
public KafkaSink(final String name, final Settings settings, final String settingsPrefix, AuditLogSink fallbackSink) {
super(name, settings, settingsPrefix, fallbackSink);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public WebhookSink(final String name, final Settings settings, final String sett
}

@Override
@SuppressWarnings("removal")
public boolean doStore(AuditMessage msg) {
if (Strings.isEmpty(webhookUrl)) {
log.debug("Webhook URL is null");
Expand Down Expand Up @@ -299,6 +300,7 @@ protected boolean doPost(String url, String payload) {
}
}

@SuppressWarnings("removal")
private KeyStore getEffectiveKeyStore(final Path configPath) {

return AccessController.doPrivileged(new PrivilegedAction<KeyStore>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ private static <T> Field getFieldPrivileged(Class<T> cls, String name) {
}
}

@SuppressWarnings("removal")
private static <T> Field getField(Class<T> cls, String name) {
SpecialPermission.check();
return AccessController.doPrivileged((PrivilegedAction<Field>) () -> getFieldPrivileged(cls, name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public static <T> T serializeToXContentToPojo(String jsonContent, Class<T> clazz

}

@SuppressWarnings("removal")
public static byte[] jsonMapToByteArray(Map<String, Object> jsonAsMap) throws IOException {

final SecurityManager sm = System.getSecurityManager();
Expand All @@ -164,6 +165,7 @@ public byte[] run() throws Exception {
}
}

@SuppressWarnings("removal")
public static Map<String, Object> byteArrayToMutableJsonMap(byte[] jsonBytes) throws IOException {

final SecurityManager sm = System.getSecurityManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ private String[] getEnabledSSLProtocols(final SslProvider provider, boolean http

}

@SuppressWarnings("removal")
private void initEnabledSSLCiphers() {

final List<String> secureHttpSSLCiphers = SSLConfigConstants.getSecureSSLCiphers(settings, true);
Expand Down Expand Up @@ -929,6 +930,7 @@ private SslContext buildSSLClientContext(final File _key, final File _cert, fina

}

@SuppressWarnings("removal")
private SslContext buildSSLContext0(final SslContextBuilder sslContextBuilder) throws SSLException {

final SecurityManager sm = System.getSecurityManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public class OpenSearchSecuritySSLPlugin extends Plugin implements SystemIndexPl
// this(settings, configPath, false);
// }

@SuppressWarnings("removal")
protected OpenSearchSecuritySSLPlugin(final Settings settings, final Path configPath, boolean disabled) {

if(disabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class DefaultPrincipalExtractor implements PrincipalExtractor {
protected final Logger log = LogManager.getLogger(this.getClass());

@Override
@SuppressWarnings("removal")
public String extractPrincipal(final X509Certificate x509Certificate, final Type type) {
if (x509Certificate == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ protected class SSLClientChannelInitializer extends Netty4Transport.ClientChanne
private final DiscoveryNode node;
private SSLConnectionTestResult connectionTestResult;

@SuppressWarnings("removal")
public SSLClientChannelInitializer(DiscoveryNode node) {
this.node = node;
hostnameVerificationEnabled = settings.getAsBoolean(
Expand Down
Loading

0 comments on commit 1f88d86

Please sign in to comment.