From eb5d60492510de729f003f01c2a0bfc42e713ce0 Mon Sep 17 00:00:00 2001 From: Thomas Hunter II Date: Tue, 3 Dec 2024 22:00:17 -0800 Subject: [PATCH] remove redis cloud TLS Profile feature Signed-off-by: Thomas Hunter II --- README.md | 26 ------ lib/Redis.ts | 4 +- lib/cluster/util.ts | 4 +- lib/constants/TLSProfiles.ts | 149 ----------------------------------- lib/utils/index.ts | 21 ----- test/unit/utils.ts | 70 ---------------- 6 files changed, 3 insertions(+), 271 deletions(-) delete mode 100644 lib/constants/TLSProfiles.ts diff --git a/README.md b/README.md index 9bf87fc5..87c95346 100644 --- a/README.md +++ b/README.md @@ -848,32 +848,6 @@ const valkey = new Valkey({ }); ``` -### TLS Profiles - -> **Warning** -> TLS profiles described in this section are going to be deprecated in the next major version. Please provide TLS options explicitly. - -To make it easier to configure we provide a few pre-configured TLS profiles that can be specified by setting the `tls` option to the profile's name or specifying a `tls.profile` option in case you need to customize some values of the profile. - -Profiles: - -- `RedisCloudFixed`: Contains the CA for [Redis.com](https://redis.com/) Cloud fixed subscriptions -- `RedisCloudFlexible`: Contains the CA for [Redis.com](https://redis.com/) Cloud flexible subscriptions - -```javascript -const valkey = new Valkey({ - host: "localhost", - tls: "RedisCloudFixed", -}); - -const valkeyWithClientCertificate = new Valkey({ - host: "localhost", - tls: { - profile: "RedisCloudFixed", - key: "123", - }, -}); -```
diff --git a/lib/Redis.ts b/lib/Redis.ts index 18121574..de8356ac 100644 --- a/lib/Redis.ts +++ b/lib/Redis.ts @@ -27,7 +27,6 @@ import { Debug, isInt, parseURL, - resolveTLSProfile, } from "./utils"; import applyMixin from "./utils/applyMixin"; import Commander from "./utils/Commander"; @@ -742,8 +741,7 @@ class Redis extends Commander implements DataHandledable { options.db = parseInt(options.db, 10); } - // @ts-expect-error - this.options = resolveTLSProfile(options); + this.options = options; } /** diff --git a/lib/cluster/util.ts b/lib/cluster/util.ts index 4b12b955..0067e403 100644 --- a/lib/cluster/util.ts +++ b/lib/cluster/util.ts @@ -1,4 +1,4 @@ -import { parseURL, resolveTLSProfile } from "../utils"; +import { parseURL } from "../utils"; import { isIP } from "net"; import { SrvRecord } from "dns"; @@ -67,7 +67,7 @@ export function normalizeNodeOptions( options.host = "127.0.0.1"; } - return resolveTLSProfile(options); + return options; }); } diff --git a/lib/constants/TLSProfiles.ts b/lib/constants/TLSProfiles.ts deleted file mode 100644 index 45074fc7..00000000 --- a/lib/constants/TLSProfiles.ts +++ /dev/null @@ -1,149 +0,0 @@ -/** - * TLS settings for Redis Cloud. Updated on 2022-08-19. - */ -const RedisCloudCA = `-----BEGIN CERTIFICATE----- -MIIDTzCCAjegAwIBAgIJAKSVpiDswLcwMA0GCSqGSIb3DQEBBQUAMD4xFjAUBgNV -BAoMDUdhcmFudGlhIERhdGExJDAiBgNVBAMMG1NTTCBDZXJ0aWZpY2F0aW9uIEF1 -dGhvcml0eTAeFw0xMzEwMDExMjE0NTVaFw0yMzA5MjkxMjE0NTVaMD4xFjAUBgNV -BAoMDUdhcmFudGlhIERhdGExJDAiBgNVBAMMG1NTTCBDZXJ0aWZpY2F0aW9uIEF1 -dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALZqkh/DczWP -JnxnHLQ7QL0T4B4CDKWBKCcisriGbA6ZePWVNo4hfKQC6JrzfR+081NeD6VcWUiz -rmd+jtPhIY4c+WVQYm5PKaN6DT1imYdxQw7aqO5j2KUCEh/cznpLxeSHoTxlR34E -QwF28Wl3eg2vc5ct8LjU3eozWVk3gb7alx9mSA2SgmuX5lEQawl++rSjsBStemY2 -BDwOpAMXIrdEyP/cVn8mkvi/BDs5M5G+09j0gfhyCzRWMQ7Hn71u1eolRxwVxgi3 -TMn+/vTaFSqxKjgck6zuAYjBRPaHe7qLxHNr1So/Mc9nPy+3wHebFwbIcnUojwbp -4nctkWbjb2cCAwEAAaNQME4wHQYDVR0OBBYEFP1whtcrydmW3ZJeuSoKZIKjze3w -MB8GA1UdIwQYMBaAFP1whtcr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ztcpH -WD9f ------END CERTIFICATE-----`; - -const TLSProfiles = { - RedisCloudFixed: { ca: RedisCloudCA }, - RedisCloudFlexible: { ca: RedisCloudCA }, -} as const; - -export default TLSProfiles; diff --git a/lib/utils/index.ts b/lib/utils/index.ts index 46bf2161..350f95aa 100644 --- a/lib/utils/index.ts +++ b/lib/utils/index.ts @@ -3,8 +3,6 @@ import { defaults, noop } from "./lodash"; import { Callback } from "../types"; import Debug from "./debug"; -import TLSProfiles from "../constants/TLSProfiles"; - /** * Convert a buffer to string, supports buffer array * @@ -255,25 +253,6 @@ interface TLSOptions { [key: string]: any; } -/** - * Resolve TLS profile shortcut in connection options - */ -export function resolveTLSProfile(options: TLSOptions): TLSOptions { - let tls = options?.tls; - - if (typeof tls === "string") tls = { profile: tls }; - - const profile = TLSProfiles[tls?.profile]; - - if (profile) { - tls = Object.assign({}, profile, tls); - delete tls.profile; - options = Object.assign({}, options, { tls }); - } - - return options; -} - /** * Get a random element from `array` */ diff --git a/test/unit/utils.ts b/test/unit/utils.ts index 7aa80822..27b00048 100644 --- a/test/unit/utils.ts +++ b/test/unit/utils.ts @@ -1,7 +1,6 @@ import * as sinon from "sinon"; import { expect } from "chai"; import * as utils from "../../lib/utils"; -import TLSProfiles from "../../lib/constants/TLSProfiles"; describe("utils", () => { describe(".convertBufferToString", () => { @@ -206,75 +205,6 @@ describe("utils", () => { }); }); - describe(".resolveTLSProfile", () => { - it("should leave options alone when no tls profile is set", () => { - [ - { host: "localhost", port: 6379 }, - { host: "localhost", port: 6379, tls: true }, - { host: "localhost", port: 6379, tls: false }, - { host: "localhost", port: 6379, tls: "foo" }, - { host: "localhost", port: 6379, tls: {} }, - { host: "localhost", port: 6379, tls: { ca: "foo" } }, - { host: "localhost", port: 6379, tls: { profile: "foo" } }, - ].forEach((options) => { - expect(utils.resolveTLSProfile(options)).to.eql(options); - }); - }); - - it("should have redis.com profiles defined", () => { - expect(TLSProfiles).to.have.property("RedisCloudFixed"); - expect(TLSProfiles).to.have.property("RedisCloudFlexible"); - }); - - it("should read profile from options.tls.profile", () => { - const input = { - host: "localhost", - port: 6379, - tls: { profile: "RedisCloudFixed" }, - }; - const expected = { - host: "localhost", - port: 6379, - tls: TLSProfiles.RedisCloudFixed, - }; - - expect(utils.resolveTLSProfile(input)).to.eql(expected); - }); - - it("should read profile from options.tls", () => { - const input = { - host: "localhost", - port: 6379, - tls: "RedisCloudFixed", - }; - const expected = { - host: "localhost", - port: 6379, - tls: TLSProfiles.RedisCloudFixed, - }; - - expect(utils.resolveTLSProfile(input)).to.eql(expected); - }); - - it("supports extra options when using options.tls.profile", () => { - const input = { - host: "localhost", - port: 6379, - tls: { profile: "RedisCloudFixed", key: "foo" }, - }; - const expected = { - host: "localhost", - port: 6379, - tls: { - ...TLSProfiles.RedisCloudFixed, - key: "foo", - }, - }; - - expect(utils.resolveTLSProfile(input)).to.eql(expected); - }); - }); - describe(".sample", () => { it("should return a random value", () => { let stub = sinon.stub(Math, "random").callsFake(() => 0);