Skip to content

feat(ffi): return delegated credentials to hosts that opt in - #193

Merged
araujof merged 2 commits into
mainfrom
feat/host-delegated-credentials
Oct 16, 2026
Merged

araujof merged 2 commits into
mainfrom
feat/host-delegated-credentials

Conversation

@araujof

@araujof araujof commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Out-of-process hosts (Go, C) can run delegate() but never receive the token it mints: raw_credentials is skip-serialized, so a host can only forward the caller's own bearer or fail.

Changes

This adds an opt-in that returns minted credentials on allowed results:

  • C: cpex_apl_install flag CPEX_APL_EXPOSE_DELEGATED_CREDENTIALS (2).
  • Go: WithDelegatedCredentials(); results carry PipelineResult.DelegatedCredentials (header, value with scheme prefix, delegator, target, audience, scopes, expiry).
  • Values are a SecretValue that prints, marshals and logs as [REDACTED]; Reveal() returns the token. Rust Debug redacts too.
  • Off by default; nothing is returned on deny. Empty tokens are dropped.
  • Additive, so the ABI stays at 3. A library without the flag rejects it with ErrCpexInvalidInput instead of silently returning nothing.

Not covered: Python bindings.

Tests

Tests: FFI unit tests for the flag and redaction; the Go acceptance test asserts no credential without the opt-in, one Authorization: Bearer <minted> with it, and none on deny. Verified end to end from cortex against a local build.

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
@araujof araujof added the enhancement New feature or request label Oct 15, 2026
@araujof araujof added this to CPEX Oct 15, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in CPEX Oct 15, 2026
@araujof araujof moved this from Backlog to In review in CPEX Oct 15, 2026
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>

@terylt terylt 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.

LGTM

@araujof
araujof merged commit 061160a into main Oct 16, 2026
15 checks passed
@araujof
araujof deleted the feat/host-delegated-credentials branch October 16, 2026 02:06
@github-project-automation github-project-automation Bot moved this from In review to Done in CPEX Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants