Repository navigation
[#1727] vscode: declare untrustedWorkspaces support so Codev activates in Restricted Mode - #1728
Merged
Merged
Conversation
…v activates in Restricted Mode Without a capabilities.untrustedWorkspaces declaration VS Code treats the extension as unsupported in Restricted Mode and does not activate it until the folder is trusted, leaving the sidebar and status bar dead on first open of any untrusted repo and counting Codev among the disabled extensions in the Trust dialog. Declare "limited" support so the extension activates immediately. The four settings a hostile cloned repo could weaponize via .vscode/settings.json are marked restricted (both in restrictedConfigurations and with "restricted": true on each property definition), so their workspace-scope values are ignored while untrusted: towerHost/towerPort (redirect the Tower endpoint), workspacePath (re-roots the workspace / afx child-process cwd), autoStartTower (launches a process on activation). The other 18 codev.* keys are UI toggles, intervals, thresholds and font sizes and keep working from workspace scope. virtualWorkspaces is false: the extension shells out to afx/git and reads the local filesystem, so it cannot function without one. Tests: manifest parity for the declaration and the exact restricted set, plus runtime coverage that getTowerAddress reads the safe global endpoint while untrusted and that workspace-path resolution stays trust-independent and never adopts $HOME (#1722 guard).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
apps/vscode/package.jsondeclared nocapabilities.untrustedWorkspaces, so VS Code treated codev-vscode as unsupported in Restricted Mode and did not activate it until the folder was trusted. On first open of any untrusted repo the Codev sidebar was inert, the status-bar item absent, and the Workspace Trust dialog counted Codev among the disabled extensions — the wrong first impression for the extension that is the point of the product.This is a manifest-only change (plus tests). It declares
"limited"untrusted-workspace support so the extension activates immediately, and marks the four settings a hostile cloned repo could weaponize asrestrictedso their workspace-scope values are ignored until the folder is trusted. The sidebar, Tower status, agent list and spawn all work in Restricted Mode using user/global settings; only the four workspace-scoped values below are withheld.Closes #1727.
Manifest changes (
apps/vscode/package.json)Plus
"restricted": trueon each of those four property definitions undercontributes.configuration(so the Settings UI shows the lock and VS Code withholds workspace-scope values while untrusted). The restriction is declared in both places; a test keeps the two lists in sync.virtualWorkspaces: false— explicit decisionfalseis the honest value. The extension shells out toafx/gitchild processes and reads the local filesystem (workspace detection, worktree config, PTY-backed terminals). A virtual workspace has no local FS — nocodevCLI, no Tower, no PTYs — so the sidebar genuinely cannot function there. Declaringtruewould promise something the extension cannot deliver.Settings audit (re-derived, not remembered)
All 22
codev.*keys, checked against everygetConfiguration(...)read inapps/vscode/src. A setting is restricted only if a workspace-scope value from a cloned repo could redirect an endpoint, re-root the workspace, or launch a process. Exactly four qualify:codev.towerHostcodev.towerPortcodev.workspacePathafxspawn/cleanup/approve child processescodev.autoStartTowertower-starter.ts)codev.autoConnectcodev.cliVersionTimeoutMscodev --versioncall; cannot change what is runcodev.terminalPositioncodev.terminalLinks.issueTarget#Nlink openscodev.diffCodelensModecodev.maxTerminalscodev.terminal.repaintOnRefocuscodev.autoOpenBuilderTerminalcodev.gateToasts.enabledcodev.mailboxEscalationToasts.enabledcodev.overviewRefreshSecondscodev.buildersAutoCollapsecodev.buildersFileViewAsTreecodev.buildersAutoRevealcodev.backlogShowAllcodev.buildersGroupBycodev.markdownPreview.fontSizecodev.markdownPreview.lineHeightThe 18 non-restricted keys are UI toggles, intervals, thresholds and font sizes; none resolves to a command, path or endpoint, so they keep working from workspace scope even while untrusted.
Tests
src/__tests__/contributes-untrusted-workspace.test.ts— manifest parity:supported: "limited", the description, the exactrestrictedConfigurationslist,virtualWorkspaces: false,"restricted": trueon the four property defs, list↔flags sync, and the audit assertion that no othercodev.*key is restricted.src/__tests__/untrusted-workspace-config.test.ts— runtime behavior:getTowerAddress()reads the safe global endpoint while untrusted (workspace-scopeevil.example:6666is ignored) and the workspace endpoint once trusted;detectWorkspacePath()resolves a real codev project to itself, not$HOME, while untrusted, and never adopts a workspace for a plain untrusted project (guard against a vscode: an empty window adopts $HOME as the workspace and badges unrelated held mail #1722 regression — the two fixes cannot regress each other; vscode: an empty window adopts $HOME as the workspace and badges unrelated held mail #1722 is not fixed here).Full vscode unit suite: 85 files / 1035 tests pass.
check-typesandlintclean. (The suite needspnpm --filter 'codev-vscode^...' buildfirst to build thecodev-sdksubpath exports — a build-prerequisite artifact, unrelated to this change.)Packaging
Standard schema field since VS Code 1.57; engine is already
^1.105.0.vsce package/ovsxpublish are unaffected. Behavior is host-independent (stock VS Code, Cursor, any fork).Scope / fences
package.jsonhunk limited to thecapabilitiesblock and the fourrestrictedflags (shared file with pir-1566). No changes toviews/tower*.ts,workspace-label.ts,fleet-order.ts,attention-format.ts,switch-workspace.ts, oricons/tower.svg. Changelog is the vscode architect's on the changelog branch after merge. AIR: no spec/plan/review files; this review lives in the PR body.