@@ -46,12 +46,15 @@ class PxEnforcer {
4646 }
4747 this . reversePrefix = this . pxConfig . conf . PX_APP_ID . substring ( 2 ) ;
4848 this . initializeCredentialsIntelligence ( this . logger , this . _config ) ;
49-
5049 }
5150
5251 initializeCredentialsIntelligence ( logger , config ) {
5352 if ( config . ENABLE_LOGIN_CREDS_EXTRACTION && config . LOGIN_CREDS_EXTRACTION . length > 0 ) {
54- this . loginCredentialsExtractor = new LoginCredentialsExtractor ( logger , config . CREDENTIALS_INTELLIGENCE_VERSION , config . LOGIN_CREDS_EXTRACTION ) ;
53+ this . loginCredentialsExtractor = new LoginCredentialsExtractor (
54+ logger ,
55+ config . CREDENTIALS_INTELLIGENCE_VERSION ,
56+ config . LOGIN_CREDS_EXTRACTION ,
57+ ) ;
5558 this . loginSuccessfulParser = LoginSuccessfulParserFactory . Create ( config ) ;
5659 }
5760 }
@@ -335,8 +338,8 @@ class PxEnforcer {
335338 const isJsonResponse =
336339 this . _config . ADVANCED_BLOCKING_RESPONSE &&
337340 acceptHeaderValue &&
338- acceptHeaderValue . split ( ',' ) . find ( ( value ) => value . toLowerCase ( ) === 'application/json' ) &&
339- ( ctx . cookieOrigin !== CookieOrigin . HEADER ) &&
341+ acceptHeaderValue . split ( ',' ) . find ( ( value ) => value . trim ( ) . toLowerCase ( ) === 'application/json' ) &&
342+ ctx . cookieOrigin !== CookieOrigin . HEADER &&
340343 ctx . blockAction !== 'r' ;
341344
342345 this . logger . debug (
@@ -346,7 +349,7 @@ class PxEnforcer {
346349 ) ;
347350 const config = this . _config ;
348351
349- this . generateResponse ( ctx , isJsonResponse , function ( responseObject ) {
352+ this . generateResponse ( ctx , isJsonResponse , function ( responseObject ) {
350353 const response = {
351354 status : '403' ,
352355 statusDescription : 'Forbidden' ,
@@ -373,11 +376,11 @@ class PxEnforcer {
373376 hostUrl : responseObject . hostUrl ,
374377 blockScript : responseObject . blockScript ,
375378 altBlockScript : responseObject . altBlockScript ,
376- customLogo : responseObject . customLogo
379+ customLogo : responseObject . customLogo ,
377380 } ;
378381 return cb ( null , response ) ;
379382 }
380-
383+
381384 pxUtil . appendContentType ( response , 'text/html' ) ;
382385
383386 response . body = responseObject ;
@@ -422,7 +425,7 @@ class PxEnforcer {
422425 const details = {
423426 ...this . getActivityDetails ( ctx ) ,
424427 px_cookie : ctx . decodedCookie ,
425- pass_reason : ctx . passReason
428+ pass_reason : ctx . passReason ,
426429 } ;
427430 if ( ctx . serverInfoRegion ) {
428431 details [ 'server_info_region' ] = ctx . serverInfoRegion ;
@@ -432,7 +435,11 @@ class PxEnforcer {
432435 this . setS2SErrorInfo ( details , ctx . s2sErrorInfo ) ;
433436 }
434437
435- if ( this . _config . ENABLE_LOGIN_CREDS_EXTRACTION && ctx . additionalFields && ctx . additionalFields . loginCredentials ) {
438+ if (
439+ this . _config . ENABLE_LOGIN_CREDS_EXTRACTION &&
440+ ctx . additionalFields &&
441+ ctx . additionalFields . loginCredentials
442+ ) {
436443 this . handleCredentialsIntelligenceInPageRequestedActivity ( ctx , req , details ) ;
437444 }
438445
@@ -451,9 +458,11 @@ class PxEnforcer {
451458
452459 if ( this . _config . ENABLE_ADDITIONAL_S2S_ACTIVITY_HEADER ) {
453460 req . headers [ Constants . DEFAULT_ADDITIONAL_ACTIVITY_HEADER_NAME ] = JSON . stringify (
454- this . pxClient . generateAdditionalS2SActivity ( ctx , this . _config )
461+ this . pxClient . generateAdditionalS2SActivity ( ctx , this . _config ) ,
455462 ) ;
456- req . headers [ Constants . DEFAULT_ADDITIONAL_ACTIVITY_URL_HEADER_NAME ] = `${ this . _config . BACKEND_URL } ${ this . _config . SERVER_COLLECT_URI } ` ;
463+ req . headers [
464+ Constants . DEFAULT_ADDITIONAL_ACTIVITY_URL_HEADER_NAME
465+ ] = `${ this . _config . BACKEND_URL } ${ this . _config . SERVER_COLLECT_URI } ` ;
457466 }
458467 }
459468
@@ -561,9 +570,9 @@ class PxEnforcer {
561570
562571 getProps ( ctx ) {
563572 let jsClientSrc = `//${ this . _config . CLIENT_HOST } /${ this . _config . PX_APP_ID } /main.min.js` ;
564- const captchaParams = `/captcha.js?a=${ ctx . blockAction } &u=${
565- ctx . uuid
566- } &v= ${ ctx . vid || '' } &m= ${ ctx . isMobile ( ) ? '1' : '0' } `;
573+ const captchaParams = `/captcha.js?a=${ ctx . blockAction } &u=${ ctx . uuid } &v= ${ ctx . vid || '' } &m= ${
574+ ctx . isMobile ( ) ? '1' : '0'
575+ } `;
567576 let captchaSrc = `//${ this . _config . CAPTCHA_HOST } /${ this . _config . PX_APP_ID } ${ captchaParams } ` ;
568577 let hostUrl = ctx . collectorUrl ;
569578
@@ -586,7 +595,7 @@ class PxEnforcer {
586595 firstPartyEnabled : this . _config . FIRST_PARTY_ENABLED ,
587596 isMobile : ctx . isMobile ( ) ,
588597 blockScript : captchaSrc ,
589- altBlockScript : `${ this . _config . BACKUP_CAPTCHA_HOST } /${ this . _config . PX_APP_ID } ${ captchaParams } `
598+ altBlockScript : `${ this . _config . BACKUP_CAPTCHA_HOST } /${ this . _config . PX_APP_ID } ${ captchaParams } ` ,
590599 } ;
591600 }
592601
0 commit comments