@@ -6,10 +6,13 @@ import fs from 'node:fs/promises';
66import os from 'node:os' ;
77import path from 'node:path' ;
88import {
9+ ARCHIVE_EXTENSIONS ,
10+ isBlockedIpAddress ,
11+ isBlockedSourceHostname ,
912 isTrustedInstallSourceUrl ,
1013 materializeInstallablePath ,
1114 validateDownloadSourceUrl ,
12- } from '../install-source.ts' ;
15+ } from '../../ install-source.ts' ;
1316import { prepareAndroidInstallArtifact } from '../android/install-artifact.ts' ;
1417import { prepareIosInstallArtifact } from '../ios/install-artifact.ts' ;
1518
@@ -46,6 +49,14 @@ test('validateDownloadSourceUrl rejects unsupported protocols', async () => {
4649 ) ;
4750} ) ;
4851
52+ test ( 'public install-source helpers expose the SSRF and archive surface' , ( ) => {
53+ assert . deepEqual ( ARCHIVE_EXTENSIONS , [ '.zip' , '.tar' , '.tar.gz' , '.tgz' ] ) ;
54+ assert . equal ( isBlockedSourceHostname ( 'localhost' ) , true ) ;
55+ assert . equal ( isBlockedSourceHostname ( 'example.com' ) , false ) ;
56+ assert . equal ( isBlockedIpAddress ( '127.0.0.1' ) , true ) ;
57+ assert . equal ( isBlockedIpAddress ( '203.0.113.10' ) , false ) ;
58+ } ) ;
59+
4960test ( 'isTrustedInstallSourceUrl recognizes supported artifact services' , ( ) => {
5061 assert . equal (
5162 isTrustedInstallSourceUrl ( 'https://api.github.com/repos/acme/app/actions/artifacts/1/zip' ) ,
0 commit comments