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

bug(oidc): short static request state nonce #152

Open
TheoTechnicguy opened this issue Oct 3, 2024 · 1 comment
Open

bug(oidc): short static request state nonce #152

TheoTechnicguy opened this issue Oct 3, 2024 · 1 comment

Comments

@TheoTechnicguy
Copy link
Contributor

Hi!

I have noticed that the nonce used in the OIDC authentication flow is a short static string. This poses a security issue as these state nonces are intended to protect against CSRF attacks.

My current solution is to use the URL and the current time to generate a hash.

h := sha256.New()
h.Write([]byte(fmt.Sprintf("%d", time.Now().UnixMilli())))
state := hex.EncodeToString(h.Sum([]byte(secretUrl)))

I do know that it isn't a great solution as the URL is in the request and the time is a monotonically incrementing counter, so I'm open to suggestions on how to improve this solution. Any suggestions?

@TheoTechnicguy
Copy link
Contributor Author

I will add that the state is currently not checked.

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

No branches or pull requests

1 participant