Skip to content

Split CLI-proxy security policy into focused modules - #12006

Merged
lpcox merged 3 commits into
mainfrom
copilot/refactor-security-js-modules
Nov 23, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/refactor-security-js-modules

Conversation

@lpcox

@lpcox lpcox commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

The CLI-proxy security gate combines five responsibilities without dedicated unit coverage. This refactor separates review surfaces while preserving policy behavior.

  • Module boundaries: Isolate environment sanitization, command-path policy, enclave validation, and file-input validation; retain top-level dispatch in the facade.
  • Compatibility: Preserve all 11 public exports and existing caller imports; include the new modules in the Docker image.
  • Regression contract: Add dedicated tests pinning allow/deny results, capability validation, environment scrubbing, and facade exports before extraction.
  • Documentation: Update the design reference to reflect module ownership.

@lpcox lpcox changed the title [WIP] Refactor security.js into focused modules Split CLI-proxy security policy into focused modules Nov 23, 2026
@lpcox
lpcox marked this pull request as ready for review November 23, 2026 16:19
Copilot AI adaptive review requested due to automatic review settings November 23, 2026 16:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The extraction rewires admission controls and enclave security policies across modules and the production container image, requiring human review to confirm security boundaries and module loading.

No open issues 🎉

What changed in this PR

Refactors the CLI-proxy security gate into focused modules, addressing #11999 while preserving policy behavior, existing caller imports, and all 11 public exports.

Changes:

  • Extract environment, command-path, enclave, and file-input policies behind the existing facade.
  • Add dedicated regression tests for validation results, capability handling, environment scrubbing, and exports.
  • Include the new modules in the Docker image and document their ownership.
File Description
docs/​gh-cli-proxy-design.md Documents module ownership and regression coverage.
containers/​cli-proxy/​security/​file-inputs.js Extracts stdin-only and positional file-input checks.
containers/​cli-proxy/​security/​env.js Extracts child-environment sanitization.
containers/​cli-proxy/​security/​enclave.js Extracts enclave argument and capability validation.
containers/​cli-proxy/​security/​command-policy.js Extracts command discovery, aliases, and denial tables.
containers/​cli-proxy/​security.test.js Adds dedicated security-policy regression tests.
containers/​cli-proxy/​security.js Retains top-level dispatch and compatible exports.
containers/​cli-proxy/​Dockerfile Copies the new security modules into the image.

Review effort: Max (adaptive)

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-12006 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 6ff3041

@lpcox
lpcox merged commit 4bc5ca0 into main Nov 23, 2026
37 of 41 checks passed
@lpcox
lpcox deleted the copilot/refactor-security-js-modules branch November 23, 2026 17:00
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.

[Refactoring] Split containers/cli-proxy/security.js into focused modules

3 participants