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

Add KRA KeyRequestService to v2 APIs #4821

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

fmarco76
Copy link
Member

There is a difference related to the start parameter for the list request. In the v1 APIs this is the RequestId to start from but here it is just an index. A similar change was implemented in #4672 and it is in the right direction moving from sequential to random ids.

@fmarco76 fmarco76 requested a review from edewata August 12, 2024 16:48
@fmarco76 fmarco76 marked this pull request as draft August 12, 2024 16:58
@fmarco76 fmarco76 marked this pull request as ready for review August 12, 2024 17:10
Copy link
Contributor

@edewata edewata left a comment

Choose a reason for hiding this comment

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

I have some comments but overall it LGTM.

"approve"));

} catch (EAuthzAccessDenied e) {
throw new UnauthorizedException("Not authorized to approve request", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is identical to the original code, but do you think we should log an audit event here? No need to fix the code now, but maybe just add a TODO comment for a future review.

Copy link
Member Author

Choose a reason for hiding this comment

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

In this exception (and some other) there is no audit failure while in other there is. I have added the TODO in all cases for future evaluation.

In my opinion this should not generate a failure event for the operation in the audit because the authorisation stop any processing before it start. An authorisation failure event could be possible but not one related to the following operation.
An improvement of this would be to move the authorisation check in the ACL filter and decide what the audit should include for the authorisation event.

id,
"reject"));
}catch (EAuthzAccessDenied e) {
throw new UnauthorizedException("Not authorized to reject request", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here.

id,
"cancel"));
} catch (EAuthzAccessDenied e) {
throw new UnauthorizedException("Not authorized to cancel request", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here.

}
}

private KeyRequestResponse generateASymKey(Principal userPrincipal, String baseUrl, AsymKeyGenerationRequest data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC this method is generating an asymmetric key (as opposed to a symmetric key), so the method probably should be called generateAsymKey() with lower case s to avoid confusions.

return createKeyRequestResponse(request, baseUrl);
}

private KeyRequestResponse submitGenerateASymKeyRequest(AsymKeyGenerationRequest data, String userName, String baseUrl) throws EBaseException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here with AsymKey instead of ASymKey.

Comment on lines +980 to +989
RequestId requestID;
if (ephemeral) {
requestID = createEphemeralRequestID();
} else {
requestID = requestRepository.createRequestID();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

No issue here, I just want to point out that ephemeral request ID is probably no longer needed with RSNv3, so it's something that can be removed in the future.

@fmarco76
Copy link
Member Author

@edewata Thanks! I have update the method name and added the TODO for the audit evaluation. We can continue the discussion for the audit in following PR/issues.

@fmarco76 fmarco76 merged commit 32f0378 into dogtagpki:master Aug 19, 2024
138 of 155 checks passed
Copy link

sonarcloud bot commented Aug 19, 2024

@fmarco76 fmarco76 deleted the KeyRequestService_v2 branch August 19, 2024 11:11
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