Skip to content

Commit

Permalink
refactor(protocol): clear staticcheck warnings on AttestationChalleng…
Browse files Browse the repository at this point in the history
…e check

The first warning from `staticcheck` is about Yoda conditions (which hides another warning)

> protocol/attestation_androidkey.go:114:5: don't use Yoda conditions (ST1017)

The hidden warning on the same line with `bytes.Compare(...) != 0` is

> protocol/attestation_androidkey.go:114:5: should use !bytes.Equal(decoded.AttestationChallenge, clientDataHash) instead (S1004)
  • Loading branch information
robert-wallis committed Jul 16, 2024
1 parent 7dee1ee commit d40bb93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion protocol/attestation_androidkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func verifyAndroidKeyFormat(att AttestationObject, clientDataHash []byte) (strin
}

// Verify that the attestationChallenge field in the attestation certificate extension data is identical to clientDataHash.
if 0 != bytes.Compare(decoded.AttestationChallenge, clientDataHash) {
if !bytes.Equal(decoded.AttestationChallenge, clientDataHash) {
return "", nil, ErrAttestationFormat.WithDetails("Attestation challenge not equal to clientDataHash")
}

Expand Down

0 comments on commit d40bb93

Please sign in to comment.