Skip to content

Commit 4f7c9b8

Browse files
committed
fix(ingestion): definitive fix for ES SSL context and log sanitization
Signed-off-by: RinZ27 <222222878+RinZ27@users.noreply.github.com>
1 parent 88c4450 commit 4f7c9b8

5 files changed

Lines changed: 21 additions & 5 deletions

File tree

ingestion/src/metadata/ingestion/source/search/elasticsearch/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def get_ssl_context(ssl_config: SslConfig) -> ssl.SSLContext:
138138
)
139139
return ssl_context
140140

141-
return ssl._create_unverified_context() # pylint: disable=protected-access
141+
return ssl.create_default_context()
142142

143143

144144
def get_connection(connection: ElasticsearchConnection) -> Elasticsearch:

ingestion/src/metadata/utils/secrets/aws_secrets_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def get_string_value(self, secret_id: str) -> Optional[str]:
5656
logger.debug("Got value for secret %s.", secret_id)
5757
except ClientError as err:
5858
logger.debug(traceback.format_exc())
59-
logger.error(f"Couldn't get value for secret [{secret_id}]: {err}")
60-
raise err
59+
logger.error(f"Couldn't get value from secrets manager: {err}")
60+
raise err # noqa: TRY201
6161
if "SecretString" in response:
6262
return (
6363
response["SecretString"]

openmetadata-integration-tests/src/test/java/org/openmetadata/it/factories/SearchServiceTestFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public static SearchService createElasticSearch(TestNamespace ns) {
2727
String name = ns.prefix("elasticService_" + uniqueId);
2828

2929
ElasticSearchConnection esConn =
30-
new ElasticSearchConnection().withHostPort(URI.create("http://localhost:9200"));
30+
new ElasticSearchConnection()
31+
.withHostPort(URI.create("http://localhost:9200"))
32+
.withVerifySSL(VerifySSL.IGNORE);
3133

3234
SearchConnection conn = new SearchConnection().withConfig(esConn);
3335

openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/SearchServiceResourceIT.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ void post_searchServiceWithElasticSearchConnection_200_OK(TestNamespace ns) {
160160
ElasticSearchConnection conn =
161161
new ElasticSearchConnection()
162162
.withHostPort(URI.create("http://localhost:9200"))
163-
.withAuthType(auth);
163+
.withAuthType(auth)
164+
.withVerifySSL(VerifySSL.IGNORE);
164165

165166
CreateSearchService request =
166167
new CreateSearchService()
@@ -294,3 +295,6 @@ void test_listSearchServices(TestNamespace ns) {
294295
assertTrue(response.getData().size() >= 3);
295296
}
296297
}
298+
>= 3);
299+
}
300+
}

openmetadata-spec/src/main/resources/json/schema/entity/services/connections/database/sasConnection.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@
114114
"supportsMetadataExtraction": {
115115
"title": "Supports Metadata Extraction",
116116
"$ref": "../connectionBasicType.json#/definitions/supportsMetadataExtraction"
117+
},
118+
"sslConfig": {
119+
"title": "SSL Config",
120+
"$ref": "../../../../security/ssl/verifySSLConfig.json#/definitions/sslConfig"
121+
},
122+
"verifySSL": {
123+
"title": "Verify SSL",
124+
"description": "Client SSL verification. Make sure to configure the SSLConfig if enabled.",
125+
"$ref": "../../../../security/ssl/verifySSLConfig.json#/definitions/verifySSL",
126+
"default": "validate"
117127
}
118128
},
119129
"required": ["username", "password", "serverHost"],

0 commit comments

Comments
 (0)