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

fix: bug which required optional hmac type #275

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

vknabel
Copy link
Contributor

@vknabel vknabel commented Feb 11, 2025

Description

If not given, this will rely on the default server behavior.

Alternatively: make this hmac type mandatory in the config and make this a breaking change.

@vknabel vknabel requested a review from a team as a code owner February 11, 2025 15:07
@robertvolkmann
Copy link

Did you already implemented a validation of hmac-auth-type?

Comment on lines +227 to +231
if hmacAuthType != "" {
client, err = metalgo.NewDriver(driverURL, apiToken, hmacKey, metalgo.AuthType(hmacAuthType))
} else {
client, err = metalgo.NewDriver(driverURL, apiToken, hmacKey)
}
Copy link

@robertvolkmann robertvolkmann Feb 12, 2025

Choose a reason for hiding this comment

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

You can set default values in viper!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean like this? Unsure if its better than the if statement, but I can change it, if you like.

viper.SetDefault("hmac-auth-type", ctx.HMACAuthType)
hmacAuthType := viper.GetString("hmac-auth-type")

@vknabel
Copy link
Contributor Author

vknabel commented Feb 12, 2025

No, currently there is no validation of the hmac type. Neither on the client side, nor on the server side. Technically it could be any string. Currently there aren't even constants

@Gerrit91 Gerrit91 self-requested a review February 18, 2025 14:24
Copy link
Contributor

@Gerrit91 Gerrit91 left a comment

Choose a reason for hiding this comment

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

To me it looks okay.

@vknabel vknabel merged commit 0c1a2d7 into master Feb 19, 2025
5 checks passed
@Gerrit91 Gerrit91 deleted the fix-regression-if-no-hmac-type-set branch February 19, 2025 08:10
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