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 fuzzy search for packages #153

Merged
merged 1 commit into from
Jun 21, 2024
Merged

Conversation

carkod
Copy link
Contributor

@carkod carkod commented Jun 18, 2024

Done

Add fuzzy search for packages:
"mysql-8.0" returns an expected result for Ubuntu 22.04 LTS.
https://ubuntu.com/security/cves?q=&package=mysql-8.0

However, "mysql" doesn't contains expected result for Ubuntu 22.04 LTS.
https://ubuntu.com/security/cves?q=&package=mysql

The same condition applies to PostgreSQL.

"postgresql-14" works.
https://ubuntu.com/security/cves?q=&package=postgresql-14

However, "postgresql" doesn't contains expected result:
https://ubuntu.com/security/cves?q=&package=postgresql

  • Update tests to cover for these cases.

QA

Issue / Card

Fixes https://warthogs.atlassian.net/browse/WD-4755

@carkod carkod marked this pull request as draft June 18, 2024 18:05
@carkod carkod force-pushed the fuzzy-search-packages branch 8 times, most recently from 3b931ac to 10e3e8c Compare June 18, 2024 18:42
@carkod carkod marked this pull request as ready for review June 19, 2024 11:06
@carkod carkod requested a review from samhotep June 19, 2024 20:15
Copy link
Member

@samhotep samhotep left a comment

Choose a reason for hiding this comment

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

LGTM!

The request speed is consistently ~860ms even with slightly larger payloads
I checked this against a database with 240912 cves, 6007 packages
image
image
image

@samhotep
Copy link
Member

Friendly reminder to rebase :)

)

assert filtered_cves_response.status_code == 200
assert filtered_cves_response.json["total_results"] == 1
assert filtered_cves_response.json["total_results"] > 1
Copy link
Contributor

Choose a reason for hiding this comment

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

@carkod can I ask what the usefulness is of making this test less specific? We want to know that the correct number of cves are returned with this query, total results being > 1 seems like it could very easily lead to false positives here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well for the purposes of this feature, we have to get more than one result, but sure I can make it more specific.

@carkod carkod merged commit 6b1384e into canonical:main Jun 21, 2024
5 checks passed
@carkod carkod deleted the fuzzy-search-packages branch June 21, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants