Skip to content

@W-22899437 fix: set default OCAPI/WebDAV permissions on VS Code sandbox creation - #614

Merged
clavery merged 3 commits into
mainfrom
fix/sandbox-creation-ocapi-vscode
Aug 18, 2026
Merged

@W-22899437 fix: set default OCAPI/WebDAV permissions on VS Code sandbox creation#614
clavery merged 3 commits into
mainfrom
fix/sandbox-creation-ocapi-vscode

Conversation

@clavery

@clavery clavery commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

What

The VS Code extension's Create Sandbox command now grants the configured OAuth client the same default OCAPI/WebDAV permissions as the CLI's b2c sandbox create.

The default-permission logic is extracted into a new shared SDK helper buildSandboxSettings (@salesforce/b2c-tooling-sdk, operations/ods/sandbox-settings.ts), so the CLI and the extension apply identical defaults from one source:

  • OCAPI: /code_versions, /code_versions/*, /jobs/*/executions, /jobs/*/executions/*, /sites/*/cartridges
  • WebDAV: /impex, /cartridges, /static

The CLI's sandbox create now delegates to the helper (behavior unchanged). The extension builds settings from the configured clientId and passes them in the POST /sandboxes body.

Why

Previously the extension sent only {realm, ttl, analyticsEnabled} and omitted the settings object entirely. Sandboxes created from the extension therefore had no API permissions for the client, so subsequent code deploys and job executions failed with authorization errors until permissions were set manually — inconsistent with the CLI.

Testing

  • In VS Code with an OAuth-configured dw.json, create a sandbox via the sandbox tree → Create Sandbox, then confirm the client can deploy code / run jobs against the new sandbox without manually granting OCAPI/WebDAV permissions.

Fixes W-22899437

…box creation

The VS Code extension's Create Sandbox command sent only {realm, ttl,
analyticsEnabled} and omitted the settings object, so new sandboxes had
no OCAPI/WebDAV permissions for the configured client -- unlike the CLI's
sandbox create. Downstream code deploys and job executions then failed
with authorization errors until permissions were set manually.

Extract the default-permission logic into a shared SDK helper
(buildSandboxSettings) so the CLI and the extension apply the same
defaults. The CLI now delegates to it, and the extension builds settings
from the configured clientId and passes them in the POST body.
@clavery
clavery requested a review from wei-liu-sf as a code owner August 7, 2026 14:31
clavery added 2 commits August 7, 2026 10:54
…ngs test

The custom test values used `as const`, producing readonly tuples that
failed the SDK pretest type-check (tsc --noEmit -p test) in CI. Annotate
them with the generated OcapiSettings/WebDavSettings types instead.
…ocapi-vscode

# Conflicts:
#	packages/b2c-tooling-sdk/src/index.ts
#	packages/b2c-tooling-sdk/src/operations/ods/index.ts
#	packages/b2c-vs-extension/src/sandbox-tree/sandbox-commands.ts
@clavery
clavery merged commit 9382697 into main Aug 18, 2026
7 checks passed
@clavery
clavery deleted the fix/sandbox-creation-ocapi-vscode branch August 18, 2026 13:23
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