fix(auth): normalize filters and prevent unbounded filter-based bulk user deletion - #7022
Open
vjymisal0 wants to merge 1 commit into
Open
fix(auth): normalize filters and prevent unbounded filter-based bulk user deletion#7022vjymisal0 wants to merge 1 commit into
vjymisal0 wants to merge 1 commit into
Conversation
…user deletion (fixes devtron-labs#7020)
vjymisal0
requested review from
prakarsh-dt and
vivek-devtron
as code owners
September 5, 2026 12:39
|
Bito Review Skipped - Source Branch Not Found |
|
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
Fixes #7020
Problem
When
DELETE /orchestrator/user/bulkis invoked with alistingRequestfilter object (e.g. from the UI "select all matching across pages" action) and no explicitids,getUserIdsHonoringFiltersconstructed query filters directly without applying the standard normalization (SetDefaultValuesIfNotPresent,setStatusFilterType, andsetCurrentTimeInUserInfo). This caused requests targeting a subset (e.g. inactive users) to resolve to all users and deactivate unintended accounts. Furthermore, empty bulk deletion payloads were not rejected prior to execution.Solution
UserServiceImpl.getUserIdsHonoringFilters, invokeSetDefaultValuesIfNotPresent,setStatusFilterType, andsetCurrentTimeInUserInfobefore building and executing the filter query.ValidateBulkDeleteRequestinhelper.goto ensure requests contain either concrete IDs or valid filter criteria. Added helper checks onBulkDeleteRequest.UserRestHandlerImpl.BulkDeleteUsersto reject malformed/empty payloads with HTTP 400.ValidateBulkDeleteRequestandBulkDeleteUsersinhelper_test.goandUserService_test.go.Files Changed:
api/auth/user/UserRestHandler.gopkg/auth/user/UserService.gopkg/auth/user/UserService_test.gopkg/auth/user/bean/UserRequest.gopkg/auth/user/helper/helper.gopkg/auth/user/helper/helper_test.go