Skip to content

[WEB-8401] fix(security): scope public Space asset mutations to the creator - #9483

Merged
dheeru0198 merged 43 commits into
previewfrom
web-8401/space-asset-mutation-authz
Oct 26, 2026
Merged

dheeru0198 merged 43 commits into
previewfrom
web-8401/space-asset-mutation-authz

Conversation

@mguptahub

@mguptahub mguptahub commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The public Space asset delete, restore, bulk-rebind (and patch) endpoints (apps/api/plane/space/views/asset.py) require only IsAuthenticated and scope assets to the deploy board's workspace/project — but not to created_by=request.user. Any authenticated public-site user who knew the board anchor and an asset UUID could delete or restore another user's asset, or rebind another user's comment-description assets to a caller-controlled entity_id.

EntityAssetEndpoint.post already creates assets with created_by=request.user, establishing the intended per-user boundary: a public-site user may mutate only assets they created.

Fixes WEB-8401 (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 / delete
  • AssetRestoreEndpoint.post (uses all_objects to 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.
The bulk test binds to a valid comment owned by the caller on a board with comments enabled, so only asset ownership decides the result (204 without the fix, 404 with it; the other user's asset stays unbound). Merged with preview: the bulk endpoint keeps #10071's comment and COMMENT_DESCRIPTION checks, and GET keeps #10044. Related asset suites: 25 passed.

🤖 Generated with Claude Code

Related work items

Security scan findings addressed by this PR: INFRA-1178, INFRA-1179, INFRA-1212

Summary by CodeRabbit

  • Bug Fixes

    • Space asset editing, deletion, restoration, and bulk reassignment are now limited to assets created by the authenticated user.
    • Requests to modify an asset the requester cannot access now receive a not-found response, preventing unintended changes.
  • Tests

    • Added coverage for unauthorized asset operations returning not-found without changing asset data.
    • Confirmed asset owners can still delete their own assets.

…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) <[email protected]>
Copilot AI lite review requested due to automatic review settings July 27, 2026 06:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cce0ec31-4bde-4eb0-b854-cf55aa6a8c8a
📥 Commits

Reviewing files that changed from the base of the PR and between 6e6a369 and 0093b93.

📒 Files selected for processing: 2
  • apps/api/plane/space/views/asset.py
  • apps/api/plane/tests/contract/app/test_space_asset_mutation_scope_app.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📝 Walkthrough

Asset mutation endpoints now restrict patch, delete, restore, and bulk rebind operations to assets created by the requesting user. Contract tests verify unauthorized mutations return 404 without changing asset state and that an owner can delete their asset.

Changes: Asset mutation ownership scoping

Layer / File(s) Summary
Ownership-scoped asset endpoints
apps/api/plane/space/views/asset.py
Patch, delete, restore, and bulk rebind queries now filter by the authenticated user. Single-asset endpoints return 404 when no matching asset exists.
Ownership scope contract coverage
apps/api/plane/tests/contract/app/test_space_asset_mutation_scope_app.py
Contract tests verify that cross-user mutations return 404 without changing asset state, and that owners can delete their assets.

Priority: ⬆️ High

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 0093b

The ownership-scoping change is ready to merge after normal checks. Mixed bulk requests leave foreign assets unchanged while processing eligible assets.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 6e6a3

The change restricts who can modify an asset, and no new cross-user mutation path was established. Mixed-owner bulk requests can still report success after updating only part of the requested set, and the creator identity must remain intact for restoration to work.

Retained concerns

  • Low · reliability · observed: A mixed owned/foreign bulk request updates the caller-owned subset and returns 204 without indicating that other requested assets were excluded. This changes the externally visible result of a previously board-scoped bulk operation; whether partial success is the intended contract is unresolved.
Security review details

Security Blast Radius

  • inferred — The changed authorization checks are confined to the public Space asset API's board and creator-scoped database mutations. No changed cross-service dependency was established, but downstream and runtime topology coverage is limited.

Security Findings and Attack Paths

  • observed — Requests authenticated as a different user receive 404 without changing the tested asset deletion state, binding, or attributes. The available tests do not establish a new cross-user mutation route.

Trust Boundaries and Controls

  • observed — For the changed mutations, board workspace/project and request-user creator filters precede writes; restore preserves that control while accessing soft-deleted rows through all_objects.

Resilience and Maintainability Implications

  • inferred — Repeated or overlapping delete, restore, patch, and rebind operations have no explicit concurrency control in these handlers. Their production recovery behavior, including preservation of creator identity, remains unverified.

Hardening Proposals

  • proposed — Define whether mixed-owner bulk requests should be rejected or explicitly reported as partial success, and exercise that contract alongside owner delete-to-restore recovery under production-equivalent identity handling.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains the security issue, affected endpoints, fix, tests, and related work items. It does not use the template headings or mark a Type of Change checkbox, but it contains th…
Title check Passed The title clearly identifies the security fix and the affected public Space asset mutations. It is concise and directly related to the main change.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the security issue, affected endpoints, fix, tests, and related work items. It does not use the template headings or mark a Type of Change checkbox, but it contains the required information in equivalent sections.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
- [ ] Create stacked PR - [ ] Commit on current branch
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between a8e53b6 and ddefe76.

📒 Files selected for processing (2)
  • apps/api/plane/space/views/asset.py
  • apps/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) <[email protected]>
Copilot AI review requested due to automatic review settings July 27, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mguptahub mguptahub changed the title [WEB-8401] fix(security): scope public Space asset mutations to the creator (GHSA-5q33-2766-fprm) [WEB-8401] fix(security): scope public Space asset mutations to the creator Aug 7, 2026
Explanations kept; only the IDs and the restated reasoning are removed.

Co-authored-by: Plane AI <[email protected]>
Copilot AI review requested due to automatic review settings August 7, 2026 10:31
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

React Doctor skipped this pull request — it changed no React files.

Reviewed by React Doctor for commit 4e3dc6a.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

apps/api/plane/space/views/asset.py:243

  • EntityBulkAssetEndpoint.post now scopes the queryset to created_by=request.user, but it will still return 204 and update only the owned subset if the request contains a mix of owned + non-owned asset_ids. That means the endpoint can partially apply a bulk rebind while silently ignoring foreign IDs, which contradicts the PR description’s stated 404 behavior when an asset isn’t the caller’s.

Consider enforcing that all provided asset_ids resolve under the scoped filter (after de-duplication), otherwise return 404.

        # A public-site user may only rebind assets they created.
        assets = FileAsset.objects.filter(
            id__in=asset_ids,
            workspace=deploy_board.workspace,
            project_id=deploy_board.project_id,

dheeru0198 and others added 9 commits October 17, 2026 16:04
* [INFRA-1114] fix(security): keep magic-code regeneration cap after verify exhaustion

Burn the code instead of deleting the Redis record when the verify
attempts run out, so the per-email regeneration count still applies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1114] fix(security): track issued magic codes in an atomic counter

Cap codes issued per email with a dedicated `magic_<email>:issued`
counter, incremented atomically in initiate() (INCR + first-time
EXPIRE). The window is a fixed 600s from the first code and is not
extended by later requests; the limit stays at 4 codes per window.

The cap no longer depends on the token record, so verify exhaustion
goes back to deleting the token and its verify counter. A successful
sign-in clears the issued counter. current_attempt is dropped from
the stored value.

Tests reset the issued counter wherever magic-link state is cleared.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1114] fix(security): address review

