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

Add more positive & negative E2E tests for identity (multiparty mode and non-multiparty mode) #944

Open
awrichar opened this issue Aug 9, 2022 · 3 comments
Labels
good first issue Good for newcomers
Milestone

Comments

@awrichar
Copy link
Contributor

awrichar commented Aug 9, 2022

The E2E identity tests are currently a bit thin. As a very central piece of FireFly's architecture and security model, they really should have more positive tests, and particularly some negative tests to verify disallowed operations.

Background on identities:

  • Identities in FireFly are senders and receivers of data
  • They are of type "org", "node", or "custom"
  • They are described with a DID
  • Org and custom identities are on-chain identifiers with attached blockchain keys; node identities are off-chain identifiers with an attached dataexchange ID
  • Orgs may have children of any type, custom identities may only have custom identity children, nodes may not have children
  • Each FireFly instance that participates in a multi-party system must have a root "org" identity with at least one "node" identity child
  • When sending an on+off-chain message (private or broadcast), you can choose your on-chain (org or custom) and off-chain (node) identity
  • When receiving an on+off-chain message, the node identity must be a child of the on-chain identity or one of that identity's ancestors, and both pieces must be signed appropriately by those identities
  • Slight aside: the "node" terminology is overloaded, as we sometimes also refer to FireFly itself as a "node" - but that is now somewhat distinct from the special "node identity" established between FireFly and dataexchange

What we test today:

  • The multiparty on+off-chain messaging suite thoroughly uses the baseline identity functionality across two FireFly members - ie 1 root org with 1 node each
  • The multiparty identity suite creates "custom" child identities to the root org, and uses those child identities to send basic broadcast and private messages

Gateway mode suite:
We need a copy of this suite added to the "gateway mode" (ie non-multiparty) runners. This group of tests uses a single node in isolation, which creates local definitions but does not share them with any other nodes. We need (at minimum) a basic test that creates org and child identities and then queries them back.
Note: to run the gateway suite you must run make MULTIPARTY_ENABLED=false e2e

Additional tests that could be added to the existing multiparty identity suite:

  • Registering invalid identities (keys that have already been used, parent/child relationships that are not allowed, trying to register a child of someone else's org)
  • Sending to invalid recipients (ie send a private message to an org+node that exist but are not actually related)
  • Deeper nested identities

Negative tests should usually result in an event of type message_rejected. Most tests are not currently listening for this event (usually just message_confirmed), so the websocket listeners would have to be expanded to listen for this.

@awrichar awrichar added this to the v1.1.0 milestone Aug 9, 2022
@awrichar awrichar added this to FireFly Aug 9, 2022
@awrichar awrichar moved this to Todo in FireFly Aug 9, 2022
@awrichar awrichar moved this from Todo to In Progress in FireFly Aug 10, 2022
@awrichar
Copy link
Contributor Author

Partially blocked by #952

@annamcallister
Copy link
Contributor

I've done a very small part of this issue under #996.

Some observations from some initial attempts at some of the other negative test cases

  • parent/child relationships that are not allowed - this results in a 400 error response to the API call registering the identity rather than a message_rejected event
  • trying to register a child of someone else's org - I was able to successfully register an identity as a child of org 1 using the org 2 client. I don't know whether this was due to me writing code that didn't do what I thought it did, whether I've misunderstood the test case, or whether there is actually an issue here.

@awrichar
Copy link
Contributor Author

awrichar commented Sep 1, 2022

The second bullet is interesting - it might be due to the way the CLI sets up the blockchain identities. Bottom line is if you don't have access to org 1's private key, you should not be able to create a child of it. But in the local environment, everyone might have access to all the blockchain keys...

@awrichar awrichar added the good first issue Good for newcomers label Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: In Progress
Development

No branches or pull requests

2 participants