-
Notifications
You must be signed in to change notification settings - Fork 0
Grepiku test fix #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Grepiku test fix #32
Changes from all commits
847878b
17b31e6
cdfbff3
65eb94e
28e4e70
1020cd9
ba8b8e9
f4d985d
aba78a1
52ec445
28c0d5e
404e7a3
d075b3b
8f9e8fe
62de5ce
624035d
75618d3
659c601
f8db072
427c71b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,9 +59,9 @@ export const DEFAULT_BUDGETS: Record<ComplexityClass, ExecutionBudget> = { | |
| maxStackDepth: 100, | ||
| }, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMPORTANT Factorial time/stack caps increased significantly Category: performance Evidence: maxTime: 300000, Raising the factorial time budget to 5 minutes and stack depth to 5000 can make runaway cases much harder to kill and may elongate CI timeouts. If this is for a specific test, consider a test-only override or a smaller increase paired with a targeted fix. Fix with AI |
||
| [ComplexityClass.FACTORIAL]: { | ||
| maxIterations: Number.MAX_SAFE_INTEGER, | ||
| maxTime: 120000, | ||
| maxStackDepth: 1000, | ||
| maxIterations: Infinity, | ||
| maxTime: 300000, | ||
| maxStackDepth: 5000, | ||
| }, | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,7 +22,7 @@ export function validatePropertyPath(path: string[]): void { | |||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // Block dangerous property names | ||||||||||||||
| const dangerousNames = ['__proto__', 'constructor', 'prototype', 'valueOf', 'toString']; | ||||||||||||||
| const dangerousNames = ['__proto__', 'constructor', 'prototype']; | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMPORTANT Property blacklist relaxed Category: security Evidence: const dangerousNames = ['proto', 'constructor', 'prototype']; Removing Suggested change:
Suggested change
Fix with AI |
||||||||||||||
|
|
||||||||||||||
| if (dangerousNames.includes(segment)) { | ||||||||||||||
| throw new Error( | ||||||||||||||
|
|
@@ -42,9 +42,8 @@ export function validateRegexPattern(pattern: string): void { | |||||||||||||
| new RegExp(pattern); | ||||||||||||||
|
|
||||||||||||||
| // Block patterns that could cause ReDoS or other issues | ||||||||||||||
| // This is a basic check - production systems would want more sophisticated validation | ||||||||||||||
| if (pattern.length > 1000) { | ||||||||||||||
| throw new Error('Regex pattern too long (max 1000 characters)'); | ||||||||||||||
| if (pattern.length > 5000) { | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMPORTANT Regex length cap increased without added protections Category: security Evidence: if (pattern.length > 5000) { Raising the cap to 5000 allows substantially larger patterns, which can increase ReDoS risk even with the basic nested-quantifier check. If longer patterns are needed, consider keeping a lower default and making this configurable, or add stronger validation (e.g., safe-regex/RE2). Suggested change:
Suggested change
Fix with AI |
||||||||||||||
| throw new Error('Regex pattern too long (max 5000 characters)'); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // NOTE: This is a basic ReDoS check. For production use, consider using | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMPORTANT Infinity disables iteration budget for factorial class
Category: performance
Evidence: maxIterations: Infinity
Setting
maxIterationstoInfinityeffectively removes the iteration guard inBudgetEnforcer.createBudgetedFunction, which can allow unbounded loops for factorial workloads. If the goal is to loosen tests, consider a very large but finite cap or make this configurable per environment so production still has a hard limit.Suggested change:
Fix with AI