Skip to content

🤖 feat: add admin policy file enforcement#1933

Merged
ibetitsmike merged 9 commits intomainfrom
mike/policy-file
Jan 29, 2026
Merged

🤖 feat: add admin policy file enforcement#1933
ibetitsmike merged 9 commits intomainfrom
mike/policy-file

Conversation

@ibetitsmike
Copy link
Contributor

@ibetitsmike ibetitsmike commented Jan 26, 2026

Summary

  • Adds an opt-in, admin-controlled policy file (via MUX_POLICY_FILE) that is loaded at startup and refreshed every 15 minutes.
  • Enforces policy server-side for:
    • allowed providers + forced base URLs + allowed models (strict JSON allowlists)
    • MCP user-defined servers (stdio vs remote)
    • runtime allowlist (including ssh vs ssh+coder distinction)
    • minimum client version gating (blocks usage when below minimum_client_version)
  • Adds renderer PolicyContext + UI gating (hide/disable disallowed options; block actions rather than auto-switch).
  • Adds documentation page for policy file configuration.

Background

  • Mux deployments often need centrally managed constraints so users cannot enable unsupported providers/models/MCP servers/runtimes.

Implementation

  • PolicyService parses a strict JSON policy file (JSON.parse), validates it with zod, and publishes an effective (normalized) policy via ORPC.
  • Backend services (ProviderService / AIService / WorkspaceService / MCP server manager + MCP endpoints) enforce restrictions.
  • Frontend subscribes to policy changes and filters available UI choices; actions are blocked when current selections become disallowed.

Validation

  • make static-check
  • Added unit tests for policy parsing/version gating and UI helpers.

Risks

  • Policy files are a high-leverage admin control surface; strict schema validation + last-known-good refresh behavior reduce accidental unlocks.

Generated with mux • Model: openai:gpt-5.2 • Thinking: high • Cost: $20.21

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 774cd1446a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ibetitsmike
Copy link
Contributor Author

@codex review

Addressed the outstanding review threads:

  • Treat policy state blocked as deny-all for backend enforcement.
  • Apply runtime allowlist checks to workspace forks.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3efccb87d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ibetitsmike ibetitsmike added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit c488a74 Jan 29, 2026
23 checks passed
@ibetitsmike ibetitsmike deleted the mike/policy-file branch January 29, 2026 12:36
ethanndickson pushed a commit that referenced this pull request Jan 29, 2026
Summary
- Adds an opt-in, admin-controlled policy file (via `MUX_POLICY_FILE`)
that is loaded at startup and refreshed every 15 minutes.
- Enforces policy server-side for:
- allowed providers + forced base URLs + allowed models (strict JSON
allowlists)
  - MCP user-defined servers (stdio vs remote)
  - runtime allowlist (including `ssh` vs `ssh+coder` distinction)
- minimum client version gating (blocks usage when below
`minimum_client_version`)
- Adds renderer PolicyContext + UI gating (hide/disable disallowed
options; block actions rather than auto-switch).
- Adds documentation page for policy file configuration.

Background
- Mux deployments often need centrally managed constraints so users
cannot enable unsupported providers/models/MCP servers/runtimes.

Implementation
- `PolicyService` parses a strict JSON policy file (`JSON.parse`),
validates it with zod, and publishes an effective (normalized) policy
via ORPC.
- Backend services (ProviderService / AIService / WorkspaceService / MCP
server manager + MCP endpoints) enforce restrictions.
- Frontend subscribes to policy changes and filters available UI
choices; actions are blocked when current selections become disallowed.

Validation
- `make static-check`
- Added unit tests for policy parsing/version gating and UI helpers.

Risks
- Policy files are a high-leverage admin control surface; strict schema
validation + last-known-good refresh behavior reduce accidental unlocks.

---

_Generated with `mux` • Model: `openai:gpt-5.2` • Thinking: `high` •
Cost: `$20.21`_

<!-- mux-attribution: model=openai:gpt-5.2 thinking=high costs=20.21 -->
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