Skip to content

Commit 8766c56

Browse files
committed
fix: add bounds checking for page/count before uint64 conversion in SCIM
Addresses gosec G115 integer overflow vulnerability by ensuring page and count values are non-negative before converting to uint64 in pagination parameters.
1 parent e6cc59f commit 8766c56

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/api/scim.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ func (a *API) SCIMUsersList(w http.ResponseWriter, r *http.Request) error {
139139
return scimSendJSON(w, http.StatusOK, resp)
140140
}
141141

142+
// Ensure page and count are non-negative before converting to uint64
143+
if page < 0 {
144+
page = 1
145+
}
146+
if count < 0 {
147+
count = 50
148+
}
142149
pageParams := &models.Pagination{Page: uint64(page), PerPage: uint64(count)}
143150
users, err := models.FindUsersInAudience(db, aud, pageParams, nil, "")
144151
if err != nil {

0 commit comments

Comments
 (0)