Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4183 +/- ##
==========================================
+ Coverage 98.69% 98.71% +0.02%
==========================================
Files 429 430 +1
Lines 12533 12583 +50
Branches 1986 2001 +15
==========================================
+ Hits 12369 12421 +52
+ Misses 164 162 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Changelog
@metamask/snaps-utils: Add optionaltraceContexttoSnapRpcHookArgs, withTraceContextStructandTraceContext(a W3Ctraceparent, optionalbaggage, and a required non-empty list of exactorigins)@metamask/snaps-execution-environments: Attach a request'straceparentandbaggageto the Snap'sfetchrequests to the listedoriginswhile it is the Snap's only request in flight; allowURLfor@metamask/snaps-utilsin the LavaMoat policies@metamask/snaps-controllers: Add optionaltraceContexttoSnapController:handleRequestandExecutionService:handleRpcRequestSummary
A Snap's backend requests carry no trace headers, so the backend's spans join no client trace and the operation that called the Snap cannot be followed to the backend. With this change the caller can pass its trace context with a request, and the Snap's
fetchattaches it.traceparentandbaggageare not CORS-safelisted, so sending them to any other server would add a preflight it may reject.fetchmade while requests overlap cannot be tied to one of them, and nothing is attached.traceContext, since its request struct rejects unknown keys. The controller sends the field only when a caller passes one, so callers that pass none are unaffected. A caller that does must upgrade@metamask/snaps-controllersand@metamask/snaps-execution-environmentstogether.Related: MWPE-816 (Make backend requests from snaps carry trace headers)
Test plan
yarn workspace @metamask/snaps-execution-environments test: the network endowment tests cover a listed origin, an unlisted origin, overlapping requests and Snap-set headers; the unlisted-origin cases fail with the origin check removedyarn workspace @metamask/snaps-controllers test: end to end through the Node.js thread executor to a local HTTP serveryarn workspace @metamask/snaps-utils test