Skip to content

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

fix migration

Thiago Araujo da Silva24b051d4c7bc
diff --git a/backend/src/db/migrations/20260529204743_create-github-apps.ts b/backend/src/db/migrations/20260529204743_create-github-apps.ts
index f0971a40ff..db0ea8fca9 100644
--- a/backend/src/db/migrations/20260529204743_create-github-apps.ts
+++ b/backend/src/db/migrations/20260529204743_create-github-apps.ts
@@ -27,6 +27,6 @@ export async function up(knex: Knex): Promise<void> {
}
export async function down(knex: Knex): Promise<void> {
- await knex.schema.dropTableIfExists(TableName.GitHubApp);
await dropOnUpdateTrigger(knex, TableName.GitHubApp);
+ await knex.schema.dropTableIfExists(TableName.GitHubApp);
}
diff --git a/backend/src/db/migrations/20260604120000_create-github-app-connections.ts b/backend/src/db/migrations/20260604120000_create-github-app-connections.ts
index a9d98d41df..c4c2185125 100644
--- a/backend/src/db/migrations/20260604120000_create-github-app-connections.ts
+++ b/backend/src/db/migrations/20260604120000_create-github-app-connections.ts
@@ -20,6 +20,6 @@ export async function up(knex: Knex): Promise<void> {
}
export async function down(knex: Knex): Promise<void> {
- await knex.schema.dropTableIfExists(TableName.GitHubAppConnection);
await dropOnUpdateTrigger(knex, TableName.GitHubAppConnection);
+ await knex.schema.dropTableIfExists(TableName.GitHubAppConnection);
}
diff --git a/backend/src/services/app-connection/github/github-connection-fns.ts b/backend/src/services/app-connection/github/github-connection-fns.ts
index 94276e4f0b..efc55f8bd4 100644
--- a/backend/src/services/app-connection/github/github-connection-fns.ts
+++ b/backend/src/services/app-connection/github/github-connection-fns.ts
@@ -311,7 +311,9 @@ export const signGitHubAppJwt = (appId: string, privateKey: string) => {
.join("\n");
const now = Math.floor(Date.now() / 1000);
- return crypto.jwt().sign({ iat: now, exp: now + 5 * 60, iss: appId }, appPrivateKey, { algorithm: "RS256" });
+ // Backdate iat by 60s per GitHub's recommendation — GitHub rejects app JWTs whose iat is in the
+ // future relative to their clock, so a slightly fast server clock would cause intermittent 401s.
+ return crypto.jwt().sign({ iat: now - 60, exp: now + 5 * 60, iss: appId }, appPrivateKey, { algorithm: "RS256" });
};
export const buildGitHubAppJwtHeaders = (appJwt: string) => ({