@@ -42,7 +42,9 @@ export type MaterializedInstallable = {
4242 cleanup : ( ) => Promise < void > ;
4343} ;
4444
45- const ARCHIVE_EXTENSIONS = [ '.zip' , '.tar' , '.tar.gz' , '.tgz' ] as const ;
45+ const INTERNAL_ARCHIVE_EXTENSIONS = [ '.zip' , '.tar' , '.tar.gz' , '.tgz' ] as const ;
46+
47+ export const ARCHIVE_EXTENSIONS = Object . freeze ( [ ...INTERNAL_ARCHIVE_EXTENSIONS ] as const ) ;
4648const MAX_INSTALL_SOURCE_SEARCH_DEPTH = 5 ;
4749const DEFAULT_SOURCE_DOWNLOAD_TIMEOUT_MS = resolveTimeoutMs (
4850 process . env . AGENT_DEVICE_SOURCE_DOWNLOAD_TIMEOUT_MS ,
@@ -271,13 +273,13 @@ function resolveDownloadFileName(response: Response, parsedUrl: URL): string {
271273 return 'downloaded-artifact.bin' ;
272274}
273275
274- function isBlockedSourceHostname ( hostname : string ) : boolean {
276+ export function isBlockedSourceHostname ( hostname : string ) : boolean {
275277 if ( ! hostname ) return true ;
276278 if ( hostname === 'localhost' || hostname . endsWith ( '.localhost' ) ) return true ;
277279 return isBlockedIpAddress ( hostname ) ;
278280}
279281
280- function isBlockedIpAddress ( address : string ) : boolean {
282+ export function isBlockedIpAddress ( address : string ) : boolean {
281283 const family = net . isIP ( address ) ;
282284 if ( family === 4 ) return isBlockedIpv4 ( address ) ;
283285 if ( family === 6 ) return isBlockedIpv6 ( address ) ;
@@ -449,7 +451,7 @@ async function extractArchive(
449451
450452function isArchivePath ( candidatePath : string ) : boolean {
451453 const lower = candidatePath . toLowerCase ( ) ;
452- return ARCHIVE_EXTENSIONS . some ( ( extension ) => lower . endsWith ( extension ) ) ;
454+ return INTERNAL_ARCHIVE_EXTENSIONS . some ( ( extension ) => lower . endsWith ( extension ) ) ;
453455}
454456
455457async function runCleanupTasks ( tasks : Array < ( ) => Promise < void > > ) : Promise < void > {
0 commit comments