Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e78665f
[WEB-8291] fix: gate project invitation list/retrieve/destroy to proj…
mguptahub Jul 20, 2026
f21ee4d
chore(security): drop advisory identifiers from code comments
mguptahub Aug 7, 2026
b6f9657
Merge remote-tracking branch 'origin/preview' into web-8291/project-i…
mguptahub Sep 28, 2026
48dfebd
Merge branch 'preview' into web-8291/project-invite-list-admin-scope
mguptahub Oct 12, 2026
69b1aab
[INFRA-1114] fix(security): keep magic-code regeneration limit (#10040)
dheeru0198 Oct 17, 2026
c29a5c1
[INFRA-1132] fix(security): cap invitation role updates at own role (…
dheeru0198 Oct 17, 2026
ca521bd
[INFRA-1138] fix(security): require workspace admin to PUT/PATCH work…
dheeru0198 Oct 17, 2026
0db99d5
[INFRA-1159] fix(security): pin content type on inline asset URLs (#1…
dheeru0198 Oct 17, 2026
13011ba
[INFRA-1157] fix(security): bound password input scored by zxcvbn (#1…
dheeru0198 Oct 17, 2026
f9e48e6
[INFRA-1115] fix(security): enforce guest page visibility on page end…
dheeru0198 Oct 17, 2026
879ce8b
[INFRA-1128] fix(security): scope workspace analytics to member proje…
dheeru0198 Oct 17, 2026
76e2861
[INFRA-1125] fix(security): require project membership for workspace …
dheeru0198 Oct 18, 2026
9dc9a01
[INFRA-1118] fix(security): make work item system fields read-only (#…
dheeru0198 Oct 18, 2026
1a75e0a
[INFRA-1139] fix(security): scope user-profile stats and issues endpo…
dheeru0198 Oct 18, 2026
9cd1796
[INFRA-1140] fix(security): bind URL issue_id to the URL project on c…
dheeru0198 Oct 18, 2026
e1470d5
[INFRA-1145] fix(security): bind issue history to the URL project (#1…
dheeru0198 Oct 18, 2026
77ec6e7
[INFRA-1153] fix(security): strip email style blocks in linear time (…
dheeru0198 Oct 18, 2026
ec6fda9
[INFRA-1156] fix(security): sanitize export history order_by against …
dheeru0198 Oct 18, 2026
368103a
[INFRA-1164] fix(security): restrict project member updates to admins…
dheeru0198 Oct 18, 2026
2a3dbde
[INFRA-1169] fix(security): bind module and cycle ids to the URL proj…
dheeru0198 Oct 18, 2026
5d44fed
[INFRA-1152] fix(security): mark session cookies Secure when WEB_URL …
dheeru0198 Oct 18, 2026
505dc8b
[INFRA-1182] fix(security): make deploy board identity fields read-on…
dheeru0198 Oct 18, 2026
c69d033
[INFRA-1188] fix(security): require active project membership for cre…
dheeru0198 Oct 18, 2026
63c35fd
[INFRA-1189] fix(security): throttle auth endpoints for every caller …
dheeru0198 Oct 18, 2026
f87c879
[INFRA-1194] fix(security): scope activity-task lookups to issue scop…
dheeru0198 Oct 18, 2026
4e275c9
[INFRA-1200] fix(security): apply project guest scope to issue export…
dheeru0198 Oct 18, 2026
402ee70
[INFRA-1116] fix(security): restrict user-scoped FKs on users/me upda…
dheeru0198 Oct 18, 2026
791c206
[INFRA-1208] fix(security): limit public comment writes to content fi…
dheeru0198 Oct 18, 2026
a8d6573
[INFRA-1174] fix(security): scope project stats and grouping keys (#1…
dheeru0198 Oct 18, 2026
718047e
[INFRA-1163] fix(security): scope favorites to entities the caller ca…
dheeru0198 Oct 18, 2026
cc1ffb9
[INFRA-1166] fix(security): apply guest_view_all_features in search (…
dheeru0198 Oct 18, 2026
7ce1597
[INFRA-1149] fix(security): apply entity role rules to asset changes …
dheeru0198 Oct 18, 2026
aa2a05f
[INFRA-1158] fix(security): require a non-empty matching OAuth state …
dheeru0198 Oct 18, 2026
7fa6723
[INFRA-1180] fix(security): bring v1 API permissions in line with the…
dheeru0198 Oct 18, 2026
fee8e7e
[INFRA-1146] fix(security): scope public Space asset uploads to comme…
dheeru0198 Oct 18, 2026
4345fb3
[INFRA-1165] fix(security): reset role when rejoining a public projec…
dheeru0198 Oct 18, 2026
6c16585
[INFRA-1142] fix(security): require same-origin for cookie-authentica…
dheeru0198 Oct 19, 2026
21ce35d
[INFRA-1195] fix(security): verify Redis TLS certificates by default …
dheeru0198 Oct 21, 2026
a79bc40
[INFRA-1160] fix(security): generate object-storage credentials per i…
dheeru0198 Oct 21, 2026
053b2c0
[INFRA-1189] chore(security): make proxy hop count configurable for r…
dheeru0198 Oct 21, 2026
dd85d08
Merge branch 'preview' into web-8291/project-invite-list-admin-scope
dheeru0198 Oct 21, 2026
2e52996
[WEB-8291] fix: address review feedback
dheeru0198 Oct 21, 2026
d409b05
[WEB-8291] fix: address review feedback
dheeru0198 Oct 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}
REDIS_HOST="plane-redis"
REDIS_PORT="6379"
REDIS_URL="redis://${REDIS_HOST}:6379/"
# rediss:// only: the server certificate and hostname are verified by default.
# Set REDIS_SSL_CA_CERTS to a CA bundle path for a private CA, or REDIS_SSL_CERT_REQS="none" to skip verification.
# REDIS_SSL_CA_CERTS is a path inside the container: mount the CA bundle into the
# api, worker, beat-worker and migrator services.
REDIS_SSL_CERT_REQS="required"
REDIS_SSL_CA_CERTS=""

# RabbitMQ Settings
RABBITMQ_HOST="plane-mq"
Expand Down Expand Up @@ -73,3 +79,7 @@ MINIO_ENDPOINT_SSL=0

# API key rate limit
API_KEY_RATE_LIMIT="60/minute"

# Number of reverse proxies in front of the API, used to read the client IP from
# X-Forwarded-For for rate limiting. Leave unset to keep the default behaviour.
# NUM_PROXIES=
3 changes: 2 additions & 1 deletion apps/api/plane/api/serializers/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def validate(self, data):
project_id=project_id,
)

if not data.get("owned_by"):
# Create, or an explicit null on update, assigns the requester; an update that omits it keeps the owner.
if not data.get("owned_by") and (self.instance is None or "owned_by" in data):
data["owned_by"] = self.context["request"].user

return data
Expand Down
19 changes: 18 additions & 1 deletion apps/api/plane/api/serializers/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,26 @@ class IssueSerializer(BaseSerializer):

class Meta:
model = Issue
read_only_fields = ["id", "workspace", "project", "updated_by", "updated_at", "completed_at"]
read_only_fields = [
"id",
"workspace",
"project",
"updated_by",
"updated_at",
"completed_at",
"deleted_at",
"archived_at",
"sequence_id",
]
exclude = ["description_json", "description_stripped"]

def get_fields(self):
fields = super().get_fields()
# is_draft is set when a work item is created, not changed afterwards.
if self.instance is not None:
fields["is_draft"].read_only = True
return fields

def validate(self, data):
if (
data.get("start_date", None) is not None
Expand Down
2 changes: 1 addition & 1 deletion apps/api/plane/api/serializers/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def validate_member(self, value):
raise serializers.ValidationError("Slug is required", code="INVALID_SLUG")
if not value:
raise serializers.ValidationError("Member is required", code="INVALID_MEMBER")
if not WorkspaceMember.objects.filter(workspace__slug=slug, member=value).exists():
if not WorkspaceMember.objects.filter(workspace__slug=slug, member=value, is_active=True).exists():
raise serializers.ValidationError("Member not found in workspace", code="INVALID_MEMBER")
return value

Expand Down
13 changes: 4 additions & 9 deletions apps/api/plane/api/views/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,19 +444,14 @@ def get(self, request, slug, asset_id):
status=status.HTTP_400_BAD_REQUEST,
)

# Generate presigned URL for GET.
# Force attachment disposition for script-capable MIME types (e.g. SVG)
# to prevent same-origin XSS when the asset URL shares the app's origin
# (default MinIO self-hosted setup).
# Generate presigned URL for GET. Inline only for an allow-listed image type, which S3Storage
# pins as the response Content-Type; any other type downloads.
storage = S3Storage(request=request, is_server=True)
asset_mime_type = (asset.attributes.get("type") or "").split(";")[0].strip().lower()
disposition = (
"attachment" if asset_mime_type in settings.SCRIPT_CAPABLE_MIME_TYPES else "inline"
)
presigned_url = storage.generate_presigned_url(
object_name=asset.asset.name,
filename=asset.attributes.get("name"),
disposition=disposition,
disposition="inline",
content_type=asset.attributes.get("type"),
)

return Response(
Expand Down
24 changes: 11 additions & 13 deletions apps/api/plane/api/views/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
CycleUpdateSerializer,
IssueSerializer,
)
from plane.app.permissions import ProjectEntityPermission
from plane.app.permissions import ProjectAdminPermission, ProjectEntityPermission
from plane.bgtasks.issue_activities_task import issue_activity
from plane.db.models import (
Cycle,
Expand All @@ -43,7 +43,6 @@
Project,
FileAsset,
IssueLink,
ProjectMember,
UserFavorite,
)
from plane.utils.cycle_transfer_issues import transfer_cycle_issues
Expand Down Expand Up @@ -621,15 +620,7 @@ def delete(self, request, slug, project_id, pk):
Only admins or the cycle creator can perform this action.
"""
cycle = Cycle.objects.get(workspace__slug=slug, project_id=project_id, pk=pk)
if cycle.owned_by_id != request.user.id and (
not ProjectMember.objects.filter(
workspace__slug=slug,
member=request.user,
role=20,
project_id=project_id,
is_active=True,
).exists()
):
if cycle.created_by_id != request.user.id and not ProjectAdminPermission().has_permission(request, self):
return Response(
{"error": "Only admin or creator can delete the cycle"},
status=status.HTTP_403_FORBIDDEN,
Expand Down Expand Up @@ -988,8 +979,15 @@ def post(self, request, slug, project_id, cycle_id):
status=status.HTTP_400_BAD_REQUEST,
)

# Get all CycleWorkItems already created
cycle_issues = list(CycleIssue.objects.filter(~Q(cycle_id=cycle_id), issue_id__in=issues))
# Get all CycleWorkItems already created, scoped to the URL workspace + project
cycle_issues = list(
CycleIssue.objects.filter(
~Q(cycle_id=cycle_id),
issue_id__in=issues,
workspace__slug=slug,
project_id=project_id,
)
)
existing_issues = [
str(cycle_issue.issue_id) for cycle_issue in cycle_issues if str(cycle_issue.issue_id) in issues
]
Expand Down
5 changes: 3 additions & 2 deletions apps/api/plane/api/views/intake.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from plane.bgtasks.issue_activities_task import issue_activity
from plane.db.models import Intake, IntakeIssue, Issue, Project, ProjectMember, State, StateGroup
from plane.utils.host import base_host
from plane.utils.serializers import writable_data
from plane.utils.content_validator import validate_html_content
from .base import BaseAPIView
from plane.db.models.intake import SourceType
Expand Down Expand Up @@ -404,8 +405,8 @@ def patch(self, request, slug, project_id, issue_id):
# Both serializers are valid, now save them
if issue_serializer:
current_instance = issue
# Log all the updates
requested_data = json.dumps(issue_data, cls=DjangoJSONEncoder)
# Log all the updates; read-only fields are ignored on save, so they are not reported either.
requested_data = json.dumps(writable_data(issue_serializer, issue_data), cls=DjangoJSONEncoder)
issue_activity.delay(
type="issue.activity.updated",
requested_data=requested_data,
Expand Down
31 changes: 22 additions & 9 deletions apps/api/plane/api/views/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

# Third party imports
from rest_framework import status
from rest_framework.permissions import SAFE_METHODS
from rest_framework.response import Response

# drf-spectacular imports
Expand Down Expand Up @@ -60,6 +61,7 @@
RelatedIssueSerializer,
)
from plane.app.permissions import (
ProjectAdminPermission,
ProjectEntityPermission,
ProjectLitePermission,
ProjectMemberPermission,
Expand Down Expand Up @@ -88,6 +90,7 @@
from plane.bgtasks.storage_metadata_task import get_asset_object_metadata
from .base import BaseAPIView
from plane.utils.host import base_host
from plane.utils.serializers import writable_data
from plane.utils.issue_relation_mapper import get_actual_relation
from plane.bgtasks.webhook_task import model_activity
from plane.app.permissions import ROLE
Expand Down Expand Up @@ -645,9 +648,7 @@ def put(self, request, slug, project_id):
# changes and dispatch the issue activity
current_instance = json.dumps(IssueSerializer(issue).data, cls=DjangoJSONEncoder)

# Get the requested data, encode it as django object and pass it
# to serializer to validation
requested_data = json.dumps(self.request.data, cls=DjangoJSONEncoder)
# Pass the requested data to the serializer for validation
serializer = IssueSerializer(
issue,
data=request.data,
Expand All @@ -661,9 +662,11 @@ def put(self, request, slug, project_id):
# If the serializer is valid, save the issue and dispatch
# the update issue activity worker event.
serializer.save()
# Read-only fields are ignored on save, so they are not reported as changes either.
accepted_data = writable_data(serializer, request.data)
issue_activity.delay(
type="issue.activity.updated",
requested_data=requested_data,
requested_data=json.dumps(accepted_data, cls=DjangoJSONEncoder),
actor_id=str(request.user.id),
issue_id=str(issue.id),
project_id=str(project_id),
Expand All @@ -676,7 +679,7 @@ def put(self, request, slug, project_id):
model_activity.delay(
model_name="issue",
model_id=str(issue.id),
requested_data=request.data,
requested_data=accepted_data,
current_instance=current_instance,
actor_id=request.user.id,
slug=slug,
Expand Down Expand Up @@ -781,7 +784,6 @@ def patch(self, request, slug, project_id, pk):
issue = Issue.objects.get(workspace__slug=slug, project_id=project_id, pk=pk)
project = Project.objects.get(pk=project_id)
current_instance = json.dumps(IssueSerializer(issue).data, cls=DjangoJSONEncoder)
requested_data = json.dumps(self.request.data, cls=DjangoJSONEncoder)
serializer = IssueSerializer(
issue,
data=request.data,
Expand All @@ -808,9 +810,11 @@ def patch(self, request, slug, project_id, pk):
)

serializer.save()
# Read-only fields are ignored on save, so they are not reported as changes either.
accepted_data = writable_data(serializer, request.data)
issue_activity.delay(
type="issue.activity.updated",
requested_data=requested_data,
requested_data=json.dumps(accepted_data, cls=DjangoJSONEncoder),
actor_id=str(request.user.id),
issue_id=str(pk),
project_id=str(project_id),
Expand All @@ -823,7 +827,7 @@ def patch(self, request, slug, project_id, pk):
model_activity.delay(
model_name="issue",
model_id=str(pk),
requested_data=request.data,
requested_data=accepted_data,
current_instance=current_instance,
actor_id=request.user.id,
slug=slug,
Expand Down Expand Up @@ -887,6 +891,12 @@ class LabelListCreateAPIEndpoint(BaseAPIView):
permission_classes = [ProjectMemberPermission]
use_read_replica = True

# Label writes are project-admin-only, matching the app API.
def get_permissions(self):
if self.request.method in SAFE_METHODS:
return [ProjectMemberPermission()]
return [ProjectAdminPermission()]

def get_queryset(self):
return (
Label.objects.filter(workspace__slug=self.kwargs.get("slug"))
Expand Down Expand Up @@ -1197,6 +1207,7 @@ def post(self, request, slug, project_id, issue_id):
Add a new external link to a work item with URL, title, and metadata.
Automatically tracks link creation activity.
"""
Issue.objects.get(workspace__slug=slug, project_id=project_id, pk=issue_id)
serializer = IssueLinkCreateSerializer(data=request.data)
if serializer.is_valid():
serializer.save(project_id=project_id, issue_id=issue_id)
Expand Down Expand Up @@ -2529,6 +2540,8 @@ def post(self, request, slug, project_id, issue_id):
relation_type = serializer.validated_data["relation_type"]
issues = serializer.validated_data["issues"]
project = Project.objects.get(pk=project_id, workspace__slug=slug)
# The URL issue is one side of every relation; bind it to the URL project too.
Issue.issue_objects.get(workspace__slug=slug, project_id=project_id, pk=issue_id)

actual_relation = get_actual_relation(relation_type)
is_reverse = relation_type in ["blocking", "start_after", "finish_after"]
Expand Down Expand Up @@ -2561,7 +2574,7 @@ def post(self, request, slug, project_id, issue_id):

issue_activity.delay(
type="issue_relation.activity.created",
requested_data=json.dumps(request.data, cls=DjangoJSONEncoder),
requested_data=json.dumps({"relation_type": relation_type, "issues": issues}, cls=DjangoJSONEncoder),
actor_id=str(request.user.id),
issue_id=str(issue_id),
project_id=str(project_id),
Expand Down
5 changes: 5 additions & 0 deletions apps/api/plane/api/views/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ def get(self, request, slug, project_id, pk):
)
def patch(self, request, slug, project_id, pk):
project_member = ProjectMember.objects.get(project_id=project_id, workspace__slug=slug, pk=pk)
# A partial update may omit `member`, so check the existing target's workspace membership here.
if not WorkspaceMember.objects.filter(
workspace__slug=slug, member_id=project_member.member_id, is_active=True
).exists():
return Response({"member": ["Member not found in workspace"]}, status=status.HTTP_400_BAD_REQUEST)
serializer = ProjectMemberSerializer(project_member, data=request.data, partial=True, context={"slug": slug})
serializer.is_valid(raise_exception=True)
serializer.save()
Expand Down
15 changes: 15 additions & 0 deletions apps/api/plane/app/permissions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ def _wrapped_view(instance, request, *args, **kwargs):
status=status.HTTP_403_FORBIDDEN,
)

# project-level creator access also requires active membership of the URL project
if (
level != "WORKSPACE"
and not ProjectMember.objects.filter(
member=request.user,
workspace__slug=kwargs["slug"],
project_id=kwargs["project_id"],
is_active=True,
).exists()
):
return Response(
{"error": "You don't have the required permissions."},
status=status.HTTP_403_FORBIDDEN,
)

obj = model.objects.filter(id=kwargs["pk"], created_by=request.user).exists()
if obj:
return view_func(instance, request, *args, **kwargs)
Expand Down
7 changes: 6 additions & 1 deletion apps/api/plane/app/permissions/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
# See the LICENSE file for details.

from plane.db.models import ProjectMember, Page
from plane.db.models import ProjectMember, Page, Project
from plane.app.permissions import ROLE


Expand Down Expand Up @@ -58,6 +58,11 @@ def has_permission(self, request, view):
if page.owned_by_id == user_id:
return True

# Guests can only access pages they own unless the project enables
# guest_view_all_features.
if role == GUEST and not Project.objects.filter(pk=project_id, guest_view_all_features=True).exists():
return False

# Handle private page access
if page.access == Page.PRIVATE_ACCESS:
return self._has_private_page_action_access(request, slug, page, project_id)
Expand Down
18 changes: 15 additions & 3 deletions apps/api/plane/app/permissions/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,25 @@ def has_permission(self, request, view):
if request.user.is_anonymous:
return False

return ProjectMember.objects.filter(
project_member_qs = ProjectMember.objects.filter(
workspace__slug=view.workspace_slug,
member=request.user,
role=ROLE.ADMIN.value,
project_id=view.project_id,
is_active=True,
).exists()
)
if project_member_qs.filter(role=ROLE.ADMIN.value).exists():
return True

# Same as allow_permission: a workspace admin who is a project member at any role counts as admin.
return (
project_member_qs.exists()
and WorkspaceMember.objects.filter(
member=request.user,
workspace__slug=view.workspace_slug,
role=ROLE.ADMIN.value,
is_active=True,
).exists()
)


class ProjectLitePermission(BasePermission):
Expand Down
2 changes: 1 addition & 1 deletion apps/api/plane/app/permissions/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def has_permission(self, request, view):
return WorkspaceMember.objects.filter(
member=request.user,
workspace__slug=view.workspace_slug,
role__in=[Admin, Member],
role=Admin,
is_active=True,
).exists()

Expand Down
Loading
Loading