Skip to content

Conversation

@mariajgrimaldi
Copy link
Member

Description

ADR for policy and model (all casbin-related concepts) management fit to our environment. In this ADR we make decisions for:

  • The authorization engine configuration (model.conf) which tells the system how to behave
  • Magement of authz.policy and the policy store
  • Make the policy store the source of truth for authorization

Merge checklist:
Check off if complete or not applicable:

  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Sep 18, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Sep 18, 2025

Thanks for the pull request, @mariajgrimaldi!

This repository is currently maintained by @openedx/committers-openedx-authz.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Sep 18, 2025
@mariajgrimaldi mariajgrimaldi marked this pull request as ready for review September 18, 2025 18:42
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Sep 18, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready to Merge in Contributions Sep 18, 2025
@mphilbrick211 mphilbrick211 moved this from Ready to Merge to Ready for Review in Contributions Sep 18, 2025

Do not Handle Grouping and Context Inheritance via Casbin's Built-in Mechanisms
-------------------------------------------------------------------------------
- Grouping resources will not be implemented via Casbin's built-in grouping mechanisms (g, g2) but will be explicitly managed when checking permissions in the application layer. For example, if a user has the ``course_admin`` role in ``org:123``, this will not automatically grant them the ``course_admin`` role in all courses within that org. Instead, the application layer will need to check both the user's role and the specific context (e.g., organization or course) when making authorization decisions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably use an example. It's also the first places where the org:123 syntax shows up so we might need a sentence or link about how contexts are represented? Or just swap the order with the next section.

Store Dynamic Policies Directly in the Policy Store
---------------------------------------------------
- Consider two types of policies: static policies (shipped with services in ``authz.policy`` files) and dynamic policies (created and managed via the Policy Management API and persisted in the policy store).
- Dynamic policies created via the Policy Management API will be stored directly in the policy store (MySQL database) using a Casbin adapter.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe swap the order of these to so that it's clear at the start what the policy store is?


Differentiate Between Static and Dynamic Policies
-------------------------------------------------
- Static policies (default) should be differentiated from dynamic policies in the policy store using a metadata field (e.g., ``is_static`` boolean field) and should be immutable after being loaded from the ``authz.policy`` file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have ideas on how this immutability can be accomplished?


Allow Shared or Separate Policy Stores as Needed
------------------------------------------------
- By default, all services share the same policy store to ensure consistency and avoid conflicts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what is meant by services here. Are LMS/CMS are one service? Is the expectation that other services like Credentials would use the API to interact with a policy store, and if so which service would own it?

Allow Shared or Separate Policy Stores as Needed
------------------------------------------------
- By default, all services share the same policy store to ensure consistency and avoid conflicts.
- If isolation between services is required, this can be achieved in two ways: (1) by using a namespace or domain field in the shared table, or (2) by creating a separate policy store for a specific service.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid large future migrations would it make sense to add a namespacing field up front and plan for future expansion that way?


Create the Record of the Back-reference Model in the same Transaction as the Policy Creation
--------------------------------------------------------------------------------------------
- To ensure data integrity, the creation of the back-reference model record and the corresponding policy in the policy store should occur within the same transaction. This ensures that both operations succeed or fail together.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of non-LMS/CMS services using the policy store over API this may not be possible, but I'm still unclear if that's a case we're supporting.


#. **Performance Considerations**: The use of dynamic policies and complex matchers may introduce performance overhead. It is essential to monitor the performance of the authorization engine and optimize policies and matchers as needed to ensure that authorization checks remain efficient.

#. **For Data Integrity Purposes, Place the Policy Store Where the Data is Owned**: To ensure data integrity and consistency, the policy store should be hosted in the same environment as the services that own the data and policies. If this is not feasible, additional mechanisms must be implemented to maintain consistency like an event-bus mechanism.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still unclear to me how this works with "Clients Share the Same Policy Store" but that probably has to do with my being unclear about what a "service" is in this context and what we're supporting in terms of cross-service authz.

@MaferMazu MaferMazu linked an issue Sep 22, 2025 that may be closed by this pull request
@MaferMazu MaferMazu moved this to Ready for testing in RBAC AuthZ Board Oct 22, 2025
@MaferMazu MaferMazu moved this from Ready for review to Blocked in RBAC AuthZ Board Oct 22, 2025
@mariajgrimaldi mariajgrimaldi self-assigned this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review
Status: Blocked

Development

Successfully merging this pull request may close these issues.

ADR: Open edX AuthZ Architecture

5 participants