Skip to content

fix(project): restrict service columns in project.one for members - #5088

Open
Alexis0800 wants to merge 1 commit into
Dokploy:canaryfrom
Alexis0800:fix/project-one-member-column-limit
Open

fix(project): restrict service columns in project.one for members#5088
Alexis0800 wants to merge 1 commit into
Dokploy:canaryfrom
Alexis0800:fix/project-one-member-column-limit

Conversation

@Alexis0800

@Alexis0800 Alexis0800 commented Aug 14, 2026

Copy link
Copy Markdown

What is this PR about?

Members with valid project access cannot open their projects: they see the project card, but clicking it redirects them away and they never reach their services. Owners and admins are unaffected.

The member branch of project.one pulls the whole service tables inside a with. Drizzle builds one json_build_array per nested relation with a single argument per column, and Postgres allows at most 100 arguments per function call. The application table is now at 101 columns, so the query fails with INTERNAL_SERVER_ERROR. getServerSideProps catches that error and redirects out of the project, which is why it looks like a permissions problem rather than a query failure.

Owners and admins go through findProjectById, which already selects explicit columns — that is why only members hit this.

This PR mirrors that same column selection in the member branch while keeping the accessedServices filters untouched. No behavioural change: members now receive exactly the same fields owners already receive.

Reproducing the underlying limit

On any Postgres instance:

SELECT json_build_array(1, 2, ..., 100);  -- ok
SELECT json_build_array(1, 2, ..., 101);  -- ERROR: cannot pass more than 100 arguments to a function

Quick one-liner:

psql -c "SELECT json_build_array($(seq -s, 1 101)) IS NOT NULL;"

Note for maintainers

project.all and findEnvironmentsByProjectId already restrict columns, so they are safe. This was the only remaining query selecting a full service table inside a nested relation. Since the limit is now only one column away from being crossed again by other tables, the added test asserts every service relation in the member branch keeps an explicit columns: selection.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Tested on a self-hosted instance running v0.30.0: before the change a member was redirected out of the project and the server logged the failing query; after the change the member opens the project and sees the services they were granted. typecheck is clean and the permissions test suite passes (47 tests).

Issues related (if applicable)

N/A

Greptile Summary

The PR prevents PostgreSQL’s function-argument limit from breaking project.one for members by explicitly selecting service columns while preserving existing access filters.

  • Adds restricted column selections for all eight nested service relations in the member query.
  • Adds regression tests covering the application-table limit and explicit service selections.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code regression identified.

The member query now limits every nested service relation while retaining the existing project organization scope and per-service access filters, and the selected response fields align with the established owner/admin query pattern.

Reviews (1): Last reviewed commit: "fix(project): restrict service columns i..." | Re-trigger Greptile

The member branch of project.one pulled the whole service tables inside a
`with`. Drizzle builds one json_build_array per nested relation with a single
argument per column, and Postgres allows at most 100 arguments per function
call. The application table crossed that limit at 101 columns, so the query
started failing with INTERNAL_SERVER_ERROR.

getServerSideProps catches that error and redirects away from the project, so
members with valid access saw the project card but never its services. Owners
and admins were unaffected because they go through findProjectById, which
already selects explicit columns.

This mirrors that same selection while keeping the accessedServices filters.

Reproduce the underlying limit on any Postgres instance:

    SELECT json_build_array(1, 2, ..., 100);  -- ok
    SELECT json_build_array(1, 2, ..., 101);  -- cannot pass more than 100
                                              -- arguments to a function
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant