mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Sanitize checkpoint tags (#4813)
This commit is contained in:
@@ -238,6 +238,12 @@ export class Logger {
|
||||
if (!this.geminiDir) {
|
||||
throw new Error('Checkpoint file path not set.');
|
||||
}
|
||||
// Sanitize tag to prevent directory traversal attacks
|
||||
tag = tag.replace(/[^a-zA-Z0-9-_]/g, '');
|
||||
if (!tag) {
|
||||
console.error('Sanitized tag is empty setting to "default".');
|
||||
tag = 'default';
|
||||
}
|
||||
return path.join(this.geminiDir, `checkpoint-${tag}.json`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user