Skip to content

Commit

Permalink
lxd: Use retrieved volume name instead of user-provided name
Browse files Browse the repository at this point in the history
Although of course this will be the same as the user-supplied
name given GetStoragePoolVolume returns without error, using the
retrieved name ensures code-analysis tools are able to track that
we are not directly using user-provided values. If we don't do
this, then CodeQL for example may assume we are not validating
user-provided values which may be used in path expressions.

Signed-off-by: Mark Bolton <[email protected]>
  • Loading branch information
boltmark committed Sep 4, 2024
1 parent e0ae8cf commit 75dc34c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lxd/daemon_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func daemonStorageValidate(s *state.State, target string) error {
return fmt.Errorf("Storage volume %q in %q project is not filesystem content type", target, api.ProjectDefaultName)
}

snapshots, err = tx.GetLocalStoragePoolVolumeSnapshotsWithType(ctx, api.ProjectDefaultName, volumeName, cluster.StoragePoolVolumeTypeCustom, poolID)
snapshots, err = tx.GetLocalStoragePoolVolumeSnapshotsWithType(ctx, api.ProjectDefaultName, dbVol.Name, cluster.StoragePoolVolumeTypeCustom, poolID)
if err != nil {
return fmt.Errorf("Unable to load storage volume snapshots %q in %q project: %w", target, api.ProjectDefaultName, err)
}
Expand Down

0 comments on commit 75dc34c

Please sign in to comment.