[WEB-8401] fix(security): scope public Space asset mutations to the creator (GHSA-5q33-2766-fprm) - #9483
[WEB-8401] fix(security): scope public Space asset mutations to the creator (GHSA-5q33-2766-fprm)#9483mguptahub wants to merge 2 commits into
Conversation
…reator (GHSA-5q33-2766-fprm) The public Space asset endpoints (space/views/asset.py) require only IsAuthenticated and scoped assets to the deploy board's workspace/project but not to created_by=request.user. Any authenticated public-site user who knew the anchor and an asset UUID could delete/restore another user's asset, or rebind others' comment-description assets to a caller-controlled entity id. EntityAssetEndpoint.post already sets created_by=request.user, establishing the intended per-user boundary. Scope EntityAssetEndpoint.patch/delete, AssetRestoreEndpoint.post, and EntityBulkAssetEndpoint.post to created_by=request.user (404 when the asset isn't the caller's). Adds 4 contract tests (attacker delete/restore/rebind blocked, owner delete allowed); fail-before verified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesAsset mutation ownership scoping
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/api/plane/tests/contract/app/test_space_asset_mutation_scope_app.py`:
- Around line 81-129: Add a PATCH regression test to TestSpaceAssetMutationScope
using an attacker client and the asset mutation endpoint, asserting a 404
response and refreshing the asset to verify its persisted attributes remain
unchanged. Follow the existing delete, restore, and rebind tests, and use the
relevant PATCH URL/payload symbols already defined in the test module.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: af221064-40d1-42c1-bfdb-b76be700a897
📒 Files selected for processing (2)
apps/api/plane/space/views/asset.pyapps/api/plane/tests/contract/app/test_space_asset_mutation_scope_app.py
#9483) The suite covered delete/restore/rebind but not PATCH (also scoped to created_by=request.user). Add an attacker PATCH asserting 404 + unchanged attributes so the PATCH ownership filter can't silently regress. Fail-before verified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
The public Space asset delete, restore, bulk-rebind (and patch) endpoints (
apps/api/plane/space/views/asset.py) require onlyIsAuthenticatedand scope assets to the deploy board's workspace/project — but not tocreated_by=request.user. Any authenticated public-site user who knew the boardanchorand an asset UUID could delete or restore another user's asset, or rebind another user's comment-description assets to a caller-controlledentity_id.EntityAssetEndpoint.postalready creates assets withcreated_by=request.user, establishing the intended per-user boundary: a public-site user may mutate only assets they created.Fixes GHSA-5q33-2766-fprm (CWE-862/639). Confirmed vulnerable against
origin/preview@a8e53b6ac7.Fix
Scope every mutation to
created_by=request.user(404 when the asset isn't the caller's):EntityAssetEndpoint.patch/deleteAssetRestoreEndpoint.post(usesall_objectsto reach soft-deleted rows)EntityBulkAssetEndpoint.post(filter scoped, so foreign assets are excluded → 404)Tests
test_space_asset_mutation_scope_app.py— attacker (different authed user) cannot delete/restore/rebind the owner's asset (404, unchanged); owner can delete their own (204). Fail-before verified; ruff clean.🤖 Generated with Claude Code
Summary by CodeRabbit