Count each magic-code verify attempt atomically before comparing the code,
so no more than MAX_VERIFY_ATTEMPTS comparisons are made per token.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1114] fix(security): address review feedback

- Keep current_attempt: 0 in the magic-code token record so pods on the
  previous release can still read it during a rolling deploy.
- Assert that later code requests do not extend the TTL of the issued-code
  counter, so the issue window stays fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…10041)

* [INFRA-1132] fix(security): cap invitation role updates at the requester's role

WorkspaceInvitationsViewset.partial_update was served by the generic mixin, which
skipped the role cap create() enforces. It now accepts only {"role"} and rejects a
role above the requester's own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1132] test: address review

Reword the invitation update test docstring and one test name as a neutral
statement of the role cap rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…space (#10042)

* [INFRA-1138] fix(security): require workspace admin to PUT/PATCH the workspace

WorkSpaceBasePermission allowed the Member role for PUT/PATCH, so PUT reached the
undecorated update() action. It now requires Admin, matching partial_update; the
unused duplicate in plane.utils.permissions gets the same change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1138] fix: address review

Make deleted_at read-only in WorkSpaceSerializer so an update cannot set it,
and reword the test module docstring as a neutral statement of the rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…0044)

* [INFRA-1159] fix(security): serve assets inline only for the stored safe image type

