Summary
Goploy contains an insecure direct object reference issue in project and project-file APIs that trust caller-supplied database row IDs without confirming namespace ownership. A user with project-management or file-sync permissions in one namespace may access, modify, delete, or redirect projects belonging to other namespaces, potentially enabling remote code execution during a later deployment.
Affected context
The vulnerability affects Goploy deployments where project-management API handlers accept project or project-file identifiers from JSON request bodies and the corresponding data-access queries authorize objects only by row ID. The issue becomes risky when a user has a role containing the FileSync or EditProject permission but the application does not additionally verify that the referenced project belongs to the caller's namespace.
Exploit preconditions
- Attack surface: Project and project-file API endpoints in the server application
- Required access: An authenticated account with a manager role or a role containing FileSync or EditProject permissions in its own namespace
- Trigger point: Supplying a project or project-file row ID in the relevant JSON request body
- Authorization gap: Backend lookups and mutations do not consistently constrain the object to the caller's namespace
- Escalation condition: If a foreign project's Git remote can be changed, a subsequent deployment may retrieve attacker-controlled content or execute deployment-related code
Why this happens
The underlying bug is an object-level authorization failure. API handlers accept client-controlled identifiers and invoke model operations that query or mutate records by row ID without enforcing the required namespace relationship.
This maps primarily to CWE-639: Authorization Bypass Through User-Controlled Key, commonly known as an insecure direct object reference. It also relates to CWE-863: Incorrect Authorization, because the application checks whether the caller has a general capability but does not verify authorization for the specific project object.
Potential impact
- An attacker may read files from projects in other namespaces
- An attacker may modify or delete foreign project files
- Project configuration or deployment behavior may be altered
- A project's Git remote URL may be redirected to an attacker-controlled repository
- A later deployment could execute attacker-controlled code in the deployment environment
- Sensitive source code, credentials, or build artifacts may be exposed
- Namespace isolation and administrative trust boundaries could be weakened
General mitigation guidance
Mitigation generally focuses on enforcing object-level authorization at every project and project-file access path.
Common defensive patterns include:
- Derive namespace ownership from the authenticated session rather than trusting request data
- Apply namespace or tenant predicates to every read, update, and delete query
- Centralize authorization checks in service or model-layer operations so individual handlers cannot bypass them
- Treat project identifiers as references requiring authorization, not as sufficient proof of access
- Restrict who may change Git remotes and require validation of approved repositories
- Use least-privilege deployment identities and isolate build or deployment workers
- Add authorization tests for cross-namespace object access, including positive and negative cases
How teams detect issues like this
Detection can combine code review, automated analysis, and runtime monitoring.
- Search for handlers that accept object IDs from request bodies and call database operations without tenant or namespace predicates
- Review model queries for lookups based solely on primary keys when multi-namespace ownership is expected
- Flag authorization checks that validate only roles or permissions without checking the target object's owner
- Add integration tests attempting read, update, delete, and Git-remote changes against objects in another namespace
- Monitor audit logs for cross-namespace identifier patterns, unusual project-file access, and unexpected remote URL changes
- Enforce policy checks in CI to require object-level authorization tests for multi-tenant APIs
- Use neutral static-analysis or automated code-review tooling to identify user-controlled IDs flowing into privileged data operations

