Skip to content

Add support for fetching keys from a JWKS endpoint#777

Merged
SgtCoDFish merged 2 commits intomasterfrom
keyfetch
Feb 27, 2026
Merged

Add support for fetching keys from a JWKS endpoint#777
SgtCoDFish merged 2 commits intomasterfrom
keyfetch

Conversation

@SgtCoDFish
Copy link
Contributor

@SgtCoDFish SgtCoDFish commented Feb 19, 2026

This requires changing a few function signatures and plumbing some things together.

Notably, I don't want to have a second service discovery client and send duplicate calls off, so I shared the service discovery client from the CyberArk client and added caching of responses to the service discovery client.

Likewise, I needed to handle auth for the jwks endpoint. I'd rather not have to have a second identity client (we could just have one) but this works for now.

Unfortunately, that means this is much longer than I'd have hoped but most of the changes are pretty simple.

@SgtCoDFish SgtCoDFish force-pushed the keyfetch branch 20 times, most recently from 49fefca to 0337378 Compare February 25, 2026 17:13
This requires changing a few function signatures and plumbing some
things together.

Notably, I don't want to have a second service discovery client and send
duplicate calls off, so I shared the service discovery client from the
CyberArk client and added caching of responses to the service discovery
client.

I also had to share credentials for auth.

Also removes encrypted-secrets example

The machinehub mode is required for key fetching, but
doesn't play nicely with one shot mode and the example hangs.

Secret encryption is covered in the e2e tests, so just
remove the example for simplicity

Signed-off-by: Ashley Davis <ashley.davis@cyberark.com>
Signed-off-by: Ashley Davis <ashley.davis@cyberark.com>
Copy link
Member

@wallrj-cyberark wallrj-cyberark left a comment

Choose a reason for hiding this comment

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

Thanks @SgtCoDFish

Looks good to me.

We've been discussing this internally, in a slack thread: C057LS7JRLP/p1772021916784319

I tested the code on my laptop, as follows

mitmproxy
kind create cluster
kubectl create secret generic e2e-sample-secret-$(date '+%s')         --namespace default         --from-literal=username=${RANDOM}
ARK_SEND_SECRET_VALUES=true \
NO_PROXY=0.0.0.0:38601 \
HTTPS_PROXY=localhost:8080 \
go run ./cmd/ark/... agent --one-shot --machine-hub --agent-config-file examples/machinehub.yaml
Image

There are two authentications, one for the jwks client which is used early in the collection process and one for the snapshot client which is used later in the upload process.

Happy to review followup PRs if necessary.

@SgtCoDFish SgtCoDFish merged commit b7cf60b into master Feb 27, 2026
13 of 16 checks passed
@SgtCoDFish SgtCoDFish deleted the keyfetch branch February 27, 2026 13:05
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.

2 participants