Skip to content

[plugins] Enforce marketplace source admission requirements#29753

Merged
xl-openai merged 1 commit into
mainfrom
xl/marketplace-source-enforcement
Jun 24, 2026
Merged

[plugins] Enforce marketplace source admission requirements#29753
xl-openai merged 1 commit into
mainfrom
xl/marketplace-source-enforcement

Conversation

@xl-openai

Copy link
Copy Markdown
Collaborator

Why

Managed marketplace source requirements only become effective when every local marketplace mutation path applies the same admission decision. This change centralizes that decision so CLI, app-server, and external-agent migration flows cannot add, install from, or refresh a disallowed source.

What changed

  • Match exact normalized Git repository URLs with an optional exact ref.
  • Match Git hosts with managed regular expressions.
  • Match local marketplaces by exact absolute path.
  • Preserve the expected path/name boundary for managed OpenAI marketplaces.
  • Enforce source admission during marketplace add, plugin install, and configured Git marketplace upgrade.
  • Continue upgrading independent marketplaces when one source is rejected and return a per-marketplace error.
  • Load the effective requirements stack at CLI, app-server, and external-agent migration entry points.

This PR does not filter already configured marketplaces at runtime; that remains in draft follow-up #29691.

Stack

This is PR 2 of 3 and is based on #29690, which introduces the requirements data shape and merge behavior.

Test plan

  • Source matcher coverage for Git URL/ref, host-pattern, local-path, and managed marketplace cases.
  • Marketplace add and plugin install coverage for allowed and rejected sources.
  • Marketplace upgrade coverage for rejection and per-marketplace continuation.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ee12246e2

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core-plugins/src/marketplace_policy.rs Outdated
Comment thread codex-rs/core-plugins/Cargo.toml
@xl-openai xl-openai force-pushed the xl/marketplace-source-admission branch from a749876 to b6afbd3 Compare June 24, 2026 00:56
@xl-openai xl-openai requested a review from a team as a code owner June 24, 2026 00:56
@xl-openai xl-openai force-pushed the xl/marketplace-source-enforcement branch from 1ee1224 to 841c737 Compare June 24, 2026 00:56
@xl-openai

Copy link
Copy Markdown
Collaborator Author

@codex review again. Ignore the MODULE.bazel.lock one it is inaccurate.

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 841c7370e5

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@xl-openai xl-openai force-pushed the xl/marketplace-source-admission branch from b6afbd3 to 730a101 Compare June 24, 2026 01:38
xl-openai added a commit that referenced this pull request Jun 24, 2026
## Why

Managed deployments need a mergeable way to declare which marketplace
sources Codex may use. An enterprise-keyed TOML table avoids array merge
ambiguity and lets every requirements layer use the existing config
precedence rules without a marketplace-specific merger.

## Requirements shape

```toml
[marketplaces]
restrict_to_allowed_sources = true

[marketplaces.allowed_sources.company_plugins]
source = "git"
url = "https://github.com/example/company-plugins.git"
ref = "main"

[marketplaces.allowed_sources.internal_git]
source = "host_pattern"
host_pattern = "^git\\.example\\.com$"

[marketplaces.allowed_sources.local_plugins]
source = "local"
path = "/opt/company/codex-plugins"
```

`restrict_to_allowed_sources` follows normal scalar precedence.
`allowed_sources` follows normal recursive TOML table merge behavior:
distinct keys accumulate and fields under the same key use normal layer
precedence. The final `source` value later selects which fields the
marketplace admission policy interprets.

The raw rule fields remain optional while requirements layers are
composed, so a higher-priority layer can override only `ref`, `url`, or
another individual field. Source-specific validation and normalization
intentionally belong to the marketplace admission layer, not
requirements merging.

This initial shape includes `git`, `host_pattern`, and `local` sources.
It does not add npm or path-pattern rules.

## What changed

- Add the marketplace requirements TOML shape to
`ConfigRequirementsToml`, `ConfigRequirementsWithSources`, and
`ConfigRequirements`.
- Carry marketplace requirements through the existing regular
requirements merge path.
- Keep allowed-source entries as raw partial tables for downstream
policy interpretation.
- Cover partial same-key overlays, source changes, unknown fields, and
unmodified local paths.

This PR defines and composes the requirements only. Source admission is
implemented by the next PR in the stack.

## Stack

This is PR 1 of 3. #29753 adds source admission on top of this PR; draft
#29691 will add runtime enforcement after it is rebased later.

## Test plan

- `just test -p codex-config marketplace_`
Base automatically changed from xl/marketplace-source-admission to main June 24, 2026 02:42
@xl-openai xl-openai force-pushed the xl/marketplace-source-enforcement branch from 841c737 to e9e21db Compare June 24, 2026 02:54

@sayan-oai sayan-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

stamping for core-agent change

@xl-openai xl-openai merged commit 4fe02f4 into main Jun 24, 2026
31 checks passed
@xl-openai xl-openai deleted the xl/marketplace-source-enforcement branch June 24, 2026 03:13
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants