mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-15 14:23:02 -07:00
address GitHub security feedback
This commit is contained in:
@@ -446,7 +446,13 @@ export function isSecretFile(fileName: string): boolean {
|
||||
return SECRET_FILES.some((s) => {
|
||||
if (s.pattern.includes('*')) {
|
||||
const regex = new RegExp(
|
||||
'^' + s.pattern.replace(/\./g, '\\.').replace(/\*/g, '.*') + '$',
|
||||
'^' +
|
||||
s.pattern
|
||||
// Escape all regex special chars
|
||||
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
// Convert the escaped asterisk back to a regex wildcard
|
||||
.replace(/\\\*/g, '.*') +
|
||||
'$',
|
||||
);
|
||||
return regex.test(fileName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user