Skip to content

Exec credential authentication ignores request AbortSignal #3077

Open

Description

@yehudacohen

Describe the bug

Generated API requests can carry an AbortSignal in RequestContext, but KubeConfig.applySecurityAuthentication() does not pass that signal to exec credential authentication. If an exec plugin hangs, aborting the request cannot stop the plugin before the HTTP request begins. The call can outlive its deadline.

Client Version

Reproduced against current main (2.0.0, 426a09af). The affected exec-auth path also exists in 1.4.0.

Server Version

Not applicable: the request stalls during credential acquisition, before contacting the API server.

To Reproduce

  1. Configure a KubeConfig user with an exec credential command that waits instead of returning credentials.
  2. Create a generated API request with context.setSignal(controller.signal) before security authentication runs.
  3. Abort the controller while the exec command is running.

The credential process remains active and the request does not settle until that process exits independently.

Expected behavior

Cancellation should stop a signal-bound exec credential process, wait for it to close, reject the request, and avoid caching its output. A signal that is already aborted should prevent the command from spawning, including when cached credentials exist. Calls without a signal should retain their existing behavior.

Example Code

const controller = new AbortController();
const context = new RequestContext(url, HttpMethod.GET);
context.setSignal(controller.signal);
setTimeout(() => controller.abort(), 100);
await kubeConfig.applySecurityAuthentication(context);

With a waiting exec plugin, the call remains pending after the timer aborts. The same behavior occurs when another task cancels the controller or an AbortSignal.timeout() deadline expires.

Environment (please complete the following information):

  • OS: macOS and Linux (POSIX process groups); Windows should terminate the direct child process
  • Node.js version: 22
  • Cloud runtime: none

Additional context

The signal needs to be set before authentication; request middleware runs later. I have a regression covering abort, deadline, child processes, cached credentials, and independent concurrent requests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions