Skip to content

chore: minor improvements to readability and updated code style#827

Merged
zepatrik merged 2 commits into
masterfrom
chore/token/hmac-cleanup
Oct 21, 2024
Merged

chore: minor improvements to readability and updated code style#827
zepatrik merged 2 commits into
masterfrom
chore/token/hmac-cleanup

Conversation

@zepatrik

Copy link
Copy Markdown
Member

Related Issue or Design Document

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    If this pull request addresses a security vulnerability,
    I confirm that I got approval (please contact security@ory.sh) from the maintainers to push the changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

Further comments

@zepatrik zepatrik requested a review from aeneasr as a code owner October 14, 2024 12:26
Comment thread go.mod
Comment on lines -3 to -7
replace github.com/dgrijalva/jwt-go => github.com/form3tech-oss/jwt-go v3.2.1+incompatible

replace github.com/gobuffalo/packr => github.com/gobuffalo/packr v1.30.1

replace github.com/gorilla/sessions => github.com/gorilla/sessions v1.2.1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These were not (anymore) in the dependencies.

Comment thread token/hmac/bytes.go
func RandomBytes(n int) ([]byte, error) {
bytes := make([]byte, n)
if _, err := io.ReadFull(rand.Reader, bytes); err != nil {
return []byte{}, errorsx.WithStack(err)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Wrong zero-value returned. Is this a breaking change? I'd argue not.

Comment thread token/hmac/hmacsha.go
keys = append(keys, secrets)
keys = append(keys, rotatedSecrets...)

if len(keys) == 0 {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Took me quite some time to figure out that the error check after the loop was just this...

@zepatrik zepatrik requested a review from alnr October 17, 2024 13:53
@zepatrik zepatrik merged commit 939bdbf into master Oct 21, 2024
@zepatrik zepatrik deleted the chore/token/hmac-cleanup branch October 21, 2024 10:01
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