fix(rbac): enforce access-control permissions - #40902
Open
WH-2099 wants to merge 8 commits into
Open
Conversation
WH-2099
requested review from
CodingOnStar,
GareArc,
QuantumGhost,
iamjoel and
laipz8200
as code owners
August 17, 2026 18:41
Contributor
Pyrefly Type Coverage
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-08-17 23:13:20.423509326 +0000
+++ /tmp/pyrefly_pr.txt 2026-08-17 23:13:06.721431022 +0000
@@ -795,21 +795,21 @@
ERROR Argument `list[str]` is not assignable to parameter `roles` with type `list[TenantAccountRole]` in function `services.account_service.TenantService.has_roles` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_account_service.py:1696:45
ERROR Object of class `NoneType` has no attribute `role` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_account_service.py:2052:16
+ --> tests/test_containers_integration_tests/services/test_account_service.py:2046:16
ERROR Object of class `NoneType` has no attribute `role` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_account_service.py:2108:16
+ --> tests/test_containers_integration_tests/services/test_account_service.py:2106:16
ERROR Object of class `NoneType` has no attribute `role` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_account_service.py:2109:16
+ --> tests/test_containers_integration_tests/services/test_account_service.py:2107:16
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_account_service.py:2255:16
+ --> tests/test_containers_integration_tests/services/test_account_service.py:2251:16
ERROR Argument `dict[str, str | dict[str, bool]]` is not assignable to parameter `value` with type `TenantCustomConfigDict` in function `models.account.Tenant.custom_config_dict` [bad-argument-type]
- --> tests/test_containers_integration_tests/services/test_account_service.py:2425:37
+ --> tests/test_containers_integration_tests/services/test_account_service.py:2421:37
ERROR TypedDict `TenantCustomConfigDict` does not have key `theme` [bad-typed-dict-key]
- --> tests/test_containers_integration_tests/services/test_account_service.py:2433:33
+ --> tests/test_containers_integration_tests/services/test_account_service.py:2429:33
ERROR TypedDict `TenantCustomConfigDict` does not have key `language` [bad-typed-dict-key]
- --> tests/test_containers_integration_tests/services/test_account_service.py:2434:33
+ --> tests/test_containers_integration_tests/services/test_account_service.py:2430:33
ERROR TypedDict `TenantCustomConfigDict` does not have key `feature_flags` [bad-typed-dict-key]
- --> tests/test_containers_integration_tests/services/test_account_service.py:2435:33
+ --> tests/test_containers_integration_tests/services/test_account_service.py:2431:33
ERROR Argument `dict[str, AppMode | str] | dict[str, str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_advanced_prompt_template_service.py:718:63
ERROR Argument `dict[str, AppMode | str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
@@ -3431,7 +3431,7 @@
ERROR Cannot set item in `OrderedDict[str, bool | list[str] | str]` [unsupported-operation]
--> tests/unit_tests/controllers/console/app/workflow_draft_variables_test.py:137:47
ERROR Argument `() -> Session` is not assignable to parameter `session_factory` with type `sessionmaker[@_]` in function `sqlalchemy.orm.scoping.scoped_session.__init__` [bad-argument-type]
- --> tests/unit_tests/controllers/console/auth/test_account_activation.py:23:36
+ --> tests/unit_tests/controllers/console/auth/test_account_activation.py:26:36
ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
--> tests/unit_tests/controllers/console/auth/test_forgot_password.py:29:9
ERROR `None` is not subscriptable [unsupported-operation]
@@ -3529,19 +3529,19 @@
ERROR Object of class `Flask` has no attribute `login_manager` [missing-attribute]
--> tests/unit_tests/controllers/console/test_workspace_members.py:18:5
ERROR `SimpleNamespace` is not assignable to attribute `_current_tenant` with type `Tenant | None` [bad-assignment]
- --> tests/unit_tests/controllers/console/test_workspace_members.py:65:43
+ --> tests/unit_tests/controllers/console/test_workspace_members.py:64:43
ERROR `SimpleNamespace` is not assignable to attribute `_current_tenant` with type `Tenant | None` [bad-assignment]
- --> tests/unit_tests/controllers/console/test_workspace_members.py:109:43
+ --> tests/unit_tests/controllers/console/test_workspace_members.py:108:43
ERROR `SimpleNamespace` is not assignable to attribute `_current_tenant` with type `Tenant | None` [bad-assignment]
- --> tests/unit_tests/controllers/console/test_workspace_members.py:143:43
+ --> tests/unit_tests/controllers/console/test_workspace_members.py:142:43
ERROR `SimpleNamespace` is not assignable to attribute `_current_tenant` with type `Tenant | None` [bad-assignment]
- --> tests/unit_tests/controllers/console/test_workspace_members.py:176:43
+ --> tests/unit_tests/controllers/console/test_workspace_members.py:175:43
ERROR Type `Response` is not iterable [not-iterable]
--> tests/unit_tests/controllers/console/test_wraps.py:190:17
ERROR Argument `Literal['app']` is not assignable to parameter `resource_type` with type `RBACResourceScope` in function `controllers.common.wraps._extract_resource_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/test_wraps.py:378:41
+ --> tests/unit_tests/controllers/console/test_wraps.py:398:41
ERROR Argument `Literal['app']` is not assignable to parameter `resource_type` with type `RBACResourceScope` in function `controllers.common.wraps._extract_resource_id` [bad-argument-type]
- --> tests/unit_tests/controllers/console/test_wraps.py:386:41
+ --> tests/unit_tests/controllers/console/test_wraps.py:406:41
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
--> tests/unit_tests/controllers/console/workspace/test_endpoint.py:185:47
ERROR Missing argument `plugin_id` in function `controllers.console.workspace.endpoint.EndpointListForPluginQuery.__init__` [missing-argument]
@@ -8578,6 +8578,28 @@
--> tests/unit_tests/services/enterprise/test_plugin_manager_service.py:59:25
ERROR Argument `None` is not assignable to parameter `response` with type `Response` in function `httpx._exceptions.HTTPStatusError.__init__` [bad-argument-type]
--> tests/unit_tests/services/enterprise/test_plugin_manager_service.py:60:26
+ERROR Argument `Literal['admin']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:36:79
+ERROR Argument `Literal['admin']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:37:83
+ERROR Argument `Literal['normal']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:38:79
+ERROR Argument `Literal['normal']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:39:84
+ERROR Argument `Literal['normal']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:55:81
+ERROR Argument `Literal['normal']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:56:81
+ERROR Argument `Literal['admin']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:829:83
+ERROR Argument `Literal['normal']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:830:83
+ERROR Argument `Literal['normal']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:1022:100
+ERROR Argument `Literal['normal']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:1051:100
+ERROR Argument `Literal['normal']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
+ --> tests/unit_tests/services/enterprise/test_rbac_service.py:1097:94
ERROR Cannot index into `list[Unknown]` [bad-index]
--> tests/unit_tests/services/hit_service.py:434:20
ERROR Cannot index into `object` [bad-index]
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #40902 +/- ##
==========================================
+ Coverage 86.76% 86.78% +0.02%
==========================================
Files 5205 5362 +157
Lines 292600 297007 +4407
Branches 58202 59346 +1144
==========================================
+ Hits 253881 257769 +3888
- Misses 33717 34224 +507
- Partials 5002 5014 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Screenshots
Not applicable.
Validation
Checklist
From Codex.