Skip to content

Commit

Permalink
defend replay attack
Browse files Browse the repository at this point in the history
  • Loading branch information
11090815 committed Oct 18, 2023
1 parent 0aa22f2 commit c5c6453
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions chaincode/cc_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ func (s *DSCABS) Access(ctx contractapi.TransactionContextInterface, userID stri
return false, err
}

if al.Log[sig] == 0 {
al.Log[sig] = 1
key := strings.Join([]string{contractName, functionName, sig, signedMessage}, ".")

if al.Log[key] == 0 {
al.Log[key] = 1
} else {
return false, errors.New("prohibit replay of signature token")
}
Expand Down

0 comments on commit c5c6453

Please sign in to comment.