diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 95bea3f..888b378 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/Yelp/detect-secrets - rev: v0.13.1 + rev: v1.4.0 hooks: - id: detect-secrets args: ['--baseline', '.secrets.baseline'] diff --git a/.secrets.baseline b/.secrets.baseline index 2ca7deb..ed46322 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -1,19 +1,18 @@ { - "exclude": { - "files": "package-lock.json|^.secrets.baseline$", - "lines": null - }, - "generated_at": "2021-08-12T13:00:16Z", + "version": "1.4.0", "plugins_used": [ + { + "name": "ArtifactoryDetector" + }, { "name": "AWSKeyDetector" }, { - "name": "ArtifactoryDetector" + "name": "AzureStorageKeyDetector" }, { - "base64_limit": 4.5, - "name": "Base64HighEntropyString" + "name": "Base64HighEntropyString", + "limit": 4.5 }, { "name": "BasicAuthDetector" @@ -22,8 +21,14 @@ "name": "CloudantDetector" }, { - "hex_limit": 3, - "name": "HexHighEntropyString" + "name": "DiscordBotTokenDetector" + }, + { + "name": "GitHubTokenDetector" + }, + { + "name": "HexHighEntropyString", + "limit": 3.0 }, { "name": "IbmCloudIamDetector" @@ -35,21 +40,30 @@ "name": "JwtTokenDetector" }, { - "keyword_exclude": null, - "name": "KeywordDetector" + "name": "KeywordDetector", + "keyword_exclude": "" }, { "name": "MailchimpDetector" }, + { + "name": "NpmDetector" + }, { "name": "PrivateKeyDetector" }, + { + "name": "SendGridDetector" + }, { "name": "SlackDetector" }, { "name": "SoftlayerDetector" }, + { + "name": "SquareOAuthDetector" + }, { "name": "StripeDetector" }, @@ -57,19 +71,42 @@ "name": "TwilioKeyDetector" } ], - "results": { - "README.md": [ - { - "hashed_secret": "29fcd7da9dc4cf68637e6efc7b29da7493ff1524", - "is_verified": false, - "line_number": 50, - "type": "Secret Keyword" - } - ] - }, - "version": "0.13.1", - "word_list": { - "file": null, - "hash": null - } + "filters_used": [ + { + "path": "detect_secrets.filters.allowlist.is_line_allowlisted" + }, + { + "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies", + "min_level": 2 + }, + { + "path": "detect_secrets.filters.heuristic.is_indirect_reference" + }, + { + "path": "detect_secrets.filters.heuristic.is_likely_id_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_lock_file" + }, + { + "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_potential_uuid" + }, + { + "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign" + }, + { + "path": "detect_secrets.filters.heuristic.is_sequential_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_swagger_file" + }, + { + "path": "detect_secrets.filters.heuristic.is_templated_secret" + } + ], + "results": {}, + "generated_at": "2023-04-20T08:32:31Z" } diff --git a/README.md b/README.md index f64ec77..85e43a1 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,13 @@ npm install --save ffc-messaging `host` - Azure Service Bus namespace, for example, `myservicebus.servicebus.windows.net` -`useCredentialChain` - Boolean value for whether to authenticate connection with using Azure's credential chain. For example, set this to true if you wish to use [AAD Pod Identity](https://github.com/Azure/aad-pod-identity). If `false`, then `username` and `password` are required. +`useCredentialChain` - Boolean value for whether to authenticate connection with using Azure's credential chain. For example, set this to true if you wish to use [AAD Pod Identity](https://github.com/Azure/aad-pod-identity). If `false`, then `username` and `password` or `connectionString` are required. -`username` - Azure Service Bus Shared Access Key name for authentication. Not required if `useCredentialChain` is `true`. +`connectionString` - Azure Service Bus connection string. If provided, `username` and `password` are ignored. -`password` - Azure Service Bus Shared Access Key value for authentication. Not required if `useCredentialChain` is `true`. +`username` - Azure Service Bus Shared Access Key name for authentication. Not required if `useCredentialChain` is `true` or `connectionString` is provided. + +`password` - Azure Service Bus Shared Access Key value for authentication. Not required if `useCredentialChain` is `true` or `connectionString` is provided. `type` - Azure Service Bus entity to connect to, allows `queue`, `sessionQueue`, `topic` or `subscription`. diff --git a/app/messaging/admin-client.js b/app/messaging/admin-client.js index 8202ea7..4a73d28 100644 --- a/app/messaging/admin-client.js +++ b/app/messaging/admin-client.js @@ -13,6 +13,8 @@ class AdminClient { if (this.config.useCredentialChain) { const credentials = this.getCredentials() this.sbClient = new ServiceBusAdministrationClient(this.config.host, credentials) + } else if (this.config.connectionString) { + this.sbClient = new ServiceBusAdministrationClient(this.config.connectionString) } else { this.sbClient = new ServiceBusAdministrationClient(`Endpoint=sb://${this.config.host}/;SharedAccessKeyName=${this.config.username};SharedAccessKey=${this.config.password}`) } diff --git a/app/messaging/message-base.js b/app/messaging/message-base.js index 4750afc..21ce931 100644 --- a/app/messaging/message-base.js +++ b/app/messaging/message-base.js @@ -13,6 +13,8 @@ class MessageBase { if (this.config.useCredentialChain) { const credentials = this.getCredentials() this.sbClient = new ServiceBusClient(this.config.host, credentials) + } else if (this.config.connectionString) { + this.sbClient = new ServiceBusClient(this.config.connectionString) } else { this.sbClient = new ServiceBusClient(`Endpoint=sb://${this.config.host}/;SharedAccessKeyName=${this.config.username};SharedAccessKey=${this.config.password}`) } diff --git a/package.json b/package.json index 9c96973..9a577a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ffc-messaging", - "version": "2.6.5", + "version": "2.7.0", "description": "Messaging npm module for FFC services", "main": "index.js", "repository": {