Skip to content

fix(api): expose project Pages collection through /api/v1 - #9936

Open
jasoncarney1864 wants to merge 4 commits into
makeplane:previewfrom
jasoncarney1864:feature/public-project-pages-api
Open

jasoncarney1864 wants to merge 4 commits into
makeplane:previewfrom
jasoncarney1864:feature/public-project-pages-api

Conversation

@jasoncarney1864

@jasoncarney1864 jasoncarney1864 commented Oct 4, 2026 •

Copy link
Copy Markdown

Description

Fixes the missing API-key-authenticated project Pages collection routes described in #9484.

Adds:

  • GET /api/v1/workspaces/{slug}/projects/{project_id}/pages/
  • POST /api/v1/workspaces/{slug}/projects/{project_id}/pages/

The implementation uses the existing project Page permission model and keeps the public surface intentionally narrow:

  • API-key authentication through X-API-Key
  • active project membership and guest/member role behavior
  • private Pages remain owner-only
  • project/workspace and soft-deleted-link isolation
  • metadata-only list responses
  • allowlisted create fields
  • server-derived ownership and workspace
  • sanitized HTML and atomic Page plus ProjectPage creation
  • OpenAPI schema coverage

Detail, update, delete, workspace-scoped Pages, and MCP functionality remain out of scope.

Type of Change

  • Bug fix
  • Documentation update

Screenshots and Media

Not applicable — this is a backend API and OpenAPI change.

Test Scenarios

  • Focused serializer, management-command, API contract, and OpenAPI schema tests: 24 passed
  • Isolated container-network smoke test:
    • unauthenticated request returns 401
    • authenticated create returns 201
    • authenticated subsequent list returns 200
  • Repository-wide pnpm check passed.
  • Test Compose resources were isolated from the existing AIO deployment and cleaned up afterward.

References

Fixes #9484
Related but intentionally not expanded to: #9511

Summary by CodeRabbit

  • New Features
    • API-key-authenticated clients can list project Pages and create new ones.
    • Page listings include metadata only and respect project membership, page visibility, and archive status.
    • New Pages can include a name, description, access setting, and color. Descriptions are sanitized before saving.
    • API documentation now describes the Pages collection endpoints.

@CLAassistant

CLAassistant commented Oct 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9212d034-65b7-4c81-85ed-ec95c613569d
📥 Commits

Reviewing files that changed from the base of the PR and between c7a5afe and 81e7699.

📒 Files selected for processing (16)
  • apps/api/plane/api/serializers/__init__.py
  • apps/api/plane/api/serializers/page.py
  • apps/api/plane/api/urls/__init__.py
  • apps/api/plane/api/urls/page.py
  • apps/api/plane/api/views/__init__.py
  • apps/api/plane/api/views/page.py
  • apps/api/plane/db/management/commands/seed_public_project_pages_smoke.py
  • apps/api/plane/settings/openapi.py
  • apps/api/plane/tests/contract/api/test_pages.py
  • apps/api/plane/tests/contract/api/test_pages_schema.py
  • apps/api/plane/tests/unit/management/test_seed_public_project_pages_smoke.py
  • apps/api/plane/tests/unit/serializers/test_pages.py
  • docker-compose-pages-smoke.yml
  • docker-compose-test.yml
  • docs/public-project-pages-api.md
  • scripts/run-public-project-pages-smoke.sh

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


📝 Walkthrough

Walkthrough

Adds API-key-authenticated GET and POST operations for project Pages. The API lists eligible Page metadata and creates Pages linked to the active project. Contract tests, OpenAPI checks, documentation, and disposable Compose smoke tooling are included.

Changes

Project Pages API

Layer / File(s) Summary
Page serialization and creation
apps/api/plane/api/serializers/page.py, apps/api/plane/api/serializers/__init__.py, apps/api/plane/tests/unit/serializers/test_pages.py
Adds metadata-only Page output and constrained Page creation. Creation validates and sanitizes HTML descriptions and creates an active project association. Serializer tests check the output fields, creation, and rejection of server-owned input.
Project Pages collection endpoint
apps/api/plane/api/urls/*, apps/api/plane/api/views/*, apps/api/plane/settings/openapi.py, apps/api/plane/tests/contract/api/test_pages*.py, docker-compose-test.yml, docs/public-project-pages-api.md
Adds GET and POST routes for project Pages. Listing filters by active project link, archival status, Page hierarchy, and visibility. Contract and schema tests cover responses, authentication, input validation, and OpenAPI details.
Disposable API smoke test
apps/api/plane/db/management/commands/seed_public_project_pages_smoke.py, apps/api/plane/tests/unit/management/test_seed_public_project_pages_smoke.py, docker-compose-pages-smoke.yml, scripts/run-public-project-pages-smoke.sh
Adds repeatable smoke-test data setup and a Compose script. The script checks that requests without an API key return 401, creation returns 201, and listing returns 200.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  actor APIClient
  participant ProjectPageListAPIEndpoint
  participant ProjectPageCreateSerializer
  participant ProjectPageListSerializer
  participant PageAndProjectAssociation
  alt List Pages
    APIClient->>ProjectPageListAPIEndpoint: GET project Pages
    ProjectPageListAPIEndpoint->>ProjectPageAndLinks: Query eligible project-linked Pages
    ProjectPageAndLinks-->>ProjectPageListAPIEndpoint: Matching Pages
    ProjectPageListAPIEndpoint->>ProjectPageListSerializer: Serialize Page metadata
    ProjectPageListSerializer-->>APIClient: Paginated Page metadata
  else Create Page
    APIClient->>ProjectPageListAPIEndpoint: POST Page fields
    ProjectPageListAPIEndpoint->>ProjectPageCreateSerializer: Validate request fields
    ProjectPageCreateSerializer->>PageAndProjectAssociation: Create Page and project link
    PageAndProjectAssociation-->>ProjectPageListAPIEndpoint: Created Page
    ProjectPageListAPIEndpoint->>ProjectPageListSerializer: Serialize Page metadata
    ProjectPageListSerializer-->>APIClient: Created Page response
  end
Loading

Merge Risk: ⚪ Minimal · up to 81e76

No actionable issue remains from this review; the project Pages collection API is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 81e76

The new API has narrow input fields, project-role checks, owner-only private Pages, and atomic creation. Its replica-enabled listing leaves a security-relevant uncertainty: whether token revocations, membership removals, and privacy changes take effect promptly. The possible exposure is Page metadata, not document bodies; stale authorization has not been demonstrated.

Retained concerns

  • Medium · security · inferred: The new collection opts into replica routing for GET, but immediate revocation and privacy enforcement are not established. Token, membership, and Page visibility queries have no explicit primary selection in the inspected path. If the database router sends those policy reads to a lagging replica, a revoked key, removed member, or formerly public Page could retain metadata visibility temporarily. Primary-routing exceptions or stronger replication guarantees could eliminate this concern; neither was established.
Security review details

Security Blast Radius

  • inferred — The new authority is project Pages access through the API-key user's existing memberships, potentially across multiple projects and workspaces available to that identity. Guests can obtain permitted metadata; members and admins can persist Pages. The conditional stale-policy concern affects metadata in previously permitted scopes, not arbitrary tenant data or document bodies.

Security Findings and Attack Paths

  • inferred — A conditional attack path is repeated GET requests using a recently revoked key or removed membership, or requesting metadata after a Page becomes private, while policy state remains stale on a replica. The endpoint enables replica context and the inspected policy queries are unpinned, but the effective database router and deployment consistency were not established. This is an unresolved exposure scenario, not a verified exploit.

Trust Boundaries and Controls

  • observed — Caller-controlled route identifiers are checked against project membership and project/workspace lookup. Caller-controlled creation fields cannot select an owner, workspace, project association, or lifecycle state. Private Page visibility is filtered at the collection query boundary, and only explicit metadata fields cross the response boundary.
  • observed — Nonempty description HTML passes through the shared sanitizer with tag, attribute, URL-scheme, and size controls before persistence. The Page model derives stripped text from the stored HTML. Neither HTML nor derived description content is included in this collection's metadata serializer; later rendering paths were not established by this review.

Resilience and Maintainability Implications

  • observed — The new creation path contains both persistence operations in one transaction and derives their workspace from the same project object. ProjectPage has an active-link uniqueness constraint, but no inspected database constraint independently enforces cross-table workspace equality; the new path maintains that invariant through server-derived values.

Hardening Proposals

  • proposed — Establish the collection's revocation and privacy freshness guarantee. If effective routing permits stale policy reads, use primary-backed policy and visibility evaluation or another mechanism that preserves that guarantee. Disabling replica routing for this bounded collection is one possible implementation, not an observed requirement.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 13 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: exposing the project Pages collection API.
Description check ✅ Passed The description covers the change, type, screenshots, test scenarios, and references. It also states the API scope and key security behavior.
Linked Issues check ✅ Passed #9484 requires API-key-authenticated listing and creation at /api/v1/workspaces/{workspace_slug}/projects/{project_id}/pages/. The PR adds the GET/POST route in apps/api/plane/api/urls/page.py, im…
Out of Scope Changes check ✅ Passed The added serializers, permission-aware contract tests, OpenAPI coverage, and API documentation support the #9484 endpoint. The smoke-test management command, Compose configuration, and script support…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 13 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Self-hosted Plane v1.3.1 Pages API differs from documented /api/v1 contract

2 participants