S3Storage.generate_presigned_url now honours inline only when the stored object's
Content-Type is an allow-listed image and pins it via ResponseContentType; anything
else downloads. Callers pass storage_metadata instead of client-editable attributes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1159] fix: address review

Decide inline disposition from the asset's claimed type instead of storage_metadata;
S3Storage pins that allow-listed image type as the response Content-Type.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1159] fix(security): address review feedback

- Pass the asset name as the filename from the static and Spaces asset
  endpoints, so a download keeps its name and extension.
- Add disposition tests for the Spaces EntityAssetEndpoint and the v1
  GenericAssetEndpoint (png inline, svg attachment), and assert the
  filename on the static endpoint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1159] fix(security): address review feedback

- S3Storage uses the asset name as the download filename only when it
  is a non-empty string (otherwise a random name), and treats a
  non-string type as missing (attachment), so non-string attributes
  no longer fail the presigned URL
- Test: static asset with a numeric name or type still redirects

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…0043)

* [INFRA-1157] fix(security): bound password input scored by zxcvbn

Add is_password_strong() helper that scores only the first 128 characters,
and route every zxcvbn caller (sign-up, password set/change/reset, instance
admin sign-up, reset_password command) through it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1157] fix: address review

Score the first and the last ZXCVBN_MAX_LENGTH characters and accept the password
if either window is strong; add a unit test that only the password helper imports zxcvbn.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…points (#10045)

* [INFRA-1115] fix(security): enforce guest page visibility in ProjectPagePermission

Apply the guest_view_all_features rule centrally so page description and
version endpoints follow it, not just PageViewSet.retrieve.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1115] test: address review

Reword the guest page access test module docstring as a neutral statement of
the guest_view_all_features rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1115] fix(security): address review feedback

- Cover page retrieve in the guest own-page and guest_view_all_features
  positive cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…cts (#10046)

* [INFRA-1128] fix(security): scope workspace analytics to member projects

Workspace, default, saved-view analytics and the analytics CSV export now only
aggregate work items from projects the caller is an active member of; saved
views are also scoped to the URL's workspace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1128] fix: address review

Also require project_projectmember__deleted_at__isnull=True in the analytics
membership filters, since related joins skip the soft-delete manager.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…drafts (#10047)

* [INFRA-1125] fix(security): require project membership for workspace drafts

Draft create/update and draft-to-issue conversion now require an active
ADMIN/MEMBER role in the draft's project within the URL workspace, matching
IssueViewSet.create. The draft serializer's project field is read-only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1125] fix(security): address review

Draft updates also require write access to the draft's own project, and a
draft's cycle_id/module_ids must belong to the draft's project (400 otherwise).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1125] fix(security): address review

Validate the convert cycle_id and module_ids against the draft's project before creating anything.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1125] fix(security): address review feedback

- Validate state, labels, assignees, parent and estimate point in a draft
  PATCH against the draft's own project instead of the supplied project_id.
  The access check on the supplied project_id is unchanged.
- Test: a writer of two projects cannot set a state from the other project.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1125] fix(security): address review feedback

- can_write_project also accepts a workspace ADMIN who is an active
  member of the project at any role, matching allow_permission
- Tests: workspace admin who is a project guest can create, update and
  convert a draft; a workspace admin outside the project cannot

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…10048)

* [INFRA-1118] fix(security): make deleted_at read-only on work item serializers

Add deleted_at to read_only_fields on the v1 IssueSerializer and the app
IssueCreateSerializer, so PATCH cannot set it; deletion stays on DELETE.
Also covers INFRA-1202.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1118] fix(security): address review

Make archived_at and sequence_id read-only on the v1 and app work item
serializers; archive/unarchive keep their dedicated endpoints.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1118] fix(security): address review feedback

- Leave the serializer's read-only fields out of the data passed to
  issue_activity and model_activity on work item PATCH (app and v1), so an
  ignored field such as archived_at no longer records activity or sends
  notifications and webhooks.
- Tests assert the ignored field is absent from both payloads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1118] fix(security): address review feedback

- is_draft is read-only when updating a work item through the app
  IssueCreateSerializer and the v1 IssueSerializer; create is unchanged
- Intake updates (app and v1) and the v1 external-id upsert send only
  the writable fields to issue/model activity, via a shared
  writable_data helper also used by the existing work item updates
