chore: update dependencies and improve security in code execution#49
chore: update dependencies and improve security in code execution#49frontegg-david merged 3 commits intorelease/2.10.xfrom
Conversation
📝 WalkthroughWalkthroughUpdates to CI review config, multiple dependency bumps across packages, adds an esbuild target for worker scripts, refactors VM/worker script wrappers, improves worker-pool event cleanup, tracks custom enclave globals, and re-enables a skipped test. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@libs/react/package.json`:
- Around line 39-41: The package.json change raising the peerDependency "react"
to ">=18.0.0" is a breaking API change for consumers on React 17; add a
documented changelog and migration guidance under docs/enclave explaining the
breaking change and upgrade path. Update docs/enclave to include a new changelog
entry referencing libs/react/package.json and the "peerDependencies" change,
describe the impact (React 17 incompatibility), list recommended migration steps
(e.g., upgrade to React 18, code adjustments, testing notes), and link to any
relevant external React 18 migration docs; ensure the docs mention the new
minimum version and which release contains the breaking change.
🧹 Nitpick comments (1)
libs/core/src/adapters/worker-pool/worker-script.ts (1)
336-341: Clarify the security comment — concatenation doesn't prevent injection.The comment states this change avoids "code injection patterns," but string concatenation and template literals offer equivalent injection risk. If
msg.codecontained a malicious payload like'}); malicious(); (async () => {', both approaches would be equally vulnerable.The actual security comes from AST validation performed upstream before code reaches this point. Consider updating the comment to reflect the true reason for this change (e.g., avoiding template literal escaping complexity, build tool compatibility, or code clarity).
📝 Suggested comment clarification
// Wrap code in async IIFE to support top-level await // Must call __ag_main() if defined, as the enclave transforms code to wrap in async function __ag_main() - // Use string concatenation instead of template literals to avoid code injection patterns + // Use string concatenation for clarity; security is enforced by AST validation upstream const wrappedCode =
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
libs/core/src/__tests__/worker-pool-adapter.spec.ts (1)
379-398:⚠️ Potential issue | 🟡 MinorRemove unnecessary
awaitfromdispose()call for consistency.Re-enabling this test with explicit cleanup is good, but the
awaiton line 398 should be removed. Thedispose()method returnsvoid, not a Promise, soawaitis unnecessary and creates inconsistency with all other tests in this file (lines 75, 300, 322, 350, 357, 364, 371, etc.) which callenclave.dispose()withoutawait.Change
await enclave.dispose();toenclave.dispose();on line 398.package.json (1)
29-70:⚠️ Potential issue | 🔴 CriticalFix the
docsscript or restore@mintlify/clidependency.
Thedocsscript at line 18 invokesmint dev --port 4300, but@mintlify/clihas been removed from devDependencies. No alternative mint CLI provider exists.npm run docswill fail until either the dependency is restored or the script is updated.
🤖 Fix all issues with AI agents
In `@libs/core/project.json`:
- Around line 36-39: The build target "build-cjs" uses the "@nx/esbuild:esbuild"
executor which defaults deleteOutputPath to true and can delete outputs from the
concurrently-run "build-worker-script"; to fix, add an options entry
"deleteOutputPath": false to the "build-cjs" target in project.json so the
esbuild step won't remove libs/core/dist and thus won't wipe the worker script
produced by "build-worker-script".
In `@libs/types/package.json`:
- Line 38: The Zod version bump to ^4.3.6 can introduce breaking changes; search
the libs/types codebase for usages of Zod APIs impacted by 4.3.0—specifically
.pick(), .omit(), .extend(), .safeExtend(), .refine(), ZodMiniType,
z.strictObject(), and intersections—and update any offending code: replace
.extend() on refined object schemas with .safeExtend() or refactor to build the
final object type without refining first, ensure .pick()/ .omit() are only
called with existing keys or replace with manual object creation, remove/replace
.refine() usages that target ZodMiniType, and adjust intersection/strictObject
patterns as required; after changes run unit tests and update public API docs in
docs/enclave/ if any exported type shapes or behavior changed.
🧹 Nitpick comments (1)
libs/core/src/adapters/worker-pool/worker-script.ts (1)
336-341: Clarify: String concatenation doesn't inherently prevent code injection.The comment states this change avoids "code injection patterns," but the security posture is unchanged—
msg.codeis still embedded directly into the executed script regardless of whether template literals or string concatenation is used. The actual security boundary here is the VM context withcodeGeneration: { strings: false }(line 301) and the sandbox restrictions, not the string assembly method.Consider updating the comment to reflect the actual reason for the change (e.g., build tooling compatibility, readability preference) or removing the security claim if it's not the true motivation.
💡 Suggested comment clarification
// Wrap code in async IIFE to support top-level await // Must call __ag_main() if defined, as the enclave transforms code to wrap in async function __ag_main() - // Use string concatenation instead of template literals to avoid code injection patterns + // Use string concatenation for clearer code boundary visualization const wrappedCode = '(async () => {\n' + msg.code +
Cherry-pick ConflictAutomatic cherry-pick to An issue has been created with manual instructions. Please resolve if this change should also be in |
* chore: update dependencies and improve security in code execution * chore: update auto_review base branches to support regex pattern matching * fix: improve code clarity and enforce security measures in worker scripts
… (#51) * chore: update dependencies and improve security in code execution * chore: update auto_review base branches to support regex pattern matching * fix: improve code clarity and enforce security measures in worker scripts
Summary by CodeRabbit
Bug Fixes
New Features
Dependencies
Chores