unee-t / frontend

Meteor front end
https://case.dev.unee-t.com/
GNU Affero General Public License v3.0
9 stars 17 forks source link

Edge case - API to list units and cases for a given user - risk exposing too much information #776

Closed franck-boullier closed 5 years ago

franck-boullier commented 5 years ago

The problem:

We now have a MEFE API that retrieves the units and cases associated to a given user. As of today these API retreive ALL the units and ALL the cases for a given users.

This will become a problem in the following scenario:

Organization X has access to one of the API keys generated for User A (via the Unee-T Enterprise Interface).

If we use the current version of the API, then the API Key shown to Organization X will enable Organization X to:

A possible solution:

We should make sure that every API keys are specific to:

kaihendry commented 5 years ago

I know in AWS's dynamodb and I think in AWS Appsync you can create policies for fine grained access, so that you can say: only expose certain attributes, for certain users.

We could leverage this, so IIUC a "resolver" would need to be written to tell AWS Appsync how to fetch the data from MEFE. And otherwise AWS's tech would manage the API.

Big con as usual is that we become even more dependent on AWS ways of doing things, making it particularly challenging to host oneself or move to another solution.

nbiton commented 5 years ago

@kaihendry Thanks for the suggestions, but it wouldn't be needed.

Since we record who was the issuer of each user's API key, we can restrict the API results to return only units/ cases under units who are "owned" (managed) by that issuer. It will be fairly straightforward to implement.

franck-boullier commented 5 years ago

Fixed in the latest version of the master The API key will only return units and cases for units where the OwnerID is the same as the MEFE user ID of the user who generated the API key.