Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix PR comments

Matheus Nogueiraebe1908508ab
diff --git a/backend/src/services/app-connection/hpe-ilo/hpe-ilo-connection-fns.ts b/backend/src/services/app-connection/hpe-ilo/hpe-ilo-connection-fns.ts
index 068f74f219..926d73c61b 100644
--- a/backend/src/services/app-connection/hpe-ilo/hpe-ilo-connection-fns.ts
+++ b/backend/src/services/app-connection/hpe-ilo/hpe-ilo-connection-fns.ts
@@ -13,6 +13,7 @@ import { HpeIloConnectionMethod } from "./hpe-ilo-connection-enums";
import { THpeIloConnectionConfig } from "./hpe-ilo-connection-types";
export const HPE_ILO_DEFAULT_PORT = 443;
+const HPE_ILO_REQUEST_TIMEOUT_MS = 30_000;
const HPE_ILO_ACCOUNTS_PATH = "/redfish/v1/AccountService/Accounts/";
export const getHpeIloConnectionListItem = () => {
@@ -71,10 +72,12 @@ export const executeHpeIloRequest = async <T>(
return withGatewayV2Proxy(
async (proxyPort) => {
const resp = await safeRequest.request<T>({
+ timeout: HPE_ILO_REQUEST_TIMEOUT_MS,
...requestCfg,
...tlsOptions,
url: `https://localhost:${proxyPort}${requestCfg.url ?? ""}`,
- headers: { ...headers, Host: toUrlHost(hostname) },
+ // safeRequest's cached agent keeps sockets alive, which would hold the tunnel open after the proxy closes
+ headers: { ...headers, Host: toUrlHost(hostname), Connection: "close" },
// the hop is the local gateway proxy, and the iLO it reaches sits in the gateway's network
allowPrivateIps: true
});
@@ -88,6 +91,7 @@ export const executeHpeIloRequest = async <T>(
}
const resp = await safeRequest.request<T>({
+ timeout: HPE_ILO_REQUEST_TIMEOUT_MS,
...requestCfg,
...tlsOptions,
url: `${getHpeIloBaseUrl(credentials)}${requestCfg.url ?? ""}`,
@@ -117,6 +121,11 @@ export const validateHpeIloConnectionCredentials = async (
if (error instanceof BadRequestError) throw error;
if (isAxiosError(error)) {
+ if (error.code === "ECONNABORTED" || error.code === "ETIMEDOUT") {
+ throw new BadRequestError({
+ message: `Unable to validate connection: HPE iLO at '${hostname}' did not respond within ${HPE_ILO_REQUEST_TIMEOUT_MS / 1000} seconds.`
+ });
+ }
if (error.response?.status === HttpStatusCode.Unauthorized) {
throw new BadRequestError({
message: `Unable to validate connection: HPE iLO at '${hostname}' rejected the username or password.`
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HpeIloConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HpeIloConnectionForm.tsx
index 6df97126dd..eb8d4acc74 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HpeIloConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HpeIloConnectionForm.tsx
@@ -235,7 +235,7 @@ export const HpeIloConnectionForm = ({ appConnection, onSubmit }: Props) => {
name="credentials.port"
control={control}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field className="mb-4">
+ <Field className="mb-4 w-24">
<FieldLabel htmlFor="port">
Port <span className="text-muted">(optional)</span>
</FieldLabel>
@@ -247,7 +247,6 @@ export const HpeIloConnectionForm = ({ appConnection, onSubmit }: Props) => {
onChange(e.target.value ? Number(e.target.value) : undefined)
}
placeholder="443"
- className="w-24"
isError={Boolean(error?.message)}
/>
<FieldError errors={[error]} />