Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[source-mysql-v2] cdk and spec change for ssl #45351

Merged
merged 16 commits into from
Sep 17, 2024
Merged

[source-mysql-v2] cdk and spec change for ssl #45351

merged 16 commits into from
Sep 17, 2024

Conversation

xiaohansong
Copy link
Contributor

@xiaohansong xiaohansong commented Sep 9, 2024

What

https://github.com/airbytehq/airbyte-internal-issues/issues/9669

mysql-v2 supports SSL

How

Review guide

User Impact

Can this PR be safely reverted and rolled back?

  • YES πŸ’š
  • NO ❌

Copy link

vercel bot commented Sep 9, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Sep 17, 2024 7:31pm

@octavia-squidington-iii octavia-squidington-iii added connectors/source/mysql-v2 area/connectors Connector related issues CDK Connector Development Kit labels Sep 9, 2024
@xiaohansong xiaohansong marked this pull request as ready for review September 10, 2024 17:30
@xiaohansong xiaohansong requested a review from a team as a code owner September 10, 2024 17:30
@@ -0,0 +1,282 @@
/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but since this was auto-generate code, it's worth doing a pass to bring this code up to a better standard of quality.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore, please update source-firetruck to use this code.

"To always require encryption and verify that the source has a valid SSL certificate."
)
@SuppressFBWarnings(value = ["NP_NONNULL_RETURN_VIOLATION"], justification = "Micronaut DI")
class SslVerifyIdentity : Encryption {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@postamar I'm actually not sure what's the best practice there. SslVerifyIdentity shares the same members as SslVerifyCertificate, but they just match to different JsonSchemaTitle and description.

Here I simply copied them. Should I have class SslVerifyIdentity extending from SslVerifyCertificate instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copying is OK here. This code is not going to change much, ever. If it's really unreadable, then using sealed class to abstract shared components is OK. I don't know how well that works with the annotations, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question is, should these objects also be in the CDK, like SSH tunneling? Are they common patterns? Let's look into this once we've migrated all the existing certified sources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They may share some fields but most connectors have pretty different settings regarding to SSL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Good to know πŸ‘

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is copied from cdk 1.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the other, this file needs to be rewritten.

Copy link
Contributor

@postamar postamar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My biggest blocker is that the copied-over code needs to be improved as part of this PR. Everything else is minor.

@@ -1,6 +1,7 @@
dependencies {
implementation project(':airbyte-cdk:bulk:core:bulk-cdk-core-base')
implementation project(':airbyte-cdk:bulk:core:bulk-cdk-core-extract')
implementation 'org.apache.httpcomponents:httpcore:4.4'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this dependency? I don't see any imports from it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for SSLContext: org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(trustStore, null)

"LUNeYd9wXefwMrEWwDn0DZSsShZmgJoppA15qOnq+FVW/bhZwRv5L4l3AJv0SGoA\n" +
"o7DXxD0VGHDA6aC4tJssZbrnoDCBPzYmt9s9GwVupuEroJHZ0Wks4pt4Wx50DUgA\n" +
"KC3v0Mo/gg==\n" +
"-----END CERTIFICATE-----\n")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be """ ... """ blocks

@@ -0,0 +1,282 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but since this was auto-generate code, it's worth doing a pass to bring this code up to a better standard of quality.

Copy link
Contributor

@postamar postamar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is close.

} catch (ex2: InvalidKeySpecException) {
KeyFactory.getInstance("EC").generatePrivate(spec)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat

"To always require encryption and verify that the source has a valid SSL certificate."
)
@SuppressFBWarnings(value = ["NP_NONNULL_RETURN_VIOLATION"], justification = "Micronaut DI")
class SslVerifyIdentity : Encryption {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Good to know πŸ‘

Copy link
Contributor

@postamar postamar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Very nice.

@postamar
Copy link
Contributor

Sorry for the slow response. I should have approved this yesterday.

@xiaohansong xiaohansong merged commit 6469111 into master Sep 17, 2024
34 checks passed
@xiaohansong xiaohansong deleted the xiaohan/ssl branch September 17, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues CDK Connector Development Kit connectors/source/mysql-v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants