Repository navigation
fix(extensions): Rust bundler/deploy path parity with TS [DEVEX-712] - #177
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Rust extension deploy pipeline to match the TypeScript CLI’s bundling/deploy behavior, including artifact metadata reporting, deploy-time path sandboxing/normalization, and improved temp-dir handling.
Changes:
- Add bundle artifact metadata (name/path/size/sha256 + optional sourcemap) and UI runtime wrapper support for embed/checkout extensions.
- Introduce robust extension path resolution/sandboxing (handle-rooted under
extensions/{handle}/, case-insensitive matching, symlink escape prevention) and normalize--sourceonplatform app add. - Use a single deploy timestamp for consistent artifact naming and temp-root naming, plus RAII cleanup for temp directories.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rust/src/extension/mod.rs | Adds bundle options/results, artifact naming, UI wrapper generation, tsconfig resolution, sandboxed path resolution/normalization, multi-chunk rejection, and temp-dir lifecycle management. |
| rust/src/application/commands/mod.rs | Updates deploy flow to use sandboxed path resolution + new bundler options, emits richer artifact progress events, and normalizes --source when writing extension config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Suppressed comments (4)
rust/src/application/commands/mod.rs:1805
- Same as above: the checkout
--sourcehelp text includes indentation spaces due to line continuations; preferconcat!(or a single-line string) to keep help output clean.
.with_arg(clap::Arg::new("source").long("source").required(true).help(
"Path to the JavaScript entry-point file, relative to \
extensions/<handle>/ (e.g. src/index.ts), or a path already \
under that directory",
))
rust/src/application/commands/mod.rs:1864
- Same as above: the blocks
--sourcehelp text will render with extra indentation whitespace because it relies on\continuations with indented lines.
.with_arg(clap::Arg::new("source").long("source").required(true).help(
"Path to the JavaScript entry-point file for the blocks extension, \
relative to extensions/blocks/ (e.g. src/index.ts), or a path \
already under that directory",
)),
rust/src/extension/mod.rs:670
resolve_extension_pathscurrently allowshandlevalues like "" or "." to resolveextension_dirto theextensions/root itself, which undermines the stated invariant that sources are sandboxed underextensions/{handle}/(and can broaden what--sourceis allowed to reference). Reject handles that resolve to the extensions root.
let extensions_root = normalize_path(&repo_root.join("extensions"));
let extension_dir = normalize_path(&extensions_root.join(handle));
if !is_path_within(&extensions_root, &extension_dir) {
return Err(invalid_handle_path(handle));
}
let extension_dir = dir_casing_on_disk(&extensions_root, &extension_dir);
rust/src/application/commands/mod.rs:1735
- The
--sourcehelp text uses\line continuations plus indentation, which will include a large run of spaces in the rendered help output. Usingconcat!(or a single-line string) avoids accidental whitespace in user-facing CLI help.
This issue also appears in the following locations of the same file:
- line 1801
- line 1860
.with_arg(clap::Arg::new("source").long("source").required(true).help(
"Path to the JavaScript entry-point file, relative to \
extensions/<handle>/ (e.g. src/index.ts), or a path already \
under that directory",
))
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
rust/src/extension/mod.rs:940
map_pathis built viaformat!("{}.map", mjs_path.display()), which round-trips through a lossy UTF-8 string and can break on non-UTF8 paths. Since this is purely a filesystem path derivation, it should stay inOsStr/OsStringspace (append ".map" to the existing path).
let map_path = {
let candidate = PathBuf::from(format!("{}.map", mjs_path.display()));
candidate.is_file().then_some(candidate)
};
rust/src/application/commands/mod.rs:1476
- The security scan runs against the bundled artifact (
bundle.bytes), so the reportedfile/line numbers should refer to the artifact (e.g.bundle.artifact_nameorbundle.artifact_path), not the configured source entry-point. Usingext.sourcehere can mislead users because the line numbers won't match the source file.
let source_display = ext.source.as_str();
let content = String::from_utf8_lossy(&bundle.bytes);
let findings = crate::extension::scan_bundle(&content, source_display);
Summary
name/path/size/sha256), handle-based artifact naming, UI runtime wrapper for embed/checkout, tsconfig resolution, shared deploy timestamp + PID-suffixed temp dirs, and RAII temp cleanup.extensions/{handle}/(lexical checks, symlink realpath, case-insensitive / on-disk casing for Mac→Linux), reject multi-chunk.mjsoutputs, and validate/normalize--sourceonplatform app addso config matches deploy.Test plan
cargo build/cargo fmt --check/cargo clippy -- -D warnings/cargo test(439 passed)GDDY_MIN_STAGE=experimental+platform app add extension embed|checkout|blockswith handle-relativesrc/index.tswrites normalizedsourceintogodaddy.toml(repo-relative under handle also normalizes)../../…), missing source file, and handle escape (../evil) withVALIDATION_ERRORhandle=Widgetwith folderwidget(covered by unit tests)