⬆️ Update dependency effect to v3 [SECURITY]#486
Open
renovate[bot] wants to merge 1 commit intomainfrom
Open
Conversation
5dd6b04 to
6993fe5
Compare
6993fe5 to
afdc67b
Compare
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 contains the following updates:
2.2.5→3.20.0GitHub Vulnerability Alerts
CVE-2026-32887
Versions
effect: 3.19.15@effect/rpc: 0.72.1@effect/platform: 0.94.2@clerk/nextjs: 6.xRoot cause
Effect's
MixedSchedulerbatches fiber continuations and drains them inside a single microtask or timer callback. TheAsyncLocalStoragecontext active during that callback belongs to whichever request first triggered the scheduler's drain cycle — not the request that owns the fiber being resumed.Detailed mechanism
1. Scheduler batching (
effect/src/Scheduler.ts,MixedScheduler)scheduleTaskonly callsstarve()whenrunningisfalse. Subsequent tasks accumulate inthis.tasksuntilstarveInternaldrains them all. ThePromise.then()(orsetTimeout) callback inherits the ALS context from whichever call site created it — i.e., whichever request's fiber first setrunning = true.Result: Under concurrent load, fiber continuations from Request A and Request B execute inside the same
starveInternalcall, sharing a single ALS context. If Request A triggeredstarve(), then Request B's fiber reads Request A's ALS context.2.
toWebHandlerRuntimedoes not propagate ALS (@effect/platform/src/HttpApp.ts:211-240)Effect's own
Context(containingHttpServerRequest) is correctly set per-request. But the Node.js ALS context — which frameworks like Next.js, Clerk, and OpenTelemetry rely on — is not captured at fork time or restored when the fiber's continuations execute.3. The dangerous pattern this enables
The
async () => auth()thunk executes when the fiber continuation is scheduled byMixedScheduler. At that point, the ALS context belongs to an arbitrary concurrent request.Reproduction scenario
Minimal reproduction
Impact
auth()returns wrong user's sessioncookies()/headers()from Next.js read wrong requestWorkaround
Capture ALS-dependent values before entering the Effect runtime and pass them via Effect's own context system:
Suggested fix (for Effect maintainers)
Option A: Propagate ALS context through the scheduler
Capture the
AsyncLocalStoragesnapshot when a fiber continuation is scheduled, and restore it when the continuation executes:AsyncLocalStorage.snapshot()(Node.js 20.5+) returns a function that, when called, restores the ALS context from the point of capture. This ensures each fiber continuation runs with its originating request's ALS context.Trade-off: Adds one closure allocation per scheduled task. Could be opt-in via a
FiberRefor scheduler option.Option B: Capture ALS at
runForkand restore per fiber stepWhen
Runtime.runForkis called, capture the ALS snapshot and associate it with the fiber. Before each fiber step (in the fiber runtime'sevaluateEffectloop), restore the snapshot.Trade-off: More invasive but provides correct ALS propagation for the fiber's entire lifetime, including across
flatMapchains andEffect.tryPromisethunks.Option C: Document the limitation and provide a
contextinjection APIIf ALS propagation is intentionally not supported, document this prominently and provide a first-class API for
toWebHandlerto accept per-request context. The existingcontext?: Context.Context<never>parameter on the handler function partially addresses this, but it requires callers to know about the issue and manually extract values before entering Effect.Related
AsyncLocalStoragedocs: https://nodejs.org/api/async_context.htmlAsyncLocalStorage.snapshot(): https://nodejs.org/api/async_context.html#static-method-asynclocalstoragesnapshotcookies(),headers(),auth()in App RouterFiberRefpropagation for this)POC replica of my setup
Used util functions
The actual effect that was run within the RPC context that the bug was found
Release Notes
Effect-TS/effect (effect)
v3.20.0Compare Source
Minor Changes
8798a84Thanks @mikearnaldi! - Fix scheduler task draining to isolateAsyncLocalStorageacross fibers.Patch Changes
#6107
fc82e81Thanks @gcanti! - BackportTypes.VoidIfEmptyto 3.x#6088
82996bcThanks @taylorOntologize! - Schema: fixSchema.omitproducing wrong result on Struct withoptionalWith({ default })and index signaturesgetIndexSignaturesnow handlesTransformationAST nodes by delegating toast.to, matching the existing behavior ofgetPropertyKeysandgetPropertyKeyIndexedAccess. Previously,Schema.omiton a struct combiningSchema.optionalWith(with{ default },{ as: "Option" }, etc.) andSchema.Recordwould silently take the wrong code path, returning a Transformation with property signatures instead of a TypeLiteral with index signatures.#6086
4d97a61Thanks @taylorOntologize! - Schema: fixgetPropertySignaturescrash on Struct withoptionalWith({ default })and other Transformation-producing variantsSchemaAST.getPropertyKeyIndexedAccessnow handlesTransformationAST nodes by delegating toast.to, matching the existing behavior ofgetPropertyKeys. Previously, callinggetPropertySignatureson aSchema.StructcontainingSchema.optionalWithwith{ default },{ as: "Option" },{ nullable: true }, or similar options would throw"Unsupported schema (Transformation)".#6097
f6b0960Thanks @gcanti! - Fix TupleWithRest post-rest validation to check each tail index sequentially.v3.19.19Compare Source
Patch Changes
#6079
4eb5c00Thanks @tim-smart! - add short circuit to fiber.await internals#6079
4eb5c00Thanks @tim-smart! - build ManagedRuntime synchronously if possible#6081
2d2bb13Thanks @tim-smart! - fix semaphore race condition where permits could be leakedv3.19.18Compare Source
Patch Changes
12b1f1eThanks @tim-smart! - prevent Stream.changes from writing empty chunksv3.19.17Compare Source
Patch Changes
a8c436fThanks @jacobconley! - FixStream.decodeTextto correctly handle multi-byte UTF-8 characters split across chunk boundaries.v3.19.16Compare Source
Patch Changes
#6018
e71889fThanks @codewithkenzo! - fix(Match): handle null/undefined inMatch.tagandMatch.tagStartsWithAdded null checks to
discriminatoranddiscriminatorStartsWithpredicates to prevent crashes when matching nullable union types.Fixes #6017
v3.19.15Compare Source
Patch Changes
#5981
7e925eaThanks @bxff! - Fix type inference loss inArray.flattenfor complex nested structures like unions of Effects with contravariant requirements. Uses distributive indexed access (T[number][number]) in theFlattentype utility and addsconstto theflattengeneric parameter.#5970
d7e75d6Thanks @KhraksMamtsov! - fix Config.orElseIf signature#5996
4860d1eThanks @parischap! - fix Equal.equals plain object comparisons in structural modev3.19.14Compare Source
Patch Changes
488d6e8Thanks @mikearnaldi! - FixEffect.retryto respecttimes: 0option by using explicit undefined check instead of truthy check.v3.19.13Compare Source
Patch Changes
#5911
77eeb86Thanks @mattiamanzati! - Add test for ensuring typeConstructor is attached#5910
287c32cThanks @mattiamanzati! - Add typeConstructor annotation for Schemav3.19.12Compare Source
Patch Changes
a6dfca9Thanks @fubhy! - Ensureperformance.nowis only used if it's availablev3.19.11Compare Source
Patch Changes
#5888
38abd67Thanks @gcanti! - filter non-JSON values from schema examples and defaults, closes #5884Introduce JsonValue type and update JsonSchemaAnnotations to use it for
type safety. Add validation to filter invalid values (BigInt, cyclic refs)
from examples and defaults, preventing infinite recursion on cycles.
#5885
44e0b04Thanks @gcanti! - feat(JSONSchema): add missing options for target JSON Schema version in make function, closes #5883v3.19.10Compare Source
Patch Changes
#5874
bd08028Thanks @mattiamanzati! - Fix NoSuchElementException instantiation in fastPath and add corresponding test case#5878
6c5c2baThanks @Hoishin! - prevent crash from Hash and Equal with invalid Date objectv3.19.9Compare Source
Patch Changes
3f9bbfeThanks @gcanti! - Fix the arbitrary generator for BigDecimal to allow negative scales.v3.19.8Compare Source
Patch Changes
f03b8e5Thanks @lokhmakov! - Prevent multiple iterations over the same Iterable in Array.intersectionWith and Array.differenceWithv3.19.7Compare Source
Patch Changes
7ef13d3Thanks @tim-smart! - fix SqlPersistedQueue batch sizev3.19.6Compare Source
Patch Changes
af7916aThanks @tim-smart! - add RcRef.invalidate apiv3.19.5Compare Source
Patch Changes
079975cThanks @tim-smart! - backport Effect.gen optimizationv3.19.4Compare Source
Patch Changes
#5752
f445b87Thanks @janglad! - Fix Types.DeepMutable mapping over functions#5757
d2b68acThanks @tim-smart! - add experimental PartitionedSemaphore moduleA
PartitionedSemaphoreis a concurrency primitive that can be used tocontrol concurrent access to a resource across multiple partitions identified
by keys.
The total number of permits is shared across all partitions, with waiting
permits equally distributed among partitions using a round-robin strategy.
This is useful when you want to limit the total number of concurrent accesses
to a resource, while still allowing for fair distribution of access across
different partitions.
v3.19.3Compare Source
Patch Changes
7d28a90Thanks @gcanti! - Use standard formatting function in Config error messages, closes #5709v3.19.2Compare Source
Patch Changes
#5703
374f58cThanks @tim-smart! - preserve Layer.mergeAll context order#5703
374f58cThanks @tim-smart! - ensure FiberHandle.run state transition is atomicv3.19.1Compare Source
Patch Changes
63f2bf3Thanks @tim-smart! - allow parallel finalization of merged layersv3.19.0Compare Source
Minor Changes
#5606
3863fa8Thanks @mikearnaldi! - Add Effect.fn.Return to allow typing returns on Effect.fn#5606
2a03c76Thanks @fubhy! - BackportGraphmodule updates#5606
24a1685Thanks @tim-smart! - add experimental HashRing modulePatch Changes
3c15d5fThanks @KhraksMamtsov! -Array.windowsignature has been improvedv3.18.5Compare Source
Patch Changes
#5669
a537469Thanks @fubhy! - Fix Graph.neighbors() returning self-loops in undirected graphs.Graph.neighbors() now correctly returns the other endpoint for undirected graphs instead of always returning edge.target, which caused nodes to appear as their own neighbors when queried from the target side of an edge.
#5628
52d5963Thanks @mikearnaldi! - Make sure AsEffect is computed#5671
463345dThanks @gcanti! - JSON Schema generation: addjsonSchema2020-12target and fix tuple output for:v3.18.4Compare Source
Patch Changes
#5617
6ae2f5dThanks @gcanti! - JSONSchema: Fix issue where invaliddefaults were included in the output.Now they are ignored, similar to invalid
examples.Before
After
v3.18.3Compare Source
Patch Changes
#5612
25fab81Thanks @gcanti! - Fix JSON Schema generation withtopLevelReferenceStrategy: "skip", closes #5611This patch fixes a bug that occurred when generating JSON Schemas with nested schemas that had identifiers, while using
topLevelReferenceStrategy: "skip".Previously, the generator would still output
$refentries even though references were supposed to be skipped, leaving unresolved definitions.Before
After
Now schemas are correctly inlined, and no leftover
$refentries or unused definitions remain.v3.18.2Compare Source
Patch Changes
8ba4757Thanks @cyberixae! - Fix Array Do documentationv3.18.1Compare Source
Patch Changes
07802f7Thanks @indietyp! - Enableconsole.groupuse inLogger.prettyFormatwhen using Bunv3.18.0Compare Source
Minor Changes
#5302
1c6ab74Thanks @schickling! - Add experimental Graph module with comprehensive graph data structure supportThis experimental module provides:
Example usage:
#5302
70fe803Thanks @mikearnaldi! - Automatically set otel parent when present as external span#5302
c296e32Thanks @tim-smart! - add Effect.Semaphore.resize#5302
a098ddfThanks @mikearnaldi! - Introduce ReadonlyTag as the covariant side of a tag, enables:v3.17.14Compare Source
Patch Changes
ea95998Thanks @IMax153! - Preserve the precision of histogram boundary valuesv3.17.13Compare Source
Patch Changes
51bfc78Thanks @tim-smart! - ensure tracerLogger does not drop message itemsv3.17.12Compare Source
Patch Changes
b359bdcThanks @tim-smart! - add preload options to LayerMapv3.17.11Compare Source
Patch Changes
#5449
fb5e414Thanks @tim-smart! - Simplify Effect.raceAll implementation, ensure children fibers are awaited#5451
018363bThanks @mikearnaldi! - Fix Predicate.isIterable to allow stringsv3.17.10Compare Source
Patch Changes
#5368
3b26094Thanks @gcanti! - ## Annotation BehaviorWhen you call
.annotationson a schema, any identifier annotations that were previously set will now be removed. Identifiers are now always tied to the schema'sastreference (this was the intended behavior).Example
v3.17.9Compare Source
Patch Changes
0271f14Thanks @gcanti! - backportformatUnknownfrom v4v3.17.8Compare Source
Patch Changes
84bc300Thanks @thewilkybarkid! - Fix Schema.Defect when seeing a null-prototype objectv3.17.7Compare Source
Patch Changes
a949539Thanks @tim-smart! - expose RcMap.has apiv3.17.6Compare Source
Patch Changes
f187941Thanks @beezee! - Use non-greedy matching for Schema.String in Schema.TemplateLiteralParserv3.17.5Compare Source
Patch Changes
5f98388Thanks @patroza! - improve provide/merge apis to support readonly array inputs.v3.17.4Compare Source
Patch Changes
7d7c55dThanks @leonitousconforti! - Align RcMap.keys return type with internal signaturev3.17.3Compare Source
Patch Changes
#5275
3504555Thanks @taylornz! - fix DateTime.makeZoned handling of DST transitions#5282
f6c7ca7Thanks @beezee! - Improve inference on Metric.trackSuccessWith for use in Effect.pipe(...)#5275
3504555Thanks @taylornz! - add DateTime.Disambiguation for handling DST edge casesAdded four disambiguation strategies to
DateTime.Zonedconstructors for handling DST edge cases:'compatible'- Maintains backward compatibility'earlier'- Choose earlier time during ambiguous periods (default)'later'- Choose later time during ambiguous periods'reject'- Throw error for ambiguous timesv3.17.2Compare Source
Patch Changes
6309e0aThanks @tim-smart! - Fix Layer.mock dual detectionv3.17.1Compare Source
Patch Changes
ea95998Thanks @IMax153! - Preserve the precision of histogram boundary valuesv3.17.0Compare Source
Minor Changes
#4949
40c3c87Thanks @fubhy! - AddedRandom.fixedto create a version of theRandomservice with fixedvalues for testing.
#4949
ed2c74aThanks @dmaretskyi! - AddStruct.entriesfunction#4949
073a1b8Thanks @f15u! - AddLayer.mockCreates a mock layer for testing purposes. You can provide a partial
implementation of the service, and any methods not provided will
throw an
UnimplementedErrordefect when called.#4949
f382e99Thanks @KhraksMamtsov! - Schedule output has been added intoCurrentIterationMetadata#4949
e8c7ba5Thanks @mikearnaldi! - Remove global state index by version, make version mismatch a warning message#4949
7e10415Thanks @devinjameson! - Array: add findFirstWithIndex function#4949
e9bdeceThanks @vinassefranche! - Add HashMap.countBy#4949
8d95eb0Thanks @tim-smart! - add Effect.ensure{Success,Error,Requirements}Type, for constraining Effect typesv3.16.17Compare Source
Patch Changes
#5246
aaa6ad0Thanks @mikearnaldi! - Copy over apply, bind, call into service proxy#5158
5b74ea5Thanks @cyberixae! - Clarify Tuple length requirementsv3.16.16Compare Source
Patch Changes
127e602Thanks @tim-smart! - prevent fiber leak when Stream.toAsyncIterable returns earlyv3.16.15Compare Source
Patch Changes
15df9bf](https://redirect.github.com/Effect-TS/effect/commit/1Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.