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

IAM: Open Policy Agent integration #3788

Merged
merged 308 commits into from
Dec 23, 2021
Merged

IAM: Open Policy Agent integration #3788

merged 308 commits into from
Dec 23, 2021

Conversation

nmanovic
Copy link
Contributor

@nmanovic nmanovic commented Oct 11, 2021

Resolve #3950
Resolve #2093
Resolve #2708
Resolve #2937
Resolve #3482
Resolve #3318
Resolve #3247
Resolve #3245
Resolve #3151
Resolve #2681
Resolve #1578
Resolve #1030
Resolve #317
Resolve #1835
Resolve #3969

image

Motivation and context

  1. Integrated Open Policy Agent to manage permissions. OPA is run as a separate micro service and handle input requests. Basically it responds with Allow/Deny.
  2. Added Organization, Membership, Invitation concepts to manage permissions for different objects (e.g. tasks, jobs, projects, etc).
  3. Removed auth application together with rule-based permissions
  4. Added cvat.apps.iam application which have the logic to work with OPA
  5. Migrated on the next version of Django and Rest framework

How has this been tested?

Added tests for policies and adjust REST API tests

Checklist

  • I submit my changes into the develop branch
  • I have added description of my changes into CHANGELOG file
  • I have added tests to cover my changes
  • I have linked related issues (read github docs)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

bsekachev and others added 22 commits October 7, 2021 15:40
+ org=slug and org_id=id
+ disable pagination for organization
Organization.contact (now supported in django, django-rest)
framework (otherwise need to implement methods to translate "worker" <->
"W")
@nmanovic
Copy link
Contributor Author

@nmanovic One more question: In my case it's possible to upload annotation from the Task view, but impossible from Job view for own or assigned tasks and non-admin users.

Just forgot to add 'import:annotations' scope into jobs.rego. Now it should work. Please don't forget after each update of rego rules to restart cvat_opa.

@dvkruchinin
Copy link
Contributor

Hi @nmanovic,
Found a problem when running a test for Email verification system.

Could not fetch organizations list
Error: Request failed with status code 401. {"detail":"Authentication credentials were not provided."}.
e @ cvat-app.tsx:284

It is reproduced when building a CVAT with support for this system. How it's done in nightly.

How to reproduce:

  1. Build CVAT with support Email verification system.
  2. Try to register an user.

@bsekachev
Copy link
Member

Hi @nmanovic, Found a problem when running a test for Email verification system.

Could not fetch organizations list
Error: Request failed with status code 401. {"detail":"Authentication credentials were not provided."}.
e @ cvat-app.tsx:284

It is reproduced when building a CVAT with support for this system. How it's done in nightly.

How to reproduce:

  1. Build CVAT with support Email verification system.
  2. Try to register an user.

I'll take a look into the issue, thanks

@bsekachev
Copy link
Member

@dvkruchinin

Should be fixed now

@dvkruchinin
Copy link
Contributor

Should be fixed now

@bsekachev
Yes, now it`s working. But need to fix the appropriate test. I did it in PR #4065

@nmanovic
Copy link
Contributor Author

@nmanovic
Copy link
Contributor Author

@dvkruchinin , another test was failed https://github.com/openvinotoolkit/cvat/runs/4611629268?check_suite_focus=true. Is it a problem with tests itself or a bug? Could you please investigate?

@nmanovic nmanovic merged commit 4708b5e into develop Dec 23, 2021
@nmanovic nmanovic deleted the nm/opa_integration branch December 23, 2021 03:47
@leeyh20
Copy link

leeyh20 commented Dec 26, 2021

Hi, how do we migrate to the version of CVAT that makes use of this IAM?

@nmanovic
Copy link
Contributor Author

I have made an alpha release with IAM: https://github.com/openvinotoolkit/cvat/releases/tag/v2.0.0-alpha. Basically a new version of CVAT with the feature will be released in Q1'22. You can try it right now. Just download the develop branch and run usual steps to build and deploy CVAT. I will not recommend to run the version in production for now. My team will test the patch on an internal server this year, on cvat.org next year, implement more tests to cover the new functionality at the beginning of next year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment