address GitHub security feedback

This commit is contained in:
ehedlund
2026-04-15 17:18:17 -04:00
parent bcf599b3b2
commit d6492830b6
@@ -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);
}