Repository navigation
Enforce user ownership on application list and datasource connections - #1655
Merged
mkumatag merged 7 commits intoOct 28, 2026
Merged
Conversation
- Filter application list results by authenticated user ID (created_by) - Pass authenticated caller identity to datasource connect and disconnect operations - Reject datasource connect/disconnect requests on applications owned by another user with 403 Forbidden - Add repository, service, and handler tests for user-scoped queries and ownership enforcement Signed-off-by: Manjunath Kumatagi <mkumatag@in.ibm.com>
- Extract loadAppWithOwnership helper in datasource service to reduce complexity - Extract parseDatasourceIDs helper in datasource handler - Regenerate swagger documentation Signed-off-by: Manjunath Kumatagi <mkumatag@in.ibm.com>
mayuka-c
reviewed
Oct 28, 2026
Signed-off-by: Manjunath Kumatagi <mkumatag@in.ibm.com>
Signed-off-by: Manjunath Kumatagi <mkumatag@in.ibm.com>
Signed-off-by: Manjunath Kumatagi <mkumatag@in.ibm.com>
sats-23
approved these changes
Oct 28, 2026
mkumatag
added a commit
that referenced
this pull request
Oct 29, 2026
…ce connections (#1655) (#1678) Cherry-pick of #1655 (488e302) to release-0.4. Enforces user ownership on application listing and datasource connect/disconnect: - `GET /api/v1/applications/` filters by authenticated user (`created_by`) - Datasource connect/disconnect return 403 when the application is owned by another user Conflict resolution notes (release-0.4 differs from main): - Dropped the `Search` filter hunks (not present on release-0.4); kept only `CreatedBy`. - Skipped version bumps in Makefile/values.yaml. - Did not carry `application_repo_test.go` (does not exist on release-0.4). - Added the `created_by` filter to `GetCount` (it builds its own query on this branch) so pagination totals match the filtered list. Validated: `go build`, `go test -tags containers_image_openpgp ./internal/pkg/catalog/...` pass. --------- Signed-off-by: Manjunath Kumatagi <mkumatag@in.ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR enforces user ownership checks on application listing and datasource connect/disconnect routes:
GET /api/v1/applications/): Filters applications by the authenticated user ID (created_by), ensuring callers only receive applications they own.PUT /api/v1/applications/:id/datasources): Passes the authenticated user identity to the datasource service and rejects connection attempts on applications owned by other users with403 Forbidden.DELETE /api/v1/applications/:id/datasources/:datasource_id): Passes the authenticated user identity to the datasource service and rejects disconnection attempts on applications owned by other users with403 Forbidden.Changes
application_repo.go: AddedCreatedByfield toApplicationFiltersand bounda.created_by = $Nin query building.application_service/common.go: ForwardedCreatedByfrom list request to repository filters, updatedDatasourceConnectorinterface and post-deploy attachment.application_handler.go: ExtracteduserIDfrom authentication context and populatedCreatedByin list requests.interface.go&datasource_service.go: UpdatedConnectDatasourcesToApplicationandDisconnectDatasourcesFromApplicationto accept caller identity and enforceapp.CreatedBy == userID.datasource_handler.go: ExtracteduserIDfrom authentication context and passed it to connect/disconnect service methods.authorization_test.go,datasource_service_test.go, andapplication_repo_test.go.Testing
go test -count=1 -tags containers_image_openpgp ./internal/pkg/catalog/...passes.