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

Create a secure-only MongoDb destination #6945

Merged
merged 7 commits into from
Oct 20, 2021

Conversation

irynakruk
Copy link
Contributor

@irynakruk irynakruk commented Oct 11, 2021

What

We want to create secure-only versions of connectors that can be used in the Airbyte cloud. The idea is that these connectors inherently prevent certain insecure connections such as connecting to a database over the public internet without encryption.

How

Created a new connector destination-mongodb-strict-encrypt based on the current connector, modified the connector's spec to hide any options which allow the user to disable TLS change the connector to enable TLS by default if the TLS option is not specified.

Recommended reading order

  1. MongodbDestinationStrictEncrypt.java
  2. tests

Pre-merge Checklist

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions
  • Connector added to connector index like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

@github-actions github-actions bot added the area/connectors Connector related issues label Oct 11, 2021
@irynakruk irynakruk linked an issue Oct 11, 2021 that may be closed by this pull request
6 tasks
Copy link
Contributor

@alexandr-shegeda alexandr-shegeda left a comment

Choose a reason for hiding this comment

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

LGTM

@alexandr-shegeda alexandr-shegeda marked this pull request as ready for review October 12, 2021 15:29
@Override
public ConnectorSpecification modifySpec(ConnectorSpecification originalSpec) throws Exception {
final ConnectorSpecification spec = Jsons.clone(originalSpec);
((ObjectNode) spec.getConnectionSpecification().get("properties").get("instance_type").get("oneOf").get(0).get("properties")).remove("tls");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment here why the tls property is removed? Something like "remove the boolean TLS option to enforce TLS connection".

Copy link
Contributor

Choose a reason for hiding this comment

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

In addition, it seems that simply removing this property is not enough. In the original destination code:

instanceConfig.get(TLS).asBoolean()

If the tls property is undefined, the above statement will throw null pointer exception. Can you also update that to do a null check, and default its value to true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you add a comment here why the tls property is removed? Something like "remove the boolean TLS option to enforce TLS connection".

Thanks, added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In addition, it seems that simply removing this property is not enough. In the original destination code:

instanceConfig.get(TLS).asBoolean()

If the tls property is undefined, the above statement will throw null pointer exception. Can you also update that to do a null check, and default its value to true?

Thanks for noticing it, one commit with this change and test was lost, sorry for that, everything is in place now.

}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This expected_spec file is defined, but never used. Can you add a unit test / acceptance test for this secure only connector?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@irynakruk irynakruk temporarily deployed to more-secrets October 18, 2021 12:31 Inactive
Copy link
Contributor

@tuliren tuliren left a comment

Choose a reason for hiding this comment

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

@irynakruk, thank you for the updates.

Please make sure to follow and check off the Pre-merge Checklist to make sure the connector is properly published.

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Oct 19, 2021
@irynakruk irynakruk temporarily deployed to more-secrets October 19, 2021 05:46 Inactive
@irynakruk irynakruk temporarily deployed to more-secrets October 19, 2021 06:01 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Oct 19, 2021

/test connector=connectors/destination-mongodb

🕑 connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/1357820670
✅ connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/1357820670
No Python unittests run

@irynakruk
Copy link
Contributor Author

irynakruk commented Oct 19, 2021

/test connector=connectors/destination-mongodb-strict-encrypt

🕑 connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/1357822703
❌ connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/1357822703
🐛 https://gradle.com/s/fp75ptduzqho6

@jrhizor jrhizor temporarily deployed to more-secrets October 19, 2021 06:05 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets October 19, 2021 06:05 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Oct 19, 2021

/test connector=connectors/destination-mongodb-strict-encrypt

🕑 connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/1359067080
✅ connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/1359067080
No Python unittests run

@irynakruk irynakruk temporarily deployed to more-secrets October 19, 2021 12:16 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets October 19, 2021 12:18 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Oct 19, 2021

@irynakruk, thank you for the updates.

Please make sure to follow and check off the Pre-merge Checklist to make sure the connector is properly published.

@tuliren thanks for review, I've pushed nitpick commit and small fixes for tests and dependencies. Also, I've bumped version for destination-mongodb, as there was some changes as well. I've updated Pre-merge Checklist, last step is to publish two connectors.

@irynakruk
Copy link
Contributor Author

irynakruk commented Oct 20, 2021

/publish connector=connectors/destination-mongodb

🕑 connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/1363355763
✅ connectors/destination-mongodb https://github.com/airbytehq/airbyte/actions/runs/1363355763

@jrhizor jrhizor temporarily deployed to more-secrets October 20, 2021 11:48 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Oct 20, 2021

/publish connector=connectors/destination-mongodb-strict-encrypt

🕑 connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/1363391597
❌ connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/1363391597

@jrhizor jrhizor temporarily deployed to more-secrets October 20, 2021 11:59 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Oct 20, 2021

/publish connector=connectors/destination-mongodb-strict-encrypt

🕑 connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/1363457557
✅ connectors/destination-mongodb-strict-encrypt https://github.com/airbytehq/airbyte/actions/runs/1363457557

@jrhizor jrhizor temporarily deployed to more-secrets October 20, 2021 12:17 Inactive
@irynakruk irynakruk temporarily deployed to more-secrets October 20, 2021 12:26 Inactive
@irynakruk irynakruk merged commit 265986b into master Oct 20, 2021
@irynakruk irynakruk deleted the irynakruk/6714-mongodb-secure-destination branch October 20, 2021 13:04
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
* Added mongodb destination strict encrypt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a secure-only MongoDb destination
4 participants