Commit graph

7092 commits

Author SHA1 Message Date
Matt Heon
24706290d5 Error when a checkpoint image is run
Support for these was removed in 3721ff82ff as the feature is
inherently insecure. Checkpoints imply an extremely privileged
operation that is incompatible with the constraints of a
`podman run` command. However, we should still tell folks that
it no longer works with a clear error message. This is done
during Specgen processing, server side, which should be safer
than the previous client-side processing for these.

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-09-29 08:40:53 -04:00
Matt Heon
7728ba0a90 Revert "Enable 'podman run' for checkpoint images"
This reverts commit f4401567cd.

This commit has been identified as a serious security issue.
Running checkpoints via `podman run` introduces potentially
confusing behavior where all security for a container, even
options specified by the user at the command line, can be turned
off by the checkpoint. Checkpoints have special security
considerations and must be explicitly requested by the user to
ensure they are used safely. We recommend ensuring the lifecycle
of a checkpoint is fully monitored and integrity is ensured at
each stage to guarantee safety.

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-09-29 08:39:49 -04:00
Lokesh Mandvekar
8e0f540d1d
Silence staticcheck for legacy fields and fix govet verb
Now that the Deprecated markers are recognized, staticcheck (SA1019) flags the remaining uses of legacy fields we must keep for backwards compatibility (StaticIP/StaticMAC, CNINetworks, the deprecated k8s seccomp annotation constants). Add targeted nolint directives for those. Also fix a govet printf verb: the network backend is an integer, so use %d instead of %q.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-09-14 08:53:26 -04:00
Lokesh Mandvekar
f25f93523c
Add blank comment line before Deprecated markers for gocritic
gocritic's deprecatedComment check requires a blank comment line separating a symbol's description from its Deprecated: marker so tooling recognizes it. Add the missing separator lines.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-09-14 08:53:26 -04:00
Lokesh Mandvekar
35920891c1
Preallocate slices flagged by prealloc for golangci-lint 2.9.0
golangci-lint 2.9.0 with go 1.26 makes the prealloc linter smarter and flags many slices that can be preallocated with a known capacity. Convert them to make([]T, 0, cap) and drop a now-unused nolint directive.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-09-14 08:53:26 -04:00
Kir Kolyshkin
e1e89017ca
pkg/machine/e2e: simplify runWslCommand
runWslCommand never returns err != nil because if there's an error, it calls Fail (which panics, so the code after it is unreachable).

Remove error returning and checking.

Inspired by the following linter warning:

> pkg/machine/e2e/config_windows_test.go:59:56: runWslCommand - result 1 (error) is always nil (unparam)
> func runWslCommand(cmdArgs []string) (*machineSession, error) {
>                                                        ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

(cherry picked from commit 94442ae44e)
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-09-14 08:53:26 -04:00
Lokesh Mandvekar
53ed0d02e4
libpod/container_internal.go: util.SizeOfPath -> directory.Size
- Remove deprecated util.SizeOfPath

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>

(cherry picked from commit 96aba07d95)
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-09-14 08:53:26 -04:00
Paul Holzinger
27cdab4be6
pkg/domain/filters: fix exit code parsing error
The function logged the wrong error, logging ec which is the return value from ParseInt makes no sense since the error tells us the function failed so ec is invalid/undefined. Also ParseInt already includes the string input in the error so just drop it.

This was flagged by govet now that we use go 1.26 because %q was wrong for integers.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

(cherry picked from commit 03ee16f5b4)
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-09-14 08:53:26 -04:00
Paul Holzinger
c647863296
pkg/systemd/notifyproxy: fix govet lint error
This is getting flagged with go.126 now. We need to use %d to log an integer.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>

(cherry picked from commit 526fbee8cc)
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-09-14 08:53:26 -04:00
Amol Yadav
d4fe9154ec
fix(quadlet): fix race condition, duplicates, and permissions
Signed-off-by: Amol Yadav <amyssnipet@yahoo.com>
(cherry picked from commit a38a9b7d20)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-08-13 15:48:40 +02:00
Paul Holzinger
d3adfdeec7
minor style fixes to make the backport apply cleanly
To make the cherry-pick apply cleanly do some of the style changes we did
on main first.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-08-13 15:47:35 +02:00
Paul Holzinger
85832029d5
fix image host env leak
When parsing image envs we need to be strict about the format, only the
"key=value" format must be accepted. Just keys must be rejected as they
are not valid according to the image spec.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit 6c431b73db)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-24 16:51:31 +02:00
Paul Holzinger
5fbeb04184
fix podman-remote save -f oci-dir/docker-dir
With podman-remote we do not enter a our user namespace like we do with
local podman so we keep running with the real user id.

