Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client assertion token does not have a jti claim, making it reusable #458

Open
clementdenis opened this issue May 16, 2024 · 4 comments
Open
Labels
bug Something isn't working stale Triaged

Comments

@clementdenis
Copy link

Describe the bug?

The ClientAssertionClaims struct in client.mustache has an ID field (jti claim)

type ClientAssertionClaims struct {
Issuer string `json:"iss,omitempty"`
Subject string `json:"sub,omitempty"`
Audience string `json:"aud,omitempty"`
Expiry *jwt.NumericDate `json:"exp,omitempty"`
IssuedAt *jwt.NumericDate `json:"iat,omitempty"`
ID string `json:"jti,omitempty"`
}

but this is not used in createClientAssertion

func createClientAssertion(orgURL, clientID string, privateKeySinger jose.Signer) (clientAssertion string, err error) {
claims := ClientAssertionClaims{
Subject: clientID,
IssuedAt: jwt.NewNumericDate(time.Now()),
Expiry: jwt.NewNumericDate(time.Now().Add(time.Hour * time.Duration(1))),
Issuer: clientID,
Audience: orgURL + "/oauth2/v1/token",
}
jwtBuilder := jwt.Signed(privateKeySinger).Claims(claims)
return jwtBuilder.CompactSerialize()
}

What is expected to happen?

The client assertion token should have a jti claim to prevent reuse.

What is the actual behavior?

The client assertion token can be used multiple times.

Reproduction Steps?

N/A

Additional Information?

The other SDKs add a jti claim:

Golang Version

Any

SDK Version

Latest

OS version

No response

@clementdenis clementdenis added the bug Something isn't working label May 16, 2024
@duytiennguyen-okta
Copy link
Contributor

Copy link

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

Copy link

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

Copy link

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

@github-actions github-actions bot added the stale label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Triaged
Projects
None yet
Development

No branches or pull requests

2 participants