Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
refactor(rate-limit): drop rate_limit table and fix rate limit docs
Calvinb5f541c7c1d4
diff --git a/backend/src/@types/knex.d.ts b/backend/src/@types/knex.d.tsindex 3774adeaf3..328695cefd 100644--- a/backend/src/@types/knex.d.ts+++ b/backend/src/@types/knex.d.ts@@ -533,9 +533,6 @@ import {TProxiedServices,TProxiedServicesInsert,TProxiedServicesUpdate,- TRateLimit,- TRateLimitInsert,- TRateLimitUpdate,TRelays,TRelaysInsert,TRelaysUpdate,@@ -1167,7 +1164,6 @@ declare module "knex/types/tables" {TSecretSharingInsert,TSecretSharingUpdate>;- [TableName.RateLimit]: KnexOriginal.CompositeTableType<TRateLimit, TRateLimitInsert, TRateLimitUpdate>;[TableName.SecretTag]: KnexOriginal.CompositeTableType<TSecretTags, TSecretTagsInsert, TSecretTagsUpdate>;[TableName.SecretImport]: KnexOriginal.CompositeTableType<TSecretImports,diff --git a/backend/src/db/migrations/20240614010847_custom-rate-limits-for-self-hosting.ts b/backend/src/db/migrations/20240614010847_custom-rate-limits-for-self-hosting.tsindex c34b2d1968..b26552f526 100644--- a/backend/src/db/migrations/20240614010847_custom-rate-limits-for-self-hosting.ts+++ b/backend/src/db/migrations/20240614010847_custom-rate-limits-for-self-hosting.ts@@ -4,8 +4,8 @@ import { TableName } from "../schemas";import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";export async function up(knex: Knex): Promise<void> {- if (!(await knex.schema.hasTable(TableName.RateLimit))) {- await knex.schema.createTable(TableName.RateLimit, (t) => {+ if (!(await knex.schema.hasTable(TableName.DeprecatedRateLimit))) {+ await knex.schema.createTable(TableName.DeprecatedRateLimit, (t) => {t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());t.integer("readRateLimit").defaultTo(600).notNullable();t.integer("writeRateLimit").defaultTo(200).notNullable();@@ -18,14 +18,14 @@ export async function up(knex: Knex): Promise<void> {t.timestamps(true, true, true);});- await createOnUpdateTrigger(knex, TableName.RateLimit);+ await createOnUpdateTrigger(knex, TableName.DeprecatedRateLimit);// create init rate limit entry with defaults- await knex(TableName.RateLimit).insert({});+ await knex(TableName.DeprecatedRateLimit).insert({});}}export async function down(knex: Knex): Promise<void> {- await knex.schema.dropTableIfExists(TableName.RateLimit);- await dropOnUpdateTrigger(knex, TableName.RateLimit);+ await knex.schema.dropTableIfExists(TableName.DeprecatedRateLimit);+ await dropOnUpdateTrigger(knex, TableName.DeprecatedRateLimit);}diff --git a/backend/src/db/migrations/20240806113425_remove-creation-limit-rate-limit.ts b/backend/src/db/migrations/20240806113425_remove-creation-limit-rate-limit.tsindex d82e4d65d1..4beacf3028 100644--- a/backend/src/db/migrations/20240806113425_remove-creation-limit-rate-limit.ts+++ b/backend/src/db/migrations/20240806113425_remove-creation-limit-rate-limit.ts@@ -3,8 +3,8 @@ import { Knex } from "knex";import { TableName } from "../schemas";export async function up(knex: Knex): Promise<void> {- const hasCreationLimitCol = await knex.schema.hasColumn(TableName.RateLimit, "creationLimit");- await knex.schema.alterTable(TableName.RateLimit, (t) => {+ const hasCreationLimitCol = await knex.schema.hasColumn(TableName.DeprecatedRateLimit, "creationLimit");+ await knex.schema.alterTable(TableName.DeprecatedRateLimit, (t) => {if (hasCreationLimitCol) {t.dropColumn("creationLimit");}@@ -12,8 +12,8 @@ export async function up(knex: Knex): Promise<void> {}export async function down(knex: Knex): Promise<void> {- const hasCreationLimitCol = await knex.schema.hasColumn(TableName.RateLimit, "creationLimit");- await knex.schema.alterTable(TableName.RateLimit, (t) => {+ const hasCreationLimitCol = await knex.schema.hasColumn(TableName.DeprecatedRateLimit, "creationLimit");+ await knex.schema.alterTable(TableName.DeprecatedRateLimit, (t) => {if (!hasCreationLimitCol) {t.integer("creationLimit").defaultTo(30).notNullable();}diff --git a/backend/src/db/migrations/20260123144431_add-identity-project-creation-rate-limits.ts b/backend/src/db/migrations/20260123144431_add-identity-project-creation-rate-limits.tsindex b251305c59..2f449d66ac 100644--- a/backend/src/db/migrations/20260123144431_add-identity-project-creation-rate-limits.ts+++ b/backend/src/db/migrations/20260123144431_add-identity-project-creation-rate-limits.ts@@ -3,10 +3,10 @@ import { Knex } from "knex";import { TableName } from "../schemas";export async function up(knex: Knex): Promise<void> {- const hasIdentityCreationLimitCol = await knex.schema.hasColumn(TableName.RateLimit, "identityCreationLimit");- const hasProjectCreationLimitCol = await knex.schema.hasColumn(TableName.RateLimit, "projectCreationLimit");+ const hasIdentityCreationLimitCol = await knex.schema.hasColumn(TableName.DeprecatedRateLimit, "identityCreationLimit");+ const hasProjectCreationLimitCol = await knex.schema.hasColumn(TableName.DeprecatedRateLimit, "projectCreationLimit");- await knex.schema.alterTable(TableName.RateLimit, (t) => {+ await knex.schema.alterTable(TableName.DeprecatedRateLimit, (t) => {if (!hasIdentityCreationLimitCol) {t.integer("identityCreationLimit").defaultTo(30).notNullable();}@@ -17,10 +17,10 @@ export async function up(knex: Knex): Promise<void> {}export async function down(knex: Knex): Promise<void> {- const hasIdentityCreationLimitCol = await knex.schema.hasColumn(TableName.RateLimit, "identityCreationLimit");- const hasProjectCreationLimitCol = await knex.schema.hasColumn(TableName.RateLimit, "projectCreationLimit");+ const hasIdentityCreationLimitCol = await knex.schema.hasColumn(TableName.DeprecatedRateLimit, "identityCreationLimit");+ const hasProjectCreationLimitCol = await knex.schema.hasColumn(TableName.DeprecatedRateLimit, "projectCreationLimit");- await knex.schema.alterTable(TableName.RateLimit, (t) => {+ await knex.schema.alterTable(TableName.DeprecatedRateLimit, (t) => {if (hasIdentityCreationLimitCol) {t.dropColumn("identityCreationLimit");}diff --git a/backend/src/db/migrations/20261009120000_drop-rate-limit.ts b/backend/src/db/migrations/20261009120000_drop-rate-limit.tsnew file mode 100644index 0000000000..2e5de92b4a--- /dev/null+++ b/backend/src/db/migrations/20261009120000_drop-rate-limit.ts@@ -0,0 +1,32 @@+import { Knex } from "knex";++import { TableName } from "../schemas";+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";++export async function up(knex: Knex): Promise<void> {+ const hasTable = await knex.schema.hasTable(TableName.DeprecatedRateLimit);+ if (hasTable) {+ await dropOnUpdateTrigger(knex, TableName.DeprecatedRateLimit);+ await knex.schema.dropTable(TableName.DeprecatedRateLimit);+ }+}++export async function down(knex: Knex): Promise<void> {+ const hasTable = await knex.schema.hasTable(TableName.DeprecatedRateLimit);+ if (!hasTable) {+ await knex.schema.createTable(TableName.DeprecatedRateLimit, (t) => {+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());+ t.integer("readRateLimit").defaultTo(600).notNullable();+ t.integer("writeRateLimit").defaultTo(200).notNullable();+ t.integer("secretsRateLimit").defaultTo(60).notNullable();+ t.integer("authRateLimit").defaultTo(60).notNullable();+ t.integer("inviteUserRateLimit").defaultTo(30).notNullable();+ t.integer("mfaRateLimit").defaultTo(20).notNullable();+ t.integer("publicEndpointLimit").defaultTo(30).notNullable();+ t.integer("identityCreationLimit").defaultTo(30).notNullable();+ t.integer("projectCreationLimit").defaultTo(30).notNullable();+ t.timestamps(true, true, true);+ });+ await createOnUpdateTrigger(knex, TableName.DeprecatedRateLimit);+ }+}diff --git a/backend/src/db/schemas/index.ts b/backend/src/db/schemas/index.tsindex 4f3cdd6bd1..aa04bf7196 100644--- a/backend/src/db/schemas/index.ts+++ b/backend/src/db/schemas/index.ts@@ -212,7 +212,6 @@ export * from "./project-user-membership-roles";export * from "./projects";export * from "./proxied-service-credentials";export * from "./proxied-services";-export * from "./rate-limit";export * from "./relays";export * from "./resource-auth-methods";export * from "./resource-aws-auths";diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.tsindex 60967d5e68..9653051f0e 100644--- a/backend/src/db/schemas/models.ts+++ b/backend/src/db/schemas/models.ts@@ -72,7 +72,6 @@ export enum TableName {UserSecretActivation = "user_secret_activation",SignupOnboardingResponse = "signup_onboarding_responses",SuperAdmin = "super_admin",- RateLimit = "rate_limit",// dropped with the SSH product; member kept for historical migrationsProjectSshConfig = "project_ssh_configs",Project = "projects",@@ -360,7 +359,8 @@ export enum TableName {DeprecatedSecretRotationV1 = "secret_rotations",DeprecatedSecretRotationOutput = "secret_rotation_outputs",DeprecatedSecretRotationOutputV2 = "secret_rotation_output_v2",- DeprecatedApiKey = "api_keys"+ DeprecatedApiKey = "api_keys",+ DeprecatedRateLimit = "rate_limit"}export type TImmutableDBKeys = "id" | "createdAt" | "updatedAt" | "commitId";diff --git a/backend/src/db/schemas/rate-limit.ts b/backend/src/db/schemas/rate-limit.tsdeleted file mode 100644index 9da2605bff..0000000000--- a/backend/src/db/schemas/rate-limit.ts+++ /dev/null@@ -1,27 +0,0 @@-// Code generated by automation script, DO NOT EDIT.-// Automated by pulling database and generating zod schema-// To update. Just run npm run generate:schema-// Written by akhilmhdh.--import { z } from "zod";--import { TImmutableDBKeys } from "./models";--export const RateLimitSchema = z.object({- id: z.string().uuid(),- readRateLimit: z.number().default(600),- writeRateLimit: z.number().default(200),- secretsRateLimit: z.number().default(60),- authRateLimit: z.number().default(60),- inviteUserRateLimit: z.number().default(30),- mfaRateLimit: z.number().default(20),- publicEndpointLimit: z.number().default(30),- createdAt: z.date(),- updatedAt: z.date(),- identityCreationLimit: z.number().default(30),- projectCreationLimit: z.number().default(30)-});--export type TRateLimit = z.infer<typeof RateLimitSchema>;-export type TRateLimitInsert = Omit<z.input<typeof RateLimitSchema>, TImmutableDBKeys>;-export type TRateLimitUpdate = Partial<Omit<z.input<typeof RateLimitSchema>, TImmutableDBKeys>>;diff --git a/docs/api-reference/overview/rate-limits.mdx b/docs/api-reference/overview/rate-limits.mdxindex d3ce3e6715..2dd020a63d 100644--- a/docs/api-reference/overview/rate-limits.mdx+++ b/docs/api-reference/overview/rate-limits.mdx@@ -45,7 +45,7 @@ Each API request is counted against one of the following categories:## Limits on self-hosted instances-If you self-host Infisical, no rate limits are enforced on the API by default. If you need throttling on your API surface, you'll need to configure an external rate limiter.+If you self-host Infisical, your instance doesn't enforce rate limits on the API. If you need rate limits, configure an external rate limiter in front of your instance.## Exceeding rate limits (429 response)diff --git a/docs/internals/security.mdx b/docs/internals/security.mdxindex a411ae2108..c7c6a26b07 100644--- a/docs/internals/security.mdx+++ b/docs/internals/security.mdx@@ -50,7 +50,7 @@ The server mandates that each request includes a valid token (issued for a userWhen accessing Infisical via web browser, JWT tokens are stored in browser memory and appended to outbound requests requiring authentication; refresh tokens are stored in HttpOnly cookies and included in requests as part of token renewal. Note also that Infisical utilizes the latest HTTP security headers and employs a strict Content-Security-Policy to mitigate XSS.-To mitigate abuse and enhance system stability, the server enforces configurable rate limiting on read, write, and secrets operations. This prevents excessive API requests from impacting system performance while ensuring fair usage across clients.+If you use Infisical Cloud, the server enforces per-minute [rate limits](/api-reference/overview/rate-limits) on API requests, so one client can't send enough requests to slow the platform down for others. If you self-host Infisical, the server doesn't enforce rate limits, so you'll need to configure an external rate limiter if you want one.Once traffic enters the server, any sensitive data (e.g. secrets, certificates entering the server), where applicable, is encrypted using a 256-bit [Advanced Encryption Standard (AES)](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) cipher in the [Galois Counter Mode (GCM)](https://en.wikipedia.org/wiki/Galois/Counter_Mode) with 96-bit nonces prior to being persisted in the storage backend. Encryption is an integral part of Infisical’s platform-wide cryptographic architecture, which also supports seal-wrapping with external KMS and HSMs. Before responding to a client request, the server securely retrieves and decrypts requested data from the storage backend. Each decryption operation includes integrity verification to ensure data hasn't been altered or tampered with.diff --git a/docs/self-hosting/configuration/requirements.mdx b/docs/self-hosting/configuration/requirements.mdxindex 186bda1d7a..782cec49bd 100644--- a/docs/self-hosting/configuration/requirements.mdx+++ b/docs/self-hosting/configuration/requirements.mdx@@ -54,8 +54,8 @@ Recommended resource allocation based on deployment size. You may require more r### RedisInfisical treats Redis as a **required, persistent datastore**. Beyond-caching, it holds the background job queue, distributed locks, cross-instance coordination state-for scheduled jobs, and rate-limit counters. An instance refuses to start unless a Redis+caching, it holds the background job queue, distributed locks, and cross-instance coordination+state for scheduled jobs. An instance refuses to start unless a Redisconnection is configured, and a running instance is degraded for as long as Redis is unreachable.<Info>diff --git a/docs/self-hosting/guides/monitoring-telemetry.mdx b/docs/self-hosting/guides/monitoring-telemetry.mdxindex 8f8f38911c..416a4191c3 100644--- a/docs/self-hosting/guides/monitoring-telemetry.mdx+++ b/docs/self-hosting/guides/monitoring-telemetry.mdx@@ -811,7 +811,7 @@ These metrics give per-queue visibility into BullMQ worker health: throughput, l### Local refresh metrics (InfisicalCore)-Every Infisical instance runs a few background tasks on a timer to refresh settings it keeps in memory, such as the license, rate limits, and SSO configuration. Each instance runs its own copy, so a failing refresh means that instance is serving stale settings while the others may be fine. These metrics are labelled by task, and each instance reports its own values.+Every Infisical instance runs a few background tasks on a timer to refresh settings it keeps in memory, such as the license and SSO configuration. Each instance runs its own copy, so a failing refresh means that instance is serving stale settings while the others may be fine. These metrics are labelled by task, and each instance reports its own values.<AccordionGroup><Accordion title="Local Refresh Run Count">