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

[WFLY-14984] Add support for encrypted expressions in the wildfly-config.xml #42

Closed
wants to merge 1 commit into from

Conversation

PrarthonaPaul
Copy link

@PrarthonaPaul PrarthonaPaul commented Jan 25, 2024

Issue: https://issues.redhat.com/browse/WFLY-14984
Related PR: wildfly-security/wildfly-elytron#2084
Proposal: wildfly/wildfly-proposals#545

Note: Both wildfly-elytron and wildfly-core projects have dependencies for wildfly-client-config. So, to do integration testing, the version would need to be updated on both projects.

pom.xml Outdated Show resolved Hide resolved
} else try {
return Expression.compile(attributeValue, flags);
} catch (IllegalArgumentException ex) {
throw msg.expressionParseException(ex, getAttributeName(index), getLocation());
}
}

default Expression resolveEncryptedExpression(String attributeValue, Expression.Flag... flags) throws ConfigXMLParseException {
Iterator resolverProviderIterator = ServiceLoader.load(ResolverProvider.class).iterator();
Copy link
Member

Choose a reason for hiding this comment

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

What class loader is expected to be used for loading the provider?

Copy link
Author

Choose a reason for hiding this comment

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

I am not exactly sure.
Here is the implementation of the ResolverClass
And this is the class that we are trying to access using the service loader.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could consider supporting multiple if we can detect if a resolver supported a specific expression format or not so if a resolver did not resolve the expression the next one can be tried.

Copy link
Member

Choose a reason for hiding this comment

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

I think then that the appropriate thing would be to load from its own class loader; e.g. ServiceLoader.load(ResovlerProvider.class, ConfigurationXMLStreamReader.class.getClassLoader()).

Be sure to wrap the whole interaction with the iterator - including both the hasNext and next calls - in a try/catch to catch ServiceConfigurationError. You can either skip it (if it is OK to try another provider), or wrap & throw it (if there is a sole provider which is expected to work).

Copy link
Author

Choose a reason for hiding this comment

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

I have made the updates. Thanks for your review! Please feel free to let me know if there are any other changes I should made.

Also, should I add a new WFCC issue? Or is the WFLY issue okay? I have a separate ELY issue related to this RFE, so I can do the same for WFCC.

@ropalka
Copy link
Contributor

ropalka commented Mar 1, 2024

Superseded by: #45 which is targeting proper branch.

@ropalka ropalka closed this Mar 1, 2024
Comment on lines +733 to +737
if (envVar.contains("ENC:")) {
return resolveEncryptedExpression(envVar, flags);
} else {
return Expression.compile(envVar, flags);
}
Copy link

Choose a reason for hiding this comment

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

This same if-block 733-737 is used in 4 places in this method.
I suggest moving it into a private method.

Copy link
Author

Choose a reason for hiding this comment

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

Hi @rsearls
Sorry, I must have sent the wrong link, but #45 supersedes this PR and has been merged already. However, it is used by the elytron PR.

I can create a separate issue to move that into a private method and submit a PR for that.
Thanks!

Copy link

Choose a reason for hiding this comment

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

No need. It would be a nice to have when someone else adds to the file in the future.

Copy link

@rsearls rsearls left a comment

Choose a reason for hiding this comment

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

Code looks good.
One code change suggestion.

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.

5 participants