mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-17 17:41:24 -07: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