@@ -236,21 +236,21 @@ async function main() {
236236
237237 // Validate gateway section
238238 core . info ( "Validating gateway configuration..." ) ;
239- const gw = /** @type { Record<string, unknown> | undefined } */ configObj . gateway ;
240- if ( ! gw ) {
239+ const gw = configObj . gateway ;
240+ if ( ! gw || typeof gw !== "object" ) {
241241 core . error ( "ERROR: Configuration is missing required 'gateway' section" ) ;
242242 core . error ( "Per MCP Gateway Specification v1.0.0 section 4.1.3, the gateway section is required" ) ;
243243 process . exit ( 1 ) ;
244244 }
245- if ( gw . port == null ) {
245+ if ( ! ( "port" in gw ) || gw . port == null ) {
246246 core . error ( "ERROR: Gateway configuration is missing required 'port' field" ) ;
247247 process . exit ( 1 ) ;
248248 }
249- if ( gw . domain == null ) {
249+ if ( ! ( "domain" in gw ) || gw . domain == null ) {
250250 core . error ( "ERROR: Gateway configuration is missing required 'domain' field" ) ;
251251 process . exit ( 1 ) ;
252252 }
253- if ( gw . apiKey == null ) {
253+ if ( ! ( "apiKey" in gw ) || gw . apiKey == null ) {
254254 core . error ( "ERROR: Gateway configuration is missing required 'apiKey' field" ) ;
255255 process . exit ( 1 ) ;
256256 }
@@ -274,7 +274,11 @@ async function main() {
274274
275275 // Split docker command into args, respecting simple quoting
276276 const args = dockerCommand . match ( / (?: [ ^ \s " ' ] + | " [ ^ " ] * " | ' [ ^ ' ] * ' ) + / g) || [ ] ;
277- const cmd = /** @type {string } */ args . shift ( ) ;
277+ const cmd = args . shift ( ) ;
278+ if ( ! cmd ) {
279+ core . error ( "ERROR: MCP_GATEWAY_DOCKER_COMMAND did not contain an executable command" ) ;
280+ process . exit ( 1 ) ;
281+ }
278282
279283 const outputFd = fs . openSync ( outputPath , "w" , 0o600 ) ;
280284 const stderrFd = fs . openSync ( stderrLogPath , "w" , 0o600 ) ;
@@ -286,6 +290,10 @@ async function main() {
286290 } ) ;
287291
288292 // Write configuration to stdin then close
293+ if ( ! child . stdin ) {
294+ core . error ( "ERROR: Gateway process stdin is not available" ) ;
295+ process . exit ( 1 ) ;
296+ }
289297 child . stdin . write ( mcpConfig ) ;
290298 child . stdin . end ( ) ;
291299
0 commit comments