@oneuptime/common 14.0.98 → 14.0.99
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/Models/DatabaseModels/CloudAccount.d.mts +8 -0
- package/Models/DatabaseModels/CloudAccount.d.ts +8 -0
- package/Models/DatabaseModels/CloudAccount.js +167 -0
- package/Models/DatabaseModels/CloudAccountFeed.d.mts +27 -0
- package/Models/DatabaseModels/CloudAccountFeed.d.ts +27 -0
- package/Models/DatabaseModels/CloudAccountFeed.js +557 -0
- package/Models/DatabaseModels/CloudAccountFeed.mjs +3 -0
- package/Models/DatabaseModels/DataSecurityCheckSetting.d.mts +17 -0
- package/Models/DatabaseModels/DataSecurityCheckSetting.d.ts +17 -0
- package/Models/DatabaseModels/DataSecurityCheckSetting.js +304 -0
- package/Models/DatabaseModels/DataSecurityCheckSetting.mjs +2 -0
- package/Models/DatabaseModels/DataSecurityCustomDataType.d.mts +25 -0
- package/Models/DatabaseModels/DataSecurityCustomDataType.d.ts +25 -0
- package/Models/DatabaseModels/DataSecurityCustomDataType.js +431 -0
- package/Models/DatabaseModels/DataSecurityCustomDataType.mjs +2 -0
- package/Models/DatabaseModels/DataSecurityFlow.d.mts +26 -0
- package/Models/DatabaseModels/DataSecurityFlow.d.ts +26 -0
- package/Models/DatabaseModels/DataSecurityFlow.js +456 -0
- package/Models/DatabaseModels/DataSecurityFlow.mjs +2 -0
- package/Models/DatabaseModels/DataSecurityIssue.d.mts +49 -0
- package/Models/DatabaseModels/DataSecurityIssue.d.ts +49 -0
- package/Models/DatabaseModels/DataSecurityIssue.js +797 -0
- package/Models/DatabaseModels/DataSecurityIssue.mjs +2 -0
- package/Models/DatabaseModels/DataSecurityIssueFeed.d.mts +43 -0
- package/Models/DatabaseModels/DataSecurityIssueFeed.d.ts +43 -0
- package/Models/DatabaseModels/DataSecurityIssueFeed.js +382 -0
- package/Models/DatabaseModels/DataSecurityIssueFeed.mjs +3 -0
- package/Models/DatabaseModels/DataSecurityResidencyRule.d.mts +18 -0
- package/Models/DatabaseModels/DataSecurityResidencyRule.d.ts +18 -0
- package/Models/DatabaseModels/DataSecurityResidencyRule.js +331 -0
- package/Models/DatabaseModels/DataSecurityResidencyRule.mjs +2 -0
- package/Models/DatabaseModels/DataSecurityScan.d.mts +29 -0
- package/Models/DatabaseModels/DataSecurityScan.d.ts +29 -0
- package/Models/DatabaseModels/DataSecurityScan.js +520 -0
- package/Models/DatabaseModels/DataSecurityScan.mjs +2 -0
- package/Models/DatabaseModels/DataSecuritySetting.d.mts +35 -0
- package/Models/DatabaseModels/DataSecuritySetting.d.ts +35 -0
- package/Models/DatabaseModels/DataSecuritySetting.js +631 -0
- package/Models/DatabaseModels/DataSecuritySetting.mjs +2 -0
- package/Models/DatabaseModels/DataStore.d.mts +83 -0
- package/Models/DatabaseModels/DataStore.d.ts +83 -0
- package/Models/DatabaseModels/DataStore.js +1343 -0
- package/Models/DatabaseModels/DataStore.mjs +2 -0
- package/Models/DatabaseModels/DataStoreAccess.d.mts +22 -0
- package/Models/DatabaseModels/DataStoreAccess.d.ts +22 -0
- package/Models/DatabaseModels/DataStoreAccess.js +407 -0
- package/Models/DatabaseModels/DataStoreAccess.mjs +2 -0
- package/Models/DatabaseModels/DataStoreFeed.d.mts +36 -0
- package/Models/DatabaseModels/DataStoreFeed.d.ts +36 -0
- package/Models/DatabaseModels/DataStoreFeed.js +613 -0
- package/Models/DatabaseModels/DataStoreFeed.mjs +3 -0
- package/Models/DatabaseModels/DataStoreFinding.d.mts +38 -0
- package/Models/DatabaseModels/DataStoreFinding.d.ts +38 -0
- package/Models/DatabaseModels/DataStoreFinding.js +683 -0
- package/Models/DatabaseModels/DataStoreFinding.mjs +2 -0
- package/Models/DatabaseModels/DataStoreLabelRule.d.mts +21 -0
- package/Models/DatabaseModels/DataStoreLabelRule.d.ts +21 -0
- package/Models/DatabaseModels/DataStoreLabelRule.js +623 -0
- package/Models/DatabaseModels/DataStoreLabelRule.mjs +2 -0
- package/Models/DatabaseModels/DataStoreOwnerRule.d.mts +24 -0
- package/Models/DatabaseModels/DataStoreOwnerRule.d.ts +24 -0
- package/Models/DatabaseModels/DataStoreOwnerRule.js +714 -0
- package/Models/DatabaseModels/DataStoreOwnerRule.mjs +2 -0
- package/Models/DatabaseModels/DataStoreOwnerTeam.d.mts +19 -0
- package/Models/DatabaseModels/DataStoreOwnerTeam.d.ts +19 -0
- package/Models/DatabaseModels/DataStoreOwnerTeam.js +477 -0
- package/Models/DatabaseModels/DataStoreOwnerTeam.mjs +2 -0
- package/Models/DatabaseModels/DataStoreOwnerUser.d.mts +18 -0
- package/Models/DatabaseModels/DataStoreOwnerUser.d.ts +18 -0
- package/Models/DatabaseModels/DataStoreOwnerUser.js +476 -0
- package/Models/DatabaseModels/DataStoreOwnerUser.mjs +2 -0
- package/Models/DatabaseModels/GlobalConfig.d.mts +5 -0
- package/Models/DatabaseModels/GlobalConfig.d.ts +5 -0
- package/Models/DatabaseModels/GlobalConfig.js +110 -0
- package/Models/DatabaseModels/Index.js +35 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.d.mts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.d.ts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +43 -0
- package/Models/DatabaseModels/ResourceAiAgent.js +3 -1
- package/Models/DatabaseModels/SecurityEntityCriticality.js +7 -6
- package/Models/DatabaseModels/SecurityEntityRisk.js +2 -2
- package/Models/DatabaseModels/TelemetryException.d.mts +5 -0
- package/Models/DatabaseModels/TelemetryException.d.ts +5 -0
- package/Models/DatabaseModels/TelemetryException.js +170 -8
- package/Types/AI/AIChatPageContext.d.mts +4 -1
- package/Types/AI/AIChatPageContext.d.ts +4 -1
- package/Types/AI/AIChatPageContext.js +7 -0
- package/Types/AI/AIChatTypes.d.mts +6 -1
- package/Types/AI/AIChatTypes.d.ts +6 -1
- package/Types/AI/AIChatTypes.js +9 -0
- package/Types/AI/AiAffectedResources.js +5 -3
- package/Types/AI/CodeFixTaskContext.d.mts +21 -0
- package/Types/AI/CodeFixTaskContext.d.ts +21 -0
- package/Types/AI/CodeFixTaskContext.js +61 -4
- package/Types/AI/CodeFixTaskContext.mjs +2 -0
- package/Types/AI/CodeTask.d.mts +2 -0
- package/Types/AI/CodeTask.d.ts +2 -0
- package/Types/AI/CodeTask.js +4 -0
- package/Types/AI/ResourceAiAccessApi.d.mts +1 -0
- package/Types/AI/ResourceAiAccessApi.d.ts +1 -0
- package/Types/AI/ResourceAiAccessPermissions.js +6 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.d.mts +19 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.d.ts +19 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.js +85 -10
- package/Types/AutoRemediation/AiRemediationCommandPlan.mjs +4 -0
- package/Types/AutoRemediation/RemediationTryAgain.d.mts +17 -0
- package/Types/AutoRemediation/RemediationTryAgain.d.ts +17 -0
- package/Types/AutoRemediation/RemediationTryAgain.js +104 -0
- package/Types/AutoRemediation/RemediationTryAgain.mjs +6 -0
- package/Types/CloudConnection/CloudAiAgentCost.d.mts +19 -0
- package/Types/CloudConnection/CloudAiAgentCost.d.ts +19 -0
- package/Types/CloudConnection/CloudAiAgentCost.js +95 -0
- package/Types/CloudConnection/CloudAiAgentCost.mjs +15 -0
- package/Types/CloudConnection/CloudAiAgentSetupCommands.d.mts +70 -0
- package/Types/CloudConnection/CloudAiAgentSetupCommands.d.ts +70 -0
- package/Types/CloudConnection/CloudAiAgentSetupCommands.js +1107 -0
- package/Types/CloudConnection/CloudAiAgentSetupCommands.mjs +37 -0
- package/Types/CloudConnection/CloudConnectionCatalog.d.mts +8 -0
- package/Types/CloudConnection/CloudConnectionCatalog.d.ts +8 -0
- package/Types/CloudConnection/CloudConnectionCatalog.js +75 -1
- package/Types/CloudConnection/CloudConnectionCatalog.mjs +6 -0
- package/Types/CloudConnection/CloudConnectionSetupCommands.d.mts +48 -4
- package/Types/CloudConnection/CloudConnectionSetupCommands.d.ts +48 -4
- package/Types/CloudConnection/CloudConnectionSetupCommands.js +410 -16
- package/Types/CloudConnection/CloudConnectionSetupCommands.mjs +21 -0
- package/Types/CodeRepository/CodeHost.d.mts +2 -1
- package/Types/CodeRepository/CodeHost.d.ts +2 -1
- package/Types/CodeRepository/CodeHost.js +12 -5
- package/Types/CodeRepository/ProductionReview.d.mts +7 -0
- package/Types/CodeRepository/ProductionReview.d.ts +7 -0
- package/Types/CodeRepository/ProductionReview.js +67 -1
- package/Types/CodeRepository/ProductionReview.mjs +1 -0
- package/Types/DataSecurity/ComplianceFramework.d.mts +21 -0
- package/Types/DataSecurity/ComplianceFramework.d.ts +21 -0
- package/Types/DataSecurity/ComplianceFramework.js +97 -0
- package/Types/DataSecurity/ComplianceFramework.mjs +5 -0
- package/Types/DataSecurity/ComplianceRequirementCatalog.d.mts +41 -0
- package/Types/DataSecurity/ComplianceRequirementCatalog.d.ts +41 -0
- package/Types/DataSecurity/ComplianceRequirementCatalog.js +199 -0
- package/Types/DataSecurity/ComplianceRequirementCatalog.mjs +7 -0
- package/Types/DataSecurity/DataCategory.d.mts +15 -0
- package/Types/DataSecurity/DataCategory.d.ts +15 -0
- package/Types/DataSecurity/DataCategory.js +61 -0
- package/Types/DataSecurity/DataCategory.mjs +7 -0
- package/Types/DataSecurity/DataConfidence.d.mts +11 -0
- package/Types/DataSecurity/DataConfidence.d.ts +11 -0
- package/Types/DataSecurity/DataConfidence.js +49 -0
- package/Types/DataSecurity/DataConfidence.mjs +7 -0
- package/Types/DataSecurity/DataSecurityApiTypes.d.mts +106 -0
- package/Types/DataSecurity/DataSecurityApiTypes.d.ts +106 -0
- package/Types/DataSecurity/DataSecurityApiTypes.js +53 -0
- package/Types/DataSecurity/DataSecurityApiTypes.mjs +3 -0
- package/Types/DataSecurity/DataSecurityCheckCatalog.d.mts +93 -0
- package/Types/DataSecurity/DataSecurityCheckCatalog.d.ts +93 -0
- package/Types/DataSecurity/DataSecurityCheckCatalog.js +1183 -0
- package/Types/DataSecurity/DataSecurityCheckCatalog.mjs +10 -0
- package/Types/DataSecurity/DataSecurityIssueStatus.d.mts +10 -0
- package/Types/DataSecurity/DataSecurityIssueStatus.d.ts +10 -0
- package/Types/DataSecurity/DataSecurityIssueStatus.js +38 -0
- package/Types/DataSecurity/DataSecurityIssueStatus.mjs +5 -0
- package/Types/DataSecurity/DataSecurityResidency.d.mts +21 -0
- package/Types/DataSecurity/DataSecurityResidency.d.ts +21 -0
- package/Types/DataSecurity/DataSecurityResidency.js +92 -0
- package/Types/DataSecurity/DataSecurityResidency.mjs +5 -0
- package/Types/DataSecurity/DataSecurityResponseAction.d.mts +14 -0
- package/Types/DataSecurity/DataSecurityResponseAction.d.ts +14 -0
- package/Types/DataSecurity/DataSecurityResponseAction.js +115 -0
- package/Types/DataSecurity/DataSecurityResponseAction.mjs +11 -0
- package/Types/DataSecurity/DataSecurityRisk.d.mts +38 -0
- package/Types/DataSecurity/DataSecurityRisk.d.ts +38 -0
- package/Types/DataSecurity/DataSecurityRisk.js +138 -0
- package/Types/DataSecurity/DataSecurityRisk.mjs +7 -0
- package/Types/DataSecurity/DataSensitivity.d.mts +13 -0
- package/Types/DataSecurity/DataSensitivity.d.ts +13 -0
- package/Types/DataSecurity/DataSensitivity.js +68 -0
- package/Types/DataSecurity/DataSensitivity.mjs +8 -0
- package/Types/DataSecurity/DataStoreAccess.d.mts +27 -0
- package/Types/DataSecurity/DataStoreAccess.d.ts +27 -0
- package/Types/DataSecurity/DataStoreAccess.js +35 -0
- package/Types/DataSecurity/DataStoreAccess.mjs +4 -0
- package/Types/DataSecurity/DataStoreEnvironment.d.mts +11 -0
- package/Types/DataSecurity/DataStoreEnvironment.d.ts +11 -0
- package/Types/DataSecurity/DataStoreEnvironment.js +80 -0
- package/Types/DataSecurity/DataStoreEnvironment.mjs +5 -0
- package/Types/DataSecurity/DataStoreKey.d.mts +18 -0
- package/Types/DataSecurity/DataStoreKey.d.ts +18 -0
- package/Types/DataSecurity/DataStoreKey.js +49 -0
- package/Types/DataSecurity/DataStoreKey.mjs +7 -0
- package/Types/DataSecurity/DataStoreKind.d.mts +67 -0
- package/Types/DataSecurity/DataStoreKind.d.ts +67 -0
- package/Types/DataSecurity/DataStoreKind.js +230 -0
- package/Types/DataSecurity/DataStoreKind.mjs +10 -0
- package/Types/DataSecurity/DataStorePosture.d.mts +40 -0
- package/Types/DataSecurity/DataStorePosture.d.ts +40 -0
- package/Types/DataSecurity/DataStorePosture.js +100 -0
- package/Types/DataSecurity/DataStorePosture.mjs +7 -0
- package/Types/DataSecurity/DataTypeCatalog.d.mts +17 -0
- package/Types/DataSecurity/DataTypeCatalog.d.ts +17 -0
- package/Types/DataSecurity/DataTypeCatalog.js +434 -0
- package/Types/DataSecurity/DataTypeCatalog.mjs +4 -0
- package/Types/Email/EmailTemplateType.d.mts +1 -0
- package/Types/Email/EmailTemplateType.d.ts +1 -0
- package/Types/Email/EmailTemplateType.js +6 -0
- package/Types/Monitor/CephAlertTemplates.d.mts +2 -1
- package/Types/Monitor/CephAlertTemplates.d.ts +2 -1
- package/Types/Monitor/CephAlertTemplates.js +49 -0
- package/Types/Monitor/CephAlertTemplates.mjs +1 -0
- package/Types/Monitor/DockerAlertTemplates.d.mts +2 -1
- package/Types/Monitor/DockerAlertTemplates.d.ts +2 -1
- package/Types/Monitor/DockerAlertTemplates.js +109 -37
- package/Types/Monitor/DockerAlertTemplates.mjs +1 -0
- package/Types/Monitor/DockerMetricCatalog.d.mts +1 -0
- package/Types/Monitor/DockerMetricCatalog.d.ts +1 -0
- package/Types/Monitor/DockerMetricCatalog.js +26 -52
- package/Types/Monitor/DockerSwarmAlertTemplates.d.mts +1 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.d.ts +1 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.js +65 -8
- package/Types/Monitor/DockerSwarmAlertTemplates.mjs +1 -0
- package/Types/Monitor/DockerSwarmMetricCatalog.js +7 -4
- package/Types/Monitor/HostAlertTemplates.d.mts +2 -1
- package/Types/Monitor/HostAlertTemplates.d.ts +2 -1
- package/Types/Monitor/HostAlertTemplates.js +48 -0
- package/Types/Monitor/HostAlertTemplates.mjs +1 -0
- package/Types/Monitor/IotAlertTemplates.d.mts +1 -0
- package/Types/Monitor/IotAlertTemplates.d.ts +1 -0
- package/Types/Monitor/IotAlertTemplates.js +11 -0
- package/Types/Monitor/IotAlertTemplates.mjs +1 -0
- package/Types/Monitor/KubernetesAlertTemplates.d.mts +49 -1
- package/Types/Monitor/KubernetesAlertTemplates.d.ts +49 -1
- package/Types/Monitor/KubernetesAlertTemplates.js +392 -75
- package/Types/Monitor/KubernetesAlertTemplates.mjs +2 -0
- package/Types/Monitor/KubernetesMetricCatalog.js +12 -2
- package/Types/Monitor/MetricMonitor/MetricMonitorResponse.d.mts +4 -4
- package/Types/Monitor/MetricMonitor/MetricMonitorResponse.d.ts +4 -4
- package/Types/Monitor/MonitorCriteriaInstance.js +107 -10
- package/Types/Monitor/MonitorStep.js +50 -3
- package/Types/Monitor/MonitorStepDockerSwarmMonitor.d.mts +33 -11
- package/Types/Monitor/MonitorStepDockerSwarmMonitor.d.ts +33 -11
- package/Types/Monitor/MonitorStepDockerSwarmMonitor.js +65 -0
- package/Types/Monitor/MonitorStepKubernetesMonitor.d.mts +6 -0
- package/Types/Monitor/MonitorStepKubernetesMonitor.d.ts +6 -0
- package/Types/Monitor/MonitorStepKubernetesMonitor.js +38 -1
- package/Types/Monitor/MonitorStepKubernetesMonitor.mjs +2 -0
- package/Types/Monitor/MonitorType.d.mts +1 -0
- package/Types/Monitor/MonitorType.d.ts +1 -0
- package/Types/Monitor/MonitorType.js +18 -0
- package/Types/Monitor/PodmanAlertTemplates.d.mts +12 -1
- package/Types/Monitor/PodmanAlertTemplates.d.ts +12 -1
- package/Types/Monitor/PodmanAlertTemplates.js +161 -33
- package/Types/Monitor/PodmanAlertTemplates.mjs +2 -0
- package/Types/Monitor/PodmanMetricCatalog.d.mts +1 -0
- package/Types/Monitor/PodmanMetricCatalog.d.ts +1 -0
- package/Types/Monitor/PodmanMetricCatalog.js +26 -52
- package/Types/Monitor/ProxmoxAlertTemplates.d.mts +1 -0
- package/Types/Monitor/ProxmoxAlertTemplates.d.ts +1 -0
- package/Types/Monitor/ProxmoxAlertTemplates.js +49 -0
- package/Types/Monitor/ProxmoxAlertTemplates.mjs +1 -0
- package/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.d.mts +19 -0
- package/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.d.ts +19 -0
- package/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.js +50 -2
- package/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.mjs +2 -0
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.mts +2 -0
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.ts +2 -0
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +31 -2
- package/Types/Monitor/StorageArrayAlertTemplates.d.mts +2 -1
- package/Types/Monitor/StorageArrayAlertTemplates.d.ts +2 -1
- package/Types/Monitor/StorageArrayAlertTemplates.js +69 -0
- package/Types/Monitor/StorageArrayAlertTemplates.mjs +1 -0
- package/Types/Monitor/VMwareAlertTemplates.d.mts +2 -1
- package/Types/Monitor/VMwareAlertTemplates.d.ts +2 -1
- package/Types/Monitor/VMwareAlertTemplates.js +50 -0
- package/Types/Monitor/VMwareAlertTemplates.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.d.mts +44 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.d.ts +44 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.js +171 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.mjs +14 -0
- package/Types/Permission.d.mts +51 -0
- package/Types/Permission.d.ts +51 -0
- package/Types/Permission.js +542 -0
- package/Types/Probe/ProbeCapability.d.mts +2 -1
- package/Types/Probe/ProbeCapability.d.ts +2 -1
- package/Types/Probe/ProbeCapability.js +8 -0
- package/Types/ProviderLogo/ProviderLogo.d.mts +2 -0
- package/Types/ProviderLogo/ProviderLogo.d.ts +2 -0
- package/Types/ProviderLogo/ProviderLogo.js +4 -0
- package/Types/ResourceAiAgent/AiResourceType.d.mts +7 -1
- package/Types/ResourceAiAgent/AiResourceType.d.ts +7 -1
- package/Types/ResourceAiAgent/AiResourceType.js +76 -2
- package/Types/ResourceAiAgent/AiResourceType.mjs +3 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.d.mts +19 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.d.ts +19 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.js +75 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.mjs +16 -0
- package/Types/ResourceAiAgent/ResourceAiAccess.d.mts +12 -1
- package/Types/ResourceAiAgent/ResourceAiAccess.d.ts +12 -1
- package/Types/ResourceAiAgent/ResourceAiAccess.js +28 -1
- package/Types/ResourceAiAgent/ResourceAiAccess.mjs +6 -0
- package/Types/Rules/RuleCriteriaFieldRegistry.js +13 -0
- package/Types/Rules/RuleCriteriaSubject.d.mts +2 -1
- package/Types/Rules/RuleCriteriaSubject.d.ts +2 -1
- package/Types/Rules/RuleCriteriaSubject.js +3 -0
- package/Types/Rules/RuleRun.d.mts +2 -0
- package/Types/Rules/RuleRun.d.ts +2 -0
- package/Types/Rules/RuleRun.js +4 -0
- package/Types/SecurityCase/SecurityDetectionSource.d.mts +2 -1
- package/Types/SecurityCase/SecurityDetectionSource.d.ts +2 -1
- package/Types/SecurityCase/SecurityDetectionSource.js +5 -2
- package/Types/SecurityCase/SecurityEntity.d.mts +5 -0
- package/Types/SecurityCase/SecurityEntity.d.ts +5 -0
- package/Types/SecurityCase/SecurityEntity.js +39 -1
- package/Types/SecurityCase/SecurityEntity.mjs +4 -0
- package/Types/SecurityCase/SecurityEntityRisk.js +14 -6
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.d.mts +2 -0
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.d.ts +2 -0
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js +124 -1
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.mjs +2 -0
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorProvider.d.mts +3 -1
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorProvider.d.ts +3 -1
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorProvider.js +4 -0
- package/Types/SecurityEvent/DataSecuritySignal.d.mts +33 -0
- package/Types/SecurityEvent/DataSecuritySignal.d.ts +33 -0
- package/Types/SecurityEvent/DataSecuritySignal.js +114 -0
- package/Types/SecurityEvent/DataSecuritySignal.mjs +14 -0
- package/Types/SecurityEvent/DetectionRuleDataKind.d.mts +7 -1
- package/Types/SecurityEvent/DetectionRuleDataKind.d.ts +7 -1
- package/Types/SecurityEvent/DetectionRuleDataKind.js +74 -0
- package/Types/SecurityEvent/DetectionRuleLibrary.d.mts +2 -1
- package/Types/SecurityEvent/DetectionRuleLibrary.d.ts +2 -1
- package/Types/SecurityEvent/DetectionRuleLibrary.js +730 -0
- package/Types/SecurityEvent/OcsfEventClass.js +31 -2
- package/Types/SecurityEvent/SecurityLogFormat.d.mts +15 -0
- package/Types/SecurityEvent/SecurityLogFormat.d.ts +15 -0
- package/Types/SecurityEvent/SecurityLogFormat.js +123 -10
- package/Types/SecurityEvent/SecurityLogFormat.mjs +4 -0
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.mts +3 -0
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.ts +3 -0
- package/Types/SecurityPlaybook/SecurityPlaybookAction.js +37 -0
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.mts +3 -0
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.ts +3 -0
- package/Types/SecurityPlaybook/SecurityPlaybookStep.js +9 -0
- package/Types/SecurityPlaybook/SecurityProtectedEntity.js +8 -1
- package/Types/Telemetry/ExceptionAIDigest.d.mts +31 -0
- package/Types/Telemetry/ExceptionAIDigest.d.ts +31 -0
- package/Types/Telemetry/ExceptionAIDigest.js +131 -0
- package/Types/Telemetry/ExceptionAIDigest.mjs +13 -0
- package/Types/Telemetry/ExceptionAIExplanation.d.mts +37 -0
- package/Types/Telemetry/ExceptionAIExplanation.d.ts +37 -0
- package/Types/Telemetry/ExceptionAIExplanation.js +110 -0
- package/Types/Telemetry/ExceptionAIExplanation.mjs +12 -0
- package/Types/Telemetry/TraceSpanType.d.mts +1 -1
- package/Types/Telemetry/TraceSpanType.d.ts +1 -1
- package/Types/Telemetry/TraceSpanType.js +33 -8
- package/Types/Telemetry/TraceSpanType.mjs +1 -1
- package/Types/UpdateCheck/SecurityAdvisory.d.mts +39 -0
- package/Types/UpdateCheck/SecurityAdvisory.d.ts +39 -0
- package/Types/UpdateCheck/SecurityAdvisory.js +221 -0
- package/Types/UpdateCheck/SecurityAdvisory.mjs +7 -0
- package/Types/UpdateCheck/UpdateCheckFailure.d.mts +9 -0
- package/Types/UpdateCheck/UpdateCheckFailure.d.ts +9 -0
- package/Types/UpdateCheck/UpdateCheckFailure.js +32 -0
- package/Types/UpdateCheck/UpdateCheckFailure.mjs +3 -0
- package/Types/UpdateCheck/UpdateStatus.d.mts +44 -0
- package/Types/UpdateCheck/UpdateStatus.d.ts +44 -0
- package/Types/UpdateCheck/UpdateStatus.js +195 -0
- package/Types/UpdateCheck/UpdateStatus.mjs +3 -0
- package/Types/Workspace/WorkspaceMessagePayload.d.mts +1 -0
- package/Types/Workspace/WorkspaceMessagePayload.d.ts +1 -0
- package/Utils/AiRemediation/CloudChangeDryRunPlan.d.mts +17 -0
- package/Utils/AiRemediation/CloudChangeDryRunPlan.d.ts +17 -0
- package/Utils/AiRemediation/CloudChangeDryRunPlan.js +122 -0
- package/Utils/AiRemediation/CloudChangeDryRunPlan.mjs +7 -0
- package/Utils/AiRemediation/Resource/CloudCommandPolicy.d.mts +4 -0
- package/Utils/AiRemediation/Resource/CloudCommandPolicy.d.ts +4 -0
- package/Utils/AiRemediation/Resource/CloudCommandPolicy.js +177 -0
- package/Utils/AiRemediation/Resource/CloudCommandPolicy.mjs +4 -0
- package/Utils/AiRemediation/Resource/CloudOperationCatalog.d.mts +144 -0
- package/Utils/AiRemediation/Resource/CloudOperationCatalog.d.ts +144 -0
- package/Utils/AiRemediation/Resource/CloudOperationCatalog.js +1964 -0
- package/Utils/AiRemediation/Resource/CloudOperationCatalog.mjs +48 -0
- package/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +4 -0
- package/Utils/DataSecurity/CustomDataTypeDetector.d.mts +23 -0
- package/Utils/DataSecurity/CustomDataTypeDetector.d.ts +23 -0
- package/Utils/DataSecurity/CustomDataTypeDetector.js +130 -0
- package/Utils/DataSecurity/CustomDataTypeDetector.mjs +8 -0
- package/Utils/DataSecurity/Detector.d.mts +26 -0
- package/Utils/DataSecurity/Detector.d.ts +26 -0
- package/Utils/DataSecurity/Detector.js +83 -0
- package/Utils/DataSecurity/Detector.mjs +8 -0
- package/Utils/DataSecurity/Detectors/ContactDetectors.d.mts +12 -0
- package/Utils/DataSecurity/Detectors/ContactDetectors.d.ts +12 -0
- package/Utils/DataSecurity/Detectors/ContactDetectors.js +915 -0
- package/Utils/DataSecurity/Detectors/ContactDetectors.mjs +12 -0
- package/Utils/DataSecurity/Detectors/DocumentMarkingDetectors.d.mts +3 -0
- package/Utils/DataSecurity/Detectors/DocumentMarkingDetectors.d.ts +3 -0
- package/Utils/DataSecurity/Detectors/DocumentMarkingDetectors.js +52 -0
- package/Utils/DataSecurity/Detectors/DocumentMarkingDetectors.mjs +3 -0
- package/Utils/DataSecurity/Detectors/FinancialDetectors.d.mts +8 -0
- package/Utils/DataSecurity/Detectors/FinancialDetectors.d.ts +8 -0
- package/Utils/DataSecurity/Detectors/FinancialDetectors.js +566 -0
- package/Utils/DataSecurity/Detectors/FinancialDetectors.mjs +8 -0
- package/Utils/DataSecurity/Detectors/GovernmentIdDetectors.d.mts +3 -0
- package/Utils/DataSecurity/Detectors/GovernmentIdDetectors.d.ts +3 -0
- package/Utils/DataSecurity/Detectors/GovernmentIdDetectors.js +2415 -0
- package/Utils/DataSecurity/Detectors/GovernmentIdDetectors.mjs +3 -0
- package/Utils/DataSecurity/Detectors/HealthIdentifierDetectors.d.mts +3 -0
- package/Utils/DataSecurity/Detectors/HealthIdentifierDetectors.d.ts +3 -0
- package/Utils/DataSecurity/Detectors/HealthIdentifierDetectors.js +258 -0
- package/Utils/DataSecurity/Detectors/HealthIdentifierDetectors.mjs +3 -0
- package/Utils/DataSecurity/Detectors/HealthRecordDetectors.d.mts +3 -0
- package/Utils/DataSecurity/Detectors/HealthRecordDetectors.d.ts +3 -0
- package/Utils/DataSecurity/Detectors/HealthRecordDetectors.js +115 -0
- package/Utils/DataSecurity/Detectors/HealthRecordDetectors.mjs +3 -0
- package/Utils/DataSecurity/Detectors/Index.d.mts +4 -0
- package/Utils/DataSecurity/Detectors/Index.d.ts +4 -0
- package/Utils/DataSecurity/Detectors/Index.js +47 -0
- package/Utils/DataSecurity/Detectors/Index.mjs +4 -0
- package/Utils/DataSecurity/Detectors/SecretDetectors.d.mts +11 -0
- package/Utils/DataSecurity/Detectors/SecretDetectors.d.ts +11 -0
- package/Utils/DataSecurity/Detectors/SecretDetectors.js +1733 -0
- package/Utils/DataSecurity/Detectors/SecretDetectors.mjs +11 -0
- package/Utils/DataSecurity/FieldClassifier.d.mts +20 -0
- package/Utils/DataSecurity/FieldClassifier.d.ts +20 -0
- package/Utils/DataSecurity/FieldClassifier.js +247 -0
- package/Utils/DataSecurity/FieldClassifier.mjs +5 -0
- package/Utils/DataSecurity/FieldCollector.d.mts +23 -0
- package/Utils/DataSecurity/FieldCollector.d.ts +23 -0
- package/Utils/DataSecurity/FieldCollector.js +81 -0
- package/Utils/DataSecurity/FieldCollector.mjs +3 -0
- package/Utils/DataSecurity/FieldNameHints.d.mts +9 -0
- package/Utils/DataSecurity/FieldNameHints.d.ts +9 -0
- package/Utils/DataSecurity/FieldNameHints.js +184 -0
- package/Utils/DataSecurity/FieldNameHints.mjs +6 -0
- package/Utils/DataSecurity/FindingTally.d.mts +44 -0
- package/Utils/DataSecurity/FindingTally.d.ts +44 -0
- package/Utils/DataSecurity/FindingTally.js +138 -0
- package/Utils/DataSecurity/FindingTally.mjs +6 -0
- package/Utils/DataSecurity/Masking.d.mts +6 -0
- package/Utils/DataSecurity/Masking.d.ts +6 -0
- package/Utils/DataSecurity/Masking.js +159 -0
- package/Utils/DataSecurity/Masking.mjs +7 -0
- package/Utils/DataSecurity/PathPattern.d.mts +3 -0
- package/Utils/DataSecurity/PathPattern.d.ts +3 -0
- package/Utils/DataSecurity/PathPattern.js +55 -0
- package/Utils/DataSecurity/PathPattern.mjs +4 -0
- package/Utils/DataSecurity/Sha256.d.mts +1 -0
- package/Utils/DataSecurity/Sha256.d.ts +1 -0
- package/Utils/DataSecurity/Sha256.js +94 -0
- package/Utils/DataSecurity/Sha256.mjs +2 -0
- package/Utils/DataSecurity/TextScanner.d.mts +35 -0
- package/Utils/DataSecurity/TextScanner.d.ts +35 -0
- package/Utils/DataSecurity/TextScanner.js +303 -0
- package/Utils/DataSecurity/TextScanner.mjs +8 -0
- package/Utils/DataSecurity/Validators.d.mts +16 -0
- package/Utils/DataSecurity/Validators.d.ts +16 -0
- package/Utils/DataSecurity/Validators.js +339 -0
- package/Utils/DataSecurity/Validators.mjs +17 -0
- package/Utils/Exceptions/ExceptionIssueState.d.mts +18 -0
- package/Utils/Exceptions/ExceptionIssueState.d.ts +18 -0
- package/Utils/Exceptions/ExceptionIssueState.js +131 -0
- package/Utils/Exceptions/ExceptionIssueState.mjs +8 -0
- package/Utils/HostCollector/HostCollectorDefaultConfig.d.mts +2 -0
- package/Utils/HostCollector/HostCollectorDefaultConfig.d.ts +2 -0
- package/Utils/HostCollector/HostCollectorDefaultConfig.js +39 -1
- package/Utils/HostCollector/HostCollectorDefaultConfig.mjs +2 -0
- package/Utils/LabelRuleImportExport.js +17 -3
- package/Utils/Monitor/PlatformResourceIdentity.js +7 -4
- package/Utils/SecurityAdvisoryMatcher.d.mts +33 -0
- package/Utils/SecurityAdvisoryMatcher.d.ts +33 -0
- package/Utils/SecurityAdvisoryMatcher.js +291 -0
- package/Utils/SecurityAdvisoryMatcher.mjs +2 -0
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.mts +24 -0
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.ts +24 -0
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.js +380 -0
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.mjs +15 -0
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.mts +29 -0
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.ts +29 -0
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.js +527 -0
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.mjs +13 -0
- package/Utils/SecurityEvent/Connectors/Microsoft365AuditNormalizer.d.mts +21 -0
- package/Utils/SecurityEvent/Connectors/Microsoft365AuditNormalizer.d.ts +21 -0
- package/Utils/SecurityEvent/Connectors/Microsoft365AuditNormalizer.js +365 -0
- package/Utils/SecurityEvent/Connectors/Microsoft365AuditNormalizer.mjs +11 -0
- package/Utils/SecurityEvent/LogParsers/AzureActivityLogParser.d.mts +17 -0
- package/Utils/SecurityEvent/LogParsers/AzureActivityLogParser.d.ts +17 -0
- package/Utils/SecurityEvent/LogParsers/AzureActivityLogParser.js +344 -0
- package/Utils/SecurityEvent/LogParsers/AzureActivityLogParser.mjs +12 -0
- package/Utils/SecurityEvent/LogParsers/GoogleCloudAuditLogParser.d.mts +27 -0
- package/Utils/SecurityEvent/LogParsers/GoogleCloudAuditLogParser.d.ts +27 -0
- package/Utils/SecurityEvent/LogParsers/GoogleCloudAuditLogParser.js +326 -0
- package/Utils/SecurityEvent/LogParsers/GoogleCloudAuditLogParser.mjs +10 -0
- package/Utils/SecurityEvent/LogParsers/SecurityDeviceLogParser.d.mts +38 -0
- package/Utils/SecurityEvent/LogParsers/SecurityDeviceLogParser.d.ts +38 -0
- package/Utils/SecurityEvent/LogParsers/SecurityDeviceLogParser.js +629 -0
- package/Utils/SecurityEvent/LogParsers/SecurityDeviceLogParser.mjs +13 -0
- package/Utils/SecurityEvent/LogParsers/SecurityLogLine.d.mts +9 -0
- package/Utils/SecurityEvent/LogParsers/SecurityLogLine.d.ts +9 -0
- package/Utils/SecurityEvent/LogParsers/SecurityLogLine.js +63 -3
- package/Utils/SecurityEvent/LogParsers/SecurityLogLine.mjs +4 -0
- package/Utils/SecurityEvent/LogParsers/SecurityLogParser.js +54 -0
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.mts +26 -0
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.ts +26 -0
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.js +1046 -0
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.mjs +11 -0
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.mts +19 -0
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.ts +19 -0
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.js +724 -0
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.mjs +7 -0
- package/Utils/SecurityEvent/SecurityRecordReading.d.mts +32 -0
- package/Utils/SecurityEvent/SecurityRecordReading.d.ts +32 -0
- package/Utils/SecurityEvent/SecurityRecordReading.js +78 -0
- package/Utils/SecurityEvent/SecurityRecordReading.mjs +2 -0
- package/Utils/Sms/OnCallPageSms.d.mts +1 -0
- package/Utils/Sms/OnCallPageSms.d.ts +1 -0
- package/Utils/Sms/OnCallPageSms.js +16 -2
- package/Utils/Suggestions/InvestigationCodeFixSuggestion.d.mts +44 -0
- package/Utils/Suggestions/InvestigationCodeFixSuggestion.d.ts +44 -0
- package/Utils/Suggestions/InvestigationCodeFixSuggestion.js +223 -0
- package/Utils/Suggestions/InvestigationCodeFixSuggestion.mjs +8 -0
- package/Utils/Syslog/LeefParser.d.mts +28 -0
- package/Utils/Syslog/LeefParser.d.ts +28 -0
- package/Utils/Syslog/LeefParser.js +326 -0
- package/Utils/Syslog/LeefParser.mjs +10 -0
- package/Utils/VersionRange.d.mts +34 -0
- package/Utils/VersionRange.d.ts +34 -0
- package/Utils/VersionRange.js +422 -0
- package/Utils/VersionRange.mjs +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1733 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SECRET_DETECTORS = void 0;
|
|
7
|
+
exports.isExampleToken = isExampleToken;
|
|
8
|
+
exports.decodeBase64 = decodeBase64;
|
|
9
|
+
exports.isPlaceholderSecret = isPlaceholderSecret;
|
|
10
|
+
exports.isGenericSecretValue = isGenericSecretValue;
|
|
11
|
+
exports.isAzureSasToken = isAzureSasToken;
|
|
12
|
+
exports.isJwtWithHeader = isJwtWithHeader;
|
|
13
|
+
exports.isSampleJwt = isSampleJwt;
|
|
14
|
+
exports.basicCredentials = basicCredentials;
|
|
15
|
+
const DataConfidence_1 = __importDefault(require("../../../Types/DataSecurity/DataConfidence"));
|
|
16
|
+
const Detector_1 = require("../Detector");
|
|
17
|
+
const Validators_1 = require("../Validators");
|
|
18
|
+
/*
|
|
19
|
+
* SECRETS AND CREDENTIALS: WHAT UNLOCKS ANOTHER SYSTEM.
|
|
20
|
+
*
|
|
21
|
+
* A leaked key is the one finding that is an incident on its own: whoever
|
|
22
|
+
* reads it can spend the account, read the bucket, push to the repository.
|
|
23
|
+
* Most providers now mint keys with a fixed prefix (ghp_, xoxb-, sk_live_,
|
|
24
|
+
* AKIA) so that scanners can find them, and the prefix with the provider's
|
|
25
|
+
* length and alphabet is proof enough on its own. A key without one - an
|
|
26
|
+
* AWS secret, a Datadog key, 32 hex characters - counts only next to words
|
|
27
|
+
* that say whose it is. A value assigned to a field called "password" or
|
|
28
|
+
* "api_key" counts when it is random enough to be real and is none of the
|
|
29
|
+
* placeholders documentation is full of.
|
|
30
|
+
*
|
|
31
|
+
* Documented examples (AKIAIOSFODNN7EXAMPLE), test-mode keys (sk_test_) and
|
|
32
|
+
* placeholders (ghp_xxxx...) are test values: counted apart, never
|
|
33
|
+
* findings.
|
|
34
|
+
*
|
|
35
|
+
* Every value group ends its match, so a value's place in the text is the
|
|
36
|
+
* match's end less the value's length.
|
|
37
|
+
*/
|
|
38
|
+
/*
|
|
39
|
+
* What follows a key's prefix is filler, not a key, when it is this
|
|
40
|
+
* predictable (bits per character) or repeats one character this many
|
|
41
|
+
* times in a row: "xxxxxxxx", "00000000". A real key's random part sits
|
|
42
|
+
* near 4 to 6 bits per character and never runs one character eight times.
|
|
43
|
+
*/
|
|
44
|
+
const FILLER_ENTROPY = 2;
|
|
45
|
+
const FILLER_RUN = 8;
|
|
46
|
+
// The longest run of one character repeated: 5 in "abxxxxxc".
|
|
47
|
+
function longestRun(value) {
|
|
48
|
+
let longest = 0;
|
|
49
|
+
let run = 0;
|
|
50
|
+
for (let index = 0; index < value.length; index++) {
|
|
51
|
+
run = index > 0 && value[index] === value[index - 1] ? run + 1 : 1;
|
|
52
|
+
if (run > longest) {
|
|
53
|
+
longest = run;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return longest;
|
|
57
|
+
}
|
|
58
|
+
/*
|
|
59
|
+
* Whether a key is a documented example or a placeholder rather than one
|
|
60
|
+
* someone holds: it says EXAMPLE, as AWS's do (AKIAIOSFODNN7EXAMPLE), or
|
|
61
|
+
* what follows its prefix is filler - "ghp_xxxx...", "T00000000".
|
|
62
|
+
*/
|
|
63
|
+
function isExampleToken(value, prefixes = []) {
|
|
64
|
+
if (value.includes("EXAMPLE")) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
let body = value;
|
|
68
|
+
for (const prefix of prefixes) {
|
|
69
|
+
if (value.startsWith(prefix) &&
|
|
70
|
+
value.length - prefix.length < body.length) {
|
|
71
|
+
body = value.slice(prefix.length);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return (body.length === 0 ||
|
|
75
|
+
(0, Validators_1.shannonEntropy)(body) < FILLER_ENTROPY ||
|
|
76
|
+
longestRun(body) >= FILLER_RUN);
|
|
77
|
+
}
|
|
78
|
+
function characterKinds(value) {
|
|
79
|
+
const kinds = {
|
|
80
|
+
upper: false,
|
|
81
|
+
lower: false,
|
|
82
|
+
digit: false,
|
|
83
|
+
symbol: false,
|
|
84
|
+
};
|
|
85
|
+
for (let index = 0; index < value.length; index++) {
|
|
86
|
+
const code = value.charCodeAt(index);
|
|
87
|
+
if (code >= 65 && code <= 90) {
|
|
88
|
+
kinds.upper = true;
|
|
89
|
+
}
|
|
90
|
+
else if (code >= 97 && code <= 122) {
|
|
91
|
+
kinds.lower = true;
|
|
92
|
+
}
|
|
93
|
+
else if (code >= 48 && code <= 57) {
|
|
94
|
+
kinds.digit = true;
|
|
95
|
+
}
|
|
96
|
+
else if (code !== 46 && code !== 95 && code !== 45) {
|
|
97
|
+
kinds.symbol = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return kinds;
|
|
101
|
+
}
|
|
102
|
+
// The value of one base64 digit, standard (+ /) or URL-safe (- _), or -1.
|
|
103
|
+
function base64Digit(code) {
|
|
104
|
+
if (code >= 65 && code <= 90) {
|
|
105
|
+
return code - 65;
|
|
106
|
+
}
|
|
107
|
+
if (code >= 97 && code <= 122) {
|
|
108
|
+
return code - 71;
|
|
109
|
+
}
|
|
110
|
+
if (code >= 48 && code <= 57) {
|
|
111
|
+
return code + 4;
|
|
112
|
+
}
|
|
113
|
+
if (code === 43 || code === 45) {
|
|
114
|
+
return 62;
|
|
115
|
+
}
|
|
116
|
+
if (code === 47 || code === 95) {
|
|
117
|
+
return 63;
|
|
118
|
+
}
|
|
119
|
+
return -1;
|
|
120
|
+
}
|
|
121
|
+
/*
|
|
122
|
+
* Decodes base64 in either alphabet, with or without its "=" padding, or
|
|
123
|
+
* returns null when the text is not base64. Written out rather than taken
|
|
124
|
+
* from Node's Buffer, which the browser does not have.
|
|
125
|
+
*/
|
|
126
|
+
function decodeBase64(value) {
|
|
127
|
+
let end = value.length;
|
|
128
|
+
while (end > 0 && value.charCodeAt(end - 1) === 61) {
|
|
129
|
+
end--;
|
|
130
|
+
}
|
|
131
|
+
const padding = value.length - end;
|
|
132
|
+
if (padding > 2 || end % 4 === 1 || (padding > 0 && value.length % 4 !== 0)) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
const bytes = [];
|
|
136
|
+
let buffer = 0;
|
|
137
|
+
let bits = 0;
|
|
138
|
+
for (let index = 0; index < end; index++) {
|
|
139
|
+
const digit = base64Digit(value.charCodeAt(index));
|
|
140
|
+
if (digit < 0) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
// At most 14 bits are ever pending, so 24 hold them all.
|
|
144
|
+
buffer = ((buffer << 6) | digit) & 0xffffff;
|
|
145
|
+
bits += 6;
|
|
146
|
+
if (bits >= 8) {
|
|
147
|
+
bits -= 8;
|
|
148
|
+
bytes.push((buffer >> bits) & 0xff);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return Uint8Array.from(bytes);
|
|
152
|
+
}
|
|
153
|
+
// Bytes as text, one character per byte: enough for JSON and "user:pass".
|
|
154
|
+
function bytesToText(bytes) {
|
|
155
|
+
let text = "";
|
|
156
|
+
for (let index = 0; index < bytes.length; index++) {
|
|
157
|
+
text += String.fromCharCode(bytes[index]);
|
|
158
|
+
}
|
|
159
|
+
return text;
|
|
160
|
+
}
|
|
161
|
+
/*
|
|
162
|
+
* Words a placeholder is made of, compared after the digits and marks a
|
|
163
|
+
* placeholder is dressed in are taken off ("password123!", "_secret_").
|
|
164
|
+
*/
|
|
165
|
+
const PLACEHOLDER_WORDS = new Set([
|
|
166
|
+
"password",
|
|
167
|
+
"passwd",
|
|
168
|
+
"passw0rd",
|
|
169
|
+
"p@ssw0rd",
|
|
170
|
+
"p@ssword",
|
|
171
|
+
"pass",
|
|
172
|
+
"pwd",
|
|
173
|
+
"secret",
|
|
174
|
+
"token",
|
|
175
|
+
"apikey",
|
|
176
|
+
"api_key",
|
|
177
|
+
"api-key",
|
|
178
|
+
"key",
|
|
179
|
+
"changeme",
|
|
180
|
+
"change_me",
|
|
181
|
+
"change-me",
|
|
182
|
+
"changeit",
|
|
183
|
+
"example",
|
|
184
|
+
"sample",
|
|
185
|
+
"test",
|
|
186
|
+
"testing",
|
|
187
|
+
"dummy",
|
|
188
|
+
"fake",
|
|
189
|
+
"placeholder",
|
|
190
|
+
"redacted",
|
|
191
|
+
"removed",
|
|
192
|
+
"hidden",
|
|
193
|
+
"masked",
|
|
194
|
+
"null",
|
|
195
|
+
"nil",
|
|
196
|
+
"none",
|
|
197
|
+
"undefined",
|
|
198
|
+
"true",
|
|
199
|
+
"false",
|
|
200
|
+
"empty",
|
|
201
|
+
"default",
|
|
202
|
+
"unknown",
|
|
203
|
+
"todo",
|
|
204
|
+
"tbd",
|
|
205
|
+
"fixme",
|
|
206
|
+
"foo",
|
|
207
|
+
"bar",
|
|
208
|
+
"foobar",
|
|
209
|
+
"qwerty",
|
|
210
|
+
"letmein",
|
|
211
|
+
"admin",
|
|
212
|
+
"root",
|
|
213
|
+
"guest",
|
|
214
|
+
"user",
|
|
215
|
+
"username",
|
|
216
|
+
"value",
|
|
217
|
+
"string",
|
|
218
|
+
"required",
|
|
219
|
+
"notset",
|
|
220
|
+
"not_set",
|
|
221
|
+
"unset",
|
|
222
|
+
"xxx",
|
|
223
|
+
"pw",
|
|
224
|
+
"pa$$w0rd",
|
|
225
|
+
"pa55word",
|
|
226
|
+
"hunter2",
|
|
227
|
+
"demo",
|
|
228
|
+
"mock",
|
|
229
|
+
]);
|
|
230
|
+
// Words a placeholder holds between its separators: "sk-smoke-test-0123".
|
|
231
|
+
const PLACEHOLDER_SEGMENTS = new Set([
|
|
232
|
+
"test",
|
|
233
|
+
"testing",
|
|
234
|
+
"example",
|
|
235
|
+
"sample",
|
|
236
|
+
"dummy",
|
|
237
|
+
"fake",
|
|
238
|
+
"placeholder",
|
|
239
|
+
"changeme",
|
|
240
|
+
"mock",
|
|
241
|
+
"fixture",
|
|
242
|
+
]);
|
|
243
|
+
// How a placeholder starts: "your-api-key", "test_secret", "changeme123".
|
|
244
|
+
const PLACEHOLDER_STARTS = [
|
|
245
|
+
"your",
|
|
246
|
+
"test",
|
|
247
|
+
"example",
|
|
248
|
+
"sample",
|
|
249
|
+
"dummy",
|
|
250
|
+
"fake",
|
|
251
|
+
"placeholder",
|
|
252
|
+
"changeme",
|
|
253
|
+
"change-me",
|
|
254
|
+
"change_me",
|
|
255
|
+
"redacted",
|
|
256
|
+
"replace",
|
|
257
|
+
"insert",
|
|
258
|
+
"enter",
|
|
259
|
+
];
|
|
260
|
+
/*
|
|
261
|
+
* What a template, a masked value or a placeholder holds anywhere:
|
|
262
|
+
* "${DB_PASSWORD}", "{{ secret }}", "#{token}", "$(cat key)", "%(pw)s",
|
|
263
|
+
* "********", "sk-xxxx", "<your key>", "abc...", and the straight runs
|
|
264
|
+
* people type for a value that does not matter ("123456", "abcdef").
|
|
265
|
+
*/
|
|
266
|
+
const PLACEHOLDER_MARKERS = [
|
|
267
|
+
"${",
|
|
268
|
+
"{{",
|
|
269
|
+
"#{",
|
|
270
|
+
"$(",
|
|
271
|
+
"%(",
|
|
272
|
+
"***",
|
|
273
|
+
"xxxx",
|
|
274
|
+
"...",
|
|
275
|
+
"\u2026",
|
|
276
|
+
"<",
|
|
277
|
+
">",
|
|
278
|
+
"123456",
|
|
279
|
+
"654321",
|
|
280
|
+
"987654",
|
|
281
|
+
"abcdef",
|
|
282
|
+
];
|
|
283
|
+
// How a value made of a placeholder's words is split: "sk-smoke-test-0123".
|
|
284
|
+
const SEGMENT_SEPARATORS = "-_.:/ ";
|
|
285
|
+
function hasPlaceholderSegment(lower) {
|
|
286
|
+
let segment = "";
|
|
287
|
+
for (let index = 0; index <= lower.length; index++) {
|
|
288
|
+
const character = lower[index] || " ";
|
|
289
|
+
if (!SEGMENT_SEPARATORS.includes(character)) {
|
|
290
|
+
segment += character;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (PLACEHOLDER_SEGMENTS.has(segment)) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
segment = "";
|
|
297
|
+
}
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
// Marks a placeholder ends in: "password123!", "secret_".
|
|
301
|
+
const TRAILING_MARKS = "0123456789!@#$%^&*._-?";
|
|
302
|
+
function isIdentifierText(value) {
|
|
303
|
+
if (value.length === 0) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
for (let index = 0; index < value.length; index++) {
|
|
307
|
+
const code = value.charCodeAt(index);
|
|
308
|
+
if (!((code >= 48 && code <= 57) ||
|
|
309
|
+
(code >= 65 && code <= 90) ||
|
|
310
|
+
(code >= 97 && code <= 122) ||
|
|
311
|
+
code === 95)) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
// A lower-cased value without the marks it is dressed in.
|
|
318
|
+
function placeholderCore(lower) {
|
|
319
|
+
let start = 0;
|
|
320
|
+
let end = lower.length;
|
|
321
|
+
while (start < end && "_.-".includes(lower[start])) {
|
|
322
|
+
start++;
|
|
323
|
+
}
|
|
324
|
+
while (end > start && TRAILING_MARKS.includes(lower[end - 1])) {
|
|
325
|
+
end--;
|
|
326
|
+
}
|
|
327
|
+
return lower.slice(start, end);
|
|
328
|
+
}
|
|
329
|
+
/*
|
|
330
|
+
* Whether a secret is a placeholder rather than one: a word documentation
|
|
331
|
+
* and templates write ("changeme", "your-password", "<password>"), a
|
|
332
|
+
* template or a variable that holds it ("${DB_PASSWORD}", "$PASSWORD",
|
|
333
|
+
* "%DB_PASS%"), or a masked value ("********"). A value that says EXAMPLE
|
|
334
|
+
* is a documented example, counted as a test value, so it is not refused
|
|
335
|
+
* here.
|
|
336
|
+
*/
|
|
337
|
+
function isPlaceholderSecret(value) {
|
|
338
|
+
if (value.includes("EXAMPLE")) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
const lower = value.toLowerCase();
|
|
342
|
+
if (lower.length === 0 || longestRun(lower) === lower.length) {
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
for (const marker of PLACEHOLDER_MARKERS) {
|
|
346
|
+
if (lower.includes(marker)) {
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
const first = lower[0];
|
|
351
|
+
const last = lower[lower.length - 1];
|
|
352
|
+
if (first === "%" ||
|
|
353
|
+
(first === "[" && last === "]") ||
|
|
354
|
+
(first === "(" && last === ")") ||
|
|
355
|
+
(first === "{" && last === "}") ||
|
|
356
|
+
(lower.startsWith("__") && lower.endsWith("__")) ||
|
|
357
|
+
(first === "$" && isIdentifierText(value.slice(1)))) {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
const core = placeholderCore(lower);
|
|
361
|
+
if (PLACEHOLDER_WORDS.has(lower) || PLACEHOLDER_WORDS.has(core)) {
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
if (lower.startsWith("my") &&
|
|
365
|
+
PLACEHOLDER_WORDS.has(placeholderCore(core.slice(2)))) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
for (const start of PLACEHOLDER_STARTS) {
|
|
369
|
+
if (lower.startsWith(start)) {
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return (hasPlaceholderSegment(lower) ||
|
|
374
|
+
lower.endsWith("_here") ||
|
|
375
|
+
lower.endsWith("-here") ||
|
|
376
|
+
lower.endsWith(".here"));
|
|
377
|
+
}
|
|
378
|
+
/*
|
|
379
|
+
* Code that reads a secret, not the secret: a property path
|
|
380
|
+
* ("options.password", "config.db2", TypeScript's "monitor.id!"), optional
|
|
381
|
+
* chaining ("req.body?."), a pointer or a scope ("$this->pw",
|
|
382
|
+
* "Config::KEY"), a member access cut short ("settings.").
|
|
383
|
+
*/
|
|
384
|
+
function isCodeReference(value) {
|
|
385
|
+
if (value.endsWith(".") ||
|
|
386
|
+
value.includes("?.") ||
|
|
387
|
+
value.includes("->") ||
|
|
388
|
+
value.includes("::")) {
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
let path = value;
|
|
392
|
+
while (path.endsWith("!")) {
|
|
393
|
+
path = path.slice(0, -1);
|
|
394
|
+
}
|
|
395
|
+
if (!path.includes(".")) {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
return path.split(".").every((segment) => {
|
|
399
|
+
const code = segment.charCodeAt(0);
|
|
400
|
+
return (isIdentifierText(segment) &&
|
|
401
|
+
((code >= 65 && code <= 90) || (code >= 97 && code <= 122) || code === 95));
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
// A mark a password is made with: anything but letters, digits and . _ - /.
|
|
405
|
+
function hasPasswordMark(value) {
|
|
406
|
+
for (let index = 0; index < value.length; index++) {
|
|
407
|
+
const code = value.charCodeAt(index);
|
|
408
|
+
if (!((code >= 48 && code <= 57) ||
|
|
409
|
+
(code >= 65 && code <= 90) ||
|
|
410
|
+
(code >= 97 && code <= 122) ||
|
|
411
|
+
code === 46 ||
|
|
412
|
+
code === 95 ||
|
|
413
|
+
code === 45 ||
|
|
414
|
+
code === 47)) {
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
// A path on disk: what PWD= holds in a shell's environment.
|
|
421
|
+
function isPathLike(value) {
|
|
422
|
+
if (value.includes("+") || value.includes("=")) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
if (value.startsWith("/") ||
|
|
426
|
+
value.startsWith("./") ||
|
|
427
|
+
value.startsWith("../") ||
|
|
428
|
+
value.startsWith("~/")) {
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
const code = value.charCodeAt(0);
|
|
432
|
+
return (value.length > 2 &&
|
|
433
|
+
((code >= 65 && code <= 90) || (code >= 97 && code <= 122)) &&
|
|
434
|
+
value[1] === ":" &&
|
|
435
|
+
(value[2] === "\\" || value[2] === "/"));
|
|
436
|
+
}
|
|
437
|
+
/*
|
|
438
|
+
* What a config holds in place of a secret: where to read it (an
|
|
439
|
+
* environment variable, a vault path, an ARN), or code that reads it.
|
|
440
|
+
*/
|
|
441
|
+
const SECRET_REFERENCE_STARTS = [
|
|
442
|
+
"process.env",
|
|
443
|
+
"os.environ",
|
|
444
|
+
"os.getenv",
|
|
445
|
+
"getenv",
|
|
446
|
+
"system.getenv",
|
|
447
|
+
"env.",
|
|
448
|
+
"env:",
|
|
449
|
+
"this.",
|
|
450
|
+
"self.",
|
|
451
|
+
"config.",
|
|
452
|
+
"settings.",
|
|
453
|
+
"secrets.",
|
|
454
|
+
"vault:",
|
|
455
|
+
"arn:",
|
|
456
|
+
"projects/",
|
|
457
|
+
"op://",
|
|
458
|
+
"ref+",
|
|
459
|
+
"file:",
|
|
460
|
+
"keyvault:",
|
|
461
|
+
"@microsoft.keyvault",
|
|
462
|
+
];
|
|
463
|
+
// How a password hash starts: bcrypt, argon2, scrypt, crypt(3), Django, LDAP.
|
|
464
|
+
const PASSWORD_HASH_STARTS = [
|
|
465
|
+
"$2a$",
|
|
466
|
+
"$2b$",
|
|
467
|
+
"$2x$",
|
|
468
|
+
"$2y$",
|
|
469
|
+
"$argon2",
|
|
470
|
+
"$scrypt$",
|
|
471
|
+
"$7$",
|
|
472
|
+
"$1$",
|
|
473
|
+
"$5$",
|
|
474
|
+
"$6$",
|
|
475
|
+
"$apr1$",
|
|
476
|
+
"$pbkdf2",
|
|
477
|
+
"$sha1$",
|
|
478
|
+
"pbkdf2_",
|
|
479
|
+
"pbkdf2:",
|
|
480
|
+
"scrypt:",
|
|
481
|
+
"argon2$",
|
|
482
|
+
"bcrypt$",
|
|
483
|
+
"bcrypt_sha256$",
|
|
484
|
+
"sha1$",
|
|
485
|
+
"md5$",
|
|
486
|
+
"{ssha}",
|
|
487
|
+
"{sha}",
|
|
488
|
+
"{ssha256}",
|
|
489
|
+
"{ssha512}",
|
|
490
|
+
"{bcrypt}",
|
|
491
|
+
"{crypt}",
|
|
492
|
+
"{md5}",
|
|
493
|
+
"{pbkdf2}",
|
|
494
|
+
];
|
|
495
|
+
// Words that make a value the name of a secret, not the secret: "db-password".
|
|
496
|
+
const SECRET_NAME_WORDS = [
|
|
497
|
+
"password",
|
|
498
|
+
"passwd",
|
|
499
|
+
"secret",
|
|
500
|
+
"token",
|
|
501
|
+
"apikey",
|
|
502
|
+
"api_key",
|
|
503
|
+
"api-key",
|
|
504
|
+
"credential",
|
|
505
|
+
];
|
|
506
|
+
function hasSecretNameWord(lower) {
|
|
507
|
+
return SECRET_NAME_WORDS.some((word) => {
|
|
508
|
+
return lower.includes(word);
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
// A date or a timestamp: 2024-03-15, 2024-03-15T14:27:39Z.
|
|
512
|
+
const ISO_DATE_START = /^[0-9]{4}-[0-9]{2}-[0-9]{2}/;
|
|
513
|
+
const GENERIC_SECRET_MIN_LENGTH = 8;
|
|
514
|
+
const GENERIC_SECRET_MAX_LENGTH = 128;
|
|
515
|
+
const GENERIC_SECRET_ENTROPY = 3;
|
|
516
|
+
// A value of lower-case letters, digits and separators reads like a name ...
|
|
517
|
+
const GENERIC_NAME_LIKE_ENTROPY = 3.5;
|
|
518
|
+
/*
|
|
519
|
+
* Whether a value assigned to a password, secret or API key is one: long
|
|
520
|
+
* enough, random enough (3 bits per character - "Tr0ub4dor&3" passes,
|
|
521
|
+
* "password1" does not), and none of the things that stand in for one - a
|
|
522
|
+
* placeholder, a reference, a path, a URL, a password hash, a date, code
|
|
523
|
+
* that reads it ("config.password"), the secret's name ("db-password").
|
|
524
|
+
*/
|
|
525
|
+
function isGenericSecretValue(value) {
|
|
526
|
+
if (value.length < GENERIC_SECRET_MIN_LENGTH ||
|
|
527
|
+
value.length > GENERIC_SECRET_MAX_LENGTH ||
|
|
528
|
+
isPlaceholderSecret(value) ||
|
|
529
|
+
isPathLike(value) ||
|
|
530
|
+
ISO_DATE_START.test(value)) {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
const lower = value.toLowerCase();
|
|
534
|
+
if (lower.includes("://")) {
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
for (const start of [...SECRET_REFERENCE_STARTS, ...PASSWORD_HASH_STARTS]) {
|
|
538
|
+
if (lower.startsWith(start)) {
|
|
539
|
+
return false;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (hasSecretNameWord(lower) || isCodeReference(value)) {
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
const kinds = characterKinds(value);
|
|
546
|
+
// Letters and separators only: a word, an identifier, "Username/Passwort".
|
|
547
|
+
if (!kinds.digit && !hasPasswordMark(value)) {
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
if (!kinds.upper &&
|
|
551
|
+
!kinds.lower &&
|
|
552
|
+
!kinds.symbol &&
|
|
553
|
+
(0, Detector_1.isPlaceholderDigits)(value)) {
|
|
554
|
+
return false;
|
|
555
|
+
}
|
|
556
|
+
// ... or a path of names: "prod/db/postgres".
|
|
557
|
+
if (!kinds.upper && value.includes("/")) {
|
|
558
|
+
return false;
|
|
559
|
+
}
|
|
560
|
+
const entropy = (0, Validators_1.shannonEntropy)(value);
|
|
561
|
+
if (!kinds.upper && !kinds.symbol) {
|
|
562
|
+
return entropy >= GENERIC_NAME_LIKE_ENTROPY;
|
|
563
|
+
}
|
|
564
|
+
return entropy >= GENERIC_SECRET_ENTROPY;
|
|
565
|
+
}
|
|
566
|
+
// Documentation's own domains (RFC 2606, RFC 6761).
|
|
567
|
+
const RESERVED_HOSTS = new Set([
|
|
568
|
+
"example.com",
|
|
569
|
+
"example.org",
|
|
570
|
+
"example.net",
|
|
571
|
+
"example.edu",
|
|
572
|
+
]);
|
|
573
|
+
const RESERVED_HOST_SUFFIXES = [
|
|
574
|
+
".example",
|
|
575
|
+
".test",
|
|
576
|
+
".invalid",
|
|
577
|
+
".example.com",
|
|
578
|
+
".example.org",
|
|
579
|
+
".example.net",
|
|
580
|
+
];
|
|
581
|
+
function isReservedHost(host) {
|
|
582
|
+
const lower = host.toLowerCase();
|
|
583
|
+
return (RESERVED_HOSTS.has(lower) ||
|
|
584
|
+
RESERVED_HOST_SUFFIXES.some((suffix) => {
|
|
585
|
+
return lower.endsWith(suffix);
|
|
586
|
+
}));
|
|
587
|
+
}
|
|
588
|
+
function prefixedToken(options) {
|
|
589
|
+
const isOtherTestValue = options.isTestValue;
|
|
590
|
+
return {
|
|
591
|
+
dataTypeId: options.dataTypeId,
|
|
592
|
+
quickCheck: (0, Detector_1.containsAny)(options.prefixes),
|
|
593
|
+
pattern: options.pattern,
|
|
594
|
+
validate: options.validate,
|
|
595
|
+
keywords: options.keywords,
|
|
596
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
597
|
+
specificity: 3,
|
|
598
|
+
isTestValue: (normalized) => {
|
|
599
|
+
return (isExampleToken(normalized, options.prefixes) ||
|
|
600
|
+
Boolean(isOtherTestValue && isOtherTestValue(normalized)));
|
|
601
|
+
},
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
/*
|
|
605
|
+
* AWS access key ID: one of the four prefixes AWS mints keys with - AKIA
|
|
606
|
+
* (a user's long-term key), ASIA (a temporary STS key), ABIA (an STS
|
|
607
|
+
* bearer token), ACCA (a context-specific credential) - and sixteen
|
|
608
|
+
* base-32 characters.
|
|
609
|
+
*/
|
|
610
|
+
const AWS_ACCESS_KEY_ID_PATTERN = /(?<![A-Za-z0-9])(?:AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16}(?![A-Za-z0-9])/g;
|
|
611
|
+
const awsAccessKeyIdDetector = prefixedToken({
|
|
612
|
+
dataTypeId: "aws-access-key-id",
|
|
613
|
+
prefixes: ["AKIA", "ASIA", "ABIA", "ACCA"],
|
|
614
|
+
pattern: AWS_ACCESS_KEY_ID_PATTERN,
|
|
615
|
+
keywords: ["aws", "access key", "access_key", "accesskeyid", "key id"],
|
|
616
|
+
});
|
|
617
|
+
/*
|
|
618
|
+
* AWS secret access key: 40 base64 characters, exactly - not part of a
|
|
619
|
+
* longer run, nor a part of a dotted token - mixing upper and lower case
|
|
620
|
+
* with a digit or a mark, as 30 random bytes do (a SHA-1's 40 hex
|
|
621
|
+
* characters never have upper case). On its shape alone it is any random
|
|
622
|
+
* value, so it counts only next to words that name it.
|
|
623
|
+
*/
|
|
624
|
+
const AWS_SECRET_ACCESS_KEY_PATTERN = /(?<![A-Za-z0-9+/_-]|[A-Za-z0-9_-]\.)[A-Za-z0-9+/]{40}(?![A-Za-z0-9+/=_-]|\.[A-Za-z0-9_-])/g;
|
|
625
|
+
const AWS_SECRET_ENTROPY = 3.5;
|
|
626
|
+
const awsSecretAccessKeyDetector = {
|
|
627
|
+
dataTypeId: "aws-secret-access-key",
|
|
628
|
+
pattern: AWS_SECRET_ACCESS_KEY_PATTERN,
|
|
629
|
+
validate: (normalized) => {
|
|
630
|
+
const kinds = characterKinds(normalized);
|
|
631
|
+
return (kinds.upper &&
|
|
632
|
+
kinds.lower &&
|
|
633
|
+
(kinds.digit || kinds.symbol) &&
|
|
634
|
+
(0, Validators_1.shannonEntropy)(normalized) >= AWS_SECRET_ENTROPY);
|
|
635
|
+
},
|
|
636
|
+
keywords: [
|
|
637
|
+
"aws",
|
|
638
|
+
"secret_access_key",
|
|
639
|
+
"secret-access-key",
|
|
640
|
+
"secret access key",
|
|
641
|
+
"secretaccesskey",
|
|
642
|
+
"awssecretaccesskey",
|
|
643
|
+
"aws_secret",
|
|
644
|
+
"secret_key",
|
|
645
|
+
"secretkey",
|
|
646
|
+
"awssecretkey",
|
|
647
|
+
],
|
|
648
|
+
requiresContext: true,
|
|
649
|
+
confidenceWithoutContext: DataConfidence_1.default.Medium,
|
|
650
|
+
specificity: 2,
|
|
651
|
+
isTestValue: (normalized) => {
|
|
652
|
+
return isExampleToken(normalized);
|
|
653
|
+
},
|
|
654
|
+
};
|
|
655
|
+
// Google API key: "AIza" and 35 URL-safe base64 characters.
|
|
656
|
+
const GOOGLE_API_KEY_PATTERN = /(?<![A-Za-z0-9_-])AIza[A-Za-z0-9_-]{35}(?![A-Za-z0-9_-])/g;
|
|
657
|
+
const googleApiKeyDetector = prefixedToken({
|
|
658
|
+
dataTypeId: "google-api-key",
|
|
659
|
+
prefixes: ["AIza"],
|
|
660
|
+
pattern: GOOGLE_API_KEY_PATTERN,
|
|
661
|
+
keywords: [
|
|
662
|
+
"google",
|
|
663
|
+
"api key",
|
|
664
|
+
"api_key",
|
|
665
|
+
"apikey",
|
|
666
|
+
"gcp",
|
|
667
|
+
"firebase",
|
|
668
|
+
"maps",
|
|
669
|
+
],
|
|
670
|
+
});
|
|
671
|
+
/*
|
|
672
|
+
* Google service account key file: its "private_key_id" field, 40 hex
|
|
673
|
+
* characters - the JSON Google hands out with the private key beside it.
|
|
674
|
+
* The field's name is only Google's, so the key ID is the finding, also
|
|
675
|
+
* when the JSON is escaped inside a string (\"private_key_id\").
|
|
676
|
+
*/
|
|
677
|
+
const GOOGLE_SERVICE_ACCOUNT_KEY_PATTERN = /(?<![A-Za-z0-9_])private_key_id\\?["']?\s{0,4}[:=]\s{0,4}\\?["']?([0-9a-f]{40})(?![A-Za-z0-9])/g;
|
|
678
|
+
const googleServiceAccountKeyDetector = {
|
|
679
|
+
dataTypeId: "google-service-account-key",
|
|
680
|
+
quickCheck: (0, Detector_1.containsAny)(["private_key_id"]),
|
|
681
|
+
pattern: GOOGLE_SERVICE_ACCOUNT_KEY_PATTERN,
|
|
682
|
+
valueGroup: 1,
|
|
683
|
+
keywords: [
|
|
684
|
+
"service_account",
|
|
685
|
+
"service account",
|
|
686
|
+
"gserviceaccount.com",
|
|
687
|
+
"client_email",
|
|
688
|
+
"private_key",
|
|
689
|
+
],
|
|
690
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
691
|
+
specificity: 3,
|
|
692
|
+
isTestValue: (normalized) => {
|
|
693
|
+
return isExampleToken(normalized);
|
|
694
|
+
},
|
|
695
|
+
};
|
|
696
|
+
// Google OAuth client secret: "GOCSPX-" and 28 URL-safe characters.
|
|
697
|
+
const GOOGLE_OAUTH_CLIENT_SECRET_PATTERN = /(?<![A-Za-z0-9_-])GOCSPX-[A-Za-z0-9_-]{28}(?![A-Za-z0-9_-])/g;
|
|
698
|
+
const googleOAuthClientSecretDetector = prefixedToken({
|
|
699
|
+
dataTypeId: "google-oauth-client-secret",
|
|
700
|
+
prefixes: ["GOCSPX-"],
|
|
701
|
+
pattern: GOOGLE_OAUTH_CLIENT_SECRET_PATTERN,
|
|
702
|
+
keywords: ["google", "client_secret", "client secret", "oauth"],
|
|
703
|
+
});
|
|
704
|
+
/*
|
|
705
|
+
* Azure storage account key: 64 bytes in base64 - 86 characters and "==" -
|
|
706
|
+
* next to words that name it, as a connection string does
|
|
707
|
+
* (DefaultEndpointsProtocol=...;AccountKey=...) and as the portal, the CLI
|
|
708
|
+
* and Terraform state do.
|
|
709
|
+
*/
|
|
710
|
+
const AZURE_STORAGE_ACCOUNT_KEY_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{86}==(?![A-Za-z0-9+/=])/g;
|
|
711
|
+
const AZURE_STORAGE_KEY_BYTES = 64;
|
|
712
|
+
const azureStorageAccountKeyDetector = {
|
|
713
|
+
dataTypeId: "azure-storage-account-key",
|
|
714
|
+
quickCheck: (0, Detector_1.containsAny)(["=="]),
|
|
715
|
+
pattern: AZURE_STORAGE_ACCOUNT_KEY_PATTERN,
|
|
716
|
+
validate: (normalized) => {
|
|
717
|
+
const bytes = decodeBase64(normalized);
|
|
718
|
+
return bytes !== null && bytes.length === AZURE_STORAGE_KEY_BYTES;
|
|
719
|
+
},
|
|
720
|
+
keywords: [
|
|
721
|
+
"accountkey",
|
|
722
|
+
"account_key",
|
|
723
|
+
"account-key",
|
|
724
|
+
"account key",
|
|
725
|
+
"storageaccountkey",
|
|
726
|
+
"storage_key",
|
|
727
|
+
"storagekey",
|
|
728
|
+
"storage key",
|
|
729
|
+
"primary_access_key",
|
|
730
|
+
"secondary_access_key",
|
|
731
|
+
"defaultendpointsprotocol",
|
|
732
|
+
"azure",
|
|
733
|
+
"windows.net",
|
|
734
|
+
],
|
|
735
|
+
requiresContext: true,
|
|
736
|
+
confidenceWithoutContext: DataConfidence_1.default.Medium,
|
|
737
|
+
specificity: 2,
|
|
738
|
+
isTestValue: (normalized) => {
|
|
739
|
+
return isExampleToken(normalized);
|
|
740
|
+
},
|
|
741
|
+
};
|
|
742
|
+
/*
|
|
743
|
+
* Azure shared access signature: a signed version that is a real date
|
|
744
|
+
* (sv=2022-11-02), the token's other fields, and a signature (sig=) that is
|
|
745
|
+
* an HMAC-SHA256 - 32 bytes - in URL-encoded base64. The whole query is the
|
|
746
|
+
* value; sig is always written last.
|
|
747
|
+
*
|
|
748
|
+
* Bounded on text anyone may write: the fields between sv= and &sig= are at
|
|
749
|
+
* most 400 characters, so a run of sv=...&sig= without a signature is read
|
|
750
|
+
* in time in line with the text, the scanner's 4 MiB window too
|
|
751
|
+
* (SecretDetectorPatternTiming.test.ts).
|
|
752
|
+
*/
|
|
753
|
+
const AZURE_SAS_TOKEN_PATTERN = /(?<![A-Za-z0-9_])sv=20[1-9][0-9]-[01][0-9]-[0-3][0-9][A-Za-z0-9%&=:._~-]{0,400}?&sig=[A-Za-z0-9%+/]{30,128}={0,2}(?![A-Za-z0-9%+/=])/g;
|
|
754
|
+
const SAS_SIGNATURE_BYTES = 32;
|
|
755
|
+
const SAS_FIRST_YEAR = 2012;
|
|
756
|
+
// URL-encoded base64 as base64: "%2B" is "+", "%2F" "/", "%3D" "=".
|
|
757
|
+
function percentDecodedBase64(value) {
|
|
758
|
+
let decoded = "";
|
|
759
|
+
for (let index = 0; index < value.length; index++) {
|
|
760
|
+
const character = value[index];
|
|
761
|
+
if (character !== "%") {
|
|
762
|
+
decoded += character;
|
|
763
|
+
continue;
|
|
764
|
+
}
|
|
765
|
+
const code = value.slice(index + 1, index + 3).toUpperCase();
|
|
766
|
+
if (code === "2B") {
|
|
767
|
+
decoded += "+";
|
|
768
|
+
}
|
|
769
|
+
else if (code === "2F") {
|
|
770
|
+
decoded += "/";
|
|
771
|
+
}
|
|
772
|
+
else if (code === "3D") {
|
|
773
|
+
decoded += "=";
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
return null;
|
|
777
|
+
}
|
|
778
|
+
index += 2;
|
|
779
|
+
}
|
|
780
|
+
return decoded;
|
|
781
|
+
}
|
|
782
|
+
function sasSignature(token) {
|
|
783
|
+
const at = token.lastIndexOf("&sig=");
|
|
784
|
+
return at < 0 ? null : percentDecodedBase64(token.slice(at + 5));
|
|
785
|
+
}
|
|
786
|
+
function isAzureSasToken(token) {
|
|
787
|
+
const year = Number(token.slice(3, 7));
|
|
788
|
+
const month = Number(token.slice(8, 10));
|
|
789
|
+
const day = Number(token.slice(11, 13));
|
|
790
|
+
if (year < SAS_FIRST_YEAR || !(0, Validators_1.isRealDate)(year, month, day)) {
|
|
791
|
+
return false;
|
|
792
|
+
}
|
|
793
|
+
const signature = sasSignature(token);
|
|
794
|
+
const bytes = signature ? decodeBase64(signature) : null;
|
|
795
|
+
return bytes !== null && bytes.length === SAS_SIGNATURE_BYTES;
|
|
796
|
+
}
|
|
797
|
+
const azureSasTokenDetector = {
|
|
798
|
+
dataTypeId: "azure-sas-token",
|
|
799
|
+
quickCheck: (text) => {
|
|
800
|
+
return text.includes("sv=") && text.includes("&sig=");
|
|
801
|
+
},
|
|
802
|
+
pattern: AZURE_SAS_TOKEN_PATTERN,
|
|
803
|
+
validate: isAzureSasToken,
|
|
804
|
+
keywords: [
|
|
805
|
+
"sas",
|
|
806
|
+
"sastoken",
|
|
807
|
+
"sas_token",
|
|
808
|
+
"sharedaccesssignature",
|
|
809
|
+
"windows.net",
|
|
810
|
+
],
|
|
811
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
812
|
+
specificity: 3,
|
|
813
|
+
isTestValue: (normalized) => {
|
|
814
|
+
const signature = sasSignature(normalized) || "";
|
|
815
|
+
return normalized.includes("EXAMPLE") || isExampleToken(signature);
|
|
816
|
+
},
|
|
817
|
+
};
|
|
818
|
+
/*
|
|
819
|
+
* Microsoft Entra ID client secret, as the portal mints them since 2021:
|
|
820
|
+
* three characters, a digit, "Q~", and 31 to 34 more of a URL-safe
|
|
821
|
+
* alphabet with "~" and ".". The "Q~" is all that is fixed, so it counts
|
|
822
|
+
* next to words that name it.
|
|
823
|
+
*/
|
|
824
|
+
const AZURE_CLIENT_SECRET_PATTERN = /(?<![A-Za-z0-9_~.-])[A-Za-z0-9_~.-]{3}[0-9]Q~[A-Za-z0-9_~.-]{31,34}(?![A-Za-z0-9_~.-])/g;
|
|
825
|
+
const AZURE_CLIENT_SECRET_ENTROPY = 3.5;
|
|
826
|
+
const azureClientSecretDetector = {
|
|
827
|
+
dataTypeId: "azure-client-secret",
|
|
828
|
+
quickCheck: (0, Detector_1.containsAny)(["Q~"]),
|
|
829
|
+
pattern: AZURE_CLIENT_SECRET_PATTERN,
|
|
830
|
+
validate: (normalized) => {
|
|
831
|
+
return (0, Validators_1.shannonEntropy)(normalized) >= AZURE_CLIENT_SECRET_ENTROPY;
|
|
832
|
+
},
|
|
833
|
+
keywords: [
|
|
834
|
+
"azure",
|
|
835
|
+
"azurerm",
|
|
836
|
+
"client_secret",
|
|
837
|
+
"client-secret",
|
|
838
|
+
"clientsecret",
|
|
839
|
+
"client secret",
|
|
840
|
+
"aad",
|
|
841
|
+
"entra",
|
|
842
|
+
"tenant",
|
|
843
|
+
"tenant_id",
|
|
844
|
+
"msal",
|
|
845
|
+
"app_secret",
|
|
846
|
+
],
|
|
847
|
+
requiresContext: true,
|
|
848
|
+
confidenceWithoutContext: DataConfidence_1.default.Medium,
|
|
849
|
+
specificity: 2,
|
|
850
|
+
isTestValue: (normalized) => {
|
|
851
|
+
return isExampleToken(normalized);
|
|
852
|
+
},
|
|
853
|
+
};
|
|
854
|
+
/*
|
|
855
|
+
* GitHub token: ghp_ (personal), gho_ (OAuth), ghu_ (app user), ghs_ (app
|
|
856
|
+
* installation), ghr_ (refresh) and 36 characters, or a fine-grained
|
|
857
|
+
* github_pat_ and 82.
|
|
858
|
+
*/
|
|
859
|
+
const GITHUB_TOKEN_PATTERN = /(?<![A-Za-z0-9_])(?:gh[pousr]_[A-Za-z0-9]{36}|github_pat_[A-Za-z0-9_]{82})(?![A-Za-z0-9_])/g;
|
|
860
|
+
const githubTokenDetector = prefixedToken({
|
|
861
|
+
dataTypeId: "github-token",
|
|
862
|
+
prefixes: ["ghp_", "gho_", "ghu_", "ghs_", "ghr_", "github_pat_"],
|
|
863
|
+
pattern: GITHUB_TOKEN_PATTERN,
|
|
864
|
+
keywords: ["github", "gh_token", "github_token", "personal access token"],
|
|
865
|
+
});
|
|
866
|
+
/*
|
|
867
|
+
* GitLab token: glpat- and 20 characters (or a longer routable token
|
|
868
|
+
* ending in its version and checksum), and the deploy (gldt-), runner
|
|
869
|
+
* (glrt-), feed (glft-), SCIM (glsoat-), pipeline trigger (glptt-) and
|
|
870
|
+
* OAuth application (gloas-) tokens.
|
|
871
|
+
*/
|
|
872
|
+
const GITLAB_TOKEN_PATTERN = /(?<![A-Za-z0-9_-])(?:glpat-[A-Za-z0-9_-]{20}|glpat-[A-Za-z0-9_-]{27,300}\.[0-9a-z]{2}\.?[0-9a-z]{7}|gl(?:dt|rt|ft|soat)-[A-Za-z0-9_-]{20,64}|glptt-[0-9a-f]{40}|gloas-[A-Za-z0-9_-]{64})(?![A-Za-z0-9_-])/g;
|
|
873
|
+
const gitlabTokenDetector = prefixedToken({
|
|
874
|
+
dataTypeId: "gitlab-token",
|
|
875
|
+
prefixes: [
|
|
876
|
+
"glpat-",
|
|
877
|
+
"gldt-",
|
|
878
|
+
"glrt-",
|
|
879
|
+
"glft-",
|
|
880
|
+
"glsoat-",
|
|
881
|
+
"glptt-",
|
|
882
|
+
"gloas-",
|
|
883
|
+
],
|
|
884
|
+
pattern: GITLAB_TOKEN_PATTERN,
|
|
885
|
+
keywords: ["gitlab", "private-token", "private_token", "gitlab_token"],
|
|
886
|
+
});
|
|
887
|
+
/*
|
|
888
|
+
* Slack token: xoxb- (bot), xoxp- (user), xoxa- and xoxo- (legacy
|
|
889
|
+
* workspace), xoxr- and xoxe- (refresh), xoxs- (session), xoxc- (client):
|
|
890
|
+
* the team's number and the token's other parts; or an app-level token,
|
|
891
|
+
* xapp-.
|
|
892
|
+
*/
|
|
893
|
+
const SLACK_TOKEN_PATTERN = /(?<![A-Za-z0-9_-])(?:xox[abceoprs]-[0-9]{1,13}-[A-Za-z0-9-]{10,250}|xapp-[0-9]-[A-Z0-9]{8,14}-[0-9]{8,16}-[A-Za-z0-9]{32,80})(?![A-Za-z0-9_-])/g;
|
|
894
|
+
const slackTokenDetector = prefixedToken({
|
|
895
|
+
dataTypeId: "slack-token",
|
|
896
|
+
prefixes: [
|
|
897
|
+
"xoxa-",
|
|
898
|
+
"xoxb-",
|
|
899
|
+
"xoxc-",
|
|
900
|
+
"xoxe-",
|
|
901
|
+
"xoxo-",
|
|
902
|
+
"xoxp-",
|
|
903
|
+
"xoxr-",
|
|
904
|
+
"xoxs-",
|
|
905
|
+
"xapp-",
|
|
906
|
+
],
|
|
907
|
+
pattern: SLACK_TOKEN_PATTERN,
|
|
908
|
+
keywords: ["slack", "slack_token", "slack_bot_token", "bot token"],
|
|
909
|
+
});
|
|
910
|
+
/*
|
|
911
|
+
* Slack incoming webhook: hooks.slack.com/services/ with the team's ID
|
|
912
|
+
* (T...), the hook's (B...) and its 24-character secret, or a workflow or
|
|
913
|
+
* trigger webhook. Anyone who has it can post to the channel.
|
|
914
|
+
*/
|
|
915
|
+
const SLACK_WEBHOOK_URL_PATTERN = /(?<![A-Za-z0-9.-])(?:https:\/\/|http:\/\/)?hooks\.slack\.com\/(?:services\/T[A-Z0-9]{6,12}\/B[A-Z0-9]{6,12}\/[A-Za-z0-9]{20,32}|(?:workflows|triggers)\/T[A-Z0-9]{6,12}\/[A-Za-z0-9/]{20,120})(?![A-Za-z0-9])/g;
|
|
916
|
+
const slackWebhookUrlDetector = {
|
|
917
|
+
dataTypeId: "slack-webhook-url",
|
|
918
|
+
quickCheck: (0, Detector_1.containsAny)(["hooks.slack.com/"]),
|
|
919
|
+
pattern: SLACK_WEBHOOK_URL_PATTERN,
|
|
920
|
+
keywords: ["slack", "webhook", "incoming webhook"],
|
|
921
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
922
|
+
specificity: 3,
|
|
923
|
+
// Slack's own example: T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX.
|
|
924
|
+
isTestValue: (normalized) => {
|
|
925
|
+
const services = normalized.indexOf("/T");
|
|
926
|
+
return isExampleToken(normalized.slice(services + 1));
|
|
927
|
+
},
|
|
928
|
+
};
|
|
929
|
+
/*
|
|
930
|
+
* Stripe secret or restricted key: sk_ or rk_, live_ or test_, and the
|
|
931
|
+
* key. A test-mode key (sk_test_) moves no money: a test value.
|
|
932
|
+
*/
|
|
933
|
+
const STRIPE_SECRET_KEY_PATTERN = /(?<![A-Za-z0-9_])(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{20,247}(?![A-Za-z0-9_])/g;
|
|
934
|
+
const stripeSecretKeyDetector = prefixedToken({
|
|
935
|
+
dataTypeId: "stripe-secret-key",
|
|
936
|
+
prefixes: ["sk_live_", "rk_live_", "sk_test_", "rk_test_"],
|
|
937
|
+
pattern: STRIPE_SECRET_KEY_PATTERN,
|
|
938
|
+
keywords: ["stripe", "secret key", "secret_key", "restricted key"],
|
|
939
|
+
isTestValue: (normalized) => {
|
|
940
|
+
return (normalized.startsWith("sk_test_") || normalized.startsWith("rk_test_"));
|
|
941
|
+
},
|
|
942
|
+
});
|
|
943
|
+
/*
|
|
944
|
+
* Twilio API key SID: "SK" and 32 hex characters. Any hex digest could
|
|
945
|
+
* follow an "SK", so it counts next to words that say it is Twilio's.
|
|
946
|
+
*/
|
|
947
|
+
const TWILIO_API_KEY_PATTERN = /(?<![A-Za-z0-9])SK[0-9a-fA-F]{32}(?![A-Za-z0-9])/g;
|
|
948
|
+
const twilioApiKeyDetector = {
|
|
949
|
+
dataTypeId: "twilio-api-key",
|
|
950
|
+
quickCheck: (0, Detector_1.containsAny)(["SK"]),
|
|
951
|
+
pattern: TWILIO_API_KEY_PATTERN,
|
|
952
|
+
validate: (normalized) => {
|
|
953
|
+
const kinds = characterKinds(normalized.slice(2));
|
|
954
|
+
return kinds.digit && (kinds.lower || kinds.upper);
|
|
955
|
+
},
|
|
956
|
+
keywords: [
|
|
957
|
+
"twilio",
|
|
958
|
+
"api_key_sid",
|
|
959
|
+
"apikeysid",
|
|
960
|
+
"api key sid",
|
|
961
|
+
"key_sid",
|
|
962
|
+
"keysid",
|
|
963
|
+
"account_sid",
|
|
964
|
+
"accountsid",
|
|
965
|
+
"api_key",
|
|
966
|
+
"apikey",
|
|
967
|
+
"api key",
|
|
968
|
+
],
|
|
969
|
+
requiresContext: true,
|
|
970
|
+
confidenceWithoutContext: DataConfidence_1.default.Medium,
|
|
971
|
+
specificity: 2,
|
|
972
|
+
isTestValue: (normalized) => {
|
|
973
|
+
return isExampleToken(normalized, ["SK"]);
|
|
974
|
+
},
|
|
975
|
+
};
|
|
976
|
+
// SendGrid API key: "SG.", a 22-character ID, ".", a 43-character secret.
|
|
977
|
+
const SENDGRID_API_KEY_PATTERN = /(?<![A-Za-z0-9_-])SG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g;
|
|
978
|
+
const sendgridApiKeyDetector = prefixedToken({
|
|
979
|
+
dataTypeId: "sendgrid-api-key",
|
|
980
|
+
prefixes: ["SG."],
|
|
981
|
+
pattern: SENDGRID_API_KEY_PATTERN,
|
|
982
|
+
keywords: ["sendgrid", "api key", "api_key", "smtp"],
|
|
983
|
+
});
|
|
984
|
+
/*
|
|
985
|
+
* Mailgun API key: "key-" and 32 lower-case letters and digits (the
|
|
986
|
+
* original form), or 32 hex characters, "-", 8 and 8 more (the private key
|
|
987
|
+
* of today). "key-" is a prefix many things have, so on its own it is
|
|
988
|
+
* Medium, and High next to the word Mailgun.
|
|
989
|
+
*/
|
|
990
|
+
const MAILGUN_API_KEY_PATTERN = /(?<![A-Za-z0-9_-])(?:key-[0-9a-z]{32}|[0-9a-f]{32}-[0-9a-f]{8}-[0-9a-f]{8})(?![A-Za-z0-9_-])/g;
|
|
991
|
+
const mailgunApiKeyDetector = {
|
|
992
|
+
dataTypeId: "mailgun-api-key",
|
|
993
|
+
quickCheck: (0, Detector_1.containsAny)(["-"]),
|
|
994
|
+
pattern: MAILGUN_API_KEY_PATTERN,
|
|
995
|
+
validate: (normalized) => {
|
|
996
|
+
const kinds = characterKinds(normalized.startsWith("key-") ? normalized.slice(4) : normalized);
|
|
997
|
+
return kinds.digit && kinds.lower;
|
|
998
|
+
},
|
|
999
|
+
keywords: ["mailgun", "mailgun_api_key", "mg_api_key", "api.mailgun.net"],
|
|
1000
|
+
confidenceWithoutContext: DataConfidence_1.default.Medium,
|
|
1001
|
+
specificity: 2,
|
|
1002
|
+
isTestValue: (normalized) => {
|
|
1003
|
+
return isExampleToken(normalized, ["key-"]);
|
|
1004
|
+
},
|
|
1005
|
+
};
|
|
1006
|
+
// Mailchimp API key: 32 hex characters and the data centre, "-us" and 1-2 digits.
|
|
1007
|
+
const MAILCHIMP_API_KEY_PATTERN = /(?<![A-Za-z0-9_-])[0-9a-f]{32}-us[0-9]{1,2}(?![A-Za-z0-9_-])/g;
|
|
1008
|
+
const mailchimpApiKeyDetector = prefixedToken({
|
|
1009
|
+
dataTypeId: "mailchimp-api-key",
|
|
1010
|
+
prefixes: ["-us"],
|
|
1011
|
+
pattern: MAILCHIMP_API_KEY_PATTERN,
|
|
1012
|
+
keywords: ["mailchimp", "api key", "api_key", "apikey"],
|
|
1013
|
+
});
|
|
1014
|
+
/*
|
|
1015
|
+
* OpenAI API key: "sk-" with "T3BlbkFJ" - "OpenAI" in base64 - inside it,
|
|
1016
|
+
* which every user and project key carries, or a project, service account
|
|
1017
|
+
* or admin key's own prefix (sk-proj-, sk-svcacct-, sk-admin-).
|
|
1018
|
+
*/
|
|
1019
|
+
const OPENAI_API_KEY_PATTERN = /(?<![A-Za-z0-9_-])sk-[A-Za-z0-9_-]{20,250}(?![A-Za-z0-9_-])/g;
|
|
1020
|
+
const OPENAI_KEY_MARKER = "T3BlbkFJ";
|
|
1021
|
+
const OPENAI_KEY_PREFIXES = [
|
|
1022
|
+
"sk-proj-",
|
|
1023
|
+
"sk-svcacct-",
|
|
1024
|
+
"sk-admin-",
|
|
1025
|
+
];
|
|
1026
|
+
const OPENAI_PREFIXED_KEY_MIN_LENGTH = 40;
|
|
1027
|
+
const openaiApiKeyDetector = prefixedToken({
|
|
1028
|
+
dataTypeId: "openai-api-key",
|
|
1029
|
+
prefixes: [OPENAI_KEY_MARKER, ...OPENAI_KEY_PREFIXES],
|
|
1030
|
+
pattern: OPENAI_API_KEY_PATTERN,
|
|
1031
|
+
validate: (normalized) => {
|
|
1032
|
+
if (normalized.startsWith("sk-ant-")) {
|
|
1033
|
+
return false;
|
|
1034
|
+
}
|
|
1035
|
+
return (normalized.includes(OPENAI_KEY_MARKER) ||
|
|
1036
|
+
(normalized.length >= OPENAI_PREFIXED_KEY_MIN_LENGTH &&
|
|
1037
|
+
OPENAI_KEY_PREFIXES.some((prefix) => {
|
|
1038
|
+
return normalized.startsWith(prefix);
|
|
1039
|
+
})));
|
|
1040
|
+
},
|
|
1041
|
+
keywords: ["openai", "openai_api_key", "chatgpt", "gpt"],
|
|
1042
|
+
});
|
|
1043
|
+
/*
|
|
1044
|
+
* Anthropic API key: "sk-ant-", the key's kind and version (api03, admin01,
|
|
1045
|
+
* oat01) and the key.
|
|
1046
|
+
*/
|
|
1047
|
+
const ANTHROPIC_API_KEY_PATTERN = /(?<![A-Za-z0-9_-])sk-ant-[a-z]{3,6}[0-9]{2}-[A-Za-z0-9_-]{32,200}(?![A-Za-z0-9_-])/g;
|
|
1048
|
+
const anthropicApiKeyDetector = prefixedToken({
|
|
1049
|
+
dataTypeId: "anthropic-api-key",
|
|
1050
|
+
prefixes: ["sk-ant-"],
|
|
1051
|
+
pattern: ANTHROPIC_API_KEY_PATTERN,
|
|
1052
|
+
keywords: ["anthropic", "anthropic_api_key", "claude"],
|
|
1053
|
+
});
|
|
1054
|
+
/*
|
|
1055
|
+
* Hugging Face token: hf_ (a user's) or api_org_ (an organization's) and
|
|
1056
|
+
* 34 characters of both cases.
|
|
1057
|
+
*/
|
|
1058
|
+
const HUGGINGFACE_TOKEN_PATTERN = /(?<![A-Za-z0-9_])(?:hf|api_org)_[A-Za-z0-9]{34}(?![A-Za-z0-9_])/g;
|
|
1059
|
+
const huggingfaceTokenDetector = prefixedToken({
|
|
1060
|
+
dataTypeId: "huggingface-token",
|
|
1061
|
+
prefixes: ["hf_", "api_org_"],
|
|
1062
|
+
pattern: HUGGINGFACE_TOKEN_PATTERN,
|
|
1063
|
+
validate: (normalized) => {
|
|
1064
|
+
const kinds = characterKinds(normalized);
|
|
1065
|
+
return kinds.upper && kinds.lower;
|
|
1066
|
+
},
|
|
1067
|
+
keywords: [
|
|
1068
|
+
"hugging face",
|
|
1069
|
+
"huggingface",
|
|
1070
|
+
"hf_token",
|
|
1071
|
+
"hugging_face_hub_token",
|
|
1072
|
+
],
|
|
1073
|
+
});
|
|
1074
|
+
// npm access token: "npm_" and 36 characters.
|
|
1075
|
+
const NPM_TOKEN_PATTERN = /(?<![A-Za-z0-9_])npm_[A-Za-z0-9]{36}(?![A-Za-z0-9_])/g;
|
|
1076
|
+
const npmTokenDetector = prefixedToken({
|
|
1077
|
+
dataTypeId: "npm-token",
|
|
1078
|
+
prefixes: ["npm_"],
|
|
1079
|
+
pattern: NPM_TOKEN_PATTERN,
|
|
1080
|
+
keywords: ["npm", "npmrc", "npm_token", "_authtoken", "registry.npmjs.org"],
|
|
1081
|
+
});
|
|
1082
|
+
/*
|
|
1083
|
+
* PyPI upload token: "pypi-" and a macaroon whose first field names the
|
|
1084
|
+
* index it is for - pypi.org, or test.pypi.org, whose tokens upload to the
|
|
1085
|
+
* test index only: test values.
|
|
1086
|
+
*/
|
|
1087
|
+
const PYPI_TOKEN_PATTERN = /(?<![A-Za-z0-9_-])pypi-AgE(?:IcHlwaS5vcmc|NdGVzdC5weXBpLm9yZw)[A-Za-z0-9_-]{50,1000}(?![A-Za-z0-9_-])/g;
|
|
1088
|
+
const TEST_PYPI_TOKEN_PREFIX = "pypi-AgENdGVzdC5weXBpLm9yZw";
|
|
1089
|
+
const pypiTokenDetector = prefixedToken({
|
|
1090
|
+
dataTypeId: "pypi-token",
|
|
1091
|
+
prefixes: ["pypi-AgEIcHlwaS5vcmc", TEST_PYPI_TOKEN_PREFIX],
|
|
1092
|
+
pattern: PYPI_TOKEN_PATTERN,
|
|
1093
|
+
keywords: ["pypi", "twine", "pypirc", "upload"],
|
|
1094
|
+
isTestValue: (normalized) => {
|
|
1095
|
+
return normalized.startsWith(TEST_PYPI_TOKEN_PREFIX);
|
|
1096
|
+
},
|
|
1097
|
+
});
|
|
1098
|
+
// Docker Hub access token: dckr_pat_ (personal) or dckr_oat_ (organization).
|
|
1099
|
+
const DOCKER_HUB_TOKEN_PATTERN = /(?<![A-Za-z0-9_-])dckr_(?:pat|oat)_[A-Za-z0-9_-]{24,64}(?![A-Za-z0-9_-])/g;
|
|
1100
|
+
const dockerHubTokenDetector = prefixedToken({
|
|
1101
|
+
dataTypeId: "docker-hub-token",
|
|
1102
|
+
prefixes: ["dckr_pat_", "dckr_oat_"],
|
|
1103
|
+
pattern: DOCKER_HUB_TOKEN_PATTERN,
|
|
1104
|
+
keywords: ["docker", "docker hub", "dockerhub", "docker_password"],
|
|
1105
|
+
});
|
|
1106
|
+
/*
|
|
1107
|
+
* Shopify token: shpat_ (admin API), shpca_ (custom app), shppa_ (private
|
|
1108
|
+
* app), shpss_ (shared secret) and 32 hex characters.
|
|
1109
|
+
*/
|
|
1110
|
+
const SHOPIFY_TOKEN_PATTERN = /(?<![A-Za-z0-9_])shp(?:at|ca|pa|ss)_[a-fA-F0-9]{32}(?![A-Za-z0-9_])/g;
|
|
1111
|
+
const shopifyTokenDetector = prefixedToken({
|
|
1112
|
+
dataTypeId: "shopify-token",
|
|
1113
|
+
prefixes: ["shpat_", "shpca_", "shppa_", "shpss_"],
|
|
1114
|
+
pattern: SHOPIFY_TOKEN_PATTERN,
|
|
1115
|
+
keywords: ["shopify", "x-shopify-access-token", "access token"],
|
|
1116
|
+
});
|
|
1117
|
+
/*
|
|
1118
|
+
* Square token: an OAuth access token (sq0atp-), an application secret
|
|
1119
|
+
* (sq0csp-), or a 64-character access token starting "EAAA". "EAAA" is
|
|
1120
|
+
* also what base64 of binary data is full of, so that form must stand
|
|
1121
|
+
* apart from any base64 around it and mix both cases with digits.
|
|
1122
|
+
*/
|
|
1123
|
+
const SQUARE_TOKEN_PATTERN = /(?<![A-Za-z0-9_+/-])(?:sq0atp-[A-Za-z0-9_-]{22}|sq0csp-[A-Za-z0-9_-]{43}|EAAA[A-Za-z0-9_-]{60})(?![A-Za-z0-9_+/=-])/g;
|
|
1124
|
+
const squareTokenDetector = prefixedToken({
|
|
1125
|
+
dataTypeId: "square-token",
|
|
1126
|
+
prefixes: ["sq0atp-", "sq0csp-", "EAAA"],
|
|
1127
|
+
pattern: SQUARE_TOKEN_PATTERN,
|
|
1128
|
+
validate: (normalized) => {
|
|
1129
|
+
if (!normalized.startsWith("EAAA")) {
|
|
1130
|
+
return true;
|
|
1131
|
+
}
|
|
1132
|
+
const kinds = characterKinds(normalized.slice(4));
|
|
1133
|
+
return kinds.upper && kinds.lower && kinds.digit;
|
|
1134
|
+
},
|
|
1135
|
+
keywords: ["square", "squareup", "square_access_token", "access token"],
|
|
1136
|
+
});
|
|
1137
|
+
/*
|
|
1138
|
+
* Braintree access token: access_token$production$, the merchant's ID and
|
|
1139
|
+
* 32 hex characters. A sandbox token reaches the sandbox only: a test
|
|
1140
|
+
* value.
|
|
1141
|
+
*/
|
|
1142
|
+
const BRAINTREE_ACCESS_TOKEN_PATTERN = /(?<![A-Za-z0-9_])access_token\$(?:production|sandbox)\$[0-9a-z]{16}\$[0-9a-f]{32}(?![A-Za-z0-9])/g;
|
|
1143
|
+
const braintreeAccessTokenDetector = prefixedToken({
|
|
1144
|
+
dataTypeId: "braintree-access-token",
|
|
1145
|
+
prefixes: ["access_token$production$", "access_token$sandbox$"],
|
|
1146
|
+
pattern: BRAINTREE_ACCESS_TOKEN_PATTERN,
|
|
1147
|
+
keywords: ["braintree", "paypal", "access token"],
|
|
1148
|
+
isTestValue: (normalized) => {
|
|
1149
|
+
return normalized.includes("$sandbox$");
|
|
1150
|
+
},
|
|
1151
|
+
});
|
|
1152
|
+
/*
|
|
1153
|
+
* DigitalOcean token: dop_v1_ (personal), doo_v1_ (OAuth) or dor_v1_
|
|
1154
|
+
* (refresh) and 64 hex characters.
|
|
1155
|
+
*/
|
|
1156
|
+
const DIGITALOCEAN_TOKEN_PATTERN = /(?<![A-Za-z0-9_])do[opr]_v1_[a-f0-9]{64}(?![A-Za-z0-9_])/g;
|
|
1157
|
+
const digitaloceanTokenDetector = prefixedToken({
|
|
1158
|
+
dataTypeId: "digitalocean-token",
|
|
1159
|
+
prefixes: ["dop_v1_", "doo_v1_", "dor_v1_"],
|
|
1160
|
+
pattern: DIGITALOCEAN_TOKEN_PATTERN,
|
|
1161
|
+
keywords: ["digitalocean", "digital ocean", "doctl", "do_token"],
|
|
1162
|
+
});
|
|
1163
|
+
/*
|
|
1164
|
+
* New Relic key: a user API key (NRAK- and 27 characters) or an insert key
|
|
1165
|
+
* (NRII- and 32).
|
|
1166
|
+
*/
|
|
1167
|
+
const NEW_RELIC_API_KEY_PATTERN = /(?<![A-Za-z0-9_-])(?:NRAK-[A-Z0-9]{27}|NRII-[A-Za-z0-9_-]{32})(?![A-Za-z0-9_-])/g;
|
|
1168
|
+
const newRelicApiKeyDetector = prefixedToken({
|
|
1169
|
+
dataTypeId: "new-relic-api-key",
|
|
1170
|
+
prefixes: ["NRAK-", "NRII-"],
|
|
1171
|
+
pattern: NEW_RELIC_API_KEY_PATTERN,
|
|
1172
|
+
keywords: ["new relic", "newrelic", "new_relic", "api-key"],
|
|
1173
|
+
});
|
|
1174
|
+
/*
|
|
1175
|
+
* Datadog key: an API key (32 hex characters) or an application key (40).
|
|
1176
|
+
* Every MD5 and SHA-1 has that shape, so it counts only next to words that
|
|
1177
|
+
* name Datadog's keys, and drops a level next to words that say it is a
|
|
1178
|
+
* digest.
|
|
1179
|
+
*/
|
|
1180
|
+
const DATADOG_API_KEY_PATTERN = /(?<![A-Za-z0-9_-]|[A-Za-z0-9]\.)(?:[a-f0-9]{32}|[a-f0-9]{40})(?![A-Za-z0-9_-]|\.[A-Za-z0-9])/g;
|
|
1181
|
+
const datadogApiKeyDetector = {
|
|
1182
|
+
dataTypeId: "datadog-api-key",
|
|
1183
|
+
pattern: DATADOG_API_KEY_PATTERN,
|
|
1184
|
+
validate: (normalized) => {
|
|
1185
|
+
const kinds = characterKinds(normalized);
|
|
1186
|
+
return kinds.digit && kinds.lower;
|
|
1187
|
+
},
|
|
1188
|
+
keywords: [
|
|
1189
|
+
"datadog",
|
|
1190
|
+
"datadoghq",
|
|
1191
|
+
"datadoghq.com",
|
|
1192
|
+
"dd_api_key",
|
|
1193
|
+
"dd-api-key",
|
|
1194
|
+
"dd_app_key",
|
|
1195
|
+
"dd-application-key",
|
|
1196
|
+
"dd_application_key",
|
|
1197
|
+
"ddapikey",
|
|
1198
|
+
"ddappkey",
|
|
1199
|
+
"datadog_api_key",
|
|
1200
|
+
"datadog_app_key",
|
|
1201
|
+
],
|
|
1202
|
+
negativeKeywords: [
|
|
1203
|
+
"md5",
|
|
1204
|
+
"sha1",
|
|
1205
|
+
"sha256",
|
|
1206
|
+
"checksum",
|
|
1207
|
+
"digest",
|
|
1208
|
+
"hash",
|
|
1209
|
+
"etag",
|
|
1210
|
+
"commit",
|
|
1211
|
+
],
|
|
1212
|
+
requiresContext: true,
|
|
1213
|
+
confidenceWithoutContext: DataConfidence_1.default.Medium,
|
|
1214
|
+
specificity: 2,
|
|
1215
|
+
isTestValue: (normalized) => {
|
|
1216
|
+
return isExampleToken(normalized);
|
|
1217
|
+
},
|
|
1218
|
+
};
|
|
1219
|
+
/*
|
|
1220
|
+
* HashiCorp Vault token: hvs. (service), hvb. (batch) or hvr. (recovery)
|
|
1221
|
+
* and the token - at least 24 characters, mixing cases or digits.
|
|
1222
|
+
*/
|
|
1223
|
+
const VAULT_TOKEN_PATTERN = /(?<![A-Za-z0-9_.-])hv[sbr]\.[A-Za-z0-9_-]{24,400}(?![A-Za-z0-9_-])/g;
|
|
1224
|
+
const VAULT_TOKEN_ENTROPY = 3;
|
|
1225
|
+
const vaultTokenDetector = prefixedToken({
|
|
1226
|
+
dataTypeId: "vault-token",
|
|
1227
|
+
prefixes: ["hvs.", "hvb.", "hvr."],
|
|
1228
|
+
pattern: VAULT_TOKEN_PATTERN,
|
|
1229
|
+
validate: (normalized) => {
|
|
1230
|
+
const body = normalized.slice(4);
|
|
1231
|
+
const kinds = characterKinds(body);
|
|
1232
|
+
return ((kinds.digit || (kinds.upper && kinds.lower)) &&
|
|
1233
|
+
(0, Validators_1.shannonEntropy)(body) >= VAULT_TOKEN_ENTROPY);
|
|
1234
|
+
},
|
|
1235
|
+
keywords: ["vault", "vault_token", "x-vault-token", "hashicorp"],
|
|
1236
|
+
});
|
|
1237
|
+
/*
|
|
1238
|
+
* Terraform Cloud / Enterprise API token: 14 characters, ".atlasv1." and
|
|
1239
|
+
* 60 to 70 more.
|
|
1240
|
+
*/
|
|
1241
|
+
const TERRAFORM_CLOUD_TOKEN_PATTERN = /(?<![A-Za-z0-9_-])[A-Za-z0-9]{14}\.atlasv1\.[A-Za-z0-9_=-]{60,70}(?![A-Za-z0-9_=-])/g;
|
|
1242
|
+
const terraformCloudTokenDetector = prefixedToken({
|
|
1243
|
+
dataTypeId: "terraform-cloud-token",
|
|
1244
|
+
prefixes: [".atlasv1."],
|
|
1245
|
+
pattern: TERRAFORM_CLOUD_TOKEN_PATTERN,
|
|
1246
|
+
keywords: [
|
|
1247
|
+
"terraform",
|
|
1248
|
+
"tfe_token",
|
|
1249
|
+
"tf_token",
|
|
1250
|
+
"credentials",
|
|
1251
|
+
"app.terraform.io",
|
|
1252
|
+
],
|
|
1253
|
+
});
|
|
1254
|
+
// Atlassian API token: "ATATT3" and the token (about 186 characters).
|
|
1255
|
+
const ATLASSIAN_API_TOKEN_PATTERN = /(?<![A-Za-z0-9_-])ATATT3[A-Za-z0-9_=-]{150,250}(?![A-Za-z0-9_=-])/g;
|
|
1256
|
+
const atlassianApiTokenDetector = prefixedToken({
|
|
1257
|
+
dataTypeId: "atlassian-api-token",
|
|
1258
|
+
prefixes: ["ATATT3"],
|
|
1259
|
+
pattern: ATLASSIAN_API_TOKEN_PATTERN,
|
|
1260
|
+
keywords: ["atlassian", "jira", "confluence", "bitbucket", "api token"],
|
|
1261
|
+
});
|
|
1262
|
+
// Linear API key: lin_api_ and 40 characters, or an OAuth token, lin_oauth_.
|
|
1263
|
+
const LINEAR_API_KEY_PATTERN = /(?<![A-Za-z0-9_])lin_(?:api_[A-Za-z0-9]{40}|oauth_[a-f0-9]{64})(?![A-Za-z0-9_])/g;
|
|
1264
|
+
const linearApiKeyDetector = prefixedToken({
|
|
1265
|
+
dataTypeId: "linear-api-key",
|
|
1266
|
+
prefixes: ["lin_api_", "lin_oauth_"],
|
|
1267
|
+
pattern: LINEAR_API_KEY_PATTERN,
|
|
1268
|
+
keywords: ["linear", "linear_api_key"],
|
|
1269
|
+
});
|
|
1270
|
+
/*
|
|
1271
|
+
* JSON web token: three base64url parts, the first a JSON header that
|
|
1272
|
+
* names its signing algorithm ({"alg": ...}) and the last a signature.
|
|
1273
|
+
* The sample jwt.io and every tutorial sign - John Doe, subject
|
|
1274
|
+
* "1234567890" - is a test value.
|
|
1275
|
+
*/
|
|
1276
|
+
const JSON_WEB_TOKEN_PATTERN = /(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]{5,1000}\.[A-Za-z0-9_-]{2,8000}\.[A-Za-z0-9_-]{16,1024}(?![A-Za-z0-9_-])/g;
|
|
1277
|
+
function decodedJwtPart(token, part) {
|
|
1278
|
+
const parts = token.split(".");
|
|
1279
|
+
const bytes = parts[part] === undefined ? null : decodeBase64(parts[part]);
|
|
1280
|
+
return bytes ? bytesToText(bytes) : null;
|
|
1281
|
+
}
|
|
1282
|
+
function isJwtWithHeader(token) {
|
|
1283
|
+
const header = decodedJwtPart(token, 0);
|
|
1284
|
+
if (header === null) {
|
|
1285
|
+
return false;
|
|
1286
|
+
}
|
|
1287
|
+
try {
|
|
1288
|
+
const parsed = JSON.parse(header);
|
|
1289
|
+
return (typeof parsed === "object" &&
|
|
1290
|
+
parsed !== null &&
|
|
1291
|
+
!Array.isArray(parsed) &&
|
|
1292
|
+
typeof parsed["alg"] === "string");
|
|
1293
|
+
}
|
|
1294
|
+
catch (_a) {
|
|
1295
|
+
return false;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
function isSampleJwt(token) {
|
|
1299
|
+
const payload = decodedJwtPart(token, 1);
|
|
1300
|
+
return (payload !== null &&
|
|
1301
|
+
payload.includes("1234567890") &&
|
|
1302
|
+
payload.includes("John Doe"));
|
|
1303
|
+
}
|
|
1304
|
+
const jsonWebTokenDetector = {
|
|
1305
|
+
dataTypeId: "json-web-token",
|
|
1306
|
+
quickCheck: (0, Detector_1.containsAny)(["eyJ"]),
|
|
1307
|
+
pattern: JSON_WEB_TOKEN_PATTERN,
|
|
1308
|
+
validate: isJwtWithHeader,
|
|
1309
|
+
keywords: [
|
|
1310
|
+
"jwt",
|
|
1311
|
+
"bearer",
|
|
1312
|
+
"token",
|
|
1313
|
+
"id_token",
|
|
1314
|
+
"access_token",
|
|
1315
|
+
"authorization",
|
|
1316
|
+
],
|
|
1317
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
1318
|
+
specificity: 3,
|
|
1319
|
+
isTestValue: (normalized) => {
|
|
1320
|
+
return normalized.includes("EXAMPLE") || isSampleJwt(normalized);
|
|
1321
|
+
},
|
|
1322
|
+
};
|
|
1323
|
+
/*
|
|
1324
|
+
* Private key: the header line of a PEM private key - RSA, EC, DSA,
|
|
1325
|
+
* OpenSSH, encrypted PKCS #8 or plain - of a PGP private key block, of an
|
|
1326
|
+
* SSH.com key or of a PuTTY key file, with the key's own text after it
|
|
1327
|
+
* (base64, or the Proc-Type / Version / Comment lines some formats start
|
|
1328
|
+
* with). A header with nothing after it - "-----BEGIN RSA PRIVATE KEY-----"
|
|
1329
|
+
* in the code that reads one - is the name of a key, not a key. Only the
|
|
1330
|
+
* header is matched, so the pattern never reads the block.
|
|
1331
|
+
*/
|
|
1332
|
+
const PRIVATE_KEY_PATTERN = /(?<![A-Za-z0-9-])(?:-----BEGIN [A-Z0-9 ]{0,40}PRIVATE KEY(?: BLOCK)?-----|---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----|PuTTY-User-Key-File-[1-3]: [a-z0-9-]{3,40})(?=(?:\\r|\\n|[\s"',]){0,8}(?:[A-Za-z0-9+/]{16}|Proc-Type:|Version:|Comment:|Subject:|Encryption:))/g;
|
|
1333
|
+
// What a key made for a test or a document calls itself: "BEGIN FAKE RSA PRIVATE KEY".
|
|
1334
|
+
const TEST_KEY_LABELS = [
|
|
1335
|
+
"EXAMPLE",
|
|
1336
|
+
"FAKE",
|
|
1337
|
+
"TEST",
|
|
1338
|
+
"DUMMY",
|
|
1339
|
+
"SAMPLE",
|
|
1340
|
+
];
|
|
1341
|
+
// The words between "BEGIN " and "PRIVATE KEY": "RSA", "OPENSSH", "".
|
|
1342
|
+
function pemLabel(header) {
|
|
1343
|
+
if (!header.startsWith("-----BEGIN ")) {
|
|
1344
|
+
return null;
|
|
1345
|
+
}
|
|
1346
|
+
return header.slice("-----BEGIN ".length, header.indexOf("PRIVATE KEY"));
|
|
1347
|
+
}
|
|
1348
|
+
const privateKeyDetector = {
|
|
1349
|
+
dataTypeId: "private-key",
|
|
1350
|
+
quickCheck: (0, Detector_1.containsAny)(["PRIVATE KEY", "PuTTY-User-Key-File-"]),
|
|
1351
|
+
pattern: PRIVATE_KEY_PATTERN,
|
|
1352
|
+
// A PEM label is words of capitals and digits, one space apart.
|
|
1353
|
+
validate: (normalized) => {
|
|
1354
|
+
const label = pemLabel(normalized);
|
|
1355
|
+
return (label === null ||
|
|
1356
|
+
label === "" ||
|
|
1357
|
+
(!label.startsWith(" ") && !label.includes(" ") && label.endsWith(" ")));
|
|
1358
|
+
},
|
|
1359
|
+
keywords: ["private key", "private_key", "privatekey", "pem", "ssh", "pgp"],
|
|
1360
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
1361
|
+
specificity: 3,
|
|
1362
|
+
isTestValue: (normalized) => {
|
|
1363
|
+
const words = (pemLabel(normalized) || "").split(" ");
|
|
1364
|
+
return words.some((word) => {
|
|
1365
|
+
return TEST_KEY_LABELS.includes(word);
|
|
1366
|
+
});
|
|
1367
|
+
},
|
|
1368
|
+
};
|
|
1369
|
+
/*
|
|
1370
|
+
* A URL with a password in it: scheme://user:password@host - a database
|
|
1371
|
+
* connection string, a git remote with a token, a proxy. The password may
|
|
1372
|
+
* hold ":" and "@" (taken up to the last "@" before the host), must not be
|
|
1373
|
+
* empty, and must not be a placeholder ("user:password@", "${DB_PASS}").
|
|
1374
|
+
* The URL up to the host is the value; a host of documentation's own
|
|
1375
|
+
* domains (example.com) makes it a test value.
|
|
1376
|
+
*/
|
|
1377
|
+
const PASSWORD_IN_URL_PATTERN = /(?<![A-Za-z0-9+.-])[A-Za-z][A-Za-z0-9+.-]{1,20}:\/\/[^\s:@/?#'"<>]{0,128}:[^\s/?#'"<>]{1,256}@(?:[A-Za-z0-9._~-]{1,253}|\[[0-9A-Fa-f:.]{2,45}\])(?![A-Za-z0-9._~-])/g;
|
|
1378
|
+
function urlCredentials(url) {
|
|
1379
|
+
const scheme = url.indexOf("://");
|
|
1380
|
+
const at = url.lastIndexOf("@");
|
|
1381
|
+
if (scheme < 0 || at < scheme) {
|
|
1382
|
+
return null;
|
|
1383
|
+
}
|
|
1384
|
+
const userInfo = url.slice(scheme + 3, at);
|
|
1385
|
+
const colon = userInfo.indexOf(":");
|
|
1386
|
+
if (colon < 0) {
|
|
1387
|
+
return null;
|
|
1388
|
+
}
|
|
1389
|
+
return {
|
|
1390
|
+
user: userInfo.slice(0, colon),
|
|
1391
|
+
password: userInfo.slice(colon + 1),
|
|
1392
|
+
host: url.slice(at + 1),
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
function percentDecoded(value) {
|
|
1396
|
+
try {
|
|
1397
|
+
return decodeURIComponent(value);
|
|
1398
|
+
}
|
|
1399
|
+
catch (_a) {
|
|
1400
|
+
return value;
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
// The most digits a port has: "host.example:8080@" is a host and its port.
|
|
1404
|
+
const MAX_PORT_DIGITS = 5;
|
|
1405
|
+
const passwordInUrlDetector = {
|
|
1406
|
+
dataTypeId: "password-in-url",
|
|
1407
|
+
quickCheck: (text) => {
|
|
1408
|
+
return text.includes("://") && text.includes("@");
|
|
1409
|
+
},
|
|
1410
|
+
pattern: PASSWORD_IN_URL_PATTERN,
|
|
1411
|
+
validate: (normalized) => {
|
|
1412
|
+
const credentials = urlCredentials(normalized);
|
|
1413
|
+
if (!credentials || credentials.password.length === 0) {
|
|
1414
|
+
return false;
|
|
1415
|
+
}
|
|
1416
|
+
const password = percentDecoded(credentials.password);
|
|
1417
|
+
const isPort = credentials.user.includes(".") &&
|
|
1418
|
+
password.length <= MAX_PORT_DIGITS &&
|
|
1419
|
+
(0, Detector_1.digitsOnly)(password) === password;
|
|
1420
|
+
return !isPort && !isPlaceholderSecret(password);
|
|
1421
|
+
},
|
|
1422
|
+
keywords: [
|
|
1423
|
+
"url",
|
|
1424
|
+
"uri",
|
|
1425
|
+
"dsn",
|
|
1426
|
+
"connection",
|
|
1427
|
+
"database_url",
|
|
1428
|
+
"jdbc",
|
|
1429
|
+
"postgres",
|
|
1430
|
+
"mysql",
|
|
1431
|
+
"mongodb",
|
|
1432
|
+
"redis",
|
|
1433
|
+
"amqp",
|
|
1434
|
+
],
|
|
1435
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
1436
|
+
specificity: 2,
|
|
1437
|
+
isTestValue: (normalized) => {
|
|
1438
|
+
const credentials = urlCredentials(normalized);
|
|
1439
|
+
return (normalized.includes("EXAMPLE") ||
|
|
1440
|
+
(credentials !== null && isReservedHost(credentials.host)));
|
|
1441
|
+
},
|
|
1442
|
+
};
|
|
1443
|
+
/*
|
|
1444
|
+
* A Password= or Pwd= value in a connection string: ADO.NET, ODBC, JDBC
|
|
1445
|
+
* for SQL Server, OLE DB. It counts among the string's other Key=Value
|
|
1446
|
+
* pairs only - one ending in ";" just before the key, or one starting just
|
|
1447
|
+
* after the value's ";", on the same line - so a statement of code
|
|
1448
|
+
* ("config.password = options.password;") is no connection string. The
|
|
1449
|
+
* value may be bare, in quotes or in ODBC's braces ({...}). Medium alone,
|
|
1450
|
+
* High next to the string's other keys (Server=, Database=, User Id=).
|
|
1451
|
+
*
|
|
1452
|
+
* Bounded on text anyone may write: the look ahead reads at most 160
|
|
1453
|
+
* characters to the next ";" and the value at most 128, so a run of
|
|
1454
|
+
* Pwd='= is read in time in line with the text
|
|
1455
|
+
* (SecretDetectorPatternTiming.test.ts).
|
|
1456
|
+
*/
|
|
1457
|
+
const CONNECTION_STRING_PASSWORD_PATTERN = /(?<![A-Za-z0-9_.$>-])(?:password|pwd)(?:(?<=;[ \t]{0,4}(?:password|pwd))|(?=[ \t]{0,2}=[^;\r\n]{1,160};[ \t]{0,4}[A-Za-z][A-Za-z0-9 _.-]{0,40}=))[ \t]{0,2}=[ \t]{0,2}(\{[^}\r\n]{1,128}\}|"[^"\r\n]{1,128}"|'[^'\r\n]{1,128}'|[^\s;"'{}][^\s;"']{0,127})(?![^\s;"'])/gi;
|
|
1458
|
+
const connectionStringPasswordDetector = {
|
|
1459
|
+
dataTypeId: "connection-string-password",
|
|
1460
|
+
quickCheck: (text) => {
|
|
1461
|
+
return (text.includes(";") && (text.includes("password") || text.includes("pwd")));
|
|
1462
|
+
},
|
|
1463
|
+
quickCheckLowerCase: true,
|
|
1464
|
+
pattern: CONNECTION_STRING_PASSWORD_PATTERN,
|
|
1465
|
+
valueGroup: 1,
|
|
1466
|
+
// The value without the quotes or braces it is written in.
|
|
1467
|
+
normalize: (value) => {
|
|
1468
|
+
const first = value[0] || "";
|
|
1469
|
+
const last = value[value.length - 1] || "";
|
|
1470
|
+
const wrapped = value.length >= 2 &&
|
|
1471
|
+
((first === "{" && last === "}") ||
|
|
1472
|
+
(first === '"' && last === '"') ||
|
|
1473
|
+
(first === "'" && last === "'"));
|
|
1474
|
+
return (wrapped ? value.slice(1, -1) : value).trim();
|
|
1475
|
+
},
|
|
1476
|
+
// No placeholder, no path, no code, and not the secret's name.
|
|
1477
|
+
validate: (normalized) => {
|
|
1478
|
+
return (normalized.length > 0 &&
|
|
1479
|
+
!isPlaceholderSecret(normalized) &&
|
|
1480
|
+
!isPathLike(normalized) &&
|
|
1481
|
+
!isCodeReference(normalized) &&
|
|
1482
|
+
!hasSecretNameWord(normalized.toLowerCase()));
|
|
1483
|
+
},
|
|
1484
|
+
keywords: [
|
|
1485
|
+
"server",
|
|
1486
|
+
"data source",
|
|
1487
|
+
"database",
|
|
1488
|
+
"initial catalog",
|
|
1489
|
+
"user id",
|
|
1490
|
+
"userid",
|
|
1491
|
+
"uid",
|
|
1492
|
+
"user",
|
|
1493
|
+
"host",
|
|
1494
|
+
"driver",
|
|
1495
|
+
"provider",
|
|
1496
|
+
"dsn",
|
|
1497
|
+
"connectionstring",
|
|
1498
|
+
"connection string",
|
|
1499
|
+
],
|
|
1500
|
+
confidenceWithoutContext: DataConfidence_1.default.Medium,
|
|
1501
|
+
specificity: 2,
|
|
1502
|
+
isTestValue: (normalized) => {
|
|
1503
|
+
return normalized.includes("EXAMPLE");
|
|
1504
|
+
},
|
|
1505
|
+
};
|
|
1506
|
+
/*
|
|
1507
|
+
* An HTTP Authorization header's credential, as a request dump, a curl
|
|
1508
|
+
* command, a HAR file or a JSON log writes it ("Authorization: ...",
|
|
1509
|
+
* "authorization":"...", Header.Set("Authorization", "...")).
|
|
1510
|
+
*
|
|
1511
|
+
* Basic: valid base64 of "user:password", with a password. The examples
|
|
1512
|
+
* of the RFCs and documentation ("Aladdin:open sesame", "user:pass") are
|
|
1513
|
+
* test values.
|
|
1514
|
+
*/
|
|
1515
|
+
const AUTHORIZATION_BASIC_PATTERN = /(?<![A-Za-z0-9_])authorization\\?["']?\s{0,4}[:=,]\s{0,4}\\?["']?\s{0,4}basic\s{1,4}([A-Za-z0-9+/]{4,1024}={0,2})(?![A-Za-z0-9+/=])/gi;
|
|
1516
|
+
const DOCUMENTED_BASIC_CREDENTIALS = new Set([
|
|
1517
|
+
"aladdin:open sesame",
|
|
1518
|
+
"aladdin:opensesame",
|
|
1519
|
+
"user:pass",
|
|
1520
|
+
"user:password",
|
|
1521
|
+
"username:password",
|
|
1522
|
+
"admin:admin",
|
|
1523
|
+
"admin:password",
|
|
1524
|
+
"test:test",
|
|
1525
|
+
"foo:bar",
|
|
1526
|
+
"demo:demo",
|
|
1527
|
+
]);
|
|
1528
|
+
// The "user:password" a Basic credential holds, or null.
|
|
1529
|
+
function basicCredentials(value) {
|
|
1530
|
+
const bytes = decodeBase64(value);
|
|
1531
|
+
if (!bytes) {
|
|
1532
|
+
return null;
|
|
1533
|
+
}
|
|
1534
|
+
const text = bytesToText(bytes);
|
|
1535
|
+
for (let index = 0; index < text.length; index++) {
|
|
1536
|
+
const code = text.charCodeAt(index);
|
|
1537
|
+
if (code < 32 || code === 127) {
|
|
1538
|
+
return null;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
const colon = text.indexOf(":");
|
|
1542
|
+
return colon < 0 || colon === text.length - 1 ? null : text;
|
|
1543
|
+
}
|
|
1544
|
+
const authorizationBasicDetector = {
|
|
1545
|
+
dataTypeId: "authorization-header",
|
|
1546
|
+
quickCheck: (0, Detector_1.containsAny)(["authorization"]),
|
|
1547
|
+
quickCheckLowerCase: true,
|
|
1548
|
+
pattern: AUTHORIZATION_BASIC_PATTERN,
|
|
1549
|
+
valueGroup: 1,
|
|
1550
|
+
validate: (normalized) => {
|
|
1551
|
+
const credentials = basicCredentials(normalized);
|
|
1552
|
+
return (credentials !== null &&
|
|
1553
|
+
!isPlaceholderSecret(credentials.slice(credentials.indexOf(":") + 1)));
|
|
1554
|
+
},
|
|
1555
|
+
keywords: ["authorization", "basic"],
|
|
1556
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
1557
|
+
specificity: 2,
|
|
1558
|
+
isTestValue: (normalized) => {
|
|
1559
|
+
const credentials = basicCredentials(normalized) || "";
|
|
1560
|
+
return (credentials.includes("EXAMPLE") ||
|
|
1561
|
+
DOCUMENTED_BASIC_CREDENTIALS.has(credentials.toLowerCase()));
|
|
1562
|
+
},
|
|
1563
|
+
};
|
|
1564
|
+
/*
|
|
1565
|
+
* Bearer (and "Token", as GitHub and Django REST Framework write it): a
|
|
1566
|
+
* token of at least 16 characters that is no placeholder and is random
|
|
1567
|
+
* enough to be one. A JWT or a provider's token here is also found by its
|
|
1568
|
+
* own, more specific detector, which wins.
|
|
1569
|
+
*/
|
|
1570
|
+
const AUTHORIZATION_BEARER_PATTERN = /(?<![A-Za-z0-9_])authorization\\?["']?\s{0,4}[:=,]\s{0,4}\\?["']?\s{0,4}(?:bearer|token)\s{1,4}([A-Za-z0-9._~+/-]{16,4096}={0,2})(?![A-Za-z0-9._~+/=-])/gi;
|
|
1571
|
+
const BEARER_TOKEN_ENTROPY = 3;
|
|
1572
|
+
const authorizationBearerDetector = {
|
|
1573
|
+
dataTypeId: "authorization-header",
|
|
1574
|
+
quickCheck: (0, Detector_1.containsAny)(["authorization"]),
|
|
1575
|
+
quickCheckLowerCase: true,
|
|
1576
|
+
pattern: AUTHORIZATION_BEARER_PATTERN,
|
|
1577
|
+
valueGroup: 1,
|
|
1578
|
+
validate: (normalized) => {
|
|
1579
|
+
return (!isPlaceholderSecret(normalized) &&
|
|
1580
|
+
(0, Validators_1.shannonEntropy)(normalized) >= BEARER_TOKEN_ENTROPY);
|
|
1581
|
+
},
|
|
1582
|
+
keywords: ["authorization", "bearer"],
|
|
1583
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
1584
|
+
specificity: 2,
|
|
1585
|
+
isTestValue: (normalized) => {
|
|
1586
|
+
return isExampleToken(normalized) || isSampleJwt(normalized);
|
|
1587
|
+
},
|
|
1588
|
+
};
|
|
1589
|
+
/*
|
|
1590
|
+
* A value assigned to a password, a secret, an API key or an access, auth,
|
|
1591
|
+
* refresh or private token, in any of the ways configs and code write
|
|
1592
|
+
* one: PASSWORD=..., "api_key": "...", secret: ..., password => '...',
|
|
1593
|
+
* token := "...", --password=... The key may be part of a longer name
|
|
1594
|
+
* (DB_PASSWORD, stripeApiKey, client_secret, SECRET_KEY) but not of a word
|
|
1595
|
+
* (secretary, passwordless). The value sits on the key's own line ("key:"
|
|
1596
|
+
* with nothing after it does not take the next line's text), is printable
|
|
1597
|
+
* ASCII up to a quote, a space or a delimiter, and is not followed by "("
|
|
1598
|
+
* or "[" (code that reads it: getPassword(), env["KEY"]) nor by " =" (a
|
|
1599
|
+
* type, not a value: const API_TOKEN: OAuth2Token = ...). The value - only
|
|
1600
|
+
* the value - must pass isGenericSecretValue.
|
|
1601
|
+
*
|
|
1602
|
+
* Medium on its own: the key's name is all the context it has, and it
|
|
1603
|
+
* says "a secret" without saying whose. A provider's key assigned this way
|
|
1604
|
+
* is also found, at High, by its own detector, which wins.
|
|
1605
|
+
*
|
|
1606
|
+
* Bounded on text anyone may write: the name before the key word is at most
|
|
1607
|
+
* 32 characters, so a run like Y-Y-Y- (a start at every letter) is read in
|
|
1608
|
+
* time in line with the text (SecretDetectorPatternTiming.test.ts).
|
|
1609
|
+
*/
|
|
1610
|
+
const GENERIC_SECRET_PATTERN = /(?<![A-Za-z0-9])[A-Za-z0-9_.-]{0,32}?(?:pass(?:word|wd|phrase)|pwd|secret|api[_.-]?key|(?:access|auth|refresh|private)[_.-]?token)(?:[_.-](?:key|token|value|string|[0-9])|key|token|value|[0-9])?\\?["']?[ \t]{0,4}(?:=>|:=|=|:)[ \t]{0,4}\\?["']?([!#$%*+./0-9:=?@A-Z^_a-z|~-]{8,128})(?![!#$%*+./0-9:=?@A-Z^_a-z|~([\u00a0-\uffff-]|[ \t]{1,4}=)/gi;
|
|
1611
|
+
/*
|
|
1612
|
+
* Secrets documentation hands out as examples: Google Authenticator's
|
|
1613
|
+
* sample TOTP seed.
|
|
1614
|
+
*/
|
|
1615
|
+
const DOCUMENTED_EXAMPLE_SECRETS = new Set([
|
|
1616
|
+
"JBSWY3DPEHPK3PXP",
|
|
1617
|
+
]);
|
|
1618
|
+
const genericSecretDetector = {
|
|
1619
|
+
dataTypeId: "generic-secret",
|
|
1620
|
+
quickCheck: (0, Detector_1.containsAny)(["pass", "pwd", "secret", "api", "token"]),
|
|
1621
|
+
quickCheckLowerCase: true,
|
|
1622
|
+
pattern: GENERIC_SECRET_PATTERN,
|
|
1623
|
+
valueGroup: 1,
|
|
1624
|
+
validate: isGenericSecretValue,
|
|
1625
|
+
negativeKeywords: [
|
|
1626
|
+
"example",
|
|
1627
|
+
"sample",
|
|
1628
|
+
"placeholder",
|
|
1629
|
+
"dummy",
|
|
1630
|
+
"fake",
|
|
1631
|
+
"mock",
|
|
1632
|
+
],
|
|
1633
|
+
confidenceWithoutContext: DataConfidence_1.default.Medium,
|
|
1634
|
+
specificity: 1,
|
|
1635
|
+
isTestValue: (normalized) => {
|
|
1636
|
+
return (normalized.includes("EXAMPLE") ||
|
|
1637
|
+
longestRun(normalized) >= FILLER_RUN ||
|
|
1638
|
+
DOCUMENTED_EXAMPLE_SECRETS.has(normalized));
|
|
1639
|
+
},
|
|
1640
|
+
// A field named password, secret or api_key holding the value alone.
|
|
1641
|
+
fieldValuePattern: /^\S{8,128}$/,
|
|
1642
|
+
};
|
|
1643
|
+
/*
|
|
1644
|
+
* Bitcoin private key in wallet import format: Base58Check of version byte
|
|
1645
|
+
* 0x80, the 32-byte key and - for a compressed key - 0x01: 51 characters
|
|
1646
|
+
* starting "5", or 52 starting "K" or "L". A testnet key (version 0xEF,
|
|
1647
|
+
* "9" or "c") holds no money: a test value, as is the Bitcoin wiki's
|
|
1648
|
+
* example key.
|
|
1649
|
+
*/
|
|
1650
|
+
const BITCOIN_PRIVATE_KEY_PATTERN = /(?<![A-Za-z0-9])(?:[59][1-9A-HJ-NP-Za-km-z]{50}|[KLc][1-9A-HJ-NP-Za-km-z]{51})(?![A-Za-z0-9])/g;
|
|
1651
|
+
const WIF_MAINNET_VERSION = 0x80;
|
|
1652
|
+
const WIF_TESTNET_VERSION = 0xef;
|
|
1653
|
+
// The wiki's "Wallet import format" page converts this key.
|
|
1654
|
+
const WIF_WIKI_EXAMPLE_KEY = "0c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d";
|
|
1655
|
+
// The decoded key with its version byte and checksum, or null.
|
|
1656
|
+
function walletImportBytes(value) {
|
|
1657
|
+
const bytes = (0, Validators_1.base58Decode)(value);
|
|
1658
|
+
if (!bytes ||
|
|
1659
|
+
!(bytes.length === 37 || (bytes.length === 38 && bytes[33] === 0x01))) {
|
|
1660
|
+
return null;
|
|
1661
|
+
}
|
|
1662
|
+
return bytes;
|
|
1663
|
+
}
|
|
1664
|
+
function hex(bytes) {
|
|
1665
|
+
let text = "";
|
|
1666
|
+
for (let index = 0; index < bytes.length; index++) {
|
|
1667
|
+
text += bytes[index].toString(16).padStart(2, "0");
|
|
1668
|
+
}
|
|
1669
|
+
return text;
|
|
1670
|
+
}
|
|
1671
|
+
const bitcoinPrivateKeyDetector = {
|
|
1672
|
+
dataTypeId: "bitcoin-private-key",
|
|
1673
|
+
pattern: BITCOIN_PRIVATE_KEY_PATTERN,
|
|
1674
|
+
validate: (normalized) => {
|
|
1675
|
+
const bytes = walletImportBytes(normalized);
|
|
1676
|
+
return (bytes !== null &&
|
|
1677
|
+
(bytes[0] === WIF_MAINNET_VERSION || bytes[0] === WIF_TESTNET_VERSION) &&
|
|
1678
|
+
(0, Validators_1.base58Check)(normalized));
|
|
1679
|
+
},
|
|
1680
|
+
keywords: ["bitcoin", "btc", "wif", "private key", "wallet"],
|
|
1681
|
+
confidenceWithoutContext: DataConfidence_1.default.High,
|
|
1682
|
+
specificity: 3,
|
|
1683
|
+
isTestValue: (normalized) => {
|
|
1684
|
+
const bytes = walletImportBytes(normalized);
|
|
1685
|
+
return (bytes !== null &&
|
|
1686
|
+
(bytes[0] === WIF_TESTNET_VERSION ||
|
|
1687
|
+
hex(bytes.slice(1, 33)) === WIF_WIKI_EXAMPLE_KEY));
|
|
1688
|
+
},
|
|
1689
|
+
};
|
|
1690
|
+
exports.SECRET_DETECTORS = [
|
|
1691
|
+
awsAccessKeyIdDetector,
|
|
1692
|
+
awsSecretAccessKeyDetector,
|
|
1693
|
+
googleApiKeyDetector,
|
|
1694
|
+
googleServiceAccountKeyDetector,
|
|
1695
|
+
googleOAuthClientSecretDetector,
|
|
1696
|
+
azureStorageAccountKeyDetector,
|
|
1697
|
+
azureSasTokenDetector,
|
|
1698
|
+
azureClientSecretDetector,
|
|
1699
|
+
githubTokenDetector,
|
|
1700
|
+
gitlabTokenDetector,
|
|
1701
|
+
slackTokenDetector,
|
|
1702
|
+
slackWebhookUrlDetector,
|
|
1703
|
+
stripeSecretKeyDetector,
|
|
1704
|
+
twilioApiKeyDetector,
|
|
1705
|
+
sendgridApiKeyDetector,
|
|
1706
|
+
mailgunApiKeyDetector,
|
|
1707
|
+
mailchimpApiKeyDetector,
|
|
1708
|
+
openaiApiKeyDetector,
|
|
1709
|
+
anthropicApiKeyDetector,
|
|
1710
|
+
huggingfaceTokenDetector,
|
|
1711
|
+
npmTokenDetector,
|
|
1712
|
+
pypiTokenDetector,
|
|
1713
|
+
dockerHubTokenDetector,
|
|
1714
|
+
shopifyTokenDetector,
|
|
1715
|
+
squareTokenDetector,
|
|
1716
|
+
braintreeAccessTokenDetector,
|
|
1717
|
+
digitaloceanTokenDetector,
|
|
1718
|
+
newRelicApiKeyDetector,
|
|
1719
|
+
datadogApiKeyDetector,
|
|
1720
|
+
vaultTokenDetector,
|
|
1721
|
+
terraformCloudTokenDetector,
|
|
1722
|
+
atlassianApiTokenDetector,
|
|
1723
|
+
linearApiKeyDetector,
|
|
1724
|
+
jsonWebTokenDetector,
|
|
1725
|
+
privateKeyDetector,
|
|
1726
|
+
passwordInUrlDetector,
|
|
1727
|
+
connectionStringPasswordDetector,
|
|
1728
|
+
authorizationBasicDetector,
|
|
1729
|
+
authorizationBearerDetector,
|
|
1730
|
+
genericSecretDetector,
|
|
1731
|
+
bitcoinPrivateKeyDetector,
|
|
1732
|
+
];
|
|
1733
|
+
exports.default = exports.SECRET_DETECTORS;
|