Skip to content

Commit f6413ce

Browse files
committed
fix(project): clarify rate limit period validation and update MAX_PERIOD to 1 month in seconds
1 parent a18e037 commit f6413ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/resolvers/project.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ module.exports = {
240240
);
241241
}
242242

243-
// Validate T (period) - must be positive integer >= 60
243+
// Validate T (period) - must be positive integer >= 60 (1 minute)
244244
if (typeof T !== 'number' || !Number.isInteger(T) || T < 60) {
245245
throw new UserInputError(
246246
'Invalid rate limit period. Must be a positive integer greater than or equal to 60 seconds.'
@@ -249,7 +249,7 @@ module.exports = {
249249

250250
// Validate reasonable maximums (prevent extremely large values)
251251
const MAX_THRESHOLD = 1000000000; // 1 billion
252-
const MAX_PERIOD = 2678400; // 1 month in seconds
252+
const MAX_PERIOD = 60 * 60 * 24 * 31; // 1 month in seconds
253253

254254
if (N > MAX_THRESHOLD) {
255255
throw new UserInputError(
@@ -259,7 +259,7 @@ module.exports = {
259259

260260
if (T > MAX_PERIOD) {
261261
throw new UserInputError(
262-
`Rate limit period cannot exceed ${MAX_PERIOD.toLocaleString()} seconds (1 year).`
262+
`Rate limit period cannot exceed ${MAX_PERIOD.toLocaleString()} seconds (1 month).`
263263
);
264264
}
265265
}

0 commit comments

Comments
 (0)