Skip to content

fix(web): enforce permissions for spawned sessions#46

Merged
shekohex merged 2 commits into
shekohex:mainfrom
fengjikui:codex/web-spawn-permissions
Jul 7, 2026
Merged

fix(web): enforce permissions for spawned sessions#46
shekohex merged 2 commits into
shekohex:mainfrom
fengjikui:codex/web-spawn-permissions

Conversation

@fengjikui

Copy link
Copy Markdown
Contributor

Summary

  • enforce existing OpenCode bash/external-directory permission checks before REST session creation
  • enforce the same checks before WebSocket spawn creates a PTY session
  • add focused handler tests proving denied web spawn requests do not call manager.spawn

Validation

  • bun test test/web-permissions.test.ts test/websocket.test.ts test/pty-tools.test.ts
  • bun run typecheck
  • bun run format
  • git diff --check
  • bun run build:plugin
  • bun run lint exits 0; it reports existing unrelated noNonNullAssertion warnings in test/notification-manager.test.ts

Notes

This keeps the web UI/API spawn path aligned with the existing pty_spawn permission behavior instead of allowing a separate path to create PTY sessions without consulting permission.bash.

@fengjikui fengjikui force-pushed the codex/web-spawn-permissions branch from 8e92877 to 825cc79 Compare July 6, 2026 11:51
@fengjikui

Copy link
Copy Markdown
Contributor Author

Pushed 5e85c2e to address the failing unit job. The spawn-repeat test was machine-speed dependent and could open too many PTYs in one second; it now uses fixed repeat count with bounded concurrency while keeping env overrides for deeper stress runs.

Validation:

  • bun test test/spawn-repeat.test.ts
  • bun test test/web-permissions.test.ts
  • bun format
  • bun typecheck
  • bun lint
  • env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy bun unittest -> 64 pass, 1 skip, 0 fail

The latest GitHub Actions run is currently action_required with no jobs, so it looks like it needs maintainer approval to run on the fork update.

@fengjikui

Copy link
Copy Markdown
Contributor Author

CI follow-up: the remaining red check is Devenv CI, but it fails before project code runs, during nix profile add nixpkgs#devenv with Nix bootstrap store path unpack-bootstrap-tools.sh reported as invalid. The PR-related jobs are green (test:e2e, format, lint, test, typecheck, and dependency-review).

I tried to rerun the failed job, but GitHub requires upstream repository admin rights for this run. I do not see a code change needed in this PR based on the current log.

@shekohex shekohex merged commit 65eee77 into shekohex:main Jul 7, 2026
13 of 14 checks passed
@shekohex

shekohex commented Jul 7, 2026

Copy link
Copy Markdown
Owner

thank you!

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.

2 participants