Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix: extend invitation links to one week

Josué4829f372278e
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 78d615f2c..d6ceb0eae 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.815",
+ "version": "0.1.816",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.815",
+ "version": "0.1.816",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",
diff --git a/control-api/package.json b/control-api/package.json
index bf305cb3a..05de184ba 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.815",
+ "version": "0.1.816",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/db.ts b/control-api/src/db.ts
index 1f1f8b958..a03ac30b1 100644
--- a/control-api/src/db.ts
+++ b/control-api/src/db.ts
@@ -3209,6 +3209,16 @@ async function applyControlAdminReplaceInviterAcceptGuard(db: DbClient): Promise
`)
}
+async function applyInvitationExpirationTtlMigration(db: DbClient): Promise<void> {
+ await db.query(`
+ ALTER TABLE invitations
+ ALTER COLUMN expires_at SET DEFAULT (NOW() + INTERVAL '7 days');
+
+ ALTER TABLE control_admin_invitations
+ ALTER COLUMN expires_at SET DEFAULT (NOW() + INTERVAL '7 days');
+ `)
+}
+
// Exported (read-only) so the migration-order invariant test can assert the
// array is monotonic by version-string. Applied strictly in array order and
// tracked by full version-string in `schema_migrations`, so a non-monotonic
@@ -6377,6 +6387,10 @@ export const CONTROL_API_MIGRATIONS: DbMigration[] = [
version: '0129_workflow_schedules_concurrency_policy',
apply: applyWorkflowScheduleConcurrencyPolicyMigration,
},
+ {
+ version: '0130_invitation_expiration_ttl_one_week',
+ apply: applyInvitationExpirationTtlMigration,
+ },
]
async function consolidateWorkflowAllowedUsersToTriggers(db: DbClient): Promise<void> {
diff --git a/control-api/src/services/directory/invitationStore.ts b/control-api/src/services/directory/invitationStore.ts
index 7d5f9c164..b7cc87932 100644
--- a/control-api/src/services/directory/invitationStore.ts
+++ b/control-api/src/services/directory/invitationStore.ts
@@ -1,7 +1,8 @@
import { type DbClient, pool } from '../../db.js'
import { type InviteRole, normalizeTeamRoleInput } from './types.js'
-export const INVITATION_TTL_HOURS = 48
+export const INVITATION_TTL_HOURS = 7 * 24
+const PASSWORD_RESET_INVITATION_TTL_HOURS = 48
export type InvitationRow = {
id: string
@@ -320,6 +321,8 @@ export async function insertInvitationForTeams(
const fallbackRole =
normalizeTeamRoleInput(input.fallbackRole) || primaryAssignment?.role || 'member'
const purpose = normalizeInvitationPurpose(input.purpose)
+ const ttlHours =
+ purpose === 'password_reset' ? PASSWORD_RESET_INVITATION_TTL_HOURS : INVITATION_TTL_HOURS
const invited = await db.query(
`WITH inserted AS (
INSERT INTO invitations(team_id, invitee_name, email, role, token, status, purpose, expires_at)
@@ -348,7 +351,7 @@ export async function insertInvitationForTeams(
primaryAssignment?.role || fallbackRole,
input.status,
purpose,
- String(INVITATION_TTL_HOURS),
+ String(ttlHours),
]
)
const invitation = invited.rows[0] as InvitationRow