-
Notifications
You must be signed in to change notification settings - Fork 9
Fix signature handling with additionalimagestore #166
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
base: main
Are you sure you want to change the base?
Conversation
dadf28e to
a8ed770
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a workaround to handle image signature invalidation errors by copying the image without signatures before installation. My review focuses on improving the robustness of the added shell script logic. I've suggested using trap for reliable temporary file cleanup and quoting variables to prevent potential shell injection or word-splitting issues.
a8ed770 to
a710bde
Compare
crates/kit/src/to_disk.rs
Outdated
| cat > "${SIG_POLICY}" <<'EOF' | ||
| {"default":[{"type":"insecureAcceptAnything"}],"transports":{"containers-storage":[{"type":"insecureAcceptAnything"}]}} | ||
| EOF | ||
| if skopeo copy --signature-policy "${SIG_POLICY}" --remove-signatures \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me what the if is doing here. If skopeo fails due to being say out of disk space then we just...try to ignore that? That seems odd.
a710bde to
0b83293
Compare
e25b44d to
94a36f6
Compare
cgwalters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Offhand looks OK to me. Does it work?
crates/kit/src/to_disk.rs
Outdated
| # Create permissive policy.json (use /var/tmp since it's mounted into podman container) | ||
| # Mount as directory to /etc/containers so podman creates the directory if it doesn't exist | ||
| POLICY_DIR=/var/tmp/bcvk-policy-dir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is an ephemeral isolated system but it's probably still good to avoid hardcoded filenames in /tmp or /var/tmp. So we could use e.g. policydir=$(mktemp -d) or so.
It might be a nicer cleanup to have this policy JSON string as a literal file in the Rust source that we include via include_str! and then template into the shell script.
crates/kit/src/to_disk.rs
Outdated
| --env=STORAGE_OPTS \ | ||
| {INSTALL_LOG} \ | ||
| {SOURCE_IMGREF} \ | ||
| "${SOURCE_REF}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks unrelated?
Some minor issues rn. Working on some changes to make the integration tests pass. |
94a36f6 to
ea1cb15
Compare
ea1cb15 to
e68793b
Compare
cgwalters
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit, but looks sane to me; the key thing is verifying this works at least manually.
| # Execute bootc installation, having the outer podman pull from | ||
| # the virtiofs store on the host, as well as the inner bootc. | ||
| # Mount /var/tmp into inner container to avoid cross-device link errors (issue #125) | ||
| export STORAGE_OPTS=additionalimagestore=${AIS} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this line move? See above
e68793b to
c1d7037
Compare
Did manually test it and the integration test |
|
I edited this issue just now to have Closes: #126 but let's try to be sure we're doing that kind of thing in general in the future |
|
Hmmm I get the same error trying this out with the reproducer from #126 |
c1d7037 to
9592974
Compare
Copy images to local storage without signatures before bootc install to avoid signature invalidation errors. Falls back to original behavior if copy fails. Signed-off-by: gursewak1997 <[email protected]>
9592974 to
914df59
Compare
Copy images to local storage without signatures before bootc install to avoid signature invalidation errors. Falls back to original behavior if copy fails.
Closes: #126