fix(wrap): route lift lookup via export name + propagate string encoding (LS-A-16)#158
Closed
avrabe wants to merge 2 commits into
Closed
fix(wrap): route lift lookup via export name + propagate string encoding (LS-A-16)#158avrabe wants to merge 2 commits into
avrabe wants to merge 2 commits into
Conversation
…ing (LS-A-16)
`find_lift_type_for_interface_func` took (iface, func) parameters but
never compared them — `let _ = target_export_name` suppressed the unused
warning. For a multi-export component, every export silently received
the first lift's type and canonical options (including string_encoding).
A guest compiled with `--string-encoding=utf16` had every export
downgraded to UTF-8 because the encoding was also hardcoded in emission
paths. Wasm validator accepts the output; downstream wasmtime transcodes
against the wrong encoding, producing mojibake / truncated strings with
no trap. Same family as the wasmtime 2026-04-09 CM-transcoding CVE wave.
Fix:
- find_lift_type_for_interface_func matches export names against the
wit-bindgen `{iface}#{func}` convention; resolves through
component_func_defs to the right canon Lift entry.
- New `source_string_encoding_option` helper maps the source
CanonStringEncoding to the wasm_encoder::CanonicalOption.
- Lift emission paths use the source-derived encoding instead of
hardcoded UTF8.
- Single-lift fallback retained for simple-fixture compatibility but
only when exactly one lift exists; multi-lift without matching
export now returns None instead of guessing.
Tests (4 new):
- ls_a_16_find_lift_distinguishes_between_two_exports
- ls_a_16_find_lift_single_lift_fallback_still_works
- ls_a_16_find_lift_two_lifts_without_matching_export_returns_none
- ls_a_16_source_string_encoding_option_round_trips
Deferred to a follow-up under the same UCA-W-2:
- Lower-side encoding propagation (canon.lower options threaded from
source canon.lower entries)
- Lift-side Memory(0) hardcoding in multi-memory mode (uncertain
reachability since assemble_component is called with a single source)
LS-A-16 added to safety/stpa/loss-scenarios.yaml. Discovered by the
post-v0.8.0 Mythos delta-pass on component_wrap.rs.
Refs: LS-A-16 (UCA-W-2, H-1, H-4)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
Author
|
Mythos delta-pass evidence (re-posted from closed #155) Tier-5 file touched: A fresh agent ran This is the re-open of stuck PR #155 (GitHub-Actions glitch); workflow_runs failed to trigger on multiple synchronize events for that PR. |
Whitespace-only change to generate a fresh SHA. The C5 LS-A-16 fix was stuck behind a GitHub-Actions glitch — workflow_runs not firing on multiple synchronize events. Adding this trivial commit produces a new SHA that GH should treat as a fresh push. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Re-opened version of #155 — that PR's CI workflows were stuck in a GitHub-Actions glitch (synchronize events not generating workflow runs). Same code, fresh PR number to clear the webhook state.
Summary
Fixes from the post-v0.8.0 Mythos delta-pass sweep on `component_wrap.rs`:
A guest compiled with `--string-encoding=utf16` had every export downgraded to UTF-8 → mojibake / truncated strings downstream with no trap. Same family as the wasmtime 2026-04-09 CM-transcoding CVE wave.
Fix
Tests (4 new)
Refs
🤖 Generated with Claude Code