File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,10 @@ export function getArtifactsHandler({
123123 res . status ( 500 ) . send ( 'Storage key is missing from artifact request' ) ;
124124 return ;
125125 }
126+ if ( key . length > 1024 ) {
127+ res . status ( 500 ) . send ( 'Object key too long' ) ;
128+ return ;
129+ }
126130 console . log ( `Getting storage artifact at: ${ source } : ${ bucket } /${ key } ` ) ;
127131
128132 let client : MinioClient ;
Original file line number Diff line number Diff line change @@ -821,6 +821,21 @@ describe('/artifacts', () => {
821821 . get ( `/artifacts/get?source=volume&bucket=artifact&key=subartifact/notxist.csv` )
822822 . expect ( 500 , 'Failed to open volume.' ) ;
823823 } ) ;
824+
825+ it ( 'rejects keys longer than 1024 characters' , async ( ) => {
826+ const configs = loadConfigs ( argv , {
827+ AWS_ACCESS_KEY_ID : 'aws123' ,
828+ AWS_SECRET_ACCESS_KEY : 'awsSecret123' ,
829+ } ) ;
830+ app = new UIServer ( configs ) ;
831+ const request = requests ( app . start ( ) ) ;
832+ await request
833+ . get (
834+ '/artifacts/get?source=s3&namespace=test&peek=256&bucket=ml-pipeline&key=' +
835+ 'a' . repeat ( 1025 ) ,
836+ )
837+ . expect ( 500 , 'Object key too long' ) ;
838+ } ) ;
824839 } ) ;
825840
826841 describe ( '/:source/:bucket/:key' , ( ) => {
You can’t perform that action at this time.
0 commit comments