Skip to content

[FC-0099] docs: add ADR proposing architecture for authz framework#57

Merged
mariajgrimaldi merged 5 commits intomainfrom
MJG/authz-architecture-and-data-modeling
Mar 10, 2026
Merged

[FC-0099] docs: add ADR proposing architecture for authz framework#57
mariajgrimaldi merged 5 commits intomainfrom
MJG/authz-architecture-and-data-modeling

Conversation

@mariajgrimaldi
Copy link
Member

Description

Make decisions about:

  • How the authz framework will interact with the Open edX ecosystem
  • How the ecosystem will make authorization decisions
  • How the policies used for access control will be managed and stored at the ecosystem level

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.

Details
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 changed the title docs: add ADR proposing architecture for authz framework [FC-0099] docs: add ADR proposing architecture for authz framework Sep 18, 2025
@mariajgrimaldi mariajgrimaldi marked this pull request as ready for review September 18, 2025 18:41
@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 for Review in Contributions Sep 18, 2025
- ``id``: A unique identifier for each policy. This depends on the database backend. In our case, MySQL uses an auto-incrementing integer.
- ``ptype``: The policy type (e.g., ``p`` for policy, ``g, g2`` for grouping).
- ``v0, v1, v2, v3, v4, v5``: The policy fields that define the subject, action, object, and context. The exact meaning of these fields depends on the policy type and model configuration.
- Optionally, include additional metadata fields in the policy table to support auditing and versioning.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these are two different things? We should have as part of this decision what we want to store for auditing and versioning, and it should be non-optional. Whereas metadata fields may be optional?

Copy link
Member Author

@mariajgrimaldi mariajgrimaldi Mar 6, 2026

Choose a reason for hiding this comment

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

@bmtcril @rodmgwgu: do we have planned an ADR for what we're going to store for auditing and versioning? I'm not sure this ADR is the best place for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have a specific plan for this, but I do agree this should be covered in a separate ADR.

Maintain Consistent Model and Policy Definitions Across Services
----------------------------------------------------------------
- Policies should be defined in a way that is consistent across services, using the same naming conventions and structures for subjects, actions, objects, and contexts. For example, if the LMS defines a policy for "viewing a course" the CMS should use the same terminology and structure when defining a similar policy for "viewing content".
- Each column in the policy table (v0, v1, v2, etc.) should have a consistent meaning across services. For example, for the same type ``v0`` should always represent the subject, ``v1`` the action, ``v2`` the object, and so on.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's worth noting that a consequence of this is that if the model.conf changes it will possibly change the meaning of the stored data and that data (at least for dynamic policies) may need to be rebuilt somehow? I'm not even sure if that's possible if the definitions of the dynamic policies assume the default model.conf.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think changes in model.conf should be considered breaking. They would also require some form of data migration so the dynamic data can evolve with the model.

For auditing purposes, it may also make sense to version model.conf together with the policies.


Use the Enforcement API for Authorization Decisions for External Clients
------------------------------------------------------------------------
- External clients (e.g., MFEs, IDAs, or any service not co-located with the policy store) must use the REST API provided by the Open edX authorization layer to request 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.

Can you be specific about which service is going to host this? I assume it will have to be LMS, but I'd like it to be explicit. Things I've read elsewhere seem to indicate that Studio may have its own store? In which case would external services have to query both? Or would both sets of policies be stored in a single LMS-based store with a single set of REST endpoints?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think assuming that the LMS will be the single store is safe enough from both a scalability and security perspective. The majority, if not all, IDAs already communicate with the LMS in some way, so we already have that integration point established. Using the LMS as the store also removes the friction of introducing additional communication paths with other products.

This does not necessarily mean the store could not become a dedicated internal service in the future if that becomes necessary. I would not want to close that direction. But for the time being and the near future, I think it is reasonable to state that the LMS is the service hosting the policy store, and that this is the direction we are currently taking.


#. **Use of MySQL for Policy Storage**: The choice of MySQL as the backend for the policy store means that all policies will be stored in a relational database, which may have implications for performance and scalability. However, this also allows us to leverage existing database infrastructure and tools for managing and querying policies. If support for other databases is needed in the future, we can explore using other Casbin adapters.

