-
Notifications
You must be signed in to change notification settings - Fork 29
Allow local absolute mag paths to point to same-orga datasets #8722
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
📝 WalkthroughWalkthroughThe change updates the path validation logic in the Changes
Possibly related PRs
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:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
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: 0
🧹 Nitpick comments (1)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/storage/RemoteSourceDescriptorService.scala (1)
58-63
: Consider adding a comment to document the security boundary change.The path validation logic has been relaxed from dataset-level to organization-level access. Adding a brief comment would help future maintainers understand the rationale behind this security boundary.
if (localPath.isAbsolute) { + // Allow absolute paths within the same organization directory or whitelisted paths if (localPath.toString.startsWith(localDatasetDir.getParent.toAbsolutePath.toString) || dataStoreConfig.Datastore.localDirectoryWhitelist .exists(whitelistEntry => localPath.toString.startsWith(whitelistEntry))) uri else throw new Exception( s"Absolute path $localPath in local file system is not in path whitelist. Consider adding it to datastore.localDirectoryWhitelist")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/storage/RemoteSourceDescriptorService.scala
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build-smoketest-push
- GitHub Check: backend-tests
🔇 Additional comments (1)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/storage/RemoteSourceDescriptorService.scala (1)
58-58
: LGTM! The change correctly implements organization-level path validation.The modification from
localDatasetDir
tolocalDatasetDir.getParent
effectively allows absolute paths to reference datasets within the same organization, which aligns with the PR objectives. SincelocalDatasetDir
is constructed asbaseDir/organizationId/datasetName
, usinggetParent
correctly targets the organization directory.However, please verify that
getParent()
won't return null in edge cases:#!/bin/bash # Description: Search for other usages of getParent() in the codebase to see if null checks are used elsewhere # Expected: Find patterns of getParent() usage and null safety handling rg "\.getParent\(\)" -A 3 -B 1
Vx now writes out absolute paths instead of symlinking other dataset layers. This is currently rejected by wk. This PR relaxes this check.
Issues: