File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1893,6 +1893,28 @@ describe('Vulnerabilities', () => {
18931893 const contentTypeArg = spy . calls . mostRecent ( ) . args [ 2 ] ;
18941894 expect ( contentTypeArg ) . not . toMatch ( / s v g | h t m l | x m l | x h t m l | x s l t | m a t h m l / i) ;
18951895 } ) ;
1896+
1897+ it ( 'falls back to raw Content-Type when Content-Type is malformed (no slash)' , async ( ) => {
1898+ // Exercises the last-resort branch: when both the filename has no usable
1899+ // extension AND the Content-Type lacks a "/" subtype to parse, the raw
1900+ // Content-Type is used as the extension so a malformed header that
1901+ // matches a blocked pattern still trips the blocklist.
1902+ await expectAsync (
1903+ request ( {
1904+ method : 'POST' ,
1905+ headers : {
1906+ ...headers ,
1907+ 'Content-Type' : 'svg' ,
1908+ } ,
1909+ url : 'http://localhost:8378/1/files/poc' ,
1910+ body : '<svg/>' ,
1911+ } ) . catch ( e => {
1912+ throw new Error ( e . data . error ) ;
1913+ } )
1914+ ) . toBeRejectedWith ( jasmine . objectContaining ( {
1915+ message : jasmine . stringMatching ( / F i l e u p l o a d o f e x t e n s i o n s v g i s d i s a b l e d / ) ,
1916+ } ) ) ;
1917+ } ) ;
18961918 } ) ;
18971919
18981920 describe ( '(GHSA-q3vj-96h2-gwvg) SQL Injection via Increment amount on nested Object field' , ( ) => {
You can’t perform that action at this time.
0 commit comments