Skip to content

Add timeout to token source subprocess calls#14

Merged
jgowdy-godaddy merged 1 commit intomainfrom
fix/token-source-timeout
Apr 17, 2026
Merged

Add timeout to token source subprocess calls#14
jgowdy-godaddy merged 1 commit intomainfrom
fix/token-source-timeout

Conversation

@jgowdy-godaddy
Copy link
Copy Markdown
Contributor

Summary

Credential helpers configured via `token_source` (1Password CLI, AWS Secrets Manager, custom scripts) were invoked with `Command::output()` and no deadline. A wedged helper would block `npm install`/`npx` indefinitely with no signal to the user.

Adopts `enclaveapp_core::timeout::run_with_timeout` with a 60s default, overridable via `NPMENC_TOKEN_SOURCE_TIMEOUT_SECS`. On timeout the helper is killed and a clear error surfaces.

Dependency

Requires libenclaveapp#52 (the shared `enclaveapp_core::timeout` module).

Test plan

  • `cargo build --workspace` clean
  • `cargo clippy --workspace --all-targets -- -D warnings` clean
  • `cargo test --workspace` — 87 tests pass in npmenc-core
  • Manual: set `NPMENC_TOKEN_SOURCE_TIMEOUT_SECS=2` with a slow helper (`sleep 10 && echo token`), confirm error fires in ~2s

Credential helpers (1Password CLI, AWS Secrets Manager CLI, custom
scripts via `token_source`) were invoked with `Command::output()` and
no deadline. A wedged helper (stalled network, hung keychain prompt,
broken shim) would block `npm install`/`npx` indefinitely with no
signal to the user.

Adopts `enclaveapp_core::timeout::run_with_timeout` with a 60s default,
overridable via `NPMENC_TOKEN_SOURCE_TIMEOUT_SECS`. On timeout, the
helper process is killed and a clear error is returned.
@jgowdy-godaddy jgowdy-godaddy merged commit bf7b24b into main Apr 17, 2026
3 of 6 checks passed
@jgowdy-godaddy jgowdy-godaddy deleted the fix/token-source-timeout branch April 17, 2026 03:52
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