Skip to content

[INFRA-778] fix(security): scope ExportIssuesEndpoint.get to the requesting user's own exports - #9707

Merged
dheeru0198 merged 43 commits into
previewfrom
infra-778/export-history-scope-to-initiator
Oct 26, 2026
Merged

dheeru0198 merged 43 commits into
previewfrom
infra-778/export-history-scope-to-initiator

Conversation

@mguptahub

@mguptahub mguptahub commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • ExportIssuesEndpoint.get filtered ExporterHistory by workspace__slug only, with no initiated_by filter — any workspace ADMIN/MEMBER could list every other member's export history.
  • ExporterHistorySerializer includes url (a presigned S3 download link, 7-day expiry, no authentication required to use) and token.
  • Since an export defaults to the initiator's own projects (including fully private ones) when no project list is supplied in the create request, any workspace member could read another member's private project data simply by listing exports and using the disclosed url — no crafted request needed, and revoking the original user's access doesn't revoke the download.
  • Fix: add initiated_by=request.user to the queryset filter, per the advisory's own suggested fix.
  • Out of scope (advisory's own "worth considering" hardening, not required to close the reported vulnerability): dropping url/token from the serializer in favor of an authenticated per-request redirect endpoint, and shortening the 7-day presigned-URL expiry.

Test plan

  • New tests in apps/api/plane/tests/contract/app/test_export_history_scope.py: a workspace member (and, separately, the admin) lists only their own export, including its url, and not the other user's
  • Verified fail-before/pass-after via git stash — the cross-member-visibility test fails against pre-fix code
  • ruff check / ruff format --check clean
  • After merging current preview (keeps the [INFRA-1156] fix(security): sanitize export history order_by #10054 order_by allowlist): both tests fail without the initiated_by filter and pass with it; test_export_order_by_allowlist_app.py, test_export_task_guest_scope.py and test_xlsx_export_sanitization.py pass (32 total)

Related work items

Security scan findings addressed by this PR: INFRA-1151, INFRA-1187

Summary by CodeRabbit

  • Bug Fixes

    • Export history is now limited to exports initiated by the signed-in member.
    • Members can no longer view or access download links for exports created by others.
    • Export initiators retain access to their own export records and download links.
  • Tests

    • Added coverage to verify export-history access controls.

…esting user's own exports

ExportIssuesEndpoint.get filtered ExporterHistory by workspace__slug only,
with no initiated_by filter, so any workspace ADMIN/MEMBER could list
every other member's export history. ExporterHistorySerializer includes
url (a presigned S3 link, 7-day expiry, no auth required to use) and
token. Since an export defaults to the initiator's own projects
(including fully private ones) when no project list is supplied, any
workspace member could read another member's private project data by
listing exports and using the disclosed url — no crafted request needed,
and revoking the user's access doesn't revoke the download.

Add initiated_by=request.user to the queryset filter, per the advisory's
own suggested fix. 2 new tests, fail-before verified.

Co-authored-by: Plane AI <[email protected]>
Copilot AI lite review requested due to automatic review settings August 28, 2026 09:58
@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9b7e5b88-6e79-4208-bba9-d5202d255d7b
Commits

Reviewing files that changed from the base of the PR and between 7737bb6 and 2565e07.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 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: 82267314-0248-4b99-9b70-1ee616423bd7
📥 Commits

Reviewing files that changed from the base of the PR and between 18ea994 and 2423501.

📒 Files selected for processing: 2
  • apps/api/plane/app/views/exporter/base.py
  • apps/api/plane/tests/contract/app/test_export_history_scope.py

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

Walkthrough

The export history endpoint now returns only issue exports initiated by the requesting user. Contract tests cover member and admin access, export ownership, and presigned URLs.

Changes: Export history access scoping

Layer / File(s) Summary
Apply initiator filtering
apps/api/plane/app/views/exporter/base.py
The export history query now filters records by initiated_by=request.user.
Verify cross-member access
apps/api/plane/tests/contract/app/test_export_history_scope.py
Contract tests verify that members and admins receive only their own export records and URLs.

Priority: Normal

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

Change: Bug fix

Merge Risk: Minimal · up to 24235

No merge-blocking issue is identified for the export-history scoping change; normal checks remain appropriate.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 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
Title check Passed The title clearly identifies the security fix: it scopes export history to the requesting user.
Description check Passed The description explains the vulnerability, the fix, and the test coverage. It includes test scenarios and related work items, so the missing template headings for Type of Change and Screenshots do no…
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 explains the vulnerability, the fix, and the test coverage. It includes test scenarios and related work items, so the missing template headings for Type of Change and Screenshots do not make it incomplete.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
- [ ] Create stacked PR - [ ] Commit on current branch
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@mguptahub

Copy link
Copy Markdown
Contributor Author

/code-review: clean, no findings. Confirmed this is the only route serving ExporterHistory data (no parallel endpoint reintroduces the leak) and the test correctly exercises both negative and positive cases.

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

Scopes ExportIssuesEndpoint.get export-history listing to the requesting user to prevent cross-member disclosure of export metadata (including presigned download URLs/tokens), and adds contract-level regression coverage to ensure the vulnerability stays closed.

Changes:

  • Restrict ExporterHistory GET queryset by initiated_by=request.user in ExportIssuesEndpoint.get.
  • Add contract regression tests verifying a member cannot see another member’s export history, while still being able to see their own.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/api/plane/app/views/exporter/base.py Adds initiated_by=request.user to the export-history queryset to prevent cross-member exposure.
apps/api/plane/tests/contract/app/test_export_history_scope.py New contract regression tests covering cross-member visibility and positive control for own exports.
Suppressed comments (2)

apps/api/plane/tests/contract/app/test_export_history_scope.py:77

  • Use status.HTTP_200_OK instead of the literal 200 to match the established pattern in other contract tests and make the assertion self-explanatory.
        assert response.status_code == 200, response.data

apps/api/plane/tests/contract/app/test_export_history_scope.py:85

  • Use status.HTTP_200_OK instead of the literal 200 to match the established pattern in other contract tests and make the assertion self-explanatory.
        assert response.status_code == 200, response.data

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Address Copilot finding on PR #9707: this repo's contract tests
consistently assert HTTP codes via rest_framework.status constants.

Co-authored-by: Plane AI <[email protected]>
@mguptahub

Copy link
Copy Markdown
Contributor Author

Re the /code-review finding on reusing session_client/create_bot_user instead of local _make_user/_client_for helpers: checked before acting on it. Neither fixture actually fits this test's need — session_client is force_authenticate-tied to the single create_user fixture (can't produce a second, distinct authenticated user), and create_bot_user creates a bot-flagged user, not a regular member. The local _make_user/_client_for pattern here matches the existing precedent already in test_project_member_is_active_authz.py (pre-existing file, not from this PR), which has the identical local _make_user helper for the same reason.

Leaving as-is rather than introducing a new shared fixture unrequested — that would be a conftest.py change affecting other test files, better done as its own deliberate cleanup than folded into this security fix. Noting it as a legitimate future refactor candidate, not fixing reactively here.

mguptahub and others added 17 commits October 12, 2026 16:53
* [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]>
…ints (#10049)

* [INFRA-1139] fix(security): scope user-profile stats and issues endpoints

Require workspace membership on user-stats and limit its cycle lists to the
requester's projects. Apply the guest created_by restriction to user-issues.

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

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

Apply the project-guest visibility rule to every user-profile stats query
(counts and cycles) through one helper, and exclude deleted project members.

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

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

- Apply the project guest rule (_visible_issues_q) to the profile
  user-activity list and its CSV export, so project guests without
  guest_view_all_features see activity only on issues they created.
- Tests for the activity list and export: restricted guest, guest with
  guest_view_all_features, and project admin.

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

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

- User stats: cycle rows are reported only when the cycle is in the
  issue's project, so the caller's active membership check applies to
  the cycle's project too
- User profile: per-project issue counts follow the caller's project
  role (restricted guests count only issues they created)
- Tests: cycle from a different project than its issue is hidden;
  per-project counts for a workspace member who is a guest in a
  restricted project and a member in another

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

---------

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

* [INFRA-1140] fix(security): bind URL issue_id to the URL project on creates

App link, attachment (legacy + V2), reaction, subscriber and comment-reaction creates,
and v1 work item link + relation creates, now 404 unless the URL issue (or comment)
belongs to the URL workspace + project. Adds contract tests for each endpoint.

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

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

Require added subscribers to be active project members; neutral comments.

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

---------

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

* [INFRA-1145] fix(security): bind issue history and comment list to the URL project

Issue history now 404s unless issue_id belongs to the URL workspace + project.
The comment list queryset also requires the comment's issue to be in the URL project.

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

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

- Bind the comment partial_update and destroy lookups to an issue in the
  URL project (issue__project_id), matching the comment list.
- Test PATCH and DELETE of a comment keyed to an issue outside the URL
  project (404, comment kept), plus a PATCH positive control.

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

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

- Comment list returns 404 when the issue is not in the URL workspace/project,
  matching the history endpoint (reuses issue_in_project).
- Test expects 404 for the comment list of an issue outside the URL project.

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

---------

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

* [INFRA-1153] fix(security): strip email style blocks in linear time

Replace the non-greedy <style> regex in generate_plain_text_from_html with a
single forward scan that gives the same result and stops once no block can close.

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

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

Reword the style-removal docstring and rename its timing test.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…an allowlist (#10054)

ExportIssuesEndpoint.get now runs order_by through sanitize_order_by with a new
EXPORTER_HISTORY_ORDER_BY_ALLOWLIST (created_at, updated_at); other values fall
back to -created_at.

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

* [INFRA-1164] fix(security): restrict project member updates to admins

Project member PATCH now requires a project admin (or workspace admin in the project).
deleted_at, created_by and updated_by are read-only on ProjectMemberSerializer.

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

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

Rename the guest membership test and give it a neutral docstring.

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

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

- Add a test that a workspace admin who is not a project member gets 403
  when editing a project membership row, and the role is unchanged.

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

---------

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

* [INFRA-1169] fix(security): bind module and cycle ids to the URL project

create_module_issues, create_issue_modules and module-link create now 404 when the
path module or issue is outside the URL project. The v1 cycle-issue POST only moves
existing CycleIssue rows of the URL project, matching the app endpoint.

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

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

Only link body module ids that belong to the URL project in create_issue_modules.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
dheeru0198 and others added 12 commits October 18, 2026 16:05
… 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 export history query is still unscoped on preview, so this PR is not superseded.

  1. major apps/api/plane/app/views/exporter/base.py:69, apps/api/plane/tests/contract/app/test_export_history_scope.py:5: Suggest rewording the new comments and module docstring to a brief statement of the ownership rule rather than describing the prior gap.
  2. minor apps/api/plane/tests/contract/app/test_export_history_scope.py:82: The "member can see their own export" test authenticates the workspace admin, so it doesn't cover the member path. Suggest creating an export for other_member and asserting that member sees its URL.
  3. nit apps/api/plane/app/views/exporter/base.py:81: #10054 is on preview and adds order_by sanitization in this method. The changes merge cleanly; preserve that allowlist when updating.

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]>
- The "member sees own export" test now authenticates as the non-admin
  member and checks the member's own export and URL; a second test covers
  the admin. Both also assert the other user's export is not listed.
- Reworded the view comment and test docstring 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 a5e958e into preview Oct 26, 2026
15 checks passed
@dheeru0198
dheeru0198 deleted the infra-778/export-history-scope-to-initiator branch October 26, 2026 19:13
sriramveeraghanta pushed a commit that referenced this pull request Nov 9, 2026
…esting user's own exports (#9707)

* [INFRA-778] fix(security): scope ExportIssuesEndpoint.get to the requesting user's own exports
* [INFRA-778] use status.HTTP_200_OK instead of bare 200 in the new test
* [INFRA-778] fix: address review feedback

(cherry picked from commit a5e958e)
nettnikl pushed a commit to nettnikl/hangar that referenced this pull request Dec 1, 2026
Port of upstream makeplane#10054, makeplane#10062 and makeplane#9707.

Export history only orders by allow-listed fields, a guest's export
follows the project guest visibility rule, and the export list shows
only the caller's own exports.
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