containers / libkrun

A dynamic library providing Virtualization-based process isolation capabilities
Apache License 2.0
901 stars 74 forks source link

Non-ASCII/Non-printable environment variables support #95

Closed Agalin closed 1 year ago

Agalin commented 1 year ago

Currently libkrun only supports printable ASCII character range for environment variables. I believe this limitation comes from variables being set as kernel args and passed down to the init process.

While this approach is really simple it also makes it not possible to run containers with more complex configuration.

I've been blocked by this limitation when trying to run a Gitlab Runner with Docker (or rather Podman) executor. There are multiple environment variables set by the runner and some of them fall outside of the supported range even if no custom secrets are configured (I believe it might be about new lines in CA files).

While #93 and #94 block me from verifying, it seems likely the issue is purely on validation side - I've built a version with valid_char check disabled and successfully started containers with env variables set to random bytes generated using openssl or new lines.

slp commented 1 year ago

In the current version of libkrun, environment variables are read from a file, so this should no longer be a problem. Please feel free to re-open if this issue is still reproducible.