fix: prevent cross-org ObjectTags from being created#633
Merged
pomegranited merged 3 commits intojill/tagging-less-queriesfrom Feb 15, 2024
Merged
fix: prevent cross-org ObjectTags from being created#633pomegranited merged 3 commits intojill/tagging-less-queriesfrom
pomegranited merged 3 commits intojill/tagging-less-queriesfrom
Conversation
A "cross-org" ObjectTag is when the object_id references an org that is not in the taxonomy's allowed list of orgs. Similarly, we forbid creating object tags for a taxonomy with no allowed orgs listed. This change adds a rules check for this case, and updates the tests.
yusuf-musleh
approved these changes
Feb 14, 2024
yusuf-musleh
left a comment
There was a problem hiding this comment.
👍 Looks good to me @pomegranited ! I just had similar question regarding the assert.
- I tested this: I checked the updated tests and confirmed they are passing
- I read through the code
-
I checked for accessibility issues - Includes documentation
-
I made sure any change in configuration variables is reflected in the corresponding client'sconfiguration-securerepository.
| if not is_all_org: | ||
| # object_id is valid, else it would have thrown in can_change_object_tag_objectid | ||
| context_key = get_context_key_from_key_string(perm_obj.object_id) | ||
| assert context_key.org |
There was a problem hiding this comment.
Similar to the question I had on openedx#34200 (comment) , if we should handle the AssertionError and return False or does the @rules.predicate or elsewhere handle it?
Author
There was a problem hiding this comment.
Agreed, I'll handle it and return False.
bradenmacdonald
approved these changes
Feb 15, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses this comment openedx#34146 (comment) about disallowing cross-org tagging and tagging using "no org" taxonomies.
Testing instructions
These changes should be validated by the unit tests.