- Tests: is_draft on work item PATCH (app and v1), intake updates with
  archived_at record no archive activity (app and v1)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
dheeru0198 and others added 15 commits October 18, 2026 15:49
…ator access (#10058)

allow_permission(creator=True) on project routes now requires the caller to be an
active member of the URL project before the creator shortcut applies. The unused
duplicate in plane/utils/permissions is kept identical.

Co-authored-by: Claude Opus 5.5 <[email protected]>
…10059)

* [INFRA-1189] fix(security): throttle auth endpoints for every caller

AuthenticationThrottle now keys on the client IP for anonymous and signed-in callers.
Apply it to instance-admin sign-in/sign-up and email-change code endpoints, and
invalidate an email-change code after 5 wrong attempts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1205] fix(security): cap email-change codes per target address

Limit email-change verification codes to 5 per hour per target address across all accounts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1189] fix(security): address review feedback

- Email-change verify: count the attempt before comparing the code, and
  reject once the attempt budget is used up, so concurrent requests share
  one budget.
- Add AuthenticationThrottle to ChangePasswordEndpoint.
- Tests for both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1189] fix(security): address review feedback

- Email-change verify counts the attempt before reading the stored code (same
  order as MagicCodeProvider), so a code invalidated by a concurrent request is
  never compared. Code and counter are still deleted together at the cap.
- Test: a code deleted after the attempt is counted is not accepted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Sriram Veeraghanta <[email protected]>
#10060)

* [INFRA-1194] fix(security): scope activity-task lookups to the issue's project/workspace

issue_activity resolved request-supplied ids (related issues, labels, assignees,
parent, estimate points, cycles, modules) without scope; they are now limited to
the activity's project (workspace for relations and assignees) and skipped otherwise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1194] fix(security): address review

Scope relation activity to the activity's own issue, pass only related ids from the views, and require project membership for added assignees.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1194] fix(security): address review feedback

- Add tests: an estimate point from another project is skipped and one
  from the issue's project is recorded; unassigning a deactivated member
  is recorded; deleting a relation to another project in the same
  workspace is recorded on both issues.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
… task (#10062)

Guests on projects without guest_view_all_features now export only the
issues they created; membership join also excludes soft-deleted members.

Co-authored-by: Claude Opus 5.5 <[email protected]>
…tes (#10064)

* [INFRA-1116] fix(security): restrict user-scoped FKs on users/me updates

Notification preference user/workspace/project fields are now read-only.
User avatar_asset/cover_image_asset accept only the user's own asset of the
matching entity type, and replacing an avatar/cover deletes only the user's own asset.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1116] fix(security): address review

Use matching entity types for the foreign-asset test so it checks ownership alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1116] fix(security): address review feedback

- Clear the avatar link in delete_old_avatar when the linked asset is not the user's own, leaving the asset untouched
- Add a test for the login avatar sync with storage mocked

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…elds (#10063)

* [INFRA-1208] fix(security): limit public comment writes to content fields

Public board comment create and edit now pass only comment_html and
comment_json to the serializer; actor, access, issue and parent stay
server-controlled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1208] fix(security): address review

Limit app comment updates to content and access fields, including the activity payloads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1208] fix(security): address review feedback

- Comment update activity: record a change only when comment_html is in
  the payload and differs.
- Space comment PATCH: capture current_instance before saving.
- App comment create: apply the same writable-field allowlist as
  partial_update (hoisted to COMMENT_WRITABLE_FIELDS) and pass the
  filtered data to model_activity.
- Tests for all three.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Sriram Veeraghanta <[email protected]>
…0065)

* [INFRA-1174] fix(security): scope project stats and grouping keys

Project stats follow the project list visibility rules, the advance analytics overview
counts members only of the caller's projects in the workspace, and workspace-level issue
grouping builds project/state/cycle/module/label keys from the caller's projects.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1174] fix(security): address review feedback

- issue_group_values raises ValueError when called with neither project_id nor user
- Add a unit test for it

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1174] fix(security): address review feedback

- Public board grouping (space issue_group_values) takes project, state, label,
  cycle and module keys only from the board's project.
- Test: public issues endpoint grouped by project/state/cycle returns only keys
  from the board's project.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…n see (#10066)

* [INFRA-1163] fix(security): scope favorites to entities the caller can see

