You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to prevent attacks based on false claims, I think it would be very useful to add to CIP-0030 signData function implementation instructions to verify, in case of a payload corresponding to a CWT claim set, a verification of said claims directly on the wallet side.
It would make sense to edit the current implementation of the claim set to match CWT standard.
It would just mean for this repo changing buildMessage function from sign.js and verify function from verify.js function to make the signer function sign an hex encoded CBOR of the claim set such as the following example given in the CWT standard:
sign function should be changed accordingly to include issuer, subject, audience, expires-at, not-before, issued-at, token-id arguments as optional parameters. Default claim set could correspond to the following:
{
/ iss / 1: document.location.host,
/ iat / 6: Math.floor(Date.now()/1000),
/ cti / 7: random uuid as bytes
}
If we want to include an additional custom payload argument to the sign function, we could add a custom claim, with id 8, containing a custom body. It is yet to discuss if it should be a hex encoded CBOR of the input body object, or JSON.stringify(body) hex encoded or anything else.
This change could prevent phishing attacks. If I try to connect on jpgs.store and attempt to sign a message that a malicious attacker generated on jpg.store, my wallet would warn me that I am signing a CWT payload with issuer claim different from the current host. It would prevent replay attacks as well.
I am currently writing a PR to CIP-0030 signData implementation to recommend detecting signature of CWT claims and their verification. When it is done, i will propose a PR on open source wallets (nami, yoroi) for the implementation of those recommendations.
What do you think about this change?
By the way, thank you @pyropy for working on this very useful repo, and @gavinharris-dev for adding the signature verification. It helped a lot!
The text was updated successfully, but these errors were encountered:
I opened a CIP-0030 issue, which is related to this repo.
In order to prevent attacks based on false claims, I think it would be very useful to add to CIP-0030 signData function implementation instructions to verify, in case of a payload corresponding to a CWT claim set, a verification of said claims directly on the wallet side.
It would make sense to edit the current implementation of the claim set to match CWT standard.
It would just mean for this repo changing
buildMessage
function fromsign.js
andverify
function fromverify.js
function to make thesigner
function sign an hex encoded CBOR of the claim set such as the following example given in the CWT standard:Which corresponds to the claim set:
sign
function should be changed accordingly to include issuer, subject, audience, expires-at, not-before, issued-at, token-id arguments as optional parameters. Default claim set could correspond to the following:If we want to include an additional custom payload argument to the sign function, we could add a custom claim, with id 8, containing a custom body. It is yet to discuss if it should be a hex encoded CBOR of the input
body
object, orJSON.stringify(body)
hex encoded or anything else.This change could prevent phishing attacks. If I try to connect on
jpgs.store
and attempt to sign a message that a malicious attacker generated onjpg.store
, my wallet would warn me that I am signing a CWT payload with issuer claim different from the current host. It would prevent replay attacks as well.I am currently writing a PR to CIP-0030
signData
implementation to recommend detecting signature of CWT claims and their verification. When it is done, i will propose a PR on open source wallets (nami, yoroi) for the implementation of those recommendations.What do you think about this change?
By the way, thank you @pyropy for working on this very useful repo, and @gavinharris-dev for adding the signature verification. It helped a lot!
The text was updated successfully, but these errors were encountered: