Skip to content

fix: guard untrusted writes and drift - #1

Merged
saefulrahman merged 1 commit into
mainfrom
fix/untrusted-writes-drift
Oct 12, 2026
Merged

saefulrahman merged 1 commit into
mainfrom
fix/untrusted-writes-drift

Conversation

@saefulrahman

@saefulrahman saefulrahman commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Restricted Mode: no writes outside the workspace folder (absolute path, .., symlink). Covers switch, default env, save/discard and add missing keys. Switch is refused before any copy, so never half done. New src/services/writeGuard.ts + src/core/paths.ts.
  • Drift ≠ hand edit: a target replaced with another env's content is no longer marked modified, so "Save to env file" can't overwrite the active env with another env. Notification offers Use (set active, no copy, no restart).
  • Identical env files: recorded env is preferred, no false drift.
  • Tooltip: "Switch environment" link now allowed (enabledCommands).
  • Parser: unclosed quote reads as a single-line value instead of swallowing the rest of the file.
  • README, CHANGELOG and l10n bundle updated.

Notes

The integration test a reformatted copy of another env is detected as that env still expected the old "active env follows" behaviour, which 4d142db changed to drift. Updated it to assert drifted and rebased the following hand-edit tests on Staging.

Testing

  • pnpm check: typecheck, lint, 76 unit tests pass (new: test/paths.test.ts, test/drift.test.ts, parser case).
  • Integration tests not run locally (VS Code download blocked in my environment); CI runs them.

- restricted mode: no writes outside workspace (abs path, .., symlink)
- drift not hand edit; offer use detected env
- identical envs: keep switched env, no false drift
- allow switch link in status bar tooltip
- unclosed quote reads as one line
@saefulrahman
saefulrahman force-pushed the fix/untrusted-writes-drift branch from e7e3d74 to 342b84d Compare October 12, 2026 07:48
@saefulrahman
saefulrahman merged commit 2c2c4ca into main Oct 12, 2026
4 checks passed
@saefulrahman
saefulrahman deleted the fix/untrusted-writes-drift branch October 12, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant