Tighten wazero guard lifecycle semantics and document start suppression#7275
Open
Copilot wants to merge 2 commits into
Open
Tighten wazero guard lifecycle semantics and document start suppression#7275Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
6 tasks
Copilot
AI
changed the title
[WIP] Review wazero module for DIFC security integration
Tighten wazero guard lifecycle semantics and document start suppression
Jun 9, 2026
4 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens WASM guard lifecycle behavior in internal/guard by preventing unintended _start execution during instantiation, exposing guard “poisoned” state after traps, and ensuring cleanup proceeds even when callers cancel contexts.
Changes:
- Suppress automatic WASM
_startexecution during guard instantiation viaWithStartFunctions()and document the rationale. - Add
(*WasmGuard).IsHealthy() boolto expose whether a prior WASM trap has permanently failed the guard. - Improve shutdown/cancellation fidelity by closing module/runtime with
context.WithoutCancel(ctx)and aligning a cancellation test with the compiler runtime config.
Show a summary per file
| File | Description |
|---|---|
| internal/guard/wasm.go | Documents _start suppression, adds IsHealthy(), and hardens cleanup to ignore caller cancellation during Close. |
| internal/guard/wasm_test.go | Updates runtime config in cancellation test and adds coverage for IsHealthy() plus Close behavior under canceled contexts. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
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.
This PR addresses the wazero review follow-ups in the guard runtime: it makes guard failure state observable, aligns test/runtime configuration, and hardens cleanup behavior during cancellation. It also documents one non-obvious instantiation choice that is easy to regress during future refactors.
Guard lifecycle
(*WasmGuard).IsHealthy() boolto expose whether a prior WASM trap has poisoned the instancecontext.WithoutCancel(ctx), so caller cancellation does not skip resource releaseInstantiation behavior
WithStartFunctions()is called with no args: guard load should not auto-run_startand accidentally block on stdin or perform side effects during instantiationTest fidelity
wazero.NewRuntimeConfigCompiler()so it matches production runtime constructionIsHealthy()and for closing a guard after the caller context has already been cancelled