Skip to content

NIFI-16260 - Add a Database Password Provider for GCP CloudSQL - #11604

Open
pvillard31 wants to merge 4 commits into
apache:mainfrom
pvillard31:NIFI-16260
Open

NIFI-16260 - Add a Database Password Provider for GCP CloudSQL#11604
pvillard31 wants to merge 4 commits into
apache:mainfrom
pvillard31:NIFI-16260

Conversation

@pvillard31

Copy link
Copy Markdown
Contributor

Summary

NIFI-16260 - Add a Database Password Provider for GCP CloudSQL

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

@exceptionfactory exceptionfactory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for putting together this new feature @pvillard31.

The basic implementation looks good, but I noted a few questions and concerns around the validation and testing.

Although the detailed introspection of the Connection URL can certainly help catch issues, it adds quite a bit of implementation and test code. I'm particularly concerned about the weight of the "legacy" parameters, which seem unnecessary to check. I recommend scoping down some of the verification steps as one way forward.

@pvillard31

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I simplified the implementation substantially and removed the database-specific validation from the password provider. The provider now focuses only on obtaining, scoping, caching, refreshing, and returning the Cloud SQL IAM token. JDBC URL, driver, username, and TLS configuration remain the responsibility of the DBCP service and JDBC driver.

I also removed the exception stack-trace introspection and reduced the tests to the essential credential lifecycle, refresh, verification, and failure-handling behavior. The focused tests, complete GCP processor module suite, Checkstyle, RAT, and PMD all pass. I also completed final live validation with both PostgreSQL and MySQL.

@exceptionfactory exceptionfactory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for making the adjustments @pvillard31, this looks close to completion. I highlighted a few remaining recommendations.

@pvillard31

Copy link
Copy Markdown
Contributor Author

Thanks for the review @exceptionfactory - I pushed a commit to address your feedback

@exceptionfactory exceptionfactory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the update @pvillard31, this looks better, I noted a few additional recommendations.

}

private void rejectIdentityPoolCredentialsOnEnable(final GoogleCredentials credentials) throws InitializationException {
if (credentials instanceof IdentityPoolCredentials) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like this rejects other kinds of credentials like ExternalAccountCredentials, is that intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The check specifically rejected IdentityPoolCredentials, rather than every ExternalAccountCredentials subtype, but that was still an unnecessarily restrictive implementation-specific check. I removed the class-based rejection from enablement, verification, and password generation. The provider now applies the Cloud SQL login scope and lets actual token acquisition determine whether the supplied GoogleCredentials implementation is compatible.

}

@Override
public List<ConfigVerificationResult> verify(final ConfigurationContext context, final ComponentLog verificationLogger,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With the verificationLogger passed in but not used, it would be helpful to pass it down to some of the nested methods and log the exceptions thrown, instead of just returning null for verification.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants