@@ -27,6 +27,12 @@ describe('MCP Security Validations', () => {
2727 } ) . toThrow ( "Argument '--shell-auto-fallback' is not allowed for command 'npx'" )
2828 } )
2929
30+ it ( 'should block -y flag' , ( ) => {
31+ expect ( ( ) => {
32+ validateCommandFlags ( 'npx' , [ '-y' , 'https://test-malicious-download.com' ] )
33+ } ) . toThrow ( "Argument '-y' is not allowed for command 'npx'" )
34+ } )
35+
3036 it ( 'should block case variations' , ( ) => {
3137 expect ( ( ) => {
3238 validateCommandFlags ( 'npx' , [ '-C' , 'command' ] )
@@ -41,10 +47,6 @@ describe('MCP Security Validations', () => {
4147 expect ( ( ) => {
4248 validateCommandFlags ( 'npx' , [ '@modelcontextprotocol/server-filesystem' , '/tmp' ] )
4349 } ) . not . toThrow ( )
44-
45- expect ( ( ) => {
46- validateCommandFlags ( 'npx' , [ '-y' , '@modelcontextprotocol/server-github' ] )
47- } ) . not . toThrow ( )
4850 } )
4951 } )
5052
@@ -393,14 +395,6 @@ describe('MCP Security Validations', () => {
393395 } )
394396
395397 it ( 'should allow legitimate MCP server configurations' , ( ) => {
396- expect ( ( ) => {
397- validateMCPServerConfig ( {
398- command : 'npx' ,
399- args : [ '-y' , '@modelcontextprotocol/server-github' ] ,
400- env : { GITHUB_TOKEN : 'token123' }
401- } )
402- } ) . not . toThrow ( )
403-
404398 expect ( ( ) => {
405399 validateMCPServerConfig ( {
406400 command : 'node' ,
0 commit comments