-
Notifications
You must be signed in to change notification settings - Fork 29
Stricter checks for explicit local mag paths #8547
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
Conversation
Note Reviews pausedUse the following commands to manage reviews:
📝 WalkthroughWalkthroughThe changes update the Changes
Suggested labels
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai pause |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DataSourceService.scala (1)
225-233
: New validation helper improves securityThis helper function effectively prevents directory traversal by ensuring explicit mag paths stay within the organization directory or are remote URIs.
Consider these minor improvements:
- The function name
pathOk
is very generic - a more descriptive name likeisValidMagPath
would better communicate its purpose- The return statement could be simplified:
- if (path.startsWith(allowedParent)) true else false + path.startsWith(allowedParent)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DataSourceService.scala
(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: frontend-tests
- GitHub Check: backend-tests
- GitHub Check: build-smoketest-push
🔇 Additional comments (4)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DataSourceService.scala (4)
215-215
: Signature update to enhance validationThe method signature now accepts an
organizationDir
parameter, which is essential for validating that mag paths remain within allowed boundaries.
256-259
: Strong security enhancement for mag path validationThis validation check is crucial for preventing directory traversal attacks by ensuring all explicit mag paths either use remote storage or stay within the organization's directory.
269-272
: Improved method organizationComputing paths upfront improves readability and makes the code easier to understand.
273-273
: Updated validation call with security parameterThe validation call now correctly passes the organization directory, enabling path containment checks.
...nossos-datastore/app/com/scalableminds/webknossos/datastore/services/DataSourceService.scala
Show resolved
Hide resolved
✅ Actions performedReviews paused. |
There are some changes coming up for explicit mag paths, as we want to get rid of symlinks wherever we can, and move more datasets to the cloud. Then this code may change again. However I think it makes sense to be strict about explicit mag paths already now.
--