-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Introduction of CustomerizedAlgorithmSuite (CXF-8971) #1660
Introduction of CustomerizedAlgorithmSuite (CXF-8971) #1660
Conversation
@ffang FYI ^ |
Thanks for the PR @JiriOndrusek ! FYI, just created |
d52ac06
to
83720f6
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Hi @JiriOndrusek , Please see my comment here Also I have other comments in the PR. Thanks! |
83720f6
to
5f5bc0a
Compare
@ffang Thanks for the help. The PR is Here is a small summary:
|
I harcoded the version of <cxf.jakarta.wss4j.version> to 3.0.3-SNAPSHOT to get https://issues.apache.org/jira/browse/WSS-709 PR requires update of wss4f to 3.0.3 before merging |
I just verified FIPS compliance by running test Scenarion 03 and 04 failed with Scenario 01 succeeds - default |
5f5bc0a
to
4c08c34
Compare
@ffang is current failure related to the PR? I don't see any failed test. I'd say that some threads are hanging during the tests. Yesterday CI execution showed 1 failure because of NPE, which is fixed in the current PR. |
Hi @JiriOndrusek , No, I don't think they are related. Freeman |
...rity/src/main/java/org/apache/cxf/ws/security/policy/custom/DefaultAlgorithmSuiteLoader.java
Outdated
Show resolved
Hide resolved
</sp:RecipientToken> | ||
<sp:AlgorithmSuite> | ||
<wsp:Policy> | ||
<sp:CustomizedAlgorithmSuite/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this PR does not implement exposing the details of the CustomAlgorithmSuite in the policy, right? Would it be doable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT @ffang ^^ (I thing that the information would benefit to all. On the other hand similar features in cxf are not exposing the details either),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JiriOndrusek ,
Though I believe technically it's doable, like in the org.apache.cxf.ws.security.policy.custom.AlgorithmSuiteBuilder constructor you can get nestedPolicyElement which is a DOM element
final Element nestedPolicyElement = SPUtils.getFirstPolicyChildElement(element);
So you can get all child element from this point actually.
However, I'm hesitant to do it because this behaviour isn't aligned with current properties implementations used in WSS4J and CXF. You can find more discussion in
https://issues.apache.org/jira/browse/CXF-8971
Best Regards
Freeman
PR requires update of wss4j to 3.0.3 before merging |
4c08c34
to
8f0d0ef
Compare
@ffang I removed the null AlgorithmSuiteType from the suite loader. |
Thanks @JiriOndrusek ! |
...rity/src/main/java/org/apache/cxf/ws/security/policy/custom/DefaultAlgorithmSuiteLoader.java
Outdated
Show resolved
Hide resolved
</sp:RecipientToken> | ||
<sp:AlgorithmSuite> | ||
<wsp:Policy> | ||
<sp:CustomizedAlgorithmSuite/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JiriOndrusek ,
Though I believe technically it's doable, like in the org.apache.cxf.ws.security.policy.custom.AlgorithmSuiteBuilder constructor you can get nestedPolicyElement which is a DOM element
final Element nestedPolicyElement = SPUtils.getFirstPolicyChildElement(element);
So you can get all child element from this point actually.
However, I'm hesitant to do it because this behaviour isn't aligned with current properties implementations used in WSS4J and CXF. You can find more discussion in
https://issues.apache.org/jira/browse/CXF-8971
Best Regards
Freeman
8f0d0ef
to
ea38dc9
Compare
This draft introduces CustomerizedAlgorithmSuite according to https://issues.apache.org/jira/browse/CXF-8971
Several pieces of code might need claricfication/discussion.
-------------------- Edited ------------------------------
commit 1
Commit 1 works on its own (could be merged separately - it is finished).New default algorithm suite (nameCustomerizedAlgorithmSuite
) is registered inDefaultAlgorithmSuiteLoader
. Default values of this suites are compliant with the FIPS.WSSecurity10CustomerizedAlgorithmSuiteTest
(based onWSSecurity10Test
) is introduced. This test ~can be successfully run on the machine with FIPS. (Parameter-Dorg.apache.xml.security.securerandom.algorithm=PKCS1
is required in such case)New certificates are required to fulfill FIPS. I added a script `generate-certs.sh', which could be used for its generation.commit 2
Security properties for customization of the alg suite are created (prefixws-security.custom.alg.suite .
)Those properties are used inAlgorithmSuiteTranslater
andPolicyBasedWSS4JOutInterceptor
to modify customize alg. suite.Problems
It is not possible to set properties via setters into algSuiteType (see missing setters in https://github.com/apache/ws-wss4j/blob/wss4j-3.0.1/policy/src/main/java/org/apache/wss4j/policy/model/AlgorithmSuite.java#L434-L440) and commit (apache/ws-wss4j@2a5dff9). Which means, that the customization on e.g.PolicyBasedWSS4JOutInterceptor
can not change much. We would need to add setters to make customization work (as is prepared in this PR)Questions and suggestions (about commit 2)
Would it make sense to merge commit 1 on its own? (From my POV it makes sense, because it would make configuration in FIPS possible)There are 2 security parameters already present (ws-security.symmetric.signature.algorithm
andws-security.asymmetric.signature.algorithm
). My understanding is, that their functionality is almost the same as is defined for customized alg. suite. Therefore it would make sense, to skipws-security.custom.alg.suite.asymmetric.key.encryption.algorithm
andws-security.custom.alg.suite.symmetric.key.encryption.algorithm
I think that it is not needed to callCustomerizedAlgorithmSuite
in that way. I would like to call the suite something likeFipsBasic256Sha256gcmRsa15
or perhapsFipsBasic256
- this name would show the intent, that the default values are FIPS compliant AND the customization mechanism would be used every-time (not just for customerizedAlgorithmSuite) -> which means that user could not "customize" but rather "set" algorithm via properties, if not specified, the alg. suite defined in the policy would be used as now. (which is the behavior ofws-security.symmetric.signature.algorithm
andws-security.asymmetric.signature.algorithm
currently)TODO
After answering the questions, the customization should be probably added intoPolicyBasedWSS4JStaxInInterceptor
,StaxAsymmetricBindingHandler
,StaxSymmetricBindingHandler
andStaxTransportBindingHandler
as well.Ideally add a test covering the customized alg suite.