Skip to content

feat: add allowBypassPermissionsMode setting#658

Merged
kevincodex1 merged 2 commits into
Gitlawb:mainfrom
Flo5k5:feat/allow-bypass-permissions-setting
Apr 13, 2026
Merged

feat: add allowBypassPermissionsMode setting#658
kevincodex1 merged 2 commits into
Gitlawb:mainfrom
Flo5k5:feat/allow-bypass-permissions-setting

Conversation

@Flo5k5
Copy link
Copy Markdown
Contributor

@Flo5k5 Flo5k5 commented Apr 13, 2026

Summary

  • Adds a new permissions.allowBypassPermissionsMode boolean setting in settings.json
  • When set to true, bypass permissions mode appears in the mode carousel (Shift+Tab) and plan mode exit options — without requiring the --allow-dangerously-skip-permissions CLI flag
  • The disableBypassPermissionsMode setting (admin/policy) retains priority and can still block bypass mode

Usage

{
  "permissions": {
    "allowBypassPermissionsMode": true
  }
}

Files changed

  • src/utils/settings/types.ts — Zod schema: new optional boolean field
  • src/utils/settings/settings.tsvalidNestedKeys whitelist: register the new field for settings expansion
  • src/utils/permissions/permissionSetup.tsisBypassPermissionsModeAvailable condition: OR with the new setting

Test plan

  • Build passes (npm run build)
  • Add "permissions": { "allowBypassPermissionsMode": true } to ~/.claude/settings.json
  • Launch claude without any CLI flag → Shift+Tab cycles through modes including "Bypass Permissions"
  • Default mode remains "Default"
  • Adding "disableBypassPermissionsMode": "disable" alongside it → bypass mode is hidden (disable wins)

Allow bypass permissions mode to appear in the mode list via
settings.json without requiring the --allow-dangerously-skip-permissions
CLI flag. The disableBypassPermissionsMode setting retains priority.
Copilot AI review requested due to automatic review settings April 13, 2026 08:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new permissions.allowBypassPermissionsMode setting to make “Bypass Permissions” mode selectable from the mode carousel / plan-mode exit UI without requiring the CLI allow-flag, while still respecting existing disables (settings + Statsig gate).

Changes:

  • Extend PermissionsSchema with optional boolean allowBypassPermissionsMode.
  • Include permissions.allowBypassPermissionsMode in the managed-settings nested key expansion used for logging.
  • Update bypass-mode availability logic to allow the new setting as an alternative to the CLI allow-flag.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/utils/settings/types.ts Adds the new permissions.allowBypassPermissionsMode boolean to the Zod settings schema.
src/utils/settings/settings.ts Adds allowBypassPermissionsMode to the permissions nested-key allowlist for managed-settings logging.
src/utils/permissions/permissionSetup.ts Broadens isBypassPermissionsModeAvailable to include the new settings-based enablement path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/permissions/permissionSetup.ts
Comment thread src/utils/permissions/permissionSetup.ts
Comment thread src/utils/settings/types.ts
- Security: read allowBypassPermissionsMode only from trusted settings
  sources (user/local/flag/policy), excluding projectSettings to prevent
  a malicious repo from enabling bypass mode
- UX: update error messages to reference the correct CLI flag
  (--allow-dangerously-skip-permissions) and the new settings option
- Tests: add schema validation tests for the new field
Copy link
Copy Markdown
Collaborator

@Vasanthdev2004 Vasanthdev2004 left a comment

Choose a reason for hiding this comment

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

Review: allowBypassPermissionsMode setting

Reviewed on head e89385e. CI green ✅. 6 files, +58/-3.

This is a clean, well-scoped feature — the settings.json equivalent of the existing --allow-dangerously-skip-permissions CLI flag. The security properties are correct and the code follows established patterns.


✅ Security: projectSettings excluded

hasAllowBypassPermissionsMode() only checks userSettings, localSettings, flagSettings, and policySettings — same trusted-source pattern as hasSkipDangerousModePermissionPrompt() and hasAutoModeOptIn(). A malicious project can't enable bypass mode via .claude/settings.json. This is the critical security property and it's correct.

✅ Precedence: disable still wins

settingsDisableBypassPermissionsMode and growthBookDisableBypassPermissionsMode remain as && ! gates after the (A || B || C) availability check. An admin/policy disableBypassPermissionsMode: "disable" still blocks even when allowBypassPermissionsMode: true is set. Correct.

✅ Operator precedence

The explicit parentheses around (permissionMode === 'bypassPermissions' || allowDangerouslySkipPermissions || settingsAllowBypassPermissionsMode) are correct — the three availability conditions are OR'd together, then AND'd with the disable gates. No precedence bug.

✅ Zod schema + validNestedKeys

allowBypassPermissionsMode: z.boolean().optional() — correct type. Added to validNestedKeys right after disableBypassPermissionsMode — consistent placement. Test covers true/false/non-boolean.

✅ Error messages updated

Both print.ts and useReplBridge.tsx error messages now reference --allow-dangerously-skip-permissions (the actual CLI flag that makes bypass available) and the new setting. Verified that --allow-dangerously-skip-permissions exists in main.tsx as a real CLI option — it enables bypass as an option without making it the default. The error message accurately points users to both enablement paths.

🟢 Minor observation (non-blocking)

The test file only validates Zod schema parsing. A more complete test would also verify hasAllowBypassPermissionsMode() returns the right value with mock settings sources — matching the coverage pattern of the auto-mode opt-in tests. But for a 3-line settings read function following an established pattern, schema validation is a reasonable starting point.


Verdict: Approve-ready

Clean feature, correct security properties, follows established patterns. The allow setting is a natural complement to the existing disable setting — both respect the trusted-source boundary.

@kevincodex1 kevincodex1 merged commit 31be66d into Gitlawb:main Apr 13, 2026
1 check passed
C1ph3r404 pushed a commit to C1ph3r404/openclaude that referenced this pull request Apr 29, 2026
* feat: add allowBypassPermissionsMode setting

Allow bypass permissions mode to appear in the mode list via
settings.json without requiring the --allow-dangerously-skip-permissions
CLI flag. The disableBypassPermissionsMode setting retains priority.

* fix: address Copilot review feedback on allowBypassPermissionsMode

- Security: read allowBypassPermissionsMode only from trusted settings
  sources (user/local/flag/policy), excluding projectSettings to prevent
  a malicious repo from enabling bypass mode
- UX: update error messages to reference the correct CLI flag
  (--allow-dangerously-skip-permissions) and the new settings option
- Tests: add schema validation tests for the new field
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.

4 participants