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

Change: Use fewer queries for GET_CREDENTIALS when possible #2122

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

mattmundell
Copy link
Contributor

@mattmundell mattmundell commented Jan 9, 2024

What

Prevent subqueries in the credential iterator when possible.

This adds a special initialiser for the credential iterator used by GET_CREDENTIALS. The resulting SQL returns '' for certain columns, depending on other values. For example, the auth_algorithm column is only needed if type is 'snmp', so when type is any other value then the SQL returns '' (saving a query to table credentials_data). Similarly, columns like password are only used when a format is requested, so they are skipped for the standard case (CREDENTIAL_FORMAT_NONE) using the lean flag.

Why

Much faster.

With 1000 trash credentials:

time o m m '<get_credentials filter="rows=-1 sort=name" trash="1"/>' > /tmp/cred

main: 51s
pr: 3s

About half the saving is coming from fc8765d, which skips the decryption when accessing the private key for credential_iterator_format_available.

References

Waits for #2121

Copy link

github-actions bot commented Jan 9, 2024

Conventional Commits Report

Type Number
Changed 2

🚀 Conventional commits found.

@mattmundell mattmundell changed the title Change: Use fewer queries in credential iterator when possible Change: Use fewer queries for GET_CREDENTIALS when possible Mar 8, 2024
@mattmundell mattmundell marked this pull request as ready for review March 11, 2024 19:43
@mattmundell mattmundell requested a review from a team as a code owner March 11, 2024 19:43
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.

1 participant