File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/core/src/v3/isomorphic Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 11export function parseNaturalLanguageDuration ( duration : string ) : Date | undefined {
2+ // Handle Code scanning alert #44 (https://github.com/triggerdotdev/trigger.dev/security/code-scanning/44) by limiting the length of the input string
3+ if ( duration . length > 100 ) {
4+ return undefined ;
5+ }
6+
27 // More flexible regex that captures all units individually regardless of order
38 const weekMatch = duration . match ( / ( \d + ) w / ) ;
49 const dayMatch = duration . match ( / ( \d + ) d / ) ;
@@ -73,6 +78,11 @@ export function safeParseNaturalLanguageDuration(duration: string): Date | undef
7378// ... existing code ...
7479
7580export function parseNaturalLanguageDurationAgo ( duration : string ) : Date | undefined {
81+ // Handle Code scanning alert #44 (https://github.com/triggerdotdev/trigger.dev/security/code-scanning/44) by limiting the length of the input string
82+ if ( duration . length > 100 ) {
83+ return undefined ;
84+ }
85+
7686 // More flexible regex that captures all units individually regardless of order
7787 const weekMatch = duration . match ( / ( \d + ) w / ) ;
7888 const dayMatch = duration . match ( / ( \d + ) d / ) ;
You can’t perform that action at this time.
0 commit comments