Description
When doing some testing I've come across a certain situation which will allow a signed document to be modified and still pass verification.
I've traced it back to this line in jsonld. So I wasn't sure if I should open a ticket there or here, please let me know if you'd like me to move this issue.
What's happening is if a "@type" entry is not mapped it is silently dropped from the expanded JSON and thus won't be a part of the digest. While unmapped properties are handled by the strict expansionMap provided in this library unmapped types are just dropped.
This means that the document can be modified after signing to add additional unmapped types and still be valid. On the other side it means that when signing you can unknowingly not sign the full document if you don't have all the "@type" values mapped properly.
I have made a reproducible test case here. To verify this issue you just need to:
npm i
npm run test