mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-09 15:38:03 -05:00
Remove username pwd in redis resource
This commit is contained in:
@@ -46,8 +46,6 @@ const makeRedisConnection = (
|
|||||||
): RedisResourceConnection => {
|
): RedisResourceConnection => {
|
||||||
const { connectionDetails, username, password } = config;
|
const { connectionDetails, username, password } = config;
|
||||||
const { sslEnabled, sslRejectUnauthorized, sslCertificate } = connectionDetails;
|
const { sslEnabled, sslRejectUnauthorized, sslCertificate } = connectionDetails;
|
||||||
const actualUsername = username ?? connectionDetails.username ?? TEST_CONNECTION_USERNAME;
|
|
||||||
const actualPassword = password ?? connectionDetails.password ?? TEST_CONNECTION_PASSWORD;
|
|
||||||
|
|
||||||
let client: Redis | null = null;
|
let client: Redis | null = null;
|
||||||
|
|
||||||
@@ -55,8 +53,6 @@ const makeRedisConnection = (
|
|||||||
return new Redis({
|
return new Redis({
|
||||||
host: "localhost",
|
host: "localhost",
|
||||||
port: proxyPort,
|
port: proxyPort,
|
||||||
username: actualUsername,
|
|
||||||
password: actualPassword,
|
|
||||||
connectTimeout: EXTERNAL_REQUEST_TIMEOUT,
|
connectTimeout: EXTERNAL_REQUEST_TIMEOUT,
|
||||||
commandTimeout: EXTERNAL_REQUEST_TIMEOUT,
|
commandTimeout: EXTERNAL_REQUEST_TIMEOUT,
|
||||||
...(sslEnabled && {
|
...(sslEnabled && {
|
||||||
@@ -75,14 +71,6 @@ const makeRedisConnection = (
|
|||||||
validate: async (connectOnly) => {
|
validate: async (connectOnly) => {
|
||||||
try {
|
try {
|
||||||
client = createClient();
|
client = createClient();
|
||||||
|
|
||||||
// Test authentication
|
|
||||||
const result = await client.auth(actualUsername, actualPassword);
|
|
||||||
if (result !== "OK") {
|
|
||||||
throw new BadRequestError({ message: `Redis authentication failed: ${result as string}` });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test connection with a simple command
|
|
||||||
await client.ping();
|
await client.ping();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (connectOnly) {
|
if (connectOnly) {
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import {
|
|||||||
export const RedisResourceConnectionDetailsSchema = z.object({
|
export const RedisResourceConnectionDetailsSchema = z.object({
|
||||||
host: z.string().trim().min(1).max(255),
|
host: z.string().trim().min(1).max(255),
|
||||||
port: z.coerce.number(),
|
port: z.coerce.number(),
|
||||||
username: z.string().trim().min(1).max(63).optional(),
|
|
||||||
password: z.string().trim().max(256).optional(),
|
|
||||||
sslEnabled: z.boolean(),
|
sslEnabled: z.boolean(),
|
||||||
sslRejectUnauthorized: z.boolean(),
|
sslRejectUnauthorized: z.boolean(),
|
||||||
sslCertificate: z
|
sslCertificate: z
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { z } from "zod";
|
|||||||
import { Button, ModalClose } from "@app/components/v2";
|
import { Button, ModalClose } from "@app/components/v2";
|
||||||
import { PamResourceType, TRedisResource } from "@app/hooks/api/pam";
|
import { PamResourceType, TRedisResource } from "@app/hooks/api/pam";
|
||||||
|
|
||||||
import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
|
|
||||||
import { RedisResourceFields } from "./shared/RedisResourceFields";
|
import { RedisResourceFields } from "./shared/RedisResourceFields";
|
||||||
|
import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
resource?: TRedisResource;
|
resource?: TRedisResource;
|
||||||
@@ -19,8 +19,6 @@ const formSchema = genericResourceFieldsSchema.extend({
|
|||||||
connectionDetails: z.object({
|
connectionDetails: z.object({
|
||||||
host: z.string().trim().min(1, "Host required"),
|
host: z.string().trim().min(1, "Host required"),
|
||||||
port: z.coerce.number().default(6379),
|
port: z.coerce.number().default(6379),
|
||||||
username: z.string().trim().optional(),
|
|
||||||
password: z.string().trim().optional(),
|
|
||||||
sslEnabled: z.boolean().default(true),
|
sslEnabled: z.boolean().default(true),
|
||||||
sslRejectUnauthorized: z.boolean().default(true),
|
sslRejectUnauthorized: z.boolean().default(true),
|
||||||
sslCertificate: z
|
sslCertificate: z
|
||||||
@@ -44,8 +42,6 @@ export const RedisResourceForm = ({ resource, onSubmit }: Props) => {
|
|||||||
connectionDetails: {
|
connectionDetails: {
|
||||||
host: "",
|
host: "",
|
||||||
port: 6379,
|
port: 6379,
|
||||||
username: undefined,
|
|
||||||
password: undefined,
|
|
||||||
sslEnabled: true,
|
sslEnabled: true,
|
||||||
sslRejectUnauthorized: true,
|
sslRejectUnauthorized: true,
|
||||||
sslCertificate: undefined
|
sslCertificate: undefined
|
||||||
|
|||||||
@@ -69,38 +69,6 @@ export const RedisResourceFields = ({ setSelectedTabIndex, selectedTabIndex }: P
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-4 flex items-start gap-2">
|
|
||||||
<Controller
|
|
||||||
name="connectionDetails.username"
|
|
||||||
control={control}
|
|
||||||
render={({ field, fieldState: { error } }) => (
|
|
||||||
<FormControl
|
|
||||||
className="flex-1"
|
|
||||||
errorText={error?.message}
|
|
||||||
isError={Boolean(error?.message)}
|
|
||||||
label="Username"
|
|
||||||
isOptional
|
|
||||||
>
|
|
||||||
<Input {...field} />
|
|
||||||
</FormControl>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<Controller
|
|
||||||
name="connectionDetails.password"
|
|
||||||
control={control}
|
|
||||||
render={({ field, fieldState: { error } }) => (
|
|
||||||
<FormControl
|
|
||||||
className="flex-1"
|
|
||||||
errorText={error?.message}
|
|
||||||
isError={Boolean(error?.message)}
|
|
||||||
label="Password"
|
|
||||||
isOptional
|
|
||||||
>
|
|
||||||
<Input type="password" {...field} />
|
|
||||||
</FormControl>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Tab.Panel>
|
</Tab.Panel>
|
||||||
<Tab.Panel>
|
<Tab.Panel>
|
||||||
<Controller
|
<Controller
|
||||||
|
|||||||
Reference in New Issue
Block a user