Skip to content

SVG Interactivity: replies name JavaScript files outside the read roots by file name - #7205

Merged
bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/svg-interactivity-hide-script-paths
Nov 13, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/svg-interactivity-hide-script-paths

Conversation

@dotCooCoo

Copy link
Copy Markdown
Contributor

What and why

#6973 made document.json name a linked JavaScript file outside a confined client's read roots by its file name alone. svgInteractivity.info and the files reply of svgInteractivity.addFile and removeFile still returned every linked file as stored, so a confined client could read the full path of a file the person or an earlier, less confined request had linked. These replies now follow the same rule. The rules below are VectorCraft's own; no help page covers them.

  • info, addFile and removeFile (crates/engine/src/cmd/interactivity.rs) name a linked file outside the read roots by its file name alone, in the stored order. A relative path is taken from the document's folder. A file inside the roots and a URL are named as they are. The document keeps every path. The rule document.json used for svg_scripts is now shared as links::script_hidden and links::shown_script (crates/engine/src/cmd/links.rs).
  • removeFile also unlinks a file outside the roots by the file name a reply gives it. When the name fits more than one linked file (two such files, or such a file and a file linked as that name), it returns "<name>" names more than one linked JavaScript file and unlinks nothing. Neither error names a stored path.
  • addFile still treats a file as already linked only when the same text is linked, so adding a name that matches a hidden file's shown name links a new file.
  • In a frame a request drives, the JavaScript Files dialog (crates/ui-egui/src/dialogs/javascript_files.rs) lists such a file by its file name. Each row keeps the file as linked, so a click selects that file and Remove sends it. A name that fits several rows selects none of them. ui.inspect (crates/ui-egui/src/control.rs) gives the dialog's selected file the same way. The person's frames show full paths, as before.
  • The params text of the three commands, docs/mcp.md (the read-roots list and SVG interactivity) and one line in docs/target-app-parity.md describe this.

Without read roots nothing changes. With read roots, the three replies no longer return paths outside them, and removeFile accepts the shown file name in addition to the stored text.

This pull request covers the three svgInteractivity replies, the JavaScript Files dialog's list and selection, and the selected file in ui.inspect. SVG export and document.serialize with format: "svg" still write the stored paths, and ui.inspect still gives the dialog's typed file field as typed.

How it was tested

New tests, each failing without the change:

  • javascript_file_replies_hide_paths_outside_read_roots (crates/engine/src/tests/interactivity.rs): info, addFile and removeFile name an outside file and a relative path that resolves outside the roots by their file names, and keep an inside file and a URL as they are. A caller with only write roots gets file names; a caller whose read roots hold the files, and a caller without roots, get the full paths. The document keeps the stored paths.
  • hidden_javascript_file_can_be_removed_by_unique_shown_name: removeFile with the shown name unlinks the hidden file in one undo step.
  • ambiguous_hidden_javascript_file_name_is_refused_without_edit: a name shared by two hidden files, or by a hidden file and a file linked as that name, is refused with an error that names no stored path, and nothing is unlinked.
  • adding_a_shown_name_does_not_deduplicate_a_different_hidden_path: addFile with a hidden file's shown name links a second file, within the 64-file limit.
  • automation_javascript_files_dialog_hides_outside_root_paths (crates/ui-egui/src/dialogs/javascript_files.rs): in a confined frame the dialog lists the file name, its rows keep the linked file, and a name two rows share selects neither.
  • ui_inspect_hides_a_selected_javascript_file_outside_the_read_root (crates/ui-egui/src/tests/automation.rs): ui.inspect gives the selected file by its file name.

Focused checks on the final tree, on Linux. The branch is one commit on main at 60fd4bd644 and merges cleanly with it.

  • cargo fmt --all -- --check
  • cargo check --workspace --tests
  • cargo clippy -p vectorcraft-engine --all-targets -- -D warnings and cargo clippy -p vectorcraft-ui-egui --all-targets -- -D warnings
  • cargo test -p vectorcraft-engine --lib filtered to tests::interactivity and document_replies_leave_out_paths_outside_the_read_roots: 11 passed, 0 failed.
  • cargo test -p vectorcraft-ui-egui --lib filtered to the JavaScript Files dialog tests and the new ui.inspect test: 4 passed, 0 failed.
  • cargo xtask brands, cargo xtask layers (30 crates) and cargo xtask assets (337 files).
  • cargo xtask ci runs in this pull request's CI.

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md.

…ts by file name

With automation read roots in force, svgInteractivity.info and the files
reply of addFile and removeFile returned every linked JavaScript file as
stored, including paths outside the roots. They now name such a file by
its file name alone, as document.json does; a file inside the roots and
a URL are named as they are, and the document keeps every path.

removeFile also unlinks a file outside the roots by that file name. When
the name fits more than one linked file, it returns an error that names
no stored path and unlinks nothing. addFile still treats only the same
text as already linked.

In a frame a request drives, the JavaScript Files dialog lists such a
file by its file name while its selection keeps the file as linked, and
ui.inspect gives the selected file the same way. The person's frames
show full paths.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 60fd4bd and f5de590.

Files selected for processing: 8

  • crates/engine/src/cmd/interactivity.rs
  • crates/engine/src/cmd/links.rs
  • crates/engine/src/tests/interactivity.rs
  • crates/ui-egui/src/control.rs
  • crates/ui-egui/src/dialogs/javascript_files.rs
  • crates/ui-egui/src/tests/automation.rs
  • docs/mcp.md
  • docs/target-app-parity.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@bflatastic
bflatastic merged commit 90a9e00 into storytold:main Nov 13, 2026
7 checks passed
@bflatastic

Copy link
Copy Markdown
Member

Merged, thanks @dotCooCoo! It passed its CI checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants