Add load-time WASM guard ABI checks and align guard unit runtime config#8779
Merged
Conversation
Copilot
AI
changed the title
[WIP] Review Go module tetratelabs/wazero for usage and compliance
Add load-time WASM guard ABI checks and align guard unit runtime config
Jul 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens WASM guard loading by validating exported guard function ABIs at load time, preventing signature mismatches from surfacing later as runtime traps. It also aligns a guard parsing coverage helper to use the interpreter runtime config for deterministic unit-test behavior.
Changes:
- Validate
label_resource,label_response, andlabel_agentexported function signatures against the expected(i32,i32,i32,i32)->i32ABI duringNewWasmGuardWithOptions. - Add a focused unit test that mutates the WASM type section to assert the new ABI-mismatch error path.
- Switch
wasm_parse_coverage_testruntime initialization towazero.NewRuntimeConfigInterpreter()to match existing guard test conventions.
Show a summary per file
| File | Description |
|---|---|
| internal/guard/wasm_lifecycle.go | Adds load-time signature validation for required exported guard functions. |
| internal/guard/wasm_new_options_coverage_test.go | Adds test coverage for invalid exported function signatures via WASM byte mutation. |
| internal/guard/wasm_parse_coverage_test.go | Updates helper runtime setup to use interpreter mode for deterministic tests. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Low
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The test copied fullGuardWasm but never actually mutated byte 14 from i32 (0x7f) to i64 (0x7e), so the signature remained valid and no error was produced. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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.
github.com/tetratelabs/wazeroguards were only validated for export presence, so ABI mismatches could surface later as runtime traps. This PR adds explicit signature validation during guard load and aligns guard parse coverage tests with interpreter-mode runtime usage for deterministic unit behavior.Guard initialization hardening
label_resource,label_response,label_agent) against the expected ABI:(i32,i32,i32,i32) -> i32.ABI mismatch coverage
Unit test runtime consistency
wasm_parse_coverage_testhelper setup to usewazero.NewRuntimeConfigInterpreter()rather than default runtime config, matching existing guard test conventions.