Repository navigation
fix: Restrict subscription PUT/DELETE to owner/admin (BOLA) (#182) - #206
Closed
AndriiPasternak31 wants to merge 2 commits into
Closed
AndriiPasternak31 wants to merge 2 commits into
AndriiPasternak31 wants to merge 2 commits into
Conversation
…ityai#182) Pentest finding 3.2.5 (CVSS 4.8): PUT/DELETE /api/subscriptions/agents/{name} used can_user_access_agent (allows shared users) instead of can_user_share_agent (owner/admin only). Shared users could hot-swap or clear agent credentials. - Replace can_user_access_agent with can_user_share_agent at lines 184, 246 - Add unit tests with mocked non-admin user verifying 403 on both endpoints Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update code snippet in subscription-management.md to reflect the can_user_share_agent fix from issue Abilityai#182. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Closing as duplicate — the fix was already merged to main via commits a2c4012 and 46bc23a. Issue #182 is closed. The unit tests in this PR (test_subscription_auth.py) are valuable and not present in the existing merge — consider submitting them as a separate PR if test coverage for this fix is desired. Also, the CSO audit note about |
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
PUT/DELETE /api/subscriptions/agents/{name}usedcan_user_access_agent(owners + shared users + admins) instead ofcan_user_share_agent(owners + admins only)can_user_access_agent→can_user_share_agenton lines 184 and 246 ofsubscriptions.pyChanges
src/backend/routers/subscriptions.py— 2-line predicate swap + comment updatestests/unit/test_subscription_auth.py— New unit tests with mocked non-admin user verifying 403 on both PUT and DELETEdocs/memory/changelog.md— Changelog entryTest Plan
cd tests/unit && python3 -m pytest test_subscription_auth.py -v(4/4 passed)cd tests && python -m pytest test_subscriptions.py -vCSO Audit Notes
Full authorization predicate audit across all routers found 1 additional variant:
agent_ssh.py:56— SSH credential generation also usescan_user_access_agent(separate issue recommended)Closes #182
Generated with Claude Code