Favorite creation now requires the entity to be in the URL workspace/project and
visible to the caller; entity_data resolves under the same rule (get_favorite_entities).
Covers INFRA-1163, INFRA-1170, INFRA-1172, INFRA-1185, INFRA-1186.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1163] fix(security): address review

Resolve workspace view favorites via workspace membership and report the favorite's project for multi-project pages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1163] fix(security): address review feedback

- Favorite PATCH only accepts name, sequence and parent, so the favorited entity can't be changed after creation
- Add a test that PATCHing entity_type/entity_identifier leaves the row unchanged while sequence still updates

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…10067)

* [INFRA-1166] fix(security): apply guest_view_all_features in search

Search issue, page, view and intake queries now apply the guest rule per
result project, inside the caller's membership join, matching the list views.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1166] fix(security): address review

Keep private pages owner-only in global search, matching the page list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1166] fix(security): address review

Keep private project views owner-only in global search, as the view list does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…10068)

* [INFRA-1149] fix(security): apply entity role rules to asset changes

Confirm, update and delete on the generic asset routes now follow the rule of
the asset's entity: workspace admin for the logo, project admin for the cover,
project admin or uploader for attachments, member or uploader otherwise (INFRA-1149, INFRA-1197).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1149] fix(security): address review

Rename asset role tests after the permission rule each one covers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1149] fix(security): address review feedback

- Asset restore applies the same role rule as update/delete (can_modify_asset)
- Add a test: a project guest can't restore another user's deleted attachment, the uploader can
- Tests assign the response before asserting on its status instead of making requests inside assert

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1149] fix(security): address review feedback

- The legacy asset delete and restore routes (by asset path) apply
  can_modify_asset, like the v2 routes.
- can_modify_asset: the uploader shortcut requires an active role in the
  asset's project, if it has one.
- Tests: legacy delete/restore follow the role rules; an uploader with an
  inactive project membership cannot delete or restore.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…10069)

* [INFRA-1158] fix(security): require a non-empty matching OAuth state

Add validate_oauth_state, which pops the session state and accepts the
callback only when both values are non-empty and match (constant time).
Use it in all eight app and space OAuth callbacks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1158] fix(security): address review

Fall back to the app base host in the Gitea callback when the session has no host.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1158] fix(security): address review feedback

- validate_oauth_state compares first and removes the stored state only on a match, so a mismatched callback no longer drops a pending login's state
- Test: a mismatched callback followed by the matching one logs in
- Add the app GitLab and Google callbacks to the state test matrix
- Compare the parsed scheme and host in the app-host redirect test

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
… app (#10070)

* [INFRA-1180] fix(security): bring v1 API permissions in line with the app

v1 cycle delete is limited to project admins or the cycle creator, and a cycle
update without owned_by keeps the current owner. v1 label writes require
project admin. v1 project-member add requires an active workspace membership.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1180] fix(security): address review

Check the target's active workspace membership on every member PATCH, and keep an explicit null cycle owner assigning the requester.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1180] fix(security): address review feedback

- ProjectAdminPermission (both copies) now also admits a workspace admin
  who is a project member at any role, matching allow_permission.
- v1 cycle delete reuses ProjectAdminPermission for its admin check.
- Tests: a workspace admin with project role member can create labels and
  delete cycles; one outside the project cannot create labels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…nts (#10071)

* [INFRA-1146] fix(security): scope public Space asset uploads to comment images

Public asset uploads now require comments enabled on the board, accept only
COMMENT_DESCRIPTION, and bind only to the caller's own EXTERNAL comment on it.
The bulk endpoint binds only the caller's own comment images to such a comment (INFRA-1144).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1146] fix(security): address review

Treat an empty comment id on upload as unbound and refuse bulk binding when board comments are disabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
#10072)

* [INFRA-1165] fix(security): reset role when rejoining a public project

Self-joining a public project reactivated an inactive ProjectMember row with
its previous role. Reactivation now sets the workspace role a new joiner gets,
and only touches inactive rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1165] fix(security): address review feedback

- Rejoin reactivation now also sets updated_by and updated_at, since
  .update() skips the model's save() hooks.
