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

Multi level pfx path #189

Merged
merged 3 commits into from
Oct 25, 2019
Merged

Multi level pfx path #189

merged 3 commits into from
Oct 25, 2019

Conversation

bgkaiser
Copy link

Please merge the following change into the mainline if you approve. Our admins insist on the flexibility to allow multiple path elements in path prefixes; this apparently also is consistent with Hashicorp Vault documentation. The change should be fully backward-compatible, causing no issues for users who don't want to take advantage of it. See the (branched) README.md for further information.

@marcoreni
Copy link

marcoreni commented Sep 18, 2019

@steve-perkins Can we push this forward? The issue is a blocker since prefixed KV v2 secrets are not usable.

@Lucas-C
Copy link

Lucas-C commented Oct 21, 2019

We'd love to have this merged too :)

*
* @param prefixPathDepth integer number of path elements in the prefix path
*/
public VaultConfig prefixPathDepth(int pathLength) {
Copy link

Choose a reason for hiding this comment

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

Maybe rename this method setPrefixPathDepth ?

* @param prefixPath string prefix path, with or without initial or
* final forward slashes
*/
public VaultConfig prefixPath(String prefixPath) {
Copy link

Choose a reason for hiding this comment

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

I suggest setPrefixPathDepthFromString because this method does not actually set a prefixPath attribute

throw new IllegalArgumentException("can't use an empty path");
}

while ((orig < pathLen) &&
Copy link

Choose a reason for hiding this comment

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

@@ -11,6 +11,20 @@ alike, without causing conflicts with any other dependency.
NOTE: Although the binary artifact produced by the project is backwards-compatible with Java 8, you do need
JDK 9 or higher to modify or build the source code of this library itself.

This Change
Copy link

Choose a reason for hiding this comment

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

👍
This is a great explanation, but it should probably be moved below in this README.md
Maybe as a sub-section of Key Value Secret Engine Config

Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely agree with this. The placement of this text here is pretty bizarre, and future people reading the README will have no context of which PR/change this paragraph is talking about.

I'll re-work this myself, post-merge.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I intended for you to move it to release notes once a release number had been assigned.

*/
public VaultConfig prefixPathDepth(int pathLength) {
if (pathLength < 1) {
throw new IllegalArgumentException("pathLength must be > 1");
Copy link

Choose a reason for hiding this comment

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

👍

@crash-bandi
Copy link

Any chance this can get pushed forward any time soon? been blocked waiting for this for a while now.

@steve-perkins
Copy link
Contributor

Sure, thanks! I have a less-insane-than-usual day today, so I'll take a look at the other open PR's and hopefully cut a binary release if everything goes smooth.

@steve-perkins steve-perkins merged commit 14e68b2 into BetterCloud:master Oct 25, 2019
@steve-perkins
Copy link
Contributor

Eeesh... not only are there no tests with this PR, but it breaks the existing tests. This code didn't even compile before it was submitted. It'll take me a bit longer to clean this up and make it shippable.

@Lucas-C
Copy link

Lucas-C commented Oct 25, 2019

Thanks for taking the time to improve & merge this !

@steve-perkins
Copy link
Contributor

In updating the unit test suite to address broken tests, I've discovered that this PR accidentally fixes a bug with the previous versions.

Previously, when a secret path had only ONE segment, then the implementation would result in that path having a trailing slash character appended. When a secret path had more than one segments, then the resulting path would only have a trailing slash if the original did.

That was awkward and had no good reason for being that way, and appears to have simply been an accidental quirk. Regardless, this PR "fixes" that. As implemented here, the modified secret paths with ALWAYS match the original in terms of having a trailing slash or not.

I don't THINK this is a breaking change. But it worries me somewhat, and I'd love to hear any second opinions from anyone else following this thread.

@JeroenBrinkman
Copy link

Any ETA on when this will be in a release?

@bgkaiser
Copy link
Author

Steve,
I'm working on a new fork and have tests building & running correctly now. I'm about to move my comment in the README.md file down to your "Version History" section. My question for you is: will this change go into a re-tagged v5.0.0, or is it destined for v5.0.1? Thanks!

@bgkaiser
Copy link
Author

Oh, also -- do you want a fix for the issue you describe above ("In updating the unit test suite to address ..."), or would you rather I change the tests so they pass with the way I originally coded LogicalUtilities.addQualifierToPath ? IOW, do you want to keep the original trailing-slash behavior, or keep the "accidental bugfix".

@steve-perkins
Copy link
Contributor

Sorry for the delay here. I've resolved the issues with the integration test suite, and bumped the version up to 5.1.0.

I just merged an unrelated pull request (#194), which is causing two broken unit tests. I'd like to give that author a chance to respond to my ping, and/or take a look to see if I can resolve that issue myself.

If not, then I'll revert the #194 change and push a new 5.1.0 binary artifact to Maven Central this week. Not taking in any additional new features for this release.

@steve-perkins
Copy link
Contributor

Unfortunately, I'm having to roll back that proposed change for now. There are other changes waiting to go out in a new release, and the automated tests are in a failing state due to this change.

If any contributor wants to look at the #194 PR changes, and take a crack at them in a way that doesn't break test coverage, then we can get them out in the next release.

sonhal added a commit to navikt/kafka-connect-vault-provider that referenced this pull request Jun 25, 2020
The vault driver lib has a issue with vault resource pathing ref:
BetterCloud/vault-java-driver#189
Forcing use of version 1, which is the version on the resources nada-kafka-conenct uses atm, seems to solve the issue.
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.

6 participants