Skip to content

fix (registration): Use registration challenge in kms-led authorization - #98

Merged
emilia-grant merged 4 commits into
mainfrom
egrant-kms-led-fix
Aug 19, 2026
Merged

fix (registration): Use registration challenge in kms-led authorization#98
emilia-grant merged 4 commits into
mainfrom
egrant-kms-led-fix

Conversation

@emilia-grant

Copy link
Copy Markdown
Contributor

Description

This PR fixes a bug in kms-led registration where the registration challenge wasn't present anywhere in the credential fetch request, so returned credentials were rejected node-side. I just added a RegistrationChallenge field to the WrappingRegistrationFlowInfo and pass it through to the resulting creds.

It also resolves an issue where, if both the provided nonce and expected nonce were empty, that was treated as ok. It shouldn't affect the new flow, but I fixed it regardless.

Please go over this with a fine-tooth comb! I'm not super familiar with the expected flow or patterns in this repo, so anything that sticks out might just be a bug.

I also noticed the resulting creds don't keep the registration challenge, not sure if that's intended or not.

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@emilia-grant
emilia-grant requested a review from a team as a code owner August 13, 2026 17:44
@hashicorp-cla-app

hashicorp-cla-app Bot commented Aug 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread types/node_credentials.go Outdated
Comment thread registration/register_node_led.go Outdated
mkeeler
mkeeler previously approved these changes Aug 17, 2026
Comment thread registration/register_node_led.go Outdated
return nil, fmt.Errorf("(%s) %s", op, err.Error())

}
if len(registrationInfo.Nonce) != 0 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If registration nonce is empty but registration challenge is not, when is the challenge checked?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As far as I understand the flow, this function is running on "the thing that received the FetchNodeCredentials request" (server in node/kms-led or node in server-led) and can't/shouldn't check the registration challenge. It just needs to return that same registration challenge with the returned credentials so the original sender can verify it.

I think.

@jefferai

Copy link
Copy Markdown
Member

If it's easy enough, in addition to addressing my comment, any chance you can look through other places where subtle is used and ensure there is an empty check?

@emilia-grant

Copy link
Copy Markdown
Contributor Author

If it's easy enough, in addition to addressing my comment, any chance you can look through other places where subtle is used and ensure there is an empty check?

yup, I'll give em a look

@jefferai jefferai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great! Thank you!

@emilia-grant
emilia-grant merged commit 244fe8c into main Aug 19, 2026
3 checks passed
@jefferai
jefferai deleted the egrant-kms-led-fix branch August 19, 2026 17:11
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.

3 participants