0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

Fix redos vulnerability

This commit is contained in:
Marc Bernard 2024-11-30 20:44:50 -05:00
parent d12a6fdb1e
commit 77c67e674b

View file

@ -8,7 +8,7 @@ import { URL } from 'url';
* @returns {String}
*/
export function getVersionFromTarball(fileName: string): string | void {
const groups = fileName.match(/^.+-(\d+\.\d+\.\d+.+)\.tgz$/);
const groups = fileName.replace(/\.tgz$/, '').match(/^[^/]+-(\d+\.\d+\.\d+.*)/);
return groups !== null ? groups[1] : undefined;
}