perimeterx-js-core 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -15
- package/lib/action/Action.d.ts +6 -0
- package/lib/action/Action.js +7 -0
- package/lib/action/ActionData.d.ts +11 -0
- package/lib/action/ActionData.js +1 -0
- package/lib/action/ActionPriorityOrder.d.ts +2 -0
- package/lib/action/ActionPriorityOrder.js +7 -0
- package/lib/action/Decision.d.ts +6 -0
- package/lib/action/Decision.js +1 -0
- package/lib/action/index.d.ts +4 -0
- package/lib/action/index.js +4 -0
- package/lib/activities/ActivityType.js +2 -5
- package/lib/activities/HttpActivityClient.d.ts +7 -7
- package/lib/activities/HttpActivityClient.js +46 -95
- package/lib/activities/HttpBatchedActivityClient.d.ts +2 -2
- package/lib/activities/HttpBatchedActivityClient.js +46 -115
- package/lib/activities/IActivityClient.d.ts +3 -3
- package/lib/activities/IActivityClient.js +1 -2
- package/lib/activities/constants.js +1 -4
- package/lib/activities/index.d.ts +7 -6
- package/lib/activities/index.js +7 -9
- package/lib/activities/model/Activity.js +1 -2
- package/lib/activities/model/ActivityDetails.d.ts +9 -7
- package/lib/activities/model/ActivityDetails.js +1 -2
- package/lib/activities/model/index.d.ts +2 -0
- package/lib/activities/model/index.js +2 -0
- package/lib/activities/utils.d.ts +11 -8
- package/lib/activities/utils.js +67 -44
- package/lib/additional_activity_handler/AdditionalActivityHandler.d.ts +2 -2
- package/lib/additional_activity_handler/AdditionalActivityHandler.js +1 -2
- package/lib/additional_activity_handler/AdditionalActivityHandlerUtils.d.ts +2 -2
- package/lib/additional_activity_handler/AdditionalActivityHandlerUtils.js +11 -53
- package/lib/additional_activity_handler/index.d.ts +2 -2
- package/lib/additional_activity_handler/index.js +2 -5
- package/lib/{block_handler → blocker}/BlockAction.d.ts +0 -1
- package/lib/blocker/BlockAction.js +6 -0
- package/lib/blocker/BlockActionToProductMap.d.ts +3 -0
- package/lib/blocker/BlockActionToProductMap.js +7 -0
- package/lib/blocker/BlockActionToWordMap.d.ts +2 -0
- package/lib/blocker/BlockActionToWordMap.js +6 -0
- package/lib/blocker/IBlocker.d.ts +5 -0
- package/lib/blocker/IBlocker.js +1 -0
- package/lib/blocker/IConditionalBlocker.d.ts +9 -0
- package/lib/blocker/IConditionalBlocker.js +1 -0
- package/lib/blocker/index.d.ts +5 -0
- package/lib/blocker/index.js +5 -0
- package/lib/config/ConfigurationParams.d.ts +23 -10
- package/lib/config/ConfigurationParams.js +1 -2
- package/lib/config/DefaultConfigurations.d.ts +1 -1
- package/lib/config/DefaultConfigurations.js +19 -13
- package/lib/config/IConfiguration.d.ts +114 -4
- package/lib/config/IConfiguration.js +1 -2
- package/lib/config/StaticConfigurationBase.d.ts +31 -3
- package/lib/config/StaticConfigurationBase.js +244 -366
- package/lib/config/index.js +2 -7
- package/lib/context/DefaultContext.d.ts +46 -0
- package/lib/context/DefaultContext.js +82 -0
- package/lib/context/index.d.ts +2 -4
- package/lib/context/index.js +2 -20
- package/lib/context/interfaces/IContext.d.ts +111 -0
- package/lib/context/interfaces/IContext.js +1 -0
- package/lib/context/interfaces/MobileData.d.ts +23 -0
- package/lib/context/interfaces/MobileData.js +1 -0
- package/lib/context/interfaces/ReadonlyContext.d.ts +3 -0
- package/lib/context/interfaces/ReadonlyContext.js +1 -0
- package/lib/context/interfaces/RequestData.d.ts +41 -0
- package/lib/context/interfaces/RequestData.js +1 -0
- package/lib/context/interfaces/RiskApiData.d.ts +27 -0
- package/lib/context/interfaces/RiskApiData.js +1 -0
- package/lib/context/interfaces/ServerData.d.ts +18 -0
- package/lib/context/interfaces/ServerData.js +1 -0
- package/lib/context/interfaces/TlsData.d.ts +30 -0
- package/lib/context/interfaces/TlsData.js +1 -0
- package/lib/context/interfaces/TokenData.d.ts +16 -0
- package/lib/context/interfaces/TokenData.js +1 -0
- package/lib/context/interfaces/index.d.ts +8 -0
- package/lib/context/interfaces/index.js +8 -0
- package/lib/cors/CustomBlockResponseHeadersHandler.d.ts +2 -0
- package/lib/cors/CustomBlockResponseHeadersHandler.js +1 -0
- package/lib/cors/CustomPreflightHandler.d.ts +2 -0
- package/lib/cors/CustomPreflightHandler.js +1 -0
- package/lib/cors/DefaultCors.d.ts +15 -0
- package/lib/cors/DefaultCors.js +59 -0
- package/lib/cors/ICors.d.ts +26 -0
- package/lib/cors/ICors.js +1 -0
- package/lib/cors/constants.d.ts +2 -0
- package/lib/cors/constants.js +2 -0
- package/lib/cors/index.d.ts +5 -0
- package/lib/cors/index.js +2 -0
- package/lib/custom_parameters/CustomParameters.js +1 -2
- package/lib/custom_parameters/CustomParametersFunction.d.ts +1 -2
- package/lib/custom_parameters/CustomParametersFunction.js +1 -2
- package/lib/custom_parameters/CustomParametersUtils.d.ts +2 -2
- package/lib/custom_parameters/CustomParametersUtils.js +18 -60
- package/lib/custom_parameters/index.js +1 -5
- package/lib/enforcer/EnforcerBase.d.ts +43 -82
- package/lib/enforcer/EnforcerBase.js +120 -377
- package/lib/enforcer/IEnforcer.js +1 -2
- package/lib/enforcer/index.d.ts +2 -1
- package/lib/enforcer/index.js +2 -5
- package/lib/enforcer/options/EnforcerBaseOptions.d.ts +25 -0
- package/lib/enforcer/options/EnforcerBaseOptions.js +1 -0
- package/lib/enforcer/options/EnforcerOptionsType.d.ts +4 -0
- package/lib/enforcer/options/EnforcerOptionsType.js +1 -0
- package/lib/enforcer/options/EnforcerV2Options.d.ts +5 -0
- package/lib/enforcer/options/EnforcerV2Options.js +1 -0
- package/lib/enforcer/options/EnforcerV3Options.d.ts +7 -0
- package/lib/enforcer/options/EnforcerV3Options.js +1 -0
- package/lib/enforcer/options/index.d.ts +4 -0
- package/lib/enforcer/options/index.js +4 -0
- package/lib/filter/FilterReason.d.ts +2 -1
- package/lib/filter/FilterReason.js +3 -5
- package/lib/filter/IFilter.d.ts +4 -4
- package/lib/filter/IFilter.js +1 -2
- package/lib/filter/index.d.ts +2 -3
- package/lib/filter/index.js +2 -7
- package/lib/first_party/FirstPartyData.d.ts +5 -0
- package/lib/first_party/FirstPartyData.js +1 -0
- package/lib/first_party/IFirstParty.d.ts +5 -5
- package/lib/first_party/IFirstParty.js +1 -2
- package/lib/first_party/index.d.ts +2 -4
- package/lib/first_party/index.js +2 -21
- package/lib/graphql/DefaultGraphQLParser.d.ts +7 -6
- package/lib/graphql/DefaultGraphQLParser.js +78 -131
- package/lib/graphql/IGraphQLParser.d.ts +5 -4
- package/lib/graphql/IGraphQLParser.js +1 -2
- package/lib/graphql/index.d.ts +3 -5
- package/lib/graphql/index.js +3 -7
- package/lib/graphql/model/GraphQLData.js +1 -2
- package/lib/graphql/model/GraphQLOperation.js +1 -2
- package/lib/graphql/model/GraphQLOperationType.js +2 -5
- package/lib/graphql/model/index.d.ts +3 -0
- package/lib/graphql/model/index.js +3 -0
- package/lib/http/impl/FormDataImpl.d.ts +12 -0
- package/lib/http/impl/FormDataImpl.js +36 -0
- package/lib/http/impl/MinimalResponseImpl.d.ts +3 -3
- package/lib/http/impl/MinimalResponseImpl.js +3 -8
- package/lib/http/impl/OutgoingRequestImpl.d.ts +3 -3
- package/lib/http/impl/OutgoingRequestImpl.js +5 -10
- package/lib/http/impl/index.d.ts +1 -0
- package/lib/http/impl/index.js +4 -19
- package/lib/http/impl/phin/PhinHttpClient.js +30 -70
- package/lib/http/impl/phin/PhinIncomingResponse.d.ts +4 -5
- package/lib/http/impl/phin/PhinIncomingResponse.js +22 -70
- package/lib/http/impl/phin/index.js +2 -18
- package/lib/http/index.js +3 -19
- package/lib/http/interfaces/IBody.d.ts +10 -12
- package/lib/http/interfaces/IBody.js +1 -2
- package/lib/http/interfaces/IFormData.d.ts +9 -0
- package/lib/http/interfaces/IFormData.js +1 -0
- package/lib/http/interfaces/IHeaders.js +1 -2
- package/lib/http/interfaces/IHttpClient.js +1 -2
- package/lib/http/interfaces/IIncomingRequest.d.ts +10 -6
- package/lib/http/interfaces/IIncomingRequest.js +1 -2
- package/lib/http/interfaces/IIncomingResponse.d.ts +2 -2
- package/lib/http/interfaces/IIncomingResponse.js +1 -2
- package/lib/http/interfaces/IMinimalResponse.d.ts +2 -2
- package/lib/http/interfaces/IMinimalResponse.js +1 -2
- package/lib/http/interfaces/IOutgoingRequest.d.ts +2 -2
- package/lib/http/interfaces/IOutgoingRequest.js +1 -2
- package/lib/http/interfaces/IOutgoingResponse.d.ts +5 -1
- package/lib/http/interfaces/IOutgoingResponse.js +1 -2
- package/lib/http/interfaces/IURL.d.ts +6 -0
- package/lib/http/interfaces/IURL.js +1 -0
- package/lib/http/interfaces/ReadonlyHeaders.d.ts +6 -0
- package/lib/http/interfaces/ReadonlyHeaders.js +14 -0
- package/lib/http/interfaces/index.d.ts +3 -1
- package/lib/http/interfaces/index.js +11 -25
- package/lib/http/utils/ContentType.js +2 -5
- package/lib/http/utils/HttpMethod.js +2 -5
- package/lib/http/utils/MinimalResponseUtils.d.ts +6 -4
- package/lib/http/utils/MinimalResponseUtils.js +31 -38
- package/lib/http/utils/MultipartFormDataUtils.d.ts +6 -0
- package/lib/http/utils/MultipartFormDataUtils.js +45 -0
- package/lib/http/utils/constants.js +9 -12
- package/lib/http/utils/index.d.ts +3 -1
- package/lib/http/utils/index.js +5 -21
- package/lib/index.d.ts +5 -1
- package/lib/index.js +22 -34
- package/lib/logger/DefaultLogger.js +7 -28
- package/lib/logger/ILogger.js +1 -2
- package/lib/logger/LoggerBase.d.ts +2 -0
- package/lib/logger/LoggerBase.js +24 -22
- package/lib/logger/LoggerSeverity.js +2 -5
- package/lib/logger/index.js +3 -9
- package/lib/phase/IPhase.d.ts +5 -0
- package/lib/phase/IPhase.js +1 -0
- package/lib/phase/PhaseResult.d.ts +5 -0
- package/lib/phase/PhaseResult.js +1 -0
- package/lib/phase/flow/EnforceFlow.d.ts +6 -0
- package/lib/phase/flow/EnforceFlow.js +15 -0
- package/lib/phase/flow/FilterFlow.d.ts +6 -0
- package/lib/phase/flow/FilterFlow.js +12 -0
- package/lib/phase/flow/PostEnforceFlow.d.ts +6 -0
- package/lib/phase/flow/PostEnforceFlow.js +10 -0
- package/lib/phase/flow/index.d.ts +3 -0
- package/lib/phase/flow/index.js +3 -0
- package/lib/phase/impl/AdditionalActivityHandlerPhase.d.ts +9 -0
- package/lib/phase/impl/AdditionalActivityHandlerPhase.js +22 -0
- package/lib/phase/impl/CompositePhase.d.ts +8 -0
- package/lib/phase/impl/CompositePhase.js +26 -0
- package/lib/phase/impl/CreateBlockResponsePhase.d.ts +17 -0
- package/lib/phase/impl/CreateBlockResponsePhase.js +60 -0
- package/lib/phase/impl/DecideActionPhase.d.ts +19 -0
- package/lib/phase/impl/DecideActionPhase.js +56 -0
- package/lib/phase/impl/EnrichContextFromRequestPhase.d.ts +18 -0
- package/lib/phase/impl/EnrichContextFromRequestPhase.js +59 -0
- package/lib/phase/impl/EnrichContextFromResponsePhase.d.ts +10 -0
- package/lib/phase/impl/EnrichContextFromResponsePhase.js +29 -0
- package/lib/phase/impl/FilterPhase.d.ts +9 -0
- package/lib/phase/impl/FilterPhase.js +19 -0
- package/lib/phase/impl/FirstPartyPhase.d.ts +12 -0
- package/lib/phase/impl/FirstPartyPhase.js +42 -0
- package/lib/phase/impl/ModifyIncomingRequestPhase.d.ts +9 -0
- package/lib/phase/impl/ModifyIncomingRequestPhase.js +20 -0
- package/lib/phase/impl/ModifyOutgoingResponsePhase.d.ts +9 -0
- package/lib/phase/impl/ModifyOutgoingResponsePhase.js +25 -0
- package/lib/phase/impl/ParseTokenPhase.d.ts +10 -0
- package/lib/phase/impl/ParseTokenPhase.js +37 -0
- package/lib/phase/impl/PreflightPhase.d.ts +12 -0
- package/lib/phase/impl/PreflightPhase.js +28 -0
- package/lib/phase/impl/RiskApiPhase.d.ts +17 -0
- package/lib/phase/impl/RiskApiPhase.js +76 -0
- package/lib/phase/impl/SendAsyncActivitiesOnRequestPhase.d.ts +10 -0
- package/lib/phase/impl/SendAsyncActivitiesOnRequestPhase.js +28 -0
- package/lib/phase/impl/SendAsyncActivitiesOnResponsePhase.d.ts +9 -0
- package/lib/phase/impl/SendAsyncActivitiesOnResponsePhase.js +20 -0
- package/lib/phase/impl/TelemetryPhase.d.ts +10 -0
- package/lib/phase/impl/TelemetryPhase.js +29 -0
- package/lib/phase/impl/index.d.ts +16 -0
- package/lib/phase/impl/index.js +16 -0
- package/lib/phase/index.d.ts +4 -0
- package/lib/phase/index.js +4 -0
- package/lib/products/account_defender/AccountDefender.d.ts +23 -0
- package/lib/products/account_defender/AccountDefender.js +98 -0
- package/lib/products/account_defender/AccountDefenderData.d.ts +6 -0
- package/lib/products/account_defender/AccountDefenderData.js +1 -0
- package/lib/products/account_defender/IAccountDefender.d.ts +4 -0
- package/lib/products/account_defender/IAccountDefender.js +1 -0
- package/lib/products/account_defender/JwtData.d.ts +4 -0
- package/lib/products/account_defender/JwtData.js +1 -0
- package/lib/products/account_defender/constants.d.ts +1 -0
- package/lib/products/account_defender/constants.js +1 -0
- package/lib/products/account_defender/index.d.ts +5 -0
- package/lib/products/account_defender/index.js +5 -0
- package/lib/products/bot_defender/BotDefender.d.ts +47 -0
- package/lib/products/bot_defender/BotDefender.js +135 -0
- package/lib/products/bot_defender/BotDefenderActionData.d.ts +7 -0
- package/lib/products/bot_defender/BotDefenderActionData.js +6 -0
- package/lib/products/bot_defender/BotDefenderData.d.ts +13 -0
- package/lib/products/bot_defender/BotDefenderData.js +1 -0
- package/lib/products/bot_defender/BotDefenderUtils.d.ts +5 -0
- package/lib/products/bot_defender/BotDefenderUtils.js +19 -0
- package/lib/products/bot_defender/IBotDefender.d.ts +7 -0
- package/lib/products/bot_defender/IBotDefender.js +1 -0
- package/lib/products/bot_defender/block/DefaultBotDefenderBlocker.d.ts +14 -0
- package/lib/products/bot_defender/block/DefaultBotDefenderBlocker.js +39 -0
- package/lib/products/bot_defender/block/captcha/CaptchaBlocker.d.ts +13 -0
- package/lib/products/bot_defender/block/captcha/CaptchaBlocker.js +20 -0
- package/lib/products/bot_defender/block/captcha/HtmlCaptchaBlocker.d.ts +9 -0
- package/lib/products/bot_defender/block/captcha/HtmlCaptchaBlocker.js +20 -0
- package/lib/products/bot_defender/block/captcha/JsonCaptchaBlocker.d.ts +10 -0
- package/lib/products/bot_defender/block/captcha/JsonCaptchaBlocker.js +38 -0
- package/lib/products/bot_defender/block/captcha/MobileCaptchaBlocker.d.ts +12 -0
- package/lib/products/bot_defender/block/captcha/MobileCaptchaBlocker.js +34 -0
- package/lib/products/bot_defender/block/captcha/index.d.ts +4 -0
- package/lib/products/bot_defender/block/captcha/index.js +4 -0
- package/lib/products/bot_defender/block/index.d.ts +5 -0
- package/lib/products/bot_defender/block/index.js +5 -0
- package/lib/{block_handler → products/bot_defender/block}/model/BlockData.d.ts +1 -1
- package/lib/products/bot_defender/block/model/BlockData.js +1 -0
- package/lib/products/bot_defender/block/model/JsonBlockPayload.js +1 -0
- package/lib/products/bot_defender/block/model/MobileBlockPayload.js +1 -0
- package/lib/products/bot_defender/block/model/index.d.ts +3 -0
- package/lib/products/bot_defender/block/model/index.js +3 -0
- package/lib/products/bot_defender/block/templates/captcha_template.js +50 -0
- package/lib/products/bot_defender/block/templates/index.d.ts +2 -0
- package/lib/products/bot_defender/block/templates/index.js +2 -0
- package/lib/products/bot_defender/block/templates/rate_limit_template.js +10 -0
- package/lib/products/bot_defender/block/utils.d.ts +5 -0
- package/lib/products/bot_defender/block/utils.js +43 -0
- package/lib/products/bot_defender/filter/DefaultBotDefenderFilter.d.ts +16 -0
- package/lib/products/bot_defender/filter/DefaultBotDefenderFilter.js +51 -0
- package/lib/products/bot_defender/filter/index.d.ts +1 -0
- package/lib/products/bot_defender/filter/index.js +1 -0
- package/lib/products/bot_defender/first_party/DefaultBotDefenderFirstParty.d.ts +20 -0
- package/lib/products/bot_defender/first_party/DefaultBotDefenderFirstParty.js +129 -0
- package/lib/products/bot_defender/first_party/FirstPartySuffix.d.ts +5 -0
- package/lib/products/bot_defender/first_party/FirstPartySuffix.js +6 -0
- package/lib/{first_party → products/bot_defender/first_party}/constants.d.ts +5 -2
- package/lib/products/bot_defender/first_party/constants.js +36 -0
- package/lib/products/bot_defender/first_party/index.d.ts +4 -0
- package/lib/products/bot_defender/first_party/index.js +4 -0
- package/lib/products/bot_defender/first_party/utils.d.ts +11 -0
- package/lib/products/bot_defender/first_party/utils.js +46 -0
- package/lib/products/bot_defender/index.d.ts +9 -0
- package/lib/products/bot_defender/index.js +9 -0
- package/lib/{block_handler/BlockReason.d.ts → products/bot_defender/reasons/BotDefenderBlockReason.d.ts} +1 -1
- package/lib/products/bot_defender/reasons/BotDefenderBlockReason.js +5 -0
- package/lib/{utils/PassReason.d.ts → products/bot_defender/reasons/BotDefenderPassReason.d.ts} +1 -1
- package/lib/products/bot_defender/reasons/BotDefenderPassReason.js +7 -0
- package/lib/products/bot_defender/reasons/BotDefenderReasonType.d.ts +5 -0
- package/lib/products/bot_defender/reasons/BotDefenderReasonType.js +1 -0
- package/lib/{risk_api/S2SCallReason.d.ts → products/bot_defender/reasons/BotDefenderS2SCallReason.d.ts} +1 -1
- package/lib/products/bot_defender/reasons/BotDefenderS2SCallReason.js +13 -0
- package/lib/products/bot_defender/reasons/index.d.ts +4 -0
- package/lib/products/bot_defender/reasons/index.js +4 -0
- package/lib/products/credential_intelligence/CredentialIntelligence.d.ts +22 -0
- package/lib/products/credential_intelligence/CredentialIntelligence.js +96 -0
- package/lib/products/credential_intelligence/ICredentialIntelligence.d.ts +4 -0
- package/lib/products/credential_intelligence/ICredentialIntelligence.js +1 -0
- package/lib/products/credential_intelligence/constants.d.ts +4 -0
- package/lib/products/credential_intelligence/constants.js +4 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpoint.d.ts +21 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpoint.js +37 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.d.ts +74 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpointConfiguration.js +1 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpointManager.d.ts +12 -0
- package/lib/products/credential_intelligence/endpoint/CredentialEndpointManager.js +32 -0
- package/lib/products/credential_intelligence/endpoint/ICredentialEndpoint.d.ts +9 -0
- package/lib/products/credential_intelligence/endpoint/ICredentialEndpoint.js +1 -0
- package/lib/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.d.ts +15 -0
- package/lib/products/credential_intelligence/endpoint/extractor/BodyCredentialExtractor.js +64 -0
- package/lib/products/credential_intelligence/endpoint/extractor/CredentialExtractorFactory.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/extractor/CredentialExtractorFactory.js +21 -0
- package/lib/products/credential_intelligence/endpoint/extractor/CustomCredentialExtractor.d.ts +9 -0
- package/lib/products/credential_intelligence/endpoint/extractor/CustomCredentialExtractor.js +24 -0
- package/lib/products/credential_intelligence/endpoint/extractor/HeaderCredentialExtractor.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/extractor/HeaderCredentialExtractor.js +22 -0
- package/lib/products/credential_intelligence/endpoint/extractor/ICredentialExtractor.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/extractor/ICredentialExtractor.js +1 -0
- package/lib/products/credential_intelligence/endpoint/extractor/QueryParamCredentialExtractor.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/extractor/QueryParamCredentialExtractor.js +23 -0
- package/lib/products/credential_intelligence/endpoint/extractor/SentThrough.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/extractor/SentThrough.js +7 -0
- package/lib/products/credential_intelligence/endpoint/extractor/index.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/extractor/index.js +5 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceHashProtocolFactory.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceHashProtocolFactory.js +17 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceVersion.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/CredentialIntelligenceVersion.js +6 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/ICredentialIntelligenceHashProtocol.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/ICredentialIntelligenceHashProtocol.js +1 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/MultistepHashProtocol.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/MultistepHashProtocol.js +30 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepAndMultistepHashProtocol.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepAndMultistepHashProtocol.js +25 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepHashProtocol.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SingleStepHashProtocol.js +49 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SsoStep.d.ts +4 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/SsoStep.js +5 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/index.d.ts +7 -0
- package/lib/products/credential_intelligence/endpoint/hash_protocol/index.js +7 -0
- package/lib/products/credential_intelligence/endpoint/index.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/index.js +8 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.d.ts +7 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/BodyLoginSuccessfulParser.js +20 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulCallback.d.ts +1 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulCallback.js +1 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulParser.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/CustomLoginSuccessfulParser.js +26 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/HeaderLoginSuccessfulParser.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/HeaderLoginSuccessfulParser.js +23 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/ILoginSuccessfulParser.d.ts +4 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/ILoginSuccessfulParser.js +1 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulParserFactory.js +26 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulReportingMethod.d.ts +6 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/LoginSuccessfulReportingMethod.js +7 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/StatusLoginSuccessfulParser.d.ts +7 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/StatusLoginSuccessfulParser.js +19 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/index.d.ts +8 -0
- package/lib/products/credential_intelligence/endpoint/login_successful/index.js +8 -0
- package/lib/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/matcher/CredentialIntelligenceEndpointMatcherFactory.js +14 -0
- package/lib/products/credential_intelligence/endpoint/matcher/ExactPathEndpointMatcher.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/matcher/ExactPathEndpointMatcher.js +9 -0
- package/lib/products/credential_intelligence/endpoint/matcher/ICredentialIntelligenceEndpointMatcher.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/matcher/ICredentialIntelligenceEndpointMatcher.js +1 -0
- package/lib/products/credential_intelligence/endpoint/matcher/PathType.d.ts +4 -0
- package/lib/products/credential_intelligence/endpoint/matcher/PathType.js +5 -0
- package/lib/products/credential_intelligence/endpoint/matcher/RegexPathEndpointMatcher.d.ts +10 -0
- package/lib/products/credential_intelligence/endpoint/matcher/RegexPathEndpointMatcher.js +9 -0
- package/lib/products/credential_intelligence/endpoint/matcher/index.d.ts +5 -0
- package/lib/products/credential_intelligence/endpoint/matcher/index.js +5 -0
- package/lib/products/credential_intelligence/index.d.ts +5 -0
- package/lib/products/credential_intelligence/index.js +5 -0
- package/lib/products/credential_intelligence/model/CredentialData.d.ts +8 -0
- package/lib/products/credential_intelligence/model/CredentialData.js +1 -0
- package/lib/products/credential_intelligence/model/CredentialIntelligenceData.d.ts +7 -0
- package/lib/products/credential_intelligence/model/CredentialIntelligenceData.js +1 -0
- package/lib/products/credential_intelligence/model/Credentials.d.ts +4 -0
- package/lib/products/credential_intelligence/model/Credentials.js +1 -0
- package/lib/products/credential_intelligence/model/CustomExtractionCallback.d.ts +2 -0
- package/lib/products/credential_intelligence/model/CustomExtractionCallback.js +1 -0
- package/lib/products/credential_intelligence/model/index.d.ts +4 -0
- package/lib/products/credential_intelligence/model/index.js +4 -0
- package/lib/products/index.d.ts +5 -0
- package/lib/products/index.js +5 -0
- package/lib/products/interfaces/IProduct.d.ts +10 -0
- package/lib/products/interfaces/IProduct.js +1 -0
- package/lib/products/interfaces/ProductData.d.ts +5 -0
- package/lib/products/interfaces/ProductData.js +1 -0
- package/lib/products/interfaces/ProductDataType.d.ts +5 -0
- package/lib/products/interfaces/ProductDataType.js +1 -0
- package/lib/products/interfaces/ProductType.d.ts +5 -0
- package/lib/products/interfaces/ProductType.js +1 -0
- package/lib/products/interfaces/Products.d.ts +5 -0
- package/lib/products/interfaces/Products.js +1 -0
- package/lib/products/interfaces/index.d.ts +5 -0
- package/lib/products/interfaces/index.js +5 -0
- package/lib/products/utils/ProductName.d.ts +7 -0
- package/lib/products/utils/ProductName.js +8 -0
- package/lib/products/utils/ProductPriorityOrder.d.ts +2 -0
- package/lib/products/utils/ProductPriorityOrder.js +8 -0
- package/lib/products/utils/index.d.ts +3 -0
- package/lib/products/utils/index.js +3 -0
- package/lib/products/utils/utils.d.ts +5 -0
- package/lib/products/utils/utils.js +12 -0
- package/lib/pxde/DefaultDataEnrichment.d.ts +7 -6
- package/lib/pxde/DefaultDataEnrichment.js +57 -116
- package/lib/pxde/IDataEnrichment.d.ts +5 -4
- package/lib/pxde/IDataEnrichment.js +1 -2
- package/lib/pxde/constants.js +4 -7
- package/lib/pxde/index.d.ts +3 -3
- package/lib/pxde/index.js +4 -20
- package/lib/pxde/model/PXDE.js +1 -2
- package/lib/pxde/model/PxdeData.d.ts +5 -0
- package/lib/pxde/model/PxdeData.js +1 -0
- package/lib/pxde/model/index.d.ts +2 -0
- package/lib/pxde/model/index.js +2 -0
- package/lib/pxhd/PXHDUtils.d.ts +5 -5
- package/lib/pxhd/PXHDUtils.js +16 -23
- package/lib/pxhd/index.d.ts +1 -0
- package/lib/pxhd/index.js +2 -5
- package/lib/pxhd/model/PXHD.d.ts +6 -0
- package/lib/pxhd/model/PXHD.js +1 -0
- package/lib/pxhd/model/PXHDSource.d.ts +4 -0
- package/lib/pxhd/model/PXHDSource.js +5 -0
- package/lib/pxhd/model/index.d.ts +2 -0
- package/lib/pxhd/model/index.js +2 -0
- package/lib/risk_api/client/IRiskApiClient.d.ts +4 -0
- package/lib/risk_api/client/IRiskApiClient.js +1 -0
- package/lib/risk_api/client/PostRiskApiClientBase.d.ts +44 -0
- package/lib/risk_api/client/PostRiskApiClientBase.js +235 -0
- package/lib/risk_api/client/PostRiskApiClientV2.d.ts +8 -0
- package/lib/risk_api/client/PostRiskApiClientV2.js +10 -0
- package/lib/risk_api/client/PostRiskApiClientV3.d.ts +8 -0
- package/lib/risk_api/client/PostRiskApiClientV3.js +10 -0
- package/lib/risk_api/client/index.d.ts +4 -0
- package/lib/risk_api/client/index.js +4 -0
- package/lib/risk_api/constants.js +1 -4
- package/lib/risk_api/index.d.ts +3 -12
- package/lib/risk_api/index.js +4 -34
- package/lib/risk_api/model/RiskActivity.d.ts +6 -2
- package/lib/risk_api/model/RiskActivity.js +1 -2
- package/lib/risk_api/model/RiskApiCallResult.d.ts +6 -0
- package/lib/risk_api/model/RiskApiCallResult.js +7 -0
- package/lib/risk_api/model/RiskStatus.js +2 -5
- package/lib/risk_api/{S2SErrorReason.js → model/S2SErrorReason.js} +2 -5
- package/lib/risk_api/model/index.d.ts +4 -0
- package/lib/risk_api/model/index.js +4 -0
- package/lib/risk_api/risk_response/IRiskResponse.d.ts +15 -0
- package/lib/risk_api/risk_response/IRiskResponse.js +1 -0
- package/lib/risk_api/risk_response/RiskResponseBase.d.ts +22 -0
- package/lib/risk_api/risk_response/RiskResponseBase.js +54 -0
- package/lib/risk_api/risk_response/RiskResponsePayloadType.d.ts +4 -0
- package/lib/risk_api/risk_response/RiskResponsePayloadType.js +1 -0
- package/lib/risk_api/risk_response/index.d.ts +4 -0
- package/lib/risk_api/risk_response/index.js +4 -0
- package/lib/risk_api/risk_response/v2/DefaultRiskResponseV2.d.ts +8 -0
- package/lib/risk_api/risk_response/v2/DefaultRiskResponseV2.js +18 -0
- package/lib/risk_api/risk_response/v2/RiskResponseV2Payload.d.ts +13 -0
- package/lib/risk_api/risk_response/v2/RiskResponseV2Payload.js +1 -0
- package/lib/risk_api/risk_response/v2/index.d.ts +2 -0
- package/lib/risk_api/risk_response/v2/index.js +2 -0
- package/lib/risk_api/risk_response/v3/DefaultRiskResponseV3.d.ts +8 -0
- package/lib/risk_api/risk_response/v3/DefaultRiskResponseV3.js +14 -0
- package/lib/risk_api/risk_response/v3/RiskResponseV3Payload.d.ts +13 -0
- package/lib/risk_api/risk_response/v3/RiskResponseV3Payload.js +1 -0
- package/lib/risk_api/risk_response/v3/index.d.ts +2 -0
- package/lib/risk_api/risk_response/v3/index.js +2 -0
- package/lib/risk_token/MobileError.js +2 -5
- package/lib/risk_token/TokenOrigin.js +2 -5
- package/lib/risk_token/{TokenVerificationResult.d.ts → TokenParseResult.d.ts} +2 -2
- package/lib/risk_token/TokenParseResult.js +7 -0
- package/lib/risk_token/TokenVersion.js +2 -5
- package/lib/risk_token/constants.js +9 -12
- package/lib/risk_token/index.d.ts +2 -3
- package/lib/risk_token/index.js +8 -32
- package/lib/risk_token/parser/DefaultTokenV2Parser.d.ts +13 -0
- package/lib/risk_token/parser/DefaultTokenV2Parser.js +14 -0
- package/lib/risk_token/parser/DefaultTokenV3Parser.d.ts +13 -0
- package/lib/risk_token/parser/DefaultTokenV3Parser.js +14 -0
- package/lib/risk_token/parser/ITokenParser.d.ts +4 -0
- package/lib/risk_token/parser/ITokenParser.js +1 -0
- package/lib/risk_token/parser/TokenParserBase.d.ts +19 -0
- package/lib/risk_token/parser/TokenParserBase.js +94 -0
- package/lib/risk_token/parser/TokenParserOptions.d.ts +4 -0
- package/lib/risk_token/parser/TokenParserOptions.js +1 -0
- package/lib/risk_token/parser/index.d.ts +5 -0
- package/lib/risk_token/parser/index.js +5 -0
- package/lib/risk_token/token/{IBotDefenderToken.d.ts → IToken.d.ts} +10 -9
- package/lib/risk_token/token/IToken.js +1 -0
- package/lib/risk_token/token/TokenBase.d.ts +32 -0
- package/lib/risk_token/token/TokenBase.js +50 -0
- package/lib/risk_token/token/TokenPayloadType.d.ts +4 -0
- package/lib/risk_token/token/TokenPayloadType.js +1 -0
- package/lib/risk_token/token/index.d.ts +6 -6
- package/lib/risk_token/token/index.js +4 -11
- package/lib/risk_token/token/v2/DefaultTokenV2.d.ts +27 -0
- package/lib/risk_token/token/v2/DefaultTokenV2.js +112 -0
- package/lib/risk_token/token/v2/{BotDefenderTokenV2Payload.d.ts → TokenV2Payload.d.ts} +1 -1
- package/lib/risk_token/token/v2/TokenV2Payload.js +1 -0
- package/lib/risk_token/token/v3/DefaultTokenV3.d.ts +30 -0
- package/lib/risk_token/token/v3/DefaultTokenV3.js +137 -0
- package/lib/risk_token/token/v3/TokenSignField.js +2 -5
- package/lib/risk_token/token/v3/TokenV3Payload.d.ts +9 -0
- package/lib/risk_token/token/v3/TokenV3Payload.js +1 -0
- package/lib/risk_token/utils.js +7 -11
- package/lib/telemetry/DefaultTelemetry.d.ts +8 -8
- package/lib/telemetry/DefaultTelemetry.js +86 -152
- package/lib/telemetry/ITelemetry.d.ts +4 -4
- package/lib/telemetry/ITelemetry.js +1 -2
- package/lib/telemetry/constants.js +7 -10
- package/lib/telemetry/index.js +2 -20
- package/lib/telemetry/model/TelemetryActivity.d.ts +1 -1
- package/lib/telemetry/model/TelemetryActivity.js +1 -2
- package/lib/utils/Algorithm.js +2 -5
- package/lib/utils/ModuleMode.js +2 -5
- package/lib/utils/VidSource.js +2 -5
- package/lib/utils/base64/AtobBase64Utils.js +6 -13
- package/lib/utils/base64/BufferBase64Utils.js +9 -16
- package/lib/utils/base64/IBase64Utils.js +1 -2
- package/lib/utils/base64/JSBase64Base64Utils.js +8 -15
- package/lib/utils/base64/index.js +4 -20
- package/lib/utils/cipher/CryptoCipherUtils.d.ts +1 -3
- package/lib/utils/cipher/CryptoCipherUtils.js +16 -53
- package/lib/utils/cipher/ICipherUtils.d.ts +2 -1
- package/lib/utils/cipher/ICipherUtils.js +1 -2
- package/lib/utils/cipher/SubtleCryptoCipherUtils.js +31 -78
- package/lib/utils/cipher/index.js +2 -18
- package/lib/utils/constants.d.ts +2 -1
- package/lib/utils/constants.js +11 -13
- package/lib/utils/cookie_parser/ICookieParser.js +1 -2
- package/lib/utils/cookie_parser/{DefaultCookieParser.d.ts → StringSplitCookieParser.d.ts} +2 -1
- package/lib/utils/cookie_parser/StringSplitCookieParser.js +28 -0
- package/lib/utils/cookie_parser/index.d.ts +2 -2
- package/lib/utils/cookie_parser/index.js +2 -5
- package/lib/utils/error/EnforcerError.js +6 -28
- package/lib/utils/error/EnforcerErrorName.js +2 -5
- package/lib/utils/error/EnforcerTimeoutError.js +7 -29
- package/lib/utils/error/index.js +3 -9
- package/lib/utils/hash/CryptoHashUtils.d.ts +11 -0
- package/lib/utils/hash/CryptoHashUtils.js +20 -0
- package/lib/utils/hash/IHashUtils.d.ts +2 -1
- package/lib/utils/hash/IHashUtils.js +1 -2
- package/lib/utils/hash/SubtleCryptoHashUtils.d.ts +8 -0
- package/lib/utils/hash/SubtleCryptoHashUtils.js +31 -0
- package/lib/utils/hash/index.d.ts +2 -2
- package/lib/utils/hash/index.js +3 -19
- package/lib/utils/{hash → hmac}/CryptoHmacUtils.d.ts +2 -2
- package/lib/utils/hmac/CryptoHmacUtils.js +19 -0
- package/lib/utils/{hash → hmac}/CryptoJSHmacUtils.d.ts +2 -2
- package/lib/utils/hmac/CryptoJSHmacUtils.js +12 -0
- package/lib/utils/hmac/IHmacUtils.d.ts +4 -0
- package/lib/utils/hmac/IHmacUtils.js +1 -0
- package/lib/utils/hmac/index.d.ts +3 -0
- package/lib/utils/hmac/index.js +3 -0
- package/lib/utils/index.d.ts +5 -6
- package/lib/utils/index.js +13 -34
- package/lib/utils/ip_range_checker/DefaultIpRangeChecker.js +5 -12
- package/lib/utils/ip_range_checker/IIpRangeChecker.js +1 -2
- package/lib/utils/ip_range_checker/index.js +1 -5
- package/lib/utils/request_id_generator/IRequestIdGenerator.d.ts +3 -0
- package/lib/utils/request_id_generator/IRequestIdGenerator.js +1 -0
- package/lib/utils/request_id_generator/UuidRequestIdGenerator.d.ts +4 -0
- package/lib/utils/request_id_generator/UuidRequestIdGenerator.js +6 -0
- package/lib/utils/request_id_generator/index.d.ts +2 -0
- package/lib/utils/request_id_generator/index.js +1 -0
- package/lib/utils/utils.d.ts +8 -2
- package/lib/utils/utils.js +55 -97
- package/package.json +5 -2
- package/lib/block_handler/BlockAction.js +0 -21
- package/lib/block_handler/BlockReason.js +0 -8
- package/lib/block_handler/DefaultBlockResponseGenerator.d.ts +0 -14
- package/lib/block_handler/DefaultBlockResponseGenerator.js +0 -49
- package/lib/block_handler/IBlockResponseGenerator.d.ts +0 -14
- package/lib/block_handler/IBlockResponseGenerator.js +0 -2
- package/lib/block_handler/captcha/CaptchaBlockResponseGenerator.d.ts +0 -14
- package/lib/block_handler/captcha/CaptchaBlockResponseGenerator.js +0 -30
- package/lib/block_handler/captcha/HtmlCaptchaResponseGenerator.d.ts +0 -10
- package/lib/block_handler/captcha/HtmlCaptchaResponseGenerator.js +0 -29
- package/lib/block_handler/captcha/JsonCaptchaResponseGenerator.d.ts +0 -10
- package/lib/block_handler/captcha/JsonCaptchaResponseGenerator.js +0 -47
- package/lib/block_handler/captcha/MobileCaptchaResponseGenerator.d.ts +0 -12
- package/lib/block_handler/captcha/MobileCaptchaResponseGenerator.js +0 -41
- package/lib/block_handler/index.d.ts +0 -13
- package/lib/block_handler/index.js +0 -21
- package/lib/block_handler/model/BlockData.js +0 -2
- package/lib/block_handler/model/JsonBlockPayload.js +0 -2
- package/lib/block_handler/model/MobileBlockPayload.js +0 -2
- package/lib/block_handler/templates/captcha_template.js +0 -4
- package/lib/block_handler/templates/rate_limit_template.js +0 -4
- package/lib/block_handler/utils.d.ts +0 -5
- package/lib/block_handler/utils.js +0 -48
- package/lib/context/ContextBase.d.ts +0 -56
- package/lib/context/ContextBase.js +0 -139
- package/lib/context/DefaultTokenV2Context.d.ts +0 -13
- package/lib/context/DefaultTokenV2Context.js +0 -35
- package/lib/context/DefaultTokenV3Context.d.ts +0 -13
- package/lib/context/DefaultTokenV3Context.js +0 -35
- package/lib/context/IContext.d.ts +0 -263
- package/lib/context/IContext.js +0 -2
- package/lib/filter/DefaultFilter.d.ts +0 -16
- package/lib/filter/DefaultFilter.js +0 -59
- package/lib/first_party/DefaultFirstParty.d.ts +0 -22
- package/lib/first_party/DefaultFirstParty.js +0 -227
- package/lib/first_party/constants.js +0 -37
- package/lib/first_party/utils.d.ts +0 -9
- package/lib/first_party/utils.js +0 -29
- package/lib/http/interfaces/ReadOnlyHeaders.d.ts +0 -4
- package/lib/http/interfaces/ReadOnlyHeaders.js +0 -19
- package/lib/risk_api/PostRiskApiClient.d.ts +0 -43
- package/lib/risk_api/PostRiskApiClient.js +0 -261
- package/lib/risk_api/S2SCallReason.js +0 -16
- package/lib/risk_api/S2SErrorHandler.d.ts +0 -9
- package/lib/risk_api/S2SErrorHandler.js +0 -121
- package/lib/risk_api/model/RiskResponseV2.d.ts +0 -12
- package/lib/risk_api/model/RiskResponseV2.js +0 -2
- package/lib/risk_api/model/RiskResponseV3.d.ts +0 -12
- package/lib/risk_api/model/RiskResponseV3.js +0 -2
- package/lib/risk_api/risk_response_handler/IRiskResponseHandler.d.ts +0 -5
- package/lib/risk_api/risk_response_handler/IRiskResponseHandler.js +0 -2
- package/lib/risk_api/risk_response_handler/RiskResponseHandlerBase.d.ts +0 -16
- package/lib/risk_api/risk_response_handler/RiskResponseHandlerBase.js +0 -73
- package/lib/risk_api/risk_response_handler/RiskResponseV2Handler.d.ts +0 -10
- package/lib/risk_api/risk_response_handler/RiskResponseV2Handler.js +0 -47
- package/lib/risk_api/risk_response_handler/RiskResponseV3Handler.d.ts +0 -10
- package/lib/risk_api/risk_response_handler/RiskResponseV3Handler.js +0 -47
- package/lib/risk_token/MobileErrorHandler.d.ts +0 -9
- package/lib/risk_token/MobileErrorHandler.js +0 -100
- package/lib/risk_token/RiskTokenScoreRetriever.d.ts +0 -14
- package/lib/risk_token/RiskTokenScoreRetriever.js +0 -148
- package/lib/risk_token/TokenVerificationResult.js +0 -10
- package/lib/risk_token/token/BotDefenderTokenBase.d.ts +0 -29
- package/lib/risk_token/token/BotDefenderTokenBase.js +0 -95
- package/lib/risk_token/token/IBotDefenderToken.js +0 -2
- package/lib/risk_token/token/v2/BotDefenderTokenV2Payload.js +0 -2
- package/lib/risk_token/token/v2/DefaultBotDefenderTokenV2.d.ts +0 -26
- package/lib/risk_token/token/v2/DefaultBotDefenderTokenV2.js +0 -206
- package/lib/risk_token/token/v3/BotDefenderTokenV3Payload.d.ts +0 -9
- package/lib/risk_token/token/v3/BotDefenderTokenV3Payload.js +0 -2
- package/lib/risk_token/token/v3/DefaultBotDefenderTokenV3.d.ts +0 -29
- package/lib/risk_token/token/v3/DefaultBotDefenderTokenV3.js +0 -231
- package/lib/utils/IScoreRetriever.d.ts +0 -14
- package/lib/utils/IScoreRetriever.js +0 -2
- package/lib/utils/PassReason.js +0 -10
- package/lib/utils/cookie_parser/DefaultCookieParser.js +0 -13
- package/lib/utils/hash/CryptoHmacUtils.js +0 -25
- package/lib/utils/hash/CryptoJSHmacUtils.js +0 -19
- package/lib/utils/uuid_generator/DefaultUuidGenerator.d.ts +0 -4
- package/lib/utils/uuid_generator/DefaultUuidGenerator.js +0 -13
- package/lib/utils/uuid_generator/IUuidGenerator.d.ts +0 -3
- package/lib/utils/uuid_generator/IUuidGenerator.js +0 -2
- package/lib/utils/uuid_generator/index.d.ts +0 -2
- package/lib/utils/uuid_generator/index.js +0 -5
- /package/lib/{block_handler → products/bot_defender/block}/model/JsonBlockPayload.d.ts +0 -0
- /package/lib/{block_handler → products/bot_defender/block}/model/MobileBlockPayload.d.ts +0 -0
- /package/lib/{block_handler → products/bot_defender/block}/templates/captcha_template.d.ts +0 -0
- /package/lib/{block_handler → products/bot_defender/block}/templates/rate_limit_template.d.ts +0 -0
- /package/lib/risk_api/{S2SErrorReason.d.ts → model/S2SErrorReason.d.ts} +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,408 +7,152 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
-
if (ar || !(i in from)) {
|
|
41
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
-
ar[i] = from[i];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.EnforcerBase = void 0;
|
|
49
|
-
var utils_1 = require("../utils");
|
|
50
|
-
var pxhd_1 = require("../pxhd");
|
|
51
|
-
var additional_activity_handler_1 = require("../additional_activity_handler");
|
|
52
|
-
var filter_1 = require("../filter");
|
|
53
|
-
var pxde_1 = require("../pxde");
|
|
54
|
-
var first_party_1 = require("../first_party");
|
|
55
|
-
var telemetry_1 = require("../telemetry");
|
|
56
|
-
var block_handler_1 = require("../block_handler");
|
|
57
|
-
var risk_token_1 = require("../risk_token");
|
|
58
|
-
var risk_api_1 = require("../risk_api");
|
|
59
|
-
var activities_1 = require("../activities");
|
|
60
|
-
var graphql_1 = require("../graphql");
|
|
61
|
-
var custom_parameters_1 = require("../custom_parameters");
|
|
62
|
-
var EnforcerBase = /** @class */ (function () {
|
|
10
|
+
import { DefaultDataEnrichment } from '../pxde';
|
|
11
|
+
import { DefaultTelemetry } from '../telemetry';
|
|
12
|
+
import { DefaultTokenV2Parser, DefaultTokenV3Parser, TokenVersion } from '../risk_token';
|
|
13
|
+
import { DefaultCors } from '../cors';
|
|
14
|
+
import { PostRiskApiClientV2, PostRiskApiClientV3 } from '../risk_api';
|
|
15
|
+
import { EnforceFlow, FilterFlow, PostEnforceFlow } from '../phase';
|
|
16
|
+
import { AccountDefender, BotDefender, CredentialIntelligence, ProductName } from '../products';
|
|
17
|
+
import { HttpActivityClient, HttpBatchedActivityClient } from '../activities';
|
|
18
|
+
import { DefaultGraphQLParser } from '../graphql';
|
|
19
|
+
export class EnforcerBase {
|
|
63
20
|
/**
|
|
64
21
|
* The EnforcerBase constructor.
|
|
65
22
|
* @param config - The enforcer configuration.
|
|
66
|
-
* @param options - An
|
|
23
|
+
* @param options - An EnforcerOptions object that allows for overriding any functional building blocks in the enforcer.
|
|
67
24
|
* @protected
|
|
68
25
|
*/
|
|
69
|
-
|
|
26
|
+
constructor(config, options) {
|
|
70
27
|
this.config = config;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
75
|
-
this.
|
|
76
|
-
this.dataEnrichment = options.dataEnrichment || new pxde_1.DefaultDataEnrichment(this.config, base64Utils, hashUtils);
|
|
77
|
-
this.graphQLParser = this.config.graphqlEnabled
|
|
78
|
-
? options.graphqlParser || new graphql_1.DefaultGraphQLParser(this.config)
|
|
79
|
-
: null;
|
|
80
|
-
var httpClient = options.httpClient;
|
|
81
|
-
this.firstParty = options.firstParty || new first_party_1.DefaultFirstParty(this.config, httpClient);
|
|
82
|
-
this.telemetry = options.telemetry || new telemetry_1.DefaultTelemetry(this.config, httpClient, base64Utils, hashUtils);
|
|
83
|
-
this.activityClient =
|
|
84
|
-
options.activityClient ||
|
|
85
|
-
(this.config.maxActivityBatchSize > 1
|
|
86
|
-
? new activities_1.HttpBatchedActivityClient(this.config, httpClient)
|
|
87
|
-
: new activities_1.HttpActivityClient(this.config, httpClient));
|
|
88
|
-
var riskResponseHandler = options.tokenVersion === risk_token_1.TokenVersion.V2
|
|
89
|
-
? new risk_api_1.RiskResponseV2Handler(this.config)
|
|
90
|
-
: new risk_api_1.RiskResponseV3Handler(this.config);
|
|
91
|
-
this.riskApiScoreRetriever =
|
|
92
|
-
options.riskApiScoreRetriever || new risk_api_1.PostRiskApiClient(this.config, httpClient, riskResponseHandler);
|
|
28
|
+
const initializationBlock = this.getInitializationBlock(config, options);
|
|
29
|
+
this.activityClient = initializationBlock.activityClient;
|
|
30
|
+
this.filterFlow = new FilterFlow(config, initializationBlock);
|
|
31
|
+
this.enforceFlow = new EnforceFlow(config, initializationBlock);
|
|
32
|
+
this.postEnforceFlow = new PostEnforceFlow(config, initializationBlock);
|
|
93
33
|
}
|
|
94
34
|
/**
|
|
95
35
|
* The central function that triggers enforcement on the incoming request.
|
|
96
36
|
* @param args - The EnforceArgs required to enforce the incoming request.
|
|
97
37
|
* @returns Promise<Res|null> - A Promise resolving to a Res or null depending on the action that should be taken.
|
|
98
38
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
var e_1;
|
|
106
|
-
return __generator(this, function (_a) {
|
|
107
|
-
switch (_a.label) {
|
|
108
|
-
case 0:
|
|
109
|
-
_a.trys.push([0, 2, , 3]);
|
|
110
|
-
if (!this.config.moduleEnabled) {
|
|
111
|
-
this.config.logger.debug('module is disabled, will not enforce');
|
|
112
|
-
return [2 /*return*/, null];
|
|
113
|
-
}
|
|
114
|
-
this.config.logger.debug('module is enabled, continuing with enforcement');
|
|
115
|
-
return [4 /*yield*/, this.doEnforce.apply(this, args)];
|
|
116
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
117
|
-
case 2:
|
|
118
|
-
e_1 = _a.sent();
|
|
119
|
-
this.config.logger.error("caught error in enforce - ".concat(e_1));
|
|
120
|
-
return [2 /*return*/, null];
|
|
121
|
-
case 3: return [2 /*return*/];
|
|
39
|
+
enforce(...args) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
try {
|
|
42
|
+
if (!this.config.moduleEnabled) {
|
|
43
|
+
this.config.logger.debug('module is disabled, will not enforce');
|
|
44
|
+
return null;
|
|
122
45
|
}
|
|
123
|
-
|
|
46
|
+
return yield this.doEnforce(...args);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
this.config.logger.error(`caught error in enforce - ${e}`);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
124
52
|
});
|
|
125
|
-
}
|
|
53
|
+
}
|
|
126
54
|
/**
|
|
127
55
|
* Performs all enforcer functionality on the incoming request context.
|
|
128
56
|
* @param args - The EnforceArgs required to enforce the incoming request.
|
|
129
57
|
* @returns Promise<Res|null> - A Promise resolving to a Res or null depending on the action that should be taken.
|
|
130
58
|
* @protected
|
|
131
59
|
*/
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
case 1:
|
|
143
|
-
context = _a.sent();
|
|
144
|
-
return [4 /*yield*/, this.handleFirstParty(context)];
|
|
145
|
-
case 2:
|
|
146
|
-
httpResponse = _a.sent();
|
|
147
|
-
if (httpResponse) {
|
|
148
|
-
this.config.logger.debug('returning first party response');
|
|
149
|
-
return [2 /*return*/, this.convertToRes(httpResponse)];
|
|
150
|
-
}
|
|
151
|
-
if (this.handleFilter(context)) {
|
|
152
|
-
this.config.logger.debug("filtering due to ".concat(context.filterReason));
|
|
153
|
-
return [2 /*return*/, null];
|
|
154
|
-
}
|
|
155
|
-
return [4 /*yield*/, this.handleCompleteContextInitialization(context)];
|
|
156
|
-
case 3:
|
|
157
|
-
_a.sent();
|
|
158
|
-
this.config.logger.debug('context initialization complete');
|
|
159
|
-
return [4 /*yield*/, this.handleGraphQL(context)];
|
|
160
|
-
case 4:
|
|
161
|
-
_a.sent();
|
|
162
|
-
return [4 /*yield*/, this.handleEnrichCustomParameters(context)];
|
|
163
|
-
case 5:
|
|
164
|
-
_a.sent();
|
|
165
|
-
return [4 /*yield*/, this.handleTelemetryIfNeeded(context)];
|
|
166
|
-
case 6:
|
|
167
|
-
_a.sent();
|
|
168
|
-
return [4 /*yield*/, this.handlePxde(context)];
|
|
169
|
-
case 7:
|
|
170
|
-
_a.sent();
|
|
171
|
-
return [4 /*yield*/, this.handleCookieRetrieverIfNeeded(context)];
|
|
172
|
-
case 8:
|
|
173
|
-
_a.sent();
|
|
174
|
-
return [4 /*yield*/, this.handleRiskApiIfNeeded(context)];
|
|
175
|
-
case 9:
|
|
176
|
-
_a.sent();
|
|
177
|
-
return [4 /*yield*/, this.handleAdditionalActivityHandler(context)];
|
|
178
|
-
case 10:
|
|
179
|
-
_a.sent();
|
|
180
|
-
return [4 /*yield*/, this.handleBlockResponse(context)];
|
|
181
|
-
case 11:
|
|
182
|
-
httpResponse = _a.sent();
|
|
183
|
-
if (httpResponse) {
|
|
184
|
-
this.config.logger.debug("blocking request due to ".concat(context.blockReason));
|
|
185
|
-
return [2 /*return*/, this.convertToRes(httpResponse)];
|
|
186
|
-
}
|
|
187
|
-
this.config.logger.debug("passing request due to ".concat(context.passReason || 'monitor mode'));
|
|
188
|
-
return [2 /*return*/, null];
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
EnforcerBase.prototype.createContext = function () {
|
|
194
|
-
var args = [];
|
|
195
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
196
|
-
args[_i] = arguments[_i];
|
|
197
|
-
}
|
|
198
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
199
|
-
return __generator(this, function (_a) {
|
|
200
|
-
return [2 /*return*/, this.constructContext.apply(this, args)];
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
EnforcerBase.prototype.handleFirstParty = function (context) {
|
|
205
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
206
|
-
return __generator(this, function (_a) {
|
|
207
|
-
switch (_a.label) {
|
|
208
|
-
case 0: return [4 /*yield*/, this.firstParty.handleFirstPartyRequest(context)];
|
|
209
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
|
-
EnforcerBase.prototype.handleFilter = function (context) {
|
|
215
|
-
return this.filter.shouldFilter(context);
|
|
216
|
-
};
|
|
217
|
-
EnforcerBase.prototype.handleCompleteContextInitialization = function (context) {
|
|
218
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
219
|
-
return __generator(this, function (_a) {
|
|
220
|
-
return [2 /*return*/];
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
};
|
|
224
|
-
EnforcerBase.prototype.handleGraphQL = function (context) {
|
|
225
|
-
var _a;
|
|
226
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
227
|
-
return __generator(this, function (_b) {
|
|
228
|
-
switch (_b.label) {
|
|
229
|
-
case 0:
|
|
230
|
-
if (!((_a = this.graphQLParser) === null || _a === void 0 ? void 0 : _a.isGraphQLRequest(context))) return [3 /*break*/, 2];
|
|
231
|
-
return [4 /*yield*/, this.graphQLParser.parseGraphQLRequest(context)];
|
|
232
|
-
case 1:
|
|
233
|
-
_b.sent();
|
|
234
|
-
_b.label = 2;
|
|
235
|
-
case 2: return [2 /*return*/];
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
};
|
|
240
|
-
EnforcerBase.prototype.handleEnrichCustomParameters = function (context) {
|
|
241
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
242
|
-
return __generator(this, function (_a) {
|
|
243
|
-
switch (_a.label) {
|
|
244
|
-
case 0: return [4 /*yield*/, custom_parameters_1.CustomParametersUtils.handleCustomParameters(this.config, context)];
|
|
245
|
-
case 1:
|
|
246
|
-
_a.sent();
|
|
247
|
-
return [2 /*return*/];
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
};
|
|
252
|
-
EnforcerBase.prototype.handleTelemetryIfNeeded = function (context) {
|
|
253
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
254
|
-
return __generator(this, function (_a) {
|
|
255
|
-
switch (_a.label) {
|
|
256
|
-
case 0: return [4 /*yield*/, this.telemetry.isValidTelemetryRequest(context)];
|
|
257
|
-
case 1:
|
|
258
|
-
if (!_a.sent()) return [3 /*break*/, 3];
|
|
259
|
-
return [4 /*yield*/, this.telemetry.sendTelemetry(context)];
|
|
260
|
-
case 2:
|
|
261
|
-
_a.sent();
|
|
262
|
-
_a.label = 3;
|
|
263
|
-
case 3: return [2 /*return*/];
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
};
|
|
268
|
-
EnforcerBase.prototype.handlePxde = function (context) {
|
|
269
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
270
|
-
return __generator(this, function (_a) {
|
|
271
|
-
switch (_a.label) {
|
|
272
|
-
case 0: return [4 /*yield*/, this.dataEnrichment.handlePxde(context)];
|
|
273
|
-
case 1:
|
|
274
|
-
_a.sent();
|
|
275
|
-
return [2 /*return*/];
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
};
|
|
280
|
-
EnforcerBase.prototype.handleCookieRetrieverIfNeeded = function (context) {
|
|
281
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
282
|
-
return __generator(this, function (_a) {
|
|
283
|
-
switch (_a.label) {
|
|
284
|
-
case 0:
|
|
285
|
-
if (!this.cookieScoreRetriever.shouldRetrieveScore(context)) return [3 /*break*/, 2];
|
|
286
|
-
this.config.logger.debug('evaluating cookie');
|
|
287
|
-
return [4 /*yield*/, this.cookieScoreRetriever.retrieveScore(context)];
|
|
288
|
-
case 1:
|
|
289
|
-
_a.sent();
|
|
290
|
-
_a.label = 2;
|
|
291
|
-
case 2: return [2 /*return*/];
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
|
-
EnforcerBase.prototype.handleRiskApiIfNeeded = function (context) {
|
|
297
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
298
|
-
return __generator(this, function (_a) {
|
|
299
|
-
switch (_a.label) {
|
|
300
|
-
case 0:
|
|
301
|
-
if (!this.riskApiScoreRetriever.shouldRetrieveScore(context)) return [3 /*break*/, 2];
|
|
302
|
-
this.config.logger.debug('sending risk api request');
|
|
303
|
-
return [4 /*yield*/, this.riskApiScoreRetriever.retrieveScore(context)];
|
|
304
|
-
case 1:
|
|
305
|
-
_a.sent();
|
|
306
|
-
_a.label = 2;
|
|
307
|
-
case 2: return [2 /*return*/];
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
};
|
|
312
|
-
EnforcerBase.prototype.handleAdditionalActivityHandler = function (context) {
|
|
313
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
314
|
-
return __generator(this, function (_a) {
|
|
315
|
-
switch (_a.label) {
|
|
316
|
-
case 0: return [4 /*yield*/, additional_activity_handler_1.AdditionalActivityHandlerUtils.invokeAdditionalActivityHandler(this.config, context)];
|
|
317
|
-
case 1:
|
|
318
|
-
_a.sent();
|
|
319
|
-
return [2 /*return*/];
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
};
|
|
324
|
-
EnforcerBase.prototype.handleBlockResponse = function (context) {
|
|
325
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
326
|
-
return __generator(this, function (_a) {
|
|
327
|
-
switch (_a.label) {
|
|
328
|
-
case 0:
|
|
329
|
-
if (!this.blockGenerator.shouldGenerate(context)) return [3 /*break*/, 2];
|
|
330
|
-
return [4 /*yield*/, this.handleSendActivities(context)];
|
|
331
|
-
case 1:
|
|
332
|
-
_a.sent();
|
|
333
|
-
return [2 /*return*/, this.blockGenerator.generateBlockResponse(context)];
|
|
334
|
-
case 2: return [2 /*return*/, null];
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
};
|
|
339
|
-
EnforcerBase.prototype.handleSendActivities = function (context) {
|
|
340
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
341
|
-
return __generator(this, function (_a) {
|
|
342
|
-
switch (_a.label) {
|
|
343
|
-
case 0: return [4 /*yield*/, this.activityClient.sendActivities(context)];
|
|
344
|
-
case 1:
|
|
345
|
-
_a.sent();
|
|
346
|
-
return [2 /*return*/];
|
|
347
|
-
}
|
|
348
|
-
});
|
|
60
|
+
doEnforce(...args) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const context = yield this.constructContext(...args);
|
|
63
|
+
let result = yield this.filterFlow.execute(context);
|
|
64
|
+
if (result.done) {
|
|
65
|
+
return result.response ? this.convertToRes(result.response) : null;
|
|
66
|
+
}
|
|
67
|
+
this.preserveContext(context, ...args);
|
|
68
|
+
result = yield this.enforceFlow.execute(context);
|
|
69
|
+
return result.response ? this.convertToRes(result.response) : null;
|
|
349
70
|
});
|
|
350
|
-
}
|
|
71
|
+
}
|
|
351
72
|
/**
|
|
352
73
|
* Performs all required functionality after an origin response has been received.
|
|
353
|
-
* @param
|
|
354
|
-
* @param res - The Res received from the origin.
|
|
355
|
-
* @param args - The EnforceArgs required to enforce the incoming request.
|
|
74
|
+
* @param args - The PostEnforce args required to enforce the incoming request.
|
|
356
75
|
* @returns Promise<void> - The response parameter will be modified as needed
|
|
357
76
|
* @protected
|
|
358
77
|
*/
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
return __generator(this, function (_a) {
|
|
367
|
-
switch (_a.label) {
|
|
368
|
-
case 0: return [4 /*yield*/, this.convertToHttpResponse(res)];
|
|
369
|
-
case 1:
|
|
370
|
-
response = _a.sent();
|
|
371
|
-
_a.label = 2;
|
|
372
|
-
case 2:
|
|
373
|
-
_a.trys.push([2, 7, , 8]);
|
|
374
|
-
context_1 = this.retrieveContext.apply(this, __spreadArray([req, res], args, false));
|
|
375
|
-
if (!context_1) return [3 /*break*/, 6];
|
|
376
|
-
return [4 /*yield*/, this.setResponseData(context_1, response)];
|
|
377
|
-
case 3:
|
|
378
|
-
_a.sent();
|
|
379
|
-
return [4 /*yield*/, this.handleSendActivities(context_1)];
|
|
380
|
-
case 4:
|
|
381
|
-
_a.sent();
|
|
382
|
-
return [4 /*yield*/, this.handlePxhd(context_1, response)];
|
|
383
|
-
case 5:
|
|
384
|
-
_a.sent();
|
|
385
|
-
_a.label = 6;
|
|
386
|
-
case 6: return [3 /*break*/, 8];
|
|
387
|
-
case 7:
|
|
388
|
-
e_2 = _a.sent();
|
|
389
|
-
this.config.logger.error("error in post enforce - ".concat(e_2));
|
|
390
|
-
return [3 /*break*/, 8];
|
|
391
|
-
case 8: return [2 /*return*/];
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
};
|
|
396
|
-
EnforcerBase.prototype.setResponseData = function (context, response) {
|
|
397
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
398
|
-
return __generator(this, function (_a) {
|
|
399
|
-
if (response.status) {
|
|
400
|
-
context.responseData.status = response.status;
|
|
78
|
+
postEnforce(...args) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
try {
|
|
81
|
+
const context = this.retrieveContext(...args);
|
|
82
|
+
if (context) {
|
|
83
|
+
context.response = yield this.convertToOutgoingResponse(...args);
|
|
84
|
+
yield this.postEnforceFlow.execute(context);
|
|
401
85
|
}
|
|
402
|
-
|
|
403
|
-
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
this.config.logger.error(`caught error in post enforce - ${e}`);
|
|
89
|
+
}
|
|
404
90
|
});
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
91
|
+
}
|
|
92
|
+
sendAdditionalS2SActivity(...args) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const context = this.retrieveContext(...args);
|
|
95
|
+
if (context) {
|
|
96
|
+
yield this.activityClient.sendActivities(context);
|
|
97
|
+
}
|
|
411
98
|
});
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Returns the components needed to initialize the enforcer according to the provided options. If no
|
|
102
|
+
* component is provided in the options, a default one is generated and returned.
|
|
103
|
+
* @param config
|
|
104
|
+
* @param options
|
|
105
|
+
* @returns Required<EnforcerBaseOptions>
|
|
106
|
+
* @protected
|
|
107
|
+
*/
|
|
108
|
+
getInitializationBlock(config, options) {
|
|
109
|
+
const { tokenVersion, httpClient, base64Utils, hmacUtils, hashUtils, ipRangeChecker } = options;
|
|
110
|
+
const cipherUtils = tokenVersion === TokenVersion.V2 ? null : options.cipherUtils;
|
|
111
|
+
const cors = options.cors || new DefaultCors(config);
|
|
112
|
+
const telemetry = options.telemetry || new DefaultTelemetry(config, httpClient, base64Utils, hmacUtils);
|
|
113
|
+
const dataEnrichment = options.dataEnrichment || new DefaultDataEnrichment(config, base64Utils, hmacUtils);
|
|
114
|
+
const graphQLParser = options.graphQLParser || new DefaultGraphQLParser(config);
|
|
115
|
+
const tokenParser = options.tokenParser ||
|
|
116
|
+
(tokenVersion === TokenVersion.V2
|
|
117
|
+
? new DefaultTokenV2Parser(config, { base64Utils, hmacUtils })
|
|
118
|
+
: new DefaultTokenV3Parser(config, { cipherUtils, hmacUtils }));
|
|
119
|
+
const riskApiClient = options.riskApiClient ||
|
|
120
|
+
(tokenVersion === TokenVersion.V2
|
|
121
|
+
? new PostRiskApiClientV2(config, httpClient)
|
|
122
|
+
: new PostRiskApiClientV3(config, httpClient));
|
|
123
|
+
const activityClient = options.activityClient ||
|
|
124
|
+
(config.maxActivityBatchSize > 1
|
|
125
|
+
? new HttpBatchedActivityClient(config, httpClient)
|
|
126
|
+
: new HttpActivityClient(config, httpClient));
|
|
127
|
+
const allOptions = {
|
|
128
|
+
httpClient,
|
|
129
|
+
base64Utils,
|
|
130
|
+
hmacUtils,
|
|
131
|
+
hashUtils,
|
|
132
|
+
ipRangeChecker,
|
|
133
|
+
cors,
|
|
134
|
+
telemetry,
|
|
135
|
+
dataEnrichment,
|
|
136
|
+
graphQLParser,
|
|
137
|
+
tokenParser,
|
|
138
|
+
riskApiClient,
|
|
139
|
+
activityClient,
|
|
140
|
+
};
|
|
141
|
+
const products = this.initializeProducts(config, options.products, base64Utils, hashUtils, ipRangeChecker);
|
|
142
|
+
return Object.assign({ products }, allOptions);
|
|
143
|
+
}
|
|
144
|
+
initializeProducts(config, products, base64Utils, hashUtils, ipRangeChecker) {
|
|
145
|
+
const botDefender = (products === null || products === void 0 ? void 0 : products.bd) || new BotDefender(config, { base64Utils, ipRangeChecker });
|
|
146
|
+
const accountDefender = (products === null || products === void 0 ? void 0 : products.ad) || new AccountDefender(config, { base64Utils });
|
|
147
|
+
const credentialIntelligence = config.ciEnabled
|
|
148
|
+
? (products === null || products === void 0 ? void 0 : products.ci) || new CredentialIntelligence(config, hashUtils)
|
|
149
|
+
: null;
|
|
150
|
+
return {
|
|
151
|
+
[ProductName.BOT_DEFENDER]: botDefender,
|
|
152
|
+
[ProductName.ACCOUNT_DEFENDER]: accountDefender,
|
|
153
|
+
[ProductName.CODE_DEFENDER]: products === null || products === void 0 ? void 0 : products.cd,
|
|
154
|
+
[ProductName.CREDENTIAL_INTELLIGENCE]: credentialIntelligence,
|
|
155
|
+
[ProductName.HYPE_SALE_CHALLENGE]: products === null || products === void 0 ? void 0 : products.hsc,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/enforcer/index.d.ts
CHANGED
package/lib/enforcer/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.EnforcerBase = void 0;
|
|
4
|
-
var EnforcerBase_1 = require("./EnforcerBase");
|
|
5
|
-
Object.defineProperty(exports, "EnforcerBase", { enumerable: true, get: function () { return EnforcerBase_1.EnforcerBase; } });
|
|
1
|
+
export { EnforcerBase } from './EnforcerBase';
|
|
2
|
+
export * from './options';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IDataEnrichment } from '../../pxde';
|
|
2
|
+
import { ITokenParser } from '../../risk_token';
|
|
3
|
+
import { IBase64Utils, IHashUtils, IHmacUtils, IIpRangeChecker } from '../../utils';
|
|
4
|
+
import { ICors } from '../../cors';
|
|
5
|
+
import { IHttpClient } from '../../http';
|
|
6
|
+
import { ITelemetry } from '../../telemetry';
|
|
7
|
+
import { IRiskApiClient } from '../../risk_api';
|
|
8
|
+
import { IActivityClient } from '../../activities';
|
|
9
|
+
import { Products } from '../../products';
|
|
10
|
+
import { IGraphQLParser } from '../../graphql';
|
|
11
|
+
export declare type EnforcerBaseOptions<Req, Res> = {
|
|
12
|
+
httpClient: IHttpClient;
|
|
13
|
+
base64Utils: IBase64Utils;
|
|
14
|
+
hmacUtils: IHmacUtils;
|
|
15
|
+
hashUtils: IHashUtils;
|
|
16
|
+
ipRangeChecker: IIpRangeChecker;
|
|
17
|
+
products?: Products<Req, Res>;
|
|
18
|
+
dataEnrichment?: IDataEnrichment<Req, Res>;
|
|
19
|
+
tokenParser?: ITokenParser<Req, Res>;
|
|
20
|
+
cors?: ICors<Req, Res>;
|
|
21
|
+
graphQLParser?: IGraphQLParser<Req, Res>;
|
|
22
|
+
telemetry?: ITelemetry<Req, Res>;
|
|
23
|
+
riskApiClient?: IRiskApiClient<Req, Res>;
|
|
24
|
+
activityClient?: IActivityClient<Req, Res>;
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TokenVersion } from '../../risk_token';
|
|
2
|
+
import { EnforcerV2Options } from './EnforcerV2Options';
|
|
3
|
+
import { EnforcerV3Options } from './EnforcerV3Options';
|
|
4
|
+
export declare type EnforcerOptionsType<TokenV extends TokenVersion, Req, Res> = TokenV extends TokenVersion.V2 ? EnforcerV2Options<Req, Res> : TokenV extends TokenVersion.V3 ? EnforcerV3Options<Req, Res> : never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TokenVersion } from '../../risk_token';
|
|
2
|
+
import { ICipherUtils } from '../../utils';
|
|
3
|
+
import { EnforcerBaseOptions } from './EnforcerBaseOptions';
|
|
4
|
+
export declare type EnforcerV3Options<Req, Res> = {
|
|
5
|
+
tokenVersion: TokenVersion.V3;
|
|
6
|
+
cipherUtils: ICipherUtils;
|
|
7
|
+
} & EnforcerBaseOptions<Req, Res>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FilterReason = void 0;
|
|
4
|
-
var FilterReason;
|
|
1
|
+
export var FilterReason;
|
|
5
2
|
(function (FilterReason) {
|
|
6
3
|
FilterReason["NONE"] = "";
|
|
7
4
|
FilterReason["ROUTE"] = "route";
|
|
@@ -9,4 +6,5 @@ var FilterReason;
|
|
|
9
6
|
FilterReason["HTTP_METHOD"] = "http_method";
|
|
10
7
|
FilterReason["USER_AGENT"] = "user_agent";
|
|
11
8
|
FilterReason["IP"] = "ip";
|
|
12
|
-
|
|
9
|
+
FilterReason["TELEMETRY_REQUEST"] = "telemetry_request";
|
|
10
|
+
})(FilterReason || (FilterReason = {}));
|