forked from RedHatProductSecurity/rapidast
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[podman_wrapper] simplify gather UID/GID mapping (RedHatProductSecuri…
…ty#131) Originally, the method was a strict rewrite from https://github.com/containers/podman/blob/main/troubleshooting.md#39-podman-run-fails-with-error-unrecognized-namespace-mode-keep-iduid1000gid1000-passed Which contained a terrible eval() call We modified it in commit 3c7e1c8, creating a "safe_eval". However, this does not work well on MacOS Rewriting the methodology from scratch: retreive the JSON output, and make the calculations from there. Added pytest for it
- Loading branch information
Showing
5 changed files
with
41 additions
and
90 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import shutil | ||
|
||
import pytest | ||
|
||
from scanners.podman_wrapper import PodmanWrapper | ||
|
||
|
||
@pytest.mark.skipif( | ||
shutil.which("podman") == False, reason="podman is required for this test" | ||
) | ||
def test_podman_mappings(): | ||
wrap = PodmanWrapper(app_name="pytest", scan_name="pytest", image="nothing") | ||
|
||
wrap.change_user_id(1000, 1000) | ||
|
||
assert "--uidmap" in wrap.opts | ||
assert "0:1:1000" in wrap.opts | ||
assert "--gidmap" in wrap.opts |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
from .add_logging_level import add_logging_level | ||
from .safe_add import safe_add |
This file was deleted.
Oops, something went wrong.