So if we then try to use chrootarchive as normal user it fails with:
creating mount namespace before pivot: operation not permitted

So simply revert back to the normal archive code.

Now the more interesting thing is we do have a test
"podman save to directory with oci format" but it never runs
rootless+remote in our CI system with our current matrix as we wanted to
reduce jobs.
So rethink the matrix and add one such job as this shows it is needed.

Fixes: 25aee24cbd ("use chrootarchive over plain archive package")

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit fd07b9c6ec)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-19 17:08:17 +02:00
Paul Holzinger
e71ded2997
pkg/machine/e2e: set XDG_CONFIG_HOME
This is basically a partial backport of commit b14e833ef6
("machine: add test to check config mount").

It seems on the ubuntu github actions runners we have XDG_CONFIG_HOME
set so the tests do not actually use its own private dir but a shared
one for the configs which breaks the test assumptions.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-05 13:28:12 +02:00
Paul Holzinger
ab71275a6d
pkg/bindings/generator: fall back to golangci-lint from $PATH
Commit cf021c4ba9 switched the logic to also allow golangci-lint in
$PATH but forgot to update the call here.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit 13c6b5d786)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-04 20:04:24 +02:00
Kir Kolyshkin
405451792d
Remove unused nolint annotations
The interfacer linter was removed a few years ago.

Remove the annotations as well.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit a7886d1fe8)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-04 19:38:16 +02:00
Kir Kolyshkin
a94d273a8f
Replace os.Is* error checks with errors.Is
Using os.Is{Exist,NotExist,Permission} checks is not recommended in the
new code (see official documentation). While using it in the existing
code is OK, it may still result in a subtle errors later (for a specific
example of that, see [1]).

Replace those with errors.Is.

Generated by:

	gofmt -r 'os.IsExist(a) -> errors.Is(a, os.ErrExist)' -w .
	gofmt -r 'os.IsNotExist(a) -> errors.Is(a, os.ErrNotExist)' -w .
	gofmt -r 'os.IsPermission(a) -> errors.Is(a, os.ErrPermission)' -w .
	goimports -w .
	git diff vendor test/tools/vendor | patch -p1 -R

[1]: https://github.com/opencontainers/runc/pull/5061
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 7f7b35356f)

[Added extra replacements manually that were only in the 5.8 tree]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-04 19:38:16 +02:00
Paul Holzinger
6cffe93d88
hyperV: fix powershell path escape
To avoid special chars from being interpreted.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit 571c842bd3)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-13 19:06:26 +02:00
Paul Holzinger
add385e31c
bindings: artifact extract reject invalid names
The server already does validate this so this is not strictly needed and
the client must trust the server no matter what.

But adding an extra check here does not hurt and may help prevent future
bugs.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit 12bec19426)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:52 +02:00
Paul Holzinger
a49ad4be81
use chrootarchive over plain archive package
Just as additional hardening.

Note chrootarchive does not work on macos/windows, in that case it still
falls back to the regular pkg/archive.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit 25aee24cbd)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:52 +02:00
Paul Holzinger
92cd24903f
fix symlink handling in checkpoint restore
Under normal circumstances this is not a problem as the archive file
created podman container checkpoint will no create symlinks.
However if a user passes a custom archive they could contain symlinks
that point outside our root. To resolve them within the root use
securejoin.

