Repository navigation
fix(transient): scope bruno- lookup to transient base, not full path - #8273
Conversation
WalkthroughIn ChangesTransient Path Detection Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/bruno-electron/src/ipc/collection.js`:
- Around line 126-131: The transient directory name extraction in the
isTransientPath block is vulnerable to path traversal because the validation
only blocks empty strings but not path traversal sequences like `..` or `.`.
After extracting transientDirName via the split operation, add validation to
ensure it does not equal `..` or `.` and optionally verify that the computed
transientDirPath is actually a direct child of transientBase by checking that
path.relative(transientBase, transientDirPath) does not contain path separators,
preventing directory escape attacks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6b96ba3c-2c8d-443f-9aeb-5b9d3ebcb3b1
📒 Files selected for processing (1)
packages/bruno-electron/src/ipc/collection.js
The previous logic scanned every segment of the file path for a 'bruno-' prefix, which incorrectly matched usernames like 'bruno-alice' in the user's home directory. Scope the lookup to the first segment under the transient base so only the actual transient collection directory is matched.
abd2503 to
a421351
Compare
Summary
JIRA
findCollectionPathByItemPathscanned every segment of the file path for abruno-prefix to find the transient collection directory. For users whose username starts withbruno-(e.g.bruno-alice), the home-directory segment matched first and the function tried to readmetadata.jsonfrom the wrong directory.Scope the lookup to the first path segment under the transient base (
<userData>/tmp/transient), which by construction is the actual transient collection directory. No user-controlled path component above the base can collide.Test plan
Summary by CodeRabbit