Skip to content

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

Add Heroku PR suggestions

carlosmonastyrski7473e3e21e39
diff --git a/backend/src/services/app-connection/heroku/heroku-connection-fns.ts b/backend/src/services/app-connection/heroku/heroku-connection-fns.ts
index dfb6f1e4b1..6d04c47805 100644
--- a/backend/src/services/app-connection/heroku/heroku-connection-fns.ts
+++ b/backend/src/services/app-connection/heroku/heroku-connection-fns.ts
@@ -86,7 +86,7 @@ export const refreshHerokuToken = async (
credentials: {
refreshToken,
authToken: data.access_token,
- expiresAt: new Date(Date.now() + data.expires_in - 60)
+ expiresAt: new Date(Date.now() + data.expires_in * 1000 - 60000)
},
orgId,
kmsService
diff --git a/backend/src/services/app-connection/heroku/heroku-connection-schemas.ts b/backend/src/services/app-connection/heroku/heroku-connection-schemas.ts
index 57f992eea2..99d637dd51 100644
--- a/backend/src/services/app-connection/heroku/heroku-connection-schemas.ts
+++ b/backend/src/services/app-connection/heroku/heroku-connection-schemas.ts
@@ -10,8 +10,8 @@ import {
import { HerokuConnectionMethod } from "./heroku-connection-enums";
-export const HerokuConnectionAccessTokenCredentialsSchema = z.object({
- authToken: z.string().trim().min(1, "Auth Token required")
+export const HerokuConnectionAuthTokenCredentialsSchema = z.object({
+ authToken: z.string().trim().min(1, "Auth Token required").startsWith("HRKU-", "Token must start with 'HRKU-")
});
export const HerokuConnectionOAuthCredentialsSchema = z.object({
@@ -38,7 +38,7 @@ export const HerokuConnectionSchema = z.intersection(
z.discriminatedUnion("method", [
z.object({
method: z.literal(HerokuConnectionMethod.AuthToken),
- credentials: HerokuConnectionAccessTokenCredentialsSchema
+ credentials: HerokuConnectionAuthTokenCredentialsSchema
}),
z.object({
method: z.literal(HerokuConnectionMethod.OAuth),
@@ -50,7 +50,7 @@ export const HerokuConnectionSchema = z.intersection(
export const SanitizedHerokuConnectionSchema = z.discriminatedUnion("method", [
BaseHerokuConnectionSchema.extend({
method: z.literal(HerokuConnectionMethod.AuthToken),
- credentials: HerokuConnectionAccessTokenCredentialsSchema.pick({})
+ credentials: HerokuConnectionAuthTokenCredentialsSchema.pick({})
}),
BaseHerokuConnectionSchema.extend({
method: z.literal(HerokuConnectionMethod.OAuth),
@@ -61,7 +61,7 @@ export const SanitizedHerokuConnectionSchema = z.discriminatedUnion("method", [
export const ValidateHerokuConnectionCredentialsSchema = z.discriminatedUnion("method", [
z.object({
method: z.literal(HerokuConnectionMethod.AuthToken).describe(AppConnections.CREATE(AppConnection.Heroku).method),
- credentials: HerokuConnectionAccessTokenCredentialsSchema.describe(
+ credentials: HerokuConnectionAuthTokenCredentialsSchema.describe(
AppConnections.CREATE(AppConnection.Heroku).credentials
)
}),
@@ -85,7 +85,7 @@ export const UpdateHerokuConnectionSchema = z
.object({
credentials: z
.union([
- HerokuConnectionAccessTokenCredentialsSchema,
+ HerokuConnectionAuthTokenCredentialsSchema,
HerokuConnectionOAuthOutputCredentialsSchema,
HerokuConnectionRefreshTokenCredentialsSchema,
HerokuConnectionOAuthCredentialsSchema
diff --git a/backend/src/services/secret-sync/heroku/heroku-sync-fns.ts b/backend/src/services/secret-sync/heroku/heroku-sync-fns.ts
index a19578f50f..402b0bb2c1 100644
--- a/backend/src/services/secret-sync/heroku/heroku-sync-fns.ts
+++ b/backend/src/services/secret-sync/heroku/heroku-sync-fns.ts
@@ -55,7 +55,7 @@ const getHerokuConfigVars = async ({ authToken, app }: THerokuListVariables): Pr
};
const updateHerokuConfigVars = async ({ authToken, app, configVars }: THerokuUpdateVariables) => {
- return request.patch(`${IntegrationUrls.HEROKU_API_URL}/apps/${app}/config-vars`, configVars, {
+ return request.patch(`${IntegrationUrls.HEROKU_API_URL}/apps/${encodeURIComponent(app)}/config-vars`, configVars, {
headers: {
Authorization: `Bearer ${authToken}`,
Accept: "application/vnd.heroku+json; version=3",
diff --git a/docs/integrations/app-connections/heroku.mdx b/docs/integrations/app-connections/heroku.mdx
index 0c27a8dc54..2a5620d5f4 100644
--- a/docs/integrations/app-connections/heroku.mdx
+++ b/docs/integrations/app-connections/heroku.mdx
@@ -39,8 +39,8 @@ Infisical supports two methods for connecting to Heroku: **OAuth** and **Auth To
Back in your Infisical instance, add two new environment variables for the credentials of your Heroku API client:
- - `INF_APP_CONNECTION_HEROKU_CLIENT_ID`: The **Client ID** of your Heroku API client.
- - `INF_APP_CONNECTION_HEROKU_CLIENT_SECRET`: The **Client Secret** of your Heroku API client.
+ - `CLIENT_ID_HEROKU`: The **Client ID** of your Heroku API client.
+ - `CLIENT_SECRET_HEROKU`: The **Client Secret** of your Heroku API client.
Once added, restart your Infisical instance and use the Heroku App Connection.
</Step>
@@ -84,7 +84,7 @@ Infisical supports two methods for connecting to Heroku: **OAuth** and **Auth To
<Step title="Generate Heroku API Token">
Log in to your Heroku account and navigate to Account Settings.
- Under the **Authorizations** section, reveal and copy your Authorization token. If you don't have one, click **Create Authorization** to create a new token.
+ Under the **Authorizations** section on the **Applications** tab, reveal and copy your Authorization token. If you don't have one, click **Create Authorization** to create a new token.
<Warning>
Keep your Authorization token secure and do not share it. Anyone with access to this token can manage your Heroku applications.
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HerokuAppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HerokuAppConnectionForm.tsx
index a7ab5e70ca..085ef49c53 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HerokuAppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HerokuAppConnectionForm.tsx
@@ -81,6 +81,7 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
handleSubmit,
control,
watch,
+ setValue,
formState: { isSubmitting, isDirty }
} = form;
@@ -175,7 +176,13 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
<Select
isDisabled={isUpdate}
value={value}
- onValueChange={(val) => onChange(val)}
+ onValueChange={(val) => {
+ console.log("val", val === HerokuConnectionMethod.OAuth);
+ onChange(val);
+ if (val === HerokuConnectionMethod.OAuth) {
+ setValue("credentials.code", "custom");
+ }
+ }}
className="w-full border border-mineshaft-500"
position="popper"
dropdownContainerClassName="max-w-none"
@@ -202,7 +209,7 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
label="Auth Token"
errorText={error?.message}
isError={Boolean(error?.message)}
- tooltipText="Your Heroku API key or auth token"
+ tooltipText="Your Heroku Auth Token"
>
<SecretInput
containerClassName="text-gray-400 group-focus-within:!border-primary-400/50 border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/HerokuSyncDestinationSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/HerokuSyncDestinationSection.tsx
index a850d13e1e..05831e8a7e 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/HerokuSyncDestinationSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/HerokuSyncDestinationSection.tsx
@@ -12,8 +12,8 @@ export const HerokuSyncDestinationSection = ({ secretSync }: Props) => {
return (
<>
- <GenericFieldLabel label="App name">{appName}</GenericFieldLabel>
- <GenericFieldLabel label="App Id">{app}</GenericFieldLabel>
+ <GenericFieldLabel label="App Name">{appName}</GenericFieldLabel>
+ <GenericFieldLabel label="App ID">{app}</GenericFieldLabel>
</>
);
};