Repository navigation
fix: knowledge document create permission scope error - #7860
Merged
peslyn merged 1 commit intoNov 12, 2026
Merged
Conversation
shaohuzhang1
commented
Nov 12, 2026
| scope=[PermissionScopeConstants.WORKSPACE, PermissionScopeConstants.WORKSPACE_RESOURCE], | ||
| ), | ||
| ) | ||
|
|
Contributor
Author
There was a problem hiding this comment.
Review result: the change itself looks like a likely bug fix, but it is security-sensitive and needs verification.
- The original
scope=[WORKSPACE, WORKSPACE]is suspicious: a duplicated scope is usually a copy/paste bug unless duplicates are intentionally allowed. - Changing the second value to
WORKSPACE_RESOURCEis probably correct ifscopeis positionally aligned withrole_list, i.e.:WORKSPACE_MANAGE→WORKSPACEUSER→WORKSPACE_RESOURCE
- If
scopeis not positional and is instead a set of accepted scopes, this change expands the accepted scope set and may unintentionally grant or change access. Confirm the authorization semantics. - Confirm
PermissionScopeConstants.WORKSPACE_RESOURCEexists and is compatible withResourcePermissionConst.KNOWLEDGE_MANAGE. - Check whether permission definitions are cached, persisted, or seeded. If so, invalidate/backfill caches or data after this change.
- Add/update tests for both roles:
WORKSPACE_MANAGEstill gets workspace-level access.USERgets resource-level access and cannot perform workspace-level operations.
- A robustness improvement is to avoid positional lists for role/scope mapping, or at least validate length/alignment:
This reduces the risk of future role/scope misalignment.
scope_by_role = { RoleConstants.WORKSPACE_MANAGE: PermissionScopeConstants.WORKSPACE, RoleConstants.USER: PermissionScopeConstants.WORKSPACE_RESOURCE, }
Overall: no syntax problem in the diff, and the duplicate-scope fix is reasonable, but verify the intended mapping and downstream authorization behavior before merging.
peslyn
deleted the
pr@v3@fix_knowledge_document_create_permission_scope_error
branch
November 12, 2026 06:19
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.
fix: knowledge document create permission scope error