- Test asserts updated_by on the reactivated membership.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…ted writes (#10073)

BaseSessionAuthentication.enforce_csrf now refuses unsafe requests whose Origin
is not the request's own host, a configured base URL, or a CORS/CSRF trusted origin.
Requests without an Origin header (non-browser clients) and safe methods are unaffected.

Co-authored-by: Claude Opus 5.5 <[email protected]>

@dheeru0198 dheeru0198 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review against current preview (6c16585)

A few changes suggested. The patch, delete and restore scoping is still needed on preview.

  1. major apps/api/plane/space/views/asset.py:268: The bulk update doesn't constrain which asset types can be attached to a given comment. Preview already validates the destination comment and limits updates to caller-owned COMMENT_DESCRIPTION assets (#10071). Preserve those checks when resolving the overlap; #10044 also touches this file's GET path.
  2. minor apps/api/plane/tests/contract/app/test_space_asset_mutation_scope_app.py:106: The bulk test uses a nonexistent comment ID, so against preview it returns 404 before asset ownership is checked. Suggest using a valid caller-owned comment on the board and asserting the other asset is unchanged.
  3. minor apps/api/plane/tests/contract/app/test_space_asset_mutation_scope_app.py:5, asset.py:164: Suggest rewording the module docstring and comment to state the ownership rule rather than describing the prior gap.

Notes from an automated review (Claude Code + Codex), checked against current preview.

dheeru0198 and others added 5 commits October 21, 2026 20:38
…10061)

* [INFRA-1195] fix(security): verify Redis TLS certificates by default

rediss:// connections (redis_instance and the django-redis cache) now verify the
server certificate and hostname. REDIS_SSL_CA_CERTS sets a custom CA bundle and
REDIS_SSL_CERT_REQS=none turns verification off. Also covers INFRA-1210.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1195] fix(security): address review

Honour ssl_cert_reqs from REDIS_URL when deciding hostname checks, and document mounting a custom CA bundle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1195] fix(security): address review feedback

- AIO: document REDIS_SSL_CERT_REQS and REDIS_SSL_CA_CERTS in
  variables.env and the README, including a -v mount for the CA bundle.
- AIO start.sh: pass both through from the container environment, so
  -e values are not replaced by the plane.env defaults.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1195] fix(security): address review feedback

- REDIS_SSL_CERT_REQS=optional keeps hostname checking on; only none turns it off.
- Tests: mapping for optional expects ssl_check_hostname=True, and a connection
  built with optional has check_hostname=True.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…nstall (#10074)

* [INFRA-1160] fix(security): generate object-storage credentials per install

install.sh/swarm.sh generate random MinIO credentials on install and replace the
template placeholders on upgrade; the CLI compose no longer falls back to them.
setup.sh generates the pair for source builds, and settings drop the fallback and
log a critical warning when MinIO runs with the placeholder pair.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1160] fix(security): address review feedback

- The API warns when AWS_SECRET_ACCESS_KEY is the template value,
  whatever the access key is.
- install.sh and swarm.sh rotate whenever the secret is the template value
  (or empty), and ignore quotes from older templates when comparing.
- docker-compose.yml keeps the access-key/secret-key fallbacks for MinIO and
  the API, so installs upgraded with an older setup.sh, or with blank keys,
  still start; the API warning covers them.
- README: download the latest setup.sh before upgrading.
- Test: custom access key with the template secret logs the warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1160] fix(security): address review feedback

- Reword the comment above the storage credential warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…ate limits (#10075)

* [INFRA-1189] chore(security): make proxy hop count configurable for rate limits

Add an optional NUM_PROXIES setting and pass TRUSTED_PROXIES/NUM_PROXIES
through the CLI compose. Defaults are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* [INFRA-1189] fix(security): address review feedback

- NUM_PROXIES accepts at most 3 digits, so an oversized value is ignored
  with a warning instead of failing settings load.
- variables.env ships NUM_PROXIES= uncommented, so an upgrade keeps an
  operator's value; an empty value is still treated as unset.
- README: "leaving NUM_PROXIES empty" matches the shipped template.
- Test: a 5000-digit value keeps DRF's default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
- Bulk test binds to a valid EXTERNAL comment owned by the caller on a board
  with comments enabled, so the result depends only on asset ownership, and
  checks the other user's asset stays unbound.
- Reword the asset ownership comment, test module docstring and test names to
  state the ownership rule.

@dheeru0198 dheeru0198 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving: review points addressed and re-verified; CI green.

@dheeru0198
dheeru0198 merged commit a42b536 into preview Oct 26, 2026
16 checks passed
@dheeru0198
dheeru0198 deleted the web-8401/space-asset-mutation-authz branch October 26, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants