Skip to content

fix: normalize collection pathnames in EnvironmentSecretsStore#7283

Merged
bijin-bruno merged 3 commits intousebruno:mainfrom
naman-bruno:bugfix/windows-secret
Feb 24, 2026
Merged

fix: normalize collection pathnames in EnvironmentSecretsStore#7283
bijin-bruno merged 3 commits intousebruno:mainfrom
naman-bruno:bugfix/windows-secret

Conversation

@naman-bruno
Copy link
Collaborator

@naman-bruno naman-bruno commented Feb 24, 2026

Description

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • Bug Fixes
    • Environment secrets and collection paths are now normalized to POSIX form for consistent cross-platform behavior.
    • Path normalization now safely handles missing/empty paths to prevent runtime errors.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91e38b8 and a8ffb83.

📒 Files selected for processing (2)
  • packages/bruno-electron/src/store/env-secrets.js
  • packages/bruno-electron/src/utils/workspace-config.js

Walkthrough

Normalize environment collection paths to POSIX form by introducing and using a posixifyPath helper across env-secrets operations and workspace config, ensuring path comparisons and stored paths are consistent across platforms.

Changes

Cohort / File(s) Summary
Environment Secrets Path Normalization
packages/bruno-electron/src/store/env-secrets.js
Adds posixifyPath usage: normalizes paths for lookups in storeEnvSecrets, getEnvSecrets, renameEnvironment, and deleteEnvironment; updates stored collection.path to POSIX form.
Workspace Config Utility
packages/bruno-electron/src/utils/workspace-config.js
Makes posixifyPath safe for falsy input by returning the input unchanged when absent, avoiding runtime errors during normalization.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno

Poem

Paths once split by backslash and glide,
A tiny helper made them coincide.
POSIX steps now guide the state,
Secrets find home — cross-platform fate. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: introducing path normalization for collection pathnames in the EnvironmentSecretsStore, which aligns with the changeset's primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/bruno-electron/src/store/env-secrets.js`:
- Line 5: The posixifyPath helper currently lacks JSDoc and will throw on
non-string inputs; add a short JSDoc above posixifyPath describing its purpose,
param (p: string | unknown) and return (string | same-type) and update the
implementation in posixifyPath to first guard non-strings (e.g., if typeof p !==
'string' return p) so calls like collectionPathname or c.path that may be
undefined/null don't throw; keep the replace behavior for string inputs
(p.replace(/\\/g, '/')) and ensure the function name posixifyPath is used
consistently where referenced.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ade4bfb and 91e38b8.

📒 Files selected for processing (1)
  • packages/bruno-electron/src/store/env-secrets.js

const Store = require('electron-store');
const { encryptStringSafe } = require('../utils/encryption');

const posixifyPath = (p) => p.replace(/\\/g, '/');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add JSDoc and guard non-string inputs in posixifyPath.

This helper is a new abstraction but lacks JSDoc, and it will throw if collectionPathname or stored c.path is undefined/null. That’s a behavior change vs. the previous direct comparison (which was safely false). Consider a safe guard and document the intent.

🔧 Suggested update
+/**
+ * Normalizes collection paths to POSIX-style separators.
+ * Returns the input unchanged when it is not a string.
+ */
-const posixifyPath = (p) => p.replace(/\\/g, '/');
+const posixifyPath = (p) => (typeof p === 'string' ? p.replace(/\\/g, '/') : p);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const posixifyPath = (p) => p.replace(/\\/g, '/');
/**
* Normalizes collection paths to POSIX-style separators.
* Returns the input unchanged when it is not a string.
*/
const posixifyPath = (p) => (typeof p === 'string' ? p.replace(/\\/g, '/') : p);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-electron/src/store/env-secrets.js` at line 5, The posixifyPath
helper currently lacks JSDoc and will throw on non-string inputs; add a short
JSDoc above posixifyPath describing its purpose, param (p: string | unknown) and
return (string | same-type) and update the implementation in posixifyPath to
first guard non-strings (e.g., if typeof p !== 'string' return p) so calls like
collectionPathname or c.path that may be undefined/null don't throw; keep the
replace behavior for string inputs (p.replace(/\\/g, '/')) and ensure the
function name posixifyPath is used consistently where referenced.

@bijin-bruno bijin-bruno merged commit 8d301df into usebruno:main Feb 24, 2026
8 of 9 checks passed
bijin-bruno pushed a commit that referenced this pull request Feb 24, 2026
* fix: normalize collection pathnames in EnvironmentSecretsStore

* fix

* fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants