-
Notifications
You must be signed in to change notification settings - Fork 51k
fix(core): Set default for allowed file access dirs #22279
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: v2-dev
Are you sure you want to change the base?
fix(core): Set default for allowed file access dirs #22279
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 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/@n8n/config/src/configs/security.config.ts">
<violation number="1" location="packages/@n8n/config/src/configs/security.config.ts:11">
Defaulting `restrictFileAccessTo` to `/home/user/...` blocks the real n8n data directory on every environment where the username isn’t literally `user`, so file access now fails by default in the standard Docker image and most installs.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
This comment has been minimized.
This comment has been minimized.
|
E2E Tests: n8n tests passed after 10m 1.3s Run Details
Groups
This message was posted automatically by
currents.dev | Integration Settings
|
f865bb6 to
838c8c1
Compare
838c8c1 to
6e6ba2c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This comment has been minimized.
This comment has been minimized.
| */ | ||
| @Env('N8N_RESTRICT_FILE_ACCESS_TO') | ||
| restrictFileAccessTo: string = ''; | ||
| restrictFileAccessTo: string = '~/.n8n-files'; |
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.
I think it would be good to keep the default value inside the N8N home folder. The breaking change docs mention the default will be
./data directory inside the n8n home folder.
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.
We already have N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES defaulting to true which according to the code blocks ~/.n8n. This clashes with a default that allowlists a subdir inside ~/.n8n for user operations. Seems more secure to guide users to keep user data separate from n8n internals or they might end up disabling the blocklist for convenience? Product-wise I'm not clear on how these two settings are meant to interact.
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.
Hmmm okay, that makes sense. Let's keep it like this and update the v2 breaking changes doc. Could you do that? 🙏
tomi
left a comment
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.
🚀
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.
Should we add a test that ~/mydir works as expected?
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.
I think we want to keep changes to a minimum or? #22280 (review)
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.
Yes, but if we introduce new logic it would be good to have some tests for it.
https://linear.app/n8n/issue/CAT-57