Skip to content

vscode: declare untrustedWorkspaces support so Codev activates in Restricted Mode (currently disabled until the folder is trusted) #1727

Closed

Description

@amrmelsayed

Problem

apps/vscode/package.json (codev-vscode 3.3.4) declares no capabilities.untrustedWorkspaces. VS Code therefore treats the extension as unsupported in Restricted Mode and does not activate it until the user trusts the folder. Net effect on first open of any repo the user has not trusted yet: the Codev sidebar is disabled, the status bar item is absent, and the Workspace Trust dialog lists Codev among "N extensions are disabled or have limited functionality". For the extension that is the point of the product, that is the wrong first impression — and it is worse than for Git/ESLint, which at least declare "limited".

Repro (stock VS Code, marketplace build, any version ≥ 1.57):

  1. git clone any repo you have never opened; code <repo>.
  2. Restricted Mode banner appears; the Codev activity-bar icon is inert until Trust is clicked.
  3. Compare with GitLens/Prettier/Python: they activate immediately (declared support), only their workspace-provided settings are withheld.

Proposed change (manifest only)

"capabilities": {
  "virtualWorkspaces": false,            // or true if the sidebar genuinely works without a local FS — decide explicitly
  "untrustedWorkspaces": {
    "supported": "limited",
    "description": "Codev works in Restricted Mode. Workspace-provided Tower connection and auto-start settings are ignored until the folder is trusted.",
    "restrictedConfigurations": [
      "codev.towerHost",
      "codev.towerPort",
      "codev.workspacePath",
      "codev.autoStartTower"
    ]
  }
}

Rationale for "limited" + that list: Workspace Trust guards against a cloned repo's .vscode/settings.json driving an extension. The only codev settings a hostile repo could weaponize are the ones that (a) redirect the sidebar to another Tower (towerHost/towerPort), (b) re-root the workspace (workspacePath), or (c) launch a process on open (autoStartTower). Marking those restricted means workspace-scope values are ignored in an untrusted folder while user/global values still apply — so the sidebar, Tower status, agent list and spawn all work immediately, and the promise the declaration makes is actually true. Review the other 18 codev.* keys once and add any that resolve to a command/path.

Also add "restricted": true on those four property definitions under contributes.configuration so the Settings UI shows the lock.

Optional, only if you want the spawn action itself gated: check vscode.workspace.isTrusted in the spawn command and offer vscode.workspace.requestWorkspaceTrust() inline, rather than leaving the whole extension dark.

Acceptance

  • Fresh clone opened in Restricted Mode: Codev activates, sidebar + status bar live, afx status reflected; the Trust dialog no longer counts Codev as disabled.
  • A repo carrying .vscode/settings.json with codev.towerHost: "evil.example" does not change the Tower target while untrusted; does after Trust.
  • vsce package / ovsx publish unaffected (standard schema field since VS Code 1.57; engine already ^1.105.0).
  • Extension-host test covering activation with workspace.isTrusted === false.

Notes

  • This is independent of any host: same behavior in stock VS Code, Cursor, and any fork.
  • Do not "fix" this by disabling security.workspace.trust.enabled in a host product — that only helps that host and leaves marketplace users with a dead sidebar.

Activity

  1. added
    area/vscode
    on Sep 23, 2026
  2. amrmelsayed commented on Sep 23, 2026

    @amrmelsayed
    CollaboratorAuthor

    Triage from main: this is now the CANONICAL issue for the untrustedWorkspaces manifest declaration. #1669 item 1 proposed the same capability from the web-workbench angle; that half is superseded by this issue (which carries the concrete restrictedConfigurations list and acceptance criteria), and #1669 is narrowed to its web-specific remainder (relay-URL Tower links + the web double-prompt flow). One implementation, both consumers.

    Owner priority noted: wanted in the NEXT extension release. Two notes for the implementer:

    • The restrictedConfigurations set [towerHost, towerPort, workspacePath, autoStartTower] is the right security shape: the sidebar works untrusted while a hostile repo's .vscode/settings.json cannot redirect Tower or auto-start anything. Verify no OTHER codev.* setting can influence process spawning or endpoints before calling the list complete - the list must be derived from an audit of the settings schema, not from memory.
    • Acceptance should include the vscode: an empty window adopts $HOME as the workspace and badges unrelated held mail #1722 interaction: an untrusted-but-real project window activating in limited mode must still not adopt $HOME semantics; the two fixes touch the same activation path.
  3. added a commit that references this issue on Sep 23, 2026
  4. added 2 commits that reference this issue on Sep 28, 2026
  5. amrmelsayed commented on Sep 28, 2026

    @amrmelsayed
    CollaboratorAuthor

    Shipped. PR #1728 merged to main 2026-09-28T22:12:41Z as merge commit 2817c2f (owner admin-bypass merge, pr gate approved by the owner at 22:06Z).

    What landed: apps/vscode/package.json declares capabilities.untrustedWorkspaces with supported: "limited", so the extension activates in Restricted Mode. Four settings are marked restricted in both the capability block and their property definitions (codev.towerHost, codev.towerPort, codev.workspacePath, codev.autoStartTower), with a test keeping the two lists in sync. virtualWorkspaces: false is declared explicitly. Manifest plus tests only; no runtime code changed. CI 7/7 green on the merged head.

    Changelog: apps/vscode/CHANGELOG.md Unreleased and docs/releases/UNRELEASED.md updated on docs/vscode-changelog (983e8f0). Owner-priority for the next extension release.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/vscode

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions