Skip to content

Add request schemas for project endpoints#1701

Merged
rmn-snpk merged 1 commit intomainfrom
fix/exclude-tables-token-from-api
Dec 1, 2025
Merged

Add request schemas for project endpoints#1701
rmn-snpk merged 1 commit intomainfrom
fix/exclude-tables-token-from-api

Conversation

@rmn-snpk
Copy link
Copy Markdown

@rmn-snpk rmn-snpk commented Dec 1, 2025

Fixes OPS-3115.

Simply added schemas to remove the token from the response

@linear
Copy link
Copy Markdown

linear Bot commented Dec 1, 2025

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 1, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/exclude-tables-token-from-api

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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Dec 1, 2025

@rmn-snpk rmn-snpk marked this pull request as ready for review December 1, 2025 11:03
Copilot AI review requested due to automatic review settings December 1, 2025 11:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds request schemas to project endpoints to exclude the tablesDatabaseToken field from API responses for security purposes.

Key Changes:

  • Added response schemas to GET endpoints that omit the tablesDatabaseToken field from project objects
  • Restructured imports to include Type, Project, and SeekPage from shared packages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/server/api/src/app/project/project-controller.ts
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Dec 1, 2025

Greptile Overview

Greptile Summary

Added response schemas to user project endpoints to exclude the sensitive tablesDatabaseToken field from API responses.

Changes:

  • Imported Type utility and Project, SeekPage types from @openops/shared
  • Created ProjectWithoutToken schema using Type.Omit to exclude tablesDatabaseToken
  • Applied response schemas to both GET /:id and GET / endpoints

Note: The project-worker-controller.ts endpoint may need similar protection if it returns project data to external consumers.

Confidence Score: 4/5

  • This PR is safe to merge with a security improvement that prevents token exposure
  • Score reflects a solid security fix that properly redacts sensitive database tokens from API responses. Implementation uses TypeBox's Type.Omit correctly. Minor concern: the worker controller endpoint may need similar protection, which should be verified separately.
  • No files require special attention, though verify project-worker-controller.ts doesn't expose tokens

Important Files Changed

File Analysis

Filename Score Overview
packages/server/api/src/app/project/project-controller.ts 4/5 Added response schemas to exclude sensitive tablesDatabaseToken from API responses; worker controller may need similar fix

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as Project Controller
    participant Service as Project Service
    participant DB as Database

    Note over Client,DB: GET /:id - Fetch Single Project
    Client->>API: GET /v1/users/projects/:id
    API->>Service: projectService.getOneOrThrow(projectId)
    Service->>DB: Query project with tablesDatabaseToken
    DB-->>Service: Full Project (including token)
    Service-->>API: Full Project Object
    Note over API: Response Schema Applied:<br/>ProjectWithoutToken removes<br/>tablesDatabaseToken field
    API-->>Client: Project (without tablesDatabaseToken)

    Note over Client,DB: GET / - List Projects
    Client->>API: GET /v1/users/projects/
    API->>Service: projectService.getOneOrThrow(projectId)
    Service->>DB: Query project with tablesDatabaseToken
    DB-->>Service: Full Project (including token)
    Service-->>API: Full Project Object
    Note over API: Response Schema Applied:<br/>SeekPage(ProjectWithoutToken)<br/>removes tablesDatabaseToken
    API-->>Client: Paginated Projects (without tokens)
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment thread packages/server/api/src/app/project/project-controller.ts
@rmn-snpk rmn-snpk merged commit f6ea2e6 into main Dec 1, 2025
24 checks passed
@rmn-snpk rmn-snpk deleted the fix/exclude-tables-token-from-api branch December 1, 2025 11:32
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.

3 participants