nearform / udaru

Open source Access Manager for node.js
https://nearform.github.io/udaru
MIT License
124 stars 19 forks source link

Bug: Policy deletion from team #489

Closed ShaunBaker closed 6 years ago

ShaunBaker commented 6 years ago
screen shot 2018-03-07 at 23 53 08

As displayed in the screenshot, we have a team which has three policies attached to it. Key to note this is in fact the same policy but each are using different variables.

Now the question here is - how can I delete one of these policies?

Udaru provides the DELETE /authorization/teams/{teamId}/policies/{policyId} endpoint - but using this endpoint will delete (all/first) of this policy as they all share the same id.

cianfoley-nearform commented 6 years ago

@ShaunBaker this is a bug as far as I can see, in the DELETE route there is no way to delete a policy based on combo of policyid and variable and it's the same on user and org endpoint

cianfoley-nearform commented 6 years ago

delete functionality is currently broken as it will delete ALL policies with the specified ID on the route

More input required on this feature before action taken.

should the idea of defining policy instances be a part of the team, user and org endpoints or should there be a policy instance endpoint to create/edit policy instances and variables so that they can be added to teams/orgs/users as per regular policies using a unique policyId for the instance... the feature of allowing either a id string or object {id, [variables]} using joi.alternatives() when adding policies to teams causes problems for swagger documentation too and is confusing so doing this would also remove this issue.

@mihaidma @ShaunBaker @dberesford

cianfoley-nearform commented 6 years ago

Hi Shaun, delete with instance is now facilitate in latest PR using instance id as a query param, this id is returned on creation. https://github.com/nearform/udaru/pull/506

an edit function on policy instances based on the instance field will be added, but need to evaluate the POST/PUT functionality across API next (this will address dangerous endpoints issue too)