#. **Roles and Permissions are Stored in the Policy Store**: All roles and permissions will be managed through the policy store, which means that any changes to roles or permissions will need to be made via the Policy Management API or by updating the ``authz.policy`` file. This centralization simplifies management but requires careful handling to avoid conflicts or inconsistencies.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't suppose there are any built-in safeguards to keep different apps / services from altering the permissions of others?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't currently have any safeguards for services... we could consider using tenancy for filtering though! https://casbin.org/docs/rbac-with-domains/ (not sure how this would look like though)

@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
@mphilbrick211 mphilbrick211 moved this from Ready for Review to Waiting on Author in Contributions Jan 22, 2026
@mphilbrick211
Copy link

@mariajgrimaldi since this FC is closed, can we close this one?

@bmtcril
Copy link
Contributor

bmtcril commented Feb 25, 2026

I think this is still good, and we're hoping to get a little more time to wrap some of these tasks up 🤞

Make decisions about:
- How the authz framework will interact with the Open edX ecosystem
- How the ecosystem will make authorization decisions
- How the policies used for access control will be managed and stored at the ecosystem level
* Changes addressing Ty's concerns
* Fixed factual mismatches:
* Request format: Fixed from 4-field sub, act, obj, scope to actual 3-field sub, act, scope, with explanation of how S-A-O-C maps to it
* Policy format: Fixed from p = sub, act, obj, eft to p = sub, act, scope, eft
* New section "Authorization Model Configuration": Documents the actual model.conf (request, policy, role definitions, namespace convention, matcher logic)
* New section "Scope and Subject Polymorphism": Documents the registry pattern with ContentLibraryScope, CourseScope, UserSubject
* API structure: Updated from generic "api.py" to the three actual modules (permissions, roles, users)
* Deployment form: Changed from vague "shared library, Django app, or Tutor plugin" to specific "Django app registered as LMS+CMS plugin via entry_points"
* PolicyCacheControl: Documented the UUID-based cache invalidation mechanism
* Custom matchers: Mentioned is_staff_or_superuser registration
* Legacy compatibility: New consequence documenting the legacy_*_role_permissions pattern
* Cross-reference added
@mariajgrimaldi mariajgrimaldi force-pushed the MJG/authz-architecture-and-data-modeling branch from a42fce0 to c0cb3c1 Compare March 6, 2026 17:29
- Correct static policy source: authz.policy file (not constants/)
  is what gets loaded into the DB via load_policies command
- Document dual representation: authz.policy for DB loading,
  constants/ for programmatic use in migration scripts and views
- Fix Casbin adapter URL to officialpycasbin/django-orm-adapter
- Note that both representations must be kept in sync (tech debt)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- State LMS as the primary service hosting the policy store,
  with rationale (existing IDA communication paths)
- Fix model.conf note: reference authz.policy for static policies,
  strengthen language to "breaking" for model changes
- Add Casbin domain/tenant filtering as future direction for
  cross-service policy isolation

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@mariajgrimaldi mariajgrimaldi requested a review from bmtcril March 6, 2026 18:30
Copy link
Contributor

@bmtcril bmtcril left a comment

Choose a reason for hiding this comment

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

LGTM 👍 👍

Copy link
Contributor

@rodmgwgu rodmgwgu left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@mariajgrimaldi mariajgrimaldi merged commit 57c2985 into main Mar 10, 2026
14 checks passed
@mariajgrimaldi mariajgrimaldi deleted the MJG/authz-architecture-and-data-modeling branch March 10, 2026 17:08
@github-project-automation github-project-automation bot moved this from Waiting on Author to Done in Contributions Mar 10, 2026
@github-project-automation github-project-automation bot moved this from Blocked to Done in RBAC AuthZ Board Mar 10, 2026
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

Archived in project
Status: Done

Development

Successfully merging this pull request may close these issues.

ADR: Open edX AuthZ Architecture

5 participants