Skip to content

Fix SQLite volume lookup queries matching too liberally #26217

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

mheon
Copy link
Member

@mheon mheon commented May 27, 2025

Specifically, this does two things:

  1. Turn on case-sensitive LIKE queries. Technically, this is not specific to volumes, as it will also affect container and pod lookups - but there, it only affects IDs. So podman rm abc123 will not be the same as podman rm ABC123 but I don't think anyone was manually entering uppercase SHA256 hash IDs so it shouldn't matter.

  2. Escape the _ and % characters in volume lookup queries. These are SQLite wildcards, and meant that podman volume rm test_1 would also match podman volume rm testa2 (or any character in place of the underscore). This isn't done with pod and container lookups, but again those just use LIKE for IDs - so technically podman volume rm abc_123 probably works and removes containers with an ID matching that pattern... I don't think that matters though.

Fixes #26168

Does this PR introduce a user-facing change?

Fixed a bug where the `podman volume rm` and `podman volume inspect` commands would incorrectly handle volume names containing the _ character when the SQLite database backend was in use

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 27, 2025
@baude
Copy link
Member

baude commented May 27, 2025

OK, LGTM

Specifically, this does two things:

1. Turn on case-sensitive LIKE queries. Technically, this is not
specific to volumes, as it will also affect container and pod
lookups - but there, it only affects IDs. So `podman rm abc123`
will not be the same as `podman rm ABC123` but I don't think
anyone was manually entering uppercase SHA256 hash IDs so it
shouldn't matter.

2. Escape the _ and % characters in volume lookup queries. These
are SQLite wildcards, and meant that `podman volume rm test_1`
would also match `podman volume rm testa2` (or any character in
place of the underscore). This isn't done with pod and container
lookups, but again those just use LIKE for IDs - so technically
`podman volume rm abc_123` probably works and removes containers
with an ID matching that pattern... I don't think that matters
though.

Fixes containers#26168

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 28, 2025
Copy link
Contributor

openshift-ci bot commented May 28, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99, mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Luap99 Luap99 added the 5.5 label May 28, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit dad0b29 into containers:main May 28, 2025
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.5 approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fail to remove volume with semi-colliding names
3 participants