Skip to content

Add application-controlled security policies for kubeconfig exec plugins - #1930

Merged
kubernetes-prow[bot] merged 14 commits into
masterfrom
copilot/add-security-policy-support
Nov 4, 2026
Merged

kubernetes-prow[bot] merged 14 commits into
masterfrom
copilot/add-security-policy-support

Conversation

Copilot AI commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Untrusted kubeconfigs can launch arbitrary local processes through exec credential plugins. This adds application-controlled authorization without requiring callers to parse and inspect kubeconfig themselves.

  • Policy API: Immutable AllowAll (default), DenyAll, and Allowlist policies across configuration builders, including Classic and AOT. Existing API signatures remain available.
  • Enforcement: Checks initial execution and token refresh before process launch. Denials throw ExecCredentialPluginDeniedException; kubeconfig cannot override the application policy.
  • Allowlist semantics: Match basenames or exact absolute paths, including Windows UNC paths. Empty lists deny all; invalid entries and quoted commands are rejected. Allowlist mode also rejects kubeconfig-supplied environment overrides to prevent command redirection and loader injection.
  • Trust boundaries: Basenames permit any matching executable location. Arguments and executable contents are not restricted; the policy is not a sandbox.
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(
    kubeConfigPath,
    execCredentialPluginPolicy: ExecCredentialPluginPolicy.DenyAll);

// Or explicitly approve credential plugins:
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(
    kubeConfigPath,
    execCredentialPluginPolicy: ExecCredentialPluginPolicy.Allowlist(
        "kubelogin",
        @"C:\Program Files\Contoso\trusted-plugin.exe"));

Copilot AI balanced review requested due to automatic review settings October 6, 2026 21:51
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 6, 2026

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.

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@kubernetes-prow kubernetes-prow Bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 6, 2026
Copilot AI linked an issue Oct 6, 2026 that may be closed by this pull request
Copilot AI balanced review requested due to automatic review settings October 6, 2026 22:01
@kubernetes-prow kubernetes-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 6, 2026

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.

Copilot review overview

🟡 Changes recommended

Kubeconfig-controlled environment variables can bypass allowlisted command restrictions and still enable arbitrary code execution.

Review effort: Balanced
Findings: 1 High severity

Open (1)

Copilot AI balanced review requested due to automatic review settings October 6, 2026 22:22

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.

Copilot review overview

🔵 Needs a closer look

Security-sensitive process execution changes span multiple target variants, while the PR explicitly indicates build and security validation remain incomplete.

Review effort: Balanced
Findings: 1 High severity

Open (1)

Copilot AI changed the title [WIP] Add security policy support for kubeconfig exec credential plugins Add application-controlled security policies for kubeconfig exec plugins Oct 6, 2026
Copilot AI requested a review from brendandburns October 6, 2026 22:28
@brendandburns

Copy link
Copy Markdown
Contributor

@copilot can you add documentation that this is intended for defense in depth and is not a hard security boundary, loading a kubeconfig from an untrusted source is an inherently dangerous activity and should be handled as part of an overall security model, not relying exclusively on this capability.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 16:03

Copilot AI commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@copilot can you add documentation that this is intended for defense in depth and is not a hard security boundary, loading a kubeconfig from an untrusted source is an inherently dangerous activity and...

Added the README clarification in commit 36876d0: the policy is defense in depth, not a hard security boundary, and untrusted kubeconfigs must be addressed within the application's overall security model.

@kubernetes-prow kubernetes-prow Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 24, 2026
@brendandburns
brendandburns marked this pull request as ready for review October 24, 2026 00:54
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 24, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from tg123 October 24, 2026 00:54

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.

🟡 Changes recommended

Allowlist mode permits HOME overrides that can inject startup code into an approved Python-based credential helper.

2 open issues
2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 24, 2026 00:55

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.

🟡 Changes recommended

Allowlist environment filtering still permits runtime redirection and Bash function injection that can execute unapproved code.

2 open issues
1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 3, 2026 17:57

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 environment filter still permits BASH_FUNC_ overrides, allowing a kubeconfig to inject code into an allowlisted Bash credential script despite blocking BASH_ENV.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 3, 2026 18:04

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

Critical code-execution risks in executable authorization and environment-variable handling require human security assessment.

No open issues 🎉

Review effort: Balanced

@brendandburns
brendandburns force-pushed the copilot/add-security-policy-support branch from a1499ea to 58ff291 Compare November 3, 2026 19:22
@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 3, 2026
@brendandburns

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 4, 2026
@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, Copilot

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 4, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit 6ef678b into master Nov 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add security policy support for kubeconfig exec credential plugins

3 participants