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

Ca list certs free vlv #4653

Merged
merged 3 commits into from
Jan 15, 2024
Merged

Conversation

fmarco76
Copy link
Member

List and search certs will move from VLV to paged search.

The current implementation is not efficient because of some peculiarities of VLV which cannot be easily replicated iwith paged search, such as the entries count.

Replacing the VLV search with the paged search for WEB UI search
certificate page. The new search is not sorted by serial number but
since the new pki version is moving to random serial number this sorting
is not useful in future release.
@fmarco76 fmarco76 added the WIP Work In Progress label Jan 11, 2024
@fmarco76 fmarco76 requested a review from edewata January 11, 2024 12:19
list.getCurrentIndex();
logger.debug("ListCerts: totalRecordCount: " + totalRecordCount);
}
totalRecordCount = mCertDB.countCertificates(filter, -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's suppose there's a search filter that will match 2000 entries on the DS, but the nsslapd-sizelimit param is set to 1000.

IIUC with VLV the list size would be 2000 (since it's virtual so it can include the entire results), so the totalRecordCount would be 2000 as well. With paged results will the totalRecordCount be 1000 since it counts the actual entries returned by the DS which are limited to 1000?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have not done test but IIUC with paged result the limit is applied to the single page. The count is getting multiple pages so at the end the number will be 2000.

Comment on lines +326 to +328
case "end":
start = Math.max(0, totalRecordCount - maxCount);
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

If the totalRecordCount is difficult to obtain accurately with paged results, we might want to remove functionalities that depend on it, e.g. navigation to the end of the list. This will affect the UI.

@edewata
Copy link
Contributor

edewata commented Jan 11, 2024

It looks like IPA doesn't actually use ListCerts:
https://github.com/dogtagpki/freeipa/wiki/CA-Services

We will still need to remove VLV eventually, but updating ListCerts might be a low priority for now.

@fmarco76 fmarco76 removed the WIP Work In Progress label Jan 12, 2024
@fmarco76 fmarco76 requested a review from ladycfu January 12, 2024 10:18
@fmarco76
Copy link
Member Author

updating ListCerts might be a low priority for now.

Yes, I started because I was doing all cert related VLVs and this appeared as an easy fix (I was wrong). However, I have completed this for now. It works in both the /ca/ee/ca/ and /ca/agent/ca/ pages the same as with VLV. I did not found other usage, @ladycfu do I miss places where this ListCerts is used?

No other services are connected with this PR so it is not a priority to review/merge.

@fmarco76 fmarco76 requested a review from edewata January 12, 2024 10:24
Comment on lines +143 to +156
mAllowedClientFilters.addElement("(\\\\(\\\\&)?(\\\\(\\\\|)?(\\\\(certStatus=(\\\\*|VALID|INVALID|EXPIRED)\\\\))*(\\\\))?(\\\\(certRecordId(<|>)=(0x)?\\\\d+\\\\))*(\\\\))?");
mUseClientFilterRegexp = true;
Copy link
Contributor

@edewata edewata Jan 12, 2024

Choose a reason for hiding this comment

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

I'm a bit concerned about using regex here since it's not easy to read and might be difficult to change in case we need to add/remove the filters. If we're going to keep the regex I think we need to include some explanation what filters will match the regex.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I'll add the comment. Since the filter now include the cert serial the previous approach becomes awkward.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also include the regex in the comment without the escape characters? That probably will make it easier to see how those filters can be captured by the regex.

@edewata
Copy link
Contributor

edewata commented Jan 12, 2024

I only have one concern about the regex, but once that is addressed I think we can merge this PR (assuming it's been sufficiently tested) since eventually we will need to drop the dependency on VLV anyway. About the performance issue I think we can address it later. That might require changes to the API and the UI/CLI too.

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 added another comment, but thanks for the update! Feel free to update/merge.

Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

5 New issues
0 Security Hotspots
0.0% Coverage on New Code
9.2% Duplication on New Code

See analysis details on SonarCloud

@fmarco76
Copy link
Member Author

I have update the comment and dome some additional tests. The interface seems to work correctly and I am merging this PR. However, this part of UI should be updated ASAP to use the REST APIs avoiding code duplication.

@edewata Thanks!

@fmarco76 fmarco76 merged commit d9dae8b into dogtagpki:master Jan 15, 2024
132 checks passed
@fmarco76 fmarco76 deleted the CAListCertsFreeVLV branch January 15, 2024 10:35
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