Note this is not a security problem because the full archive must be
trusted by a user to begin with as it contain the full container config.

Fixes: #27977

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit abb5120624)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:52 +02:00
Paul Holzinger
0fa3043415
add missing O_CLOEXEC to open calls
The go std os package to will always make sure to use O_CLOEXEC, however
in cases where we directly call unix.Open() we need to pass that flag
explicitly.

I looked at this as there was a report of a leaked fd on the pasta list,
though I am not sure this will address it.

But anyway doing this should be rather safe and avoid leaks into other
processes.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit d20933df02)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:52 +02:00
Jan Rodák
9c262736e4
Fix Quadlet Lookup() stripping unmatched quotes
Fixes: https://github.com/containers/podman/issues/28409

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
(cherry picked from commit cf6404f387)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:52 +02:00
Joe Doss
e9fe245626
Fix shell driver DriverOpts cross-contamination in secret creation
When creating a secret with driver=shell via the API, the file driver's
default DriverOpts (including path) were applied because DriverOpts was
empty. The shell driver rejects path as an unknown option, making it
impossible to create shell-driver secrets via the REST API or
podman-remote.

Only apply default DriverOpts from config when the requested driver
matches the configured default driver.

Signed-off-by: Joe Doss <joe@solidadmin.com>
(cherry picked from commit 667f55c2ce)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:51 +02:00
Jan Rodák
15a2a7d605
Remote build: nTar secrets with relative paths and ignore bypass
When `podman-remote` tars the context, extra `podman-build-secret*` paths were
either dropped by `.dockerignore` (#25314) or archived as absolute paths so
`COPY . .` pulled host-shaped trees into the image (#28334).

Use relative names under the primary context for extra sources and do not apply
`.dockerignore` to those forced entries.

Fixes: https://github.com/containers/podman/issues/25314
Fixes: https://github.com/containers/podman/issues/28334

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
(cherry picked from commit e18bb9ea8b)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:51 +02:00
crawfordxx
e5fe3fdf69
api: fix missing return after error in SystemCheck handler
In the SystemCheck HTTP handler, when parsing the
unreferenced_layer_max_age query parameter fails, the error response is
sent but execution continues to `unreferencedLayerMaximumAge = &duration`
where `duration` is the zero value. This causes the system check to run
with a zero duration instead of returning the 400 error to the client.

Add the missing `return` after the error response.

Fixes #28350

Signed-off-by: crawfordxx <crawfordxx@users.noreply.github.com>
(cherry picked from commit 29d80a26af)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 14:23:51 +02:00
umut-polat
7f37fbd6af
quadlet: allow empty Entrypoint to clear image default
Setting Entrypoint= (empty value) in a quadlet .container file should
produce --entrypoint "" in the generated podman command, which clears
the image's default entrypoint. Previously this was silently ignored
because lookupAndAddString skips empty values.

Move the Entrypoint key out of the generic stringKeys map and handle
it separately so that an empty value is passed through.

Closes #28213

Signed-off-by: umut-polat <52835619+umut-polat@users.noreply.github.com>
(cherry picked from commit 926f562bd5)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-04-09 13:41:52 +02:00
Jan Rodák
fcc6ae217c [v5.8] Fix unless-stopped containers not restarting after ...
`podman-restart.service` stop them

When `podman-restart.service` stops containers, it marks them as "stopped by
user" which breaks the `unless-stopped` restart policy. Add hidden
`--not-stopped-by-user` flag to prevent this, allowing `unless-stopped`
containers to restart on next boot.

Fixes: https://github.com/containers/podman/issues/28152
Fixes: https://issues.redhat.com/browse/RUN-4357

Cherry pick fixes: https://redhat.atlassian.net/browse/RHEL-157746, https://redhat.atlassian.net/browse/RHEL-157747

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
(cherry picked from commit 7326b862e3)
Signed-off-by: Tom Sweeney <tsweeney@redhat.com>
2026-03-19 19:40:30 -04:00
Ashley Cui
649c074bf5
Merge pull request #28042 from mheon/backports_580_rc1
Backports and release notes for v5.8.0-RC1
2026-02-09 20:10:48 -05:00
Paul Holzinger
6bec23fd04
Merge pull request #27660 from mheon/58_migrate_db
[v5.8] Add migration code for BoltDB to SQLite
2026-02-09 16:06:57 +01:00
ZuhairM7
4e3dd47967 bindings: fix handling of env secrets in remote builds
Previously, using --secret=id=foo,env=BAR in remote mode would fail because the client sent the env var name to the server, which tried to resolve it locally. This patch modifies the client to resolve the environment variable locally, write it to a temp file, and send it as a file-based secret.

Fixes #27494

Signed-off-by: ZuhairM7 <ZuhairM7>
Signed-off-by: ZuhairM7 <zuhairmerali@gmail.com>
2026-02-06 15:36:47 -05:00
Jan Rodák
86b6c75cef Fix unless-stopped restart policy to match Docker behavior
- Update documentation: Differentiate `unless-stopped` from `always` - containers stopped by the user before a reboot will not restart.
- Add `should-start-on-boot` filter: Identify containers that require a restart after a system reboot.
- Update command documentation: Add `restart-policy` and `label!` filters to the documentation for container commands (rm, ps, start, stop, pause, unpause, restart).
- Add `restart-policy` and `shoud-start-on-boot` to completions.
- Update service: Update `podman-restart.service` to use the `needs-restart=true` filter.
- Preserve state: Preserve the `StoppedByUser` state across reboots.
- Update API: Add a `ShouldStartOnBoot()` method to the Container API.
- Update documentation: Add descriptions for the `should-start-on-boot` filter.

Fixes: https://issues.redhat.com/browse/RHEL-129405
Fixes: https://github.com/containers/podman/issues/20418

Signed-off-by: Jan Rodák <hony.com@seznam.cz>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-02-06 15:36:47 -05:00
0xdvc
35c602bfbb fix: improve userns validation when joining pods
- remove old CLI validation that only checked --pod flag
- add validation in namespaces.go to catch all paths (cli, quadlet, api)
- block userns mixing for all pods with infra, not just ipc/net
- update error message to be clearer
- fix test cleanup to use PodmanExitCleanly()
- use dynamic pod names in system tests to avoid conflicts

fixes #26848

Signed-off-by: 0xdvc <neilohene@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-02-06 15:36:47 -05:00
Vyacheslav Bespalov
d6c79580f8 [Fixes: #27571] Fix 'shouldResolveWinPaths' returning 'false' on Windows
Signed-off-by: Vyacheslav Bespalov <vbespalov@ptsecurity.com>
2026-02-06 15:36:47 -05:00
axel7083
243b623629 fix(api/compat): typo in the remove secret handle
Fixes https://github.com/containers/podman/issues/27548

Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
2026-02-06 15:36:47 -05:00
Aaron Ang
8423b3bbd0 Clamp rootless rlimits to host on format
Signed-off-by: Aaron Ang <aaron.angyd@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-02-06 15:36:47 -05:00
Aaron Ang
58a15f1500 Add ulimits to podman update API
Signed-off-by: Aaron Ang <aaron.angyd@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matt Heon <matthew.heon@pm.me>
2026-02-06 15:36:47 -05:00
ryanmccann1024
484858710c feat(exec): Add --no-session flag for improved performance
Fixes: #26588

For use cases like HPC, where `podman exec` is called in rapid succession, the standard exec process can become a bottleneck due to container locking and database I/O for session tracking.

This commit introduces a new `--no-session` flag to `podman exec`. When used, this flag invokes a new, lightweight backend implementation that:

- Skips container locking, reducing lock contention
- Bypasses the creation, tracking, and removal of exec sessions in the database
- Executes the command directly and retrieves the exit code without persisting session state
- Maintains consistency with regular exec for container lookup, TTY handling, and environment setup
- Shares implementation with health check execution to avoid code duplication

The implementation addresses all performance bottlenecks while preserving compatibility with existing exec functionality including --latest flag support and proper exit code handling.

Changes include:
- Add --no-session flag to cmd/podman/containers/exec.go
- Implement lightweight execution path in libpod/container_exec.go
- Ensure consistent container validation and environment setup
- Add comprehensive exit code testing including signal handling (exit 137)
- Optimize configuration to skip unnecessary exit command setup

Signed-off-by: Ryan McCann <ryan_mccann@student.uml.edu>
Signed-off-by: ryanmccann1024 <ryan_mccann@student.uml.edu>
2026-02-06 15:36:47 -05:00
flouthoc
790f21d355 quadlet install: multiple quadlets from single file should share app
Quadlets installed from `.quadlet` file now belongs to a single
application, anyone file removed from this application removes all the
other files as well.

Assited by: claude-4-sonnet

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2026-02-06 15:36:47 -05:00
flouthoc
ed79cdfd6a quadlet: add support for multiple quadlets in a single file
Enable installing multiple quadlets from one file using '---' delimiters.
Each section requires '# FileName=<name>' comment for custom naming.
Single quadlet files remain unchanged for backward compatibility.

Assited by: claude-4-sonnet

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2026-02-06 15:36:47 -05:00
xiaolinny
e8c334f3cb chore: fix the inconsistent method names in the comments
Signed-off-by: xiaolinny <xiaolincode@outlook.com>
2026-02-06 15:36:47 -05:00
Alessandro Verzicco
d45377c6c8 Ignore auth header with empty JSON object
Signed-off-by: Alessandro Verzicco <152161683+alessandro-verzicco@users.noreply.github.com>
2026-02-06 15:36:47 -05:00
Byounguk Lee
f1dcf63a91 Fixes #27421 aritfact push and pull with authfile
Signed-off-by: Byounguk Lee <nimdrak@gmail.com>
2026-02-06 15:36:47 -05:00
shiavm006
87bb060531 Fix remote client rejecting empty --detach-keys string
The remote client (podman --remote) was incorrectly throwing an error
when --detach-keys="" was specified for attach, run, or start commands.
According to documentation and the v1.7.0 release notes, specifying an
empty string should disable detaching, not cause an error.

Fixes: #27414

Signed-off-by: shiavm006 <shivammittal42006@gmail.com>
2026-02-06 15:36:47 -05:00
Dmitry Konishchev
8b8390522b Escape RequiresMountsFor value
Signed-off-by: Dmitry Konishchev <konishchev@gmail.com>
2026-02-06 15:36:47 -05:00
Lewis Denny
f76be2a94d [play_kube] Add validation to container image field
Fixes: #27784

Signed-off-by: Lewis Denny <lewisdenny@me.com>
2026-02-06 15:36:47 -05:00
shiavm006
6c1378be44 extract shared TTY handling code into helper function
Signed-off-by: shiavm006 <shivammittal42006@gmail.com>
2026-02-06 15:36:47 -05:00
MayorFaj
8eacbd8464 fix: correct env/envFrom precedence in kube play
Fixes: #27287

Signed-off-by: MayorFaj <mayorfaj@gmail.com>
2026-02-06 13:46:37 -05:00
Gregor Dschung
9e965498aa Fix interfering escaping of commas and spaces in no_proxy variable
Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-06 13:46:37 -05:00
Gregor Dschung
4ea22f1b29 Write DefaultEnvironment proxy values to /etc/systemd/user.conf.d/default-env.conf
Otherwise, the proxy values aren't passed to rootless podman.

Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-06 13:46:37 -05:00