@@ -106,6 +106,16 @@ function run() {
106106 const block_on_severity = core . getInput ( "BLOCK_ON_SEVERITY" ) ;
107107 const warn_on_severity = core . getInput ( "WARN_ON_SEVERITY" ) ;
108108 const polling_timeout = core . getInput ( "POLLING_TIMEOUT" ) ;
109+ var parsed_polling_timeout ;
110+ if ( polling_timeout ) {
111+ parsed_polling_timeout = parseInt ( polling_timeout , 10 ) ;
112+ if ( isNaN ( parsed_polling_timeout ) ) {
113+ throw new Error ( "POLLING_TIMEOUT must be a number" ) ;
114+ }
115+ if ( parsed_polling_timeout < 0 ) {
116+ throw new Error ( "POLLING_TIMEOUT must be greater or equal to 0" ) ;
117+ }
118+ }
109119 // Validate severity levels
110120 if ( block_on_severity &&
111121 ! [ "HIGH" , "MEDIUM" , "LOW" ] . includes ( block_on_severity . toUpperCase ( ) ) ) {
@@ -261,12 +271,8 @@ function run() {
261271 for ( const scan of scan_info ) {
262272 const { mobile_app_id, scan_id } = scan ;
263273 var maxWaitTime = 300000 ; // 5 minutes
264- if ( polling_timeout ) {
265- maxWaitTime = parseInt ( polling_timeout , 10 ) ;
266- // Fallback to default value if the value is incorrect
267- if ( isNaN ( maxWaitTime ) ) {
268- maxWaitTime = 300000 ;
269- }
274+ if ( parsed_polling_timeout ) {
275+ maxWaitTime = parsed_polling_timeout * 1000 ;
270276 }
271277 // Poll for scan completion with 23-second intervals
272278 const pollInterval = 23000 ; // 23 seconds
@@ -285,8 +291,9 @@ function run() {
285291 continue ;
286292 }
287293 const status_data = yield status_response . json ( ) ;
288- if ( status_data . static_scan &&
289- status_data . static_scan . status === "FAILED" ) {
294+ const scan_status = status_data . status || status_data . static_scan . status ;
295+ if ( scan_status &&
296+ [ "FAILED" , "SCAN_ATTEMPT_ERROR" , "CANCELLED" ] . includes ( scan_status ) ) {
290297 console . log ( `Scan ${ scan_id } failed, skipping vulnerability check` ) ;
291298 break ;
292299 }
0 commit comments