Skip to content

Commit

Permalink
Fixing test and moving size checks to global
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-buttner committed Aug 2, 2022
1 parent c4f53c9 commit 9e7f176
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion x-pack/plugins/cases/server/services/user_profiles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import { excess, SuggestUserProfilesRequestRt, throwErrors } from '../../../comm
import { Operations } from '../../authorization';
import { createCaseError } from '../../common/error';

const MAX_SUGGESTION_SIZE = 100;
const MIN_SUGGESTION_SIZE = 0;

interface UserProfileOptions {
securityPluginSetup?: SecurityPluginSetup;
securityPluginStart?: SecurityPluginStart;
Expand Down Expand Up @@ -61,7 +64,7 @@ export class UserProfileService {
/**
* The limit of 100 helps prevent DDoS attacks and is also enforced by the security plugin.
*/
if (size !== undefined && (size > 100 || size < 0)) {
if (size !== undefined && (size > MAX_SUGGESTION_SIZE || size < MIN_SUGGESTION_SIZE)) {
throw Boom.badRequest('size must be between 0 and 100');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export default function ({ getService }: FtrProviderContext) {
"full_name": "sec only_no_delete",
"username": "sec_only_no_delete",
},
}
},
]
`);
});
Expand Down

0 comments on commit 9e7f176

Please sign in to comment.