-
Notifications
You must be signed in to change notification settings - Fork 52.6k
fix(core): Stronger allowed path enforcement for read/write Node #23542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/core/src/execution-engine/node-execution-context/utils/file-system-helper-functions.ts">
<violation number="1" location="packages/core/src/execution-engine/node-execution-context/utils/file-system-helper-functions.ts:133">
P1: File handle resource leak: If `fileHandle.stat()` throws or the identity check fails, the opened file handle is never closed. Unlike `writeContentToFile` which uses try/finally, this function lacks cleanup for the error path. Add `await fileHandle.close()` before throwing or wrap in try/catch.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| // Verify that the handle we've opened is the same as the path we checked earlier. | ||
| // This ensures nothing has changed between checking and reading. | ||
| const fileHandleIdentity = await fileHandle.stat(); | ||
| if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: File handle resource leak: If fileHandle.stat() throws or the identity check fails, the opened file handle is never closed. Unlike writeContentToFile which uses try/finally, this function lacks cleanup for the error path. Add await fileHandle.close() before throwing or wrap in try/catch.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/src/execution-engine/node-execution-context/utils/file-system-helper-functions.ts, line 133:
<comment>File handle resource leak: If `fileHandle.stat()` throws or the identity check fails, the opened file handle is never closed. Unlike `writeContentToFile` which uses try/finally, this function lacks cleanup for the error path. Add `await fileHandle.close()` before throwing or wrap in try/catch.</comment>
<file context>
@@ -108,34 +112,59 @@ export const getFileSystemHelperFunctions = (node: INode): FileSystemHelperFunct
+ // Verify that the handle we've opened is the same as the path we checked earlier.
+ // This ensures nothing has changed between checking and reading.
+ const fileHandleIdentity = await fileHandle.stat();
+ if (
+ fileHandleIdentity.dev !== pathIdentity.dev ||
+ fileHandleIdentity.ino !== pathIdentity.ino
</file context>
❌ 3 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
|
Found 5 test failures on Blacksmith runners: Failures
|
|
Found 3 test failures on Blacksmith runners: Failures
|
|
E2E Tests: n8n tests failed after 9m 32.9s Run Details
Failed Spec Files
Groups
This message was posted automatically by
currents.dev | Integration Settings
|
Summary
Related Linear tickets, Github issues, and Community forum posts
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)