Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] unrelated claims get deleted when deleting a credential without an ID #1269

Closed
mirceanis opened this issue Oct 6, 2023 · 0 comments · Fixed by decentralized-identity/agent-explorer#180
Labels
bug Something isn't working

Comments

@mirceanis
Copy link
Member

Bug severity
5

Describe the bug
Deleting a credential (dataStoreDeleteVerifiableCredential()) that doesn't have an id property will delete every claim in the claims table for credentials that also don't have an id

To Reproduce
This test fails in Veramo 5.5.1 and likely many versions prior.

        it('should delete credentials without clearing the claims table', async () => {
          const credA = await agent.createVerifiableCredential({
            proofFormat: 'jwt',
            credential: {
              credentialSubject: {
                important: 'yes',
                serious: true,
              },
              issuer: identifier.did,
            },
          })
          const credB = await agent.createVerifiableCredential({
            proofFormat: 'jwt',
            credential: {
              credentialSubject: {
                bla: 'bla',
              },
              issuer: identifier.did,
            },
          })

          const credAhash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential: credA })
          const credBhash = await agent.dataStoreSaveVerifiableCredential({ verifiableCredential: credB })

          await agent.dataStoreDeleteVerifiableCredential({ hash: credBhash })

          const queryAfterDelete = await agent.dataStoreORMGetVerifiableCredentialsByClaims({
            where: [
              { column: 'type', value: ['important'] },
              { column: 'value', value: ['yes'] },
            ],
          })
          expect(queryAfterDelete.length).toBeGreaterThan(0)
          expect(queryAfterDelete[0].hash).toEqual(credAhash)
        })

Details
in sql undefined === undefined so claims without a credential ID are matched for all credentials without an ID

Versions (please complete the following information):

  • Veramo: up to 5.5.1 and probably many versions before
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant