fix: validate absolute volume paths on WASM/non-Unix#220
Draft
maximeborges wants to merge 2 commits into
Draft
Conversation
Split the crate into a library (`src/lib.rs`) and a thin binary (`src/main.rs`) so podlet can be used as a dependency. The library exposes a small, string-based public API for in-memory compose -> Quadlet/Kubernetes conversion, keeping internals private: - `compose_to_files(yaml, ComposeOptions) -> Vec<GeneratedFile>` - `Cli::try_into_generated_files()` for all subcommands - `GeneratedFile`, `ComposeOptions` Split `Compose::try_into_files` into an I/O part and a pure `into_files` that takes an already-parsed `compose_spec::Compose`. Patch `compose_spec` (k9withabone/compose_spec_rs#42) so absolute volume paths validate on non-Unix targets. Signed-off-by: Maxime Borges <contact@maximeborg.es>
Patch `compose_spec` to k9withabone/compose_spec_rs#42 so Podman-style absolute volume paths (starting with `/`) validate correctly on non-Unix targets such as `wasm32-unknown-unknown`, allowing the library to convert compose files in the browser. Document WASM library usage and the required downstream patch in the README. Note: `[patch]` only applies when building podlet itself; downstream consumers targeting WASM must replicate it in their own workspace. Signed-off-by: Maxime Borges <contact@maximeborg.es>
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.
Why
This is the follow-up I mentioned in #219. Now that
podletbuilds as a library, I wanted to actually run it in the browser (wasm32-unknown-unknown). It compiles fine, but compose files with absolute volume paths (e.g./data:/data) fail to convert:compose_specvalidates them withPath::is_absolute(), which returns false for /-prefixed paths on non-Unix targets, so they get rejected.The actual fix lives upstream in k9withabone/compose_spec_rs#42. Until that's released, this patches
compose_specto that branch so conversion is correct on WASM.What
Note: [patch] only applies when building
podletitself, so projects that depend onpodletand target WASM need to replicate it in their own Cargo.toml; the README calls that out.No behavior change on native;
cargo test/clippy/fmtare green, andcargo build --lib --target wasm32-unknown-unknownbuilds clean.Stacked on #219; best reviewed/merged after it and after
compose_specis fixed so we can avoid delivering a crate with a patch at all.