Skip to content

Commit 733c2c7

Browse files
committed
fix custom mode regexp
1 parent ce3057b commit 733c2c7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/web/src/pages/api/market/script.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async function scriptPostHandler(
5353
if( (!_id && userScriptCount >= 5) || (_id && userScriptCount >= 7)){
5454
return res.status(400).json({ err: 'user script count is over 5' })
5555
}
56-
if( String(value).match(/require|import|fetch|global|process/g) ){
56+
if( String(value).match(/require\(\S+\)|import.+from.+|fetch\(\S+\)|global|process/g) ){
5757
return res.status(400).json({ err: 'cannot contain "require" / "import" / "fetch" / "global" / "process" inside eraser script.' })
5858
}
5959

packages/web/src/pages/api/task.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function _postHandler(
3535
return res.status(400).json({ err: 'please check input value and script length.' });
3636
}
3737
// customScript safe check
38-
if( String(customScript).match(/require|import|fetch|global|process/g) ){
38+
if( String(customScript).match(/require\(\S+\)|import.+from.+|fetch\(\S+\)|global|process/g) ){
3939
return res.status(400).json({ err: 'cannot contain "require" / "import" / "fetch" / "global" / "process" inside custom script.' })
4040
}
4141
console.log('task js log')

0 commit comments

Comments
 (0)