Container: Prevent shell expansion in liblxc hook arguments#17478
Merged
tomponline merged 4 commits intocanonical:mainfrom Feb 3, 2026
Merged
Container: Prevent shell expansion in liblxc hook arguments#17478tomponline merged 4 commits intocanonical:mainfrom
tomponline merged 4 commits intocanonical:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a security concern related to shell expansion in LXC hook arguments by replacing double-quoted strings with single-quoted strings to prevent potential shell expansion attacks.
Changes:
- Introduces a new
SingleQuoteutility function that provides single-quoting (unlikestrconv.Quotewhich uses double-quotes) - Replaces all instances of
strconv.Quotewithshared.SingleQuotein LXC hook configurations to prevent shell expansion vulnerabilities
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| shared/util.go | Adds SingleQuote function to provide single-quote string escaping for shell safety |
| lxd/instance/drivers/driver_lxc.go | Updates all LXC hook configurations to use SingleQuote instead of strconv.Quote for project and instance names |
e27ff6d to
b7852f3
Compare
c48c379 to
53bba63
Compare
80a1a91 to
a2209a2
Compare
591930a to
0bd5457
Compare
0bd5457 to
c539133
Compare
simondeziel
previously approved these changes
Feb 2, 2026
Signed-off-by: Stéphane Graber <[email protected]> Suggested-by: Rory McNamara <[email protected]> (cherry picked from commit a5c1c73b535fb12d2c1ccd1c6b9a933fd312dc79) Signed-off-by: Thomas Parrott <[email protected]> License: Apache-2.0
Fixes it to actually single-quote. Signed-off-by: Thomas Parrott <[email protected]>
This avoids potential shell expansion of the strings should some special characters manage to make it through. Signed-off-by: Rory McNamara <[email protected]> (cherry picked from commit 0e0cf45ecdcc902a6f319f11971ed27df81bd29f) Signed-off-by: Thomas Parrott <[email protected]> License: Apache-2.0
Signed-off-by: Thomas Parrott <[email protected]>
e900ea6 to
24fc892
Compare
simondeziel
approved these changes
Feb 3, 2026
tomponline
added a commit
to tomponline/lxd-pkg-snap
that referenced
this pull request
Feb 4, 2026
Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551 Signed-off-by: Thomas Parrott <[email protected]>
tomponline
added a commit
to canonical/lxd-pkg-snap
that referenced
this pull request
Feb 4, 2026
Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551
tomponline
added a commit
that referenced
this pull request
Feb 6, 2026
tomponline
added a commit
to tomponline/lxd-pkg-snap
that referenced
this pull request
Feb 9, 2026
Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551 Signed-off-by: Thomas Parrott <[email protected]>
tomponline
added a commit
to tomponline/lxd-pkg-snap
that referenced
this pull request
Feb 9, 2026
Cherry-picks from canonical/lxd#17577 Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551 Signed-off-by: Thomas Parrott <[email protected]>
tomponline
added a commit
to tomponline/lxd-pkg-snap
that referenced
this pull request
Feb 9, 2026
Cherry-picks from canonical/lxd#17577 Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551 Signed-off-by: Thomas Parrott <[email protected]>
tomponline
added a commit
to canonical/lxd-pkg-snap
that referenced
this pull request
Feb 9, 2026
Cherry-picks from canonical/lxd#17577 Includes fixes from: - canonical/lxd#17478 - canonical/lxd#17549 - canonical/lxd#17550 - canonical/lxd#17551
tomponline
added a commit
that referenced
this pull request
Feb 12, 2026
tomponline
added a commit
to tomponline/lxd-pkg-snap
that referenced
this pull request
Mar 6, 2026
From - canonical/lxd#17478 - canonical/lxd#17703 - canonical/lxd#17741 Signed-off-by: Thomas Parrott <[email protected]>
tomponline
added a commit
to canonical/lxd-pkg-snap
that referenced
this pull request
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on lxc/incus#2827
Related to https://github.com/lxc/incus/security/advisories/GHSA-8h3p-58qv-8p53
From @stgraber :