Skip to content

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

Merge branch 'main' into feat/point-in-time-revamp

carlosmonastyrski1748052cb0f1
diff --git a/.infisicalignore b/.infisicalignore
index b00bf09955..02cdd4f0ee 100644
--- a/.infisicalignore
+++ b/.infisicalignore
@@ -28,3 +28,15 @@ frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow
docs/cli/commands/user.mdx:generic-api-key:51
frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretOverviewTableRow.tsx:generic-api-key:76
docs/integrations/app-connections/hashicorp-vault.mdx:generic-api-key:188
+cli/detect/config/gitleaks.toml:gcp-api-key:567
+cli/detect/config/gitleaks.toml:gcp-api-key:569
+cli/detect/config/gitleaks.toml:gcp-api-key:570
+cli/detect/config/gitleaks.toml:gcp-api-key:572
+cli/detect/config/gitleaks.toml:gcp-api-key:574
+cli/detect/config/gitleaks.toml:gcp-api-key:575
+cli/detect/config/gitleaks.toml:gcp-api-key:576
+cli/detect/config/gitleaks.toml:gcp-api-key:577
+cli/detect/config/gitleaks.toml:gcp-api-key:578
+cli/detect/config/gitleaks.toml:gcp-api-key:579
+cli/detect/config/gitleaks.toml:gcp-api-key:581
+cli/detect/config/gitleaks.toml:gcp-api-key:582
diff --git a/Dockerfile.fips.standalone-infisical b/Dockerfile.fips.standalone-infisical
index 33360bf452..c799aaf233 100644
--- a/Dockerfile.fips.standalone-infisical
+++ b/Dockerfile.fips.standalone-infisical
@@ -133,8 +133,8 @@ RUN apt-get update && apt-get install -y \
RUN printf "[FreeTDS]\nDescription = FreeTDS Driver\nDriver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\nSetup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so\nFileUsage = 1\n" > /etc/odbcinst.ini
# Install Infisical CLI
-RUN curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash \
- && apt-get update && apt-get install -y infisical=0.31.1 \
+RUN curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash \
+ && apt-get update && apt-get install -y infisical=0.41.2 \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -r -g 1001 nodejs && useradd -r -u 1001 -g nodejs non-root-user
@@ -171,6 +171,7 @@ ENV NODE_ENV production
ENV STANDALONE_BUILD true
ENV STANDALONE_MODE true
ENV ChrystokiConfigurationPath=/usr/safenet/lunaclient/
+ENV NODE_OPTIONS="--max-old-space-size=1024"
WORKDIR /backend
diff --git a/Dockerfile.standalone-infisical b/Dockerfile.standalone-infisical
index 6d582ce76d..45295dec81 100644
--- a/Dockerfile.standalone-infisical
+++ b/Dockerfile.standalone-infisical
@@ -127,8 +127,8 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
# Install Infisical CLI
-RUN curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash \
- && apt-get update && apt-get install -y infisical=0.31.1 \
+RUN curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash \
+ && apt-get update && apt-get install -y infisical=0.41.2 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /
@@ -168,6 +168,7 @@ ENV HTTPS_ENABLED false
ENV NODE_ENV production
ENV STANDALONE_BUILD true
ENV STANDALONE_MODE true
+ENV NODE_OPTIONS="--max-old-space-size=1024"
WORKDIR /backend
diff --git a/backend/Dockerfile b/backend/Dockerfile
index b9edf8b987..79333cb928 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -54,8 +54,8 @@ COPY --from=build /app .
# Install Infisical CLI
RUN apt-get install -y curl bash && \
- curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash && \
- apt-get update && apt-get install -y infisical=0.8.1 git
+ curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash && \
+ apt-get update && apt-get install -y infisical=0.41.2 git
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s \
CMD node healthcheck.js
diff --git a/backend/Dockerfile.dev b/backend/Dockerfile.dev
index 3435672e78..75c561ac12 100644
--- a/backend/Dockerfile.dev
+++ b/backend/Dockerfile.dev
@@ -55,9 +55,9 @@ RUN mkdir -p /etc/softhsm2/tokens && \
# ? App setup
# Install Infisical CLI
-RUN curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash && \
+RUN curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash && \
apt-get update && \
- apt-get install -y infisical=0.8.1
+ apt-get install -y infisical=0.41.2
WORKDIR /app
diff --git a/backend/Dockerfile.dev.fips b/backend/Dockerfile.dev.fips
index 8c40404dcd..0afb330e56 100644
--- a/backend/Dockerfile.dev.fips
+++ b/backend/Dockerfile.dev.fips
@@ -64,9 +64,9 @@ RUN wget https://www.openssl.org/source/openssl-3.1.2.tar.gz \
# ? App setup
# Install Infisical CLI
-RUN curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash && \
+RUN curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash && \
apt-get update && \
- apt-get install -y infisical=0.8.1
+ apt-get install -y infisical=0.41.2
WORKDIR /app
diff --git a/backend/e2e-test/mocks/keystore.ts b/backend/e2e-test/mocks/keystore.ts
index 48f52f9e7f..f4f251616d 100644
--- a/backend/e2e-test/mocks/keystore.ts
+++ b/backend/e2e-test/mocks/keystore.ts
@@ -1,4 +1,8 @@
+import RE2 from "re2";
+
import { TKeyStoreFactory } from "@app/keystore/keystore";
+import { applyJitter } from "@app/lib/dates";
+import { delay as delayMs } from "@app/lib/delay";
import { Lock } from "@app/lib/red-lock";
export const mockKeyStore = (): TKeyStoreFactory => {
@@ -18,6 +22,27 @@ export const mockKeyStore = (): TKeyStoreFactory => {
delete store[key];
return 1;
},
+ deleteItems: async ({ pattern, batchSize = 500, delay = 1500, jitter = 200 }) => {
+ const regex = new RE2(`^${pattern.replace(/[-[\]/{}()+?.\\^$|]/g, "\\$&").replace(/\*/g, ".*")}$`);
+ let totalDeleted = 0;
+ const keys = Object.keys(store);
+
+ for (let i = 0; i < keys.length; i += batchSize) {
+ const batch = keys.slice(i, i + batchSize);
+
+ for (const key of batch) {
+ if (regex.test(key)) {
+ delete store[key];
+ totalDeleted += 1;
+ }
+ }
+
+ // eslint-disable-next-line no-await-in-loop
+ await delayMs(Math.max(0, applyJitter(delay, jitter)));
+ }
+
+ return totalDeleted;
+ },
getItem: async (key) => {
const value = store[key];
if (typeof value === "string") {
diff --git a/backend/package-lock.json b/backend/package-lock.json
index 93c28c9e29..59698d5b34 100644
--- a/backend/package-lock.json
+++ b/backend/package-lock.json
@@ -33,7 +33,8 @@
"@infisical/quic": "^1.0.8",
"@node-saml/passport-saml": "^5.0.1",
"@octokit/auth-app": "^7.1.1",
- "@octokit/plugin-paginate-graphql": "^5.2.4",
+ "@octokit/core": "^5.2.1",
+ "@octokit/plugin-paginate-graphql": "^4.0.1",
"@octokit/plugin-retry": "^5.0.5",
"@octokit/rest": "^20.0.2",
"@octokit/webhooks-types": "^7.3.1",
@@ -89,6 +90,7 @@
"mysql2": "^3.9.8",
"nanoid": "^3.3.8",
"nodemailer": "^6.9.9",
+ "oci-sdk": "^2.108.0",
"odbc": "^2.4.9",
"openid-client": "^5.6.5",
"ora": "^7.0.1",
@@ -121,7 +123,7 @@
"tweetnacl-util": "^0.15.1",
"uuid": "^9.0.1",
"zod": "^3.22.4",
- "zod-to-json-schema": "^3.22.4"
+ "zod-to-json-schema": "^3.24.5"
},
"bin": {
"backend": "dist/main.js"
@@ -7805,119 +7807,38 @@
}
},
"node_modules/@octokit/core": {
- "version": "6.1.5",
- "resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.5.tgz",
- "integrity": "sha512-vvmsN0r7rguA+FySiCsbaTTobSftpIDIpPW81trAmsv9TGxg3YCujAxRYp/Uy8xmDgYCzzgulG62H7KYUFmeIg==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@octokit/auth-token": "^5.0.0",
- "@octokit/graphql": "^8.2.2",
- "@octokit/request": "^9.2.3",
- "@octokit/request-error": "^6.1.8",
- "@octokit/types": "^14.0.0",
- "before-after-hook": "^3.0.2",
- "universal-user-agent": "^7.0.0"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/@octokit/core/node_modules/@octokit/auth-token": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.2.tgz",
- "integrity": "sha512-JcQDsBdg49Yky2w2ld20IHAlwr8d/d8N6NiOXbtuoPCqzbsiJgF633mVUw3x4mo0H5ypataQIX7SFu3yy44Mpw==",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/@octokit/core/node_modules/@octokit/endpoint": {
- "version": "10.1.4",
- "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.4.tgz",
- "integrity": "sha512-OlYOlZIsfEVZm5HCSR8aSg02T2lbUWOsCQoPKfTXJwDzcHQBrVBGdGXb89dv2Kw2ToZaRtudp8O3ZIYoaOjKlA==",
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz",
+ "integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
- "@octokit/types": "^14.0.0",
- "universal-user-agent": "^7.0.2"
+ "@octokit/auth-token": "^4.0.0",
+ "@octokit/graphql": "^7.1.0",
+ "@octokit/request": "^8.4.1",
+ "@octokit/request-error": "^5.1.1",
+ "@octokit/types": "^13.0.0",
+ "before-after-hook": "^2.2.0",
+ "universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/core/node_modules/@octokit/openapi-types": {
- "version": "25.0.0",
- "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.0.0.tgz",
- "integrity": "sha512-FZvktFu7HfOIJf2BScLKIEYjDsw6RKc7rBJCdvCTfKsVnx2GEB/Nbzjr29DUdb7vQhlzS/j8qDzdditP0OC6aw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/@octokit/core/node_modules/@octokit/request": {
- "version": "9.2.3",
- "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.3.tgz",
- "integrity": "sha512-Ma+pZU8PXLOEYzsWf0cn/gY+ME57Wq8f49WTXA8FMHp2Ps9djKw//xYJ1je8Hm0pR2lU9FUGeJRWOtxq6olt4w==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@octokit/endpoint": "^10.1.4",
- "@octokit/request-error": "^6.1.8",
- "@octokit/types": "^14.0.0",
- "fast-content-type-parse": "^2.0.0",
- "universal-user-agent": "^7.0.2"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/@octokit/core/node_modules/@octokit/request-error": {
- "version": "6.1.8",
- "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.8.tgz",
- "integrity": "sha512-WEi/R0Jmq+IJKydWlKDmryPcmdYSVjL3ekaiEL1L9eo1sUnqMJ+grqmC9cjk7CA7+b2/T397tO5d8YLOH3qYpQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@octokit/types": "^14.0.0"
- },
- "engines": {
- "node": ">= 18"
- }
+ "version": "24.2.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
+ "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
+ "license": "MIT"
},
"node_modules/@octokit/core/node_modules/@octokit/types": {
- "version": "14.0.0",
- "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.0.0.tgz",
- "integrity": "sha512-VVmZP0lEhbo2O1pdq63gZFiGCKkm8PPp8AUOijlwPO6hojEVjspA0MWKP7E4hbvGxzFKNqKr6p0IYtOH/Wf/zA==",
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
+ "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
"license": "MIT",
- "peer": true,
"dependencies": {
- "@octokit/openapi-types": "^25.0.0"
+ "@octokit/openapi-types": "^24.2.0"
}
},
- "node_modules/@octokit/core/node_modules/fast-content-type-parse": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-2.0.1.tgz",
- "integrity": "sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/fastify"
- },
- {
- "type": "opencollective",
- "url": "https://opencollective.com/fastify"
- }
- ],
- "license": "MIT",
- "peer": true
- },
- "node_modules/@octokit/core/node_modules/universal-user-agent": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
- "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
- "license": "ISC",
- "peer": true
- },
"node_modules/@octokit/endpoint": {
"version": "9.0.6",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz",
@@ -7947,105 +7868,34 @@
}
},
"node_modules/@octokit/graphql": {
- "version": "8.2.2",
- "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.2.2.tgz",
- "integrity": "sha512-Yi8hcoqsrXGdt0yObxbebHXFOiUA+2v3n53epuOg1QUgOB6c4XzvisBNVXJSl8RYA5KrDuSL2yq9Qmqe5N0ryA==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@octokit/request": "^9.2.3",
- "@octokit/types": "^14.0.0",
- "universal-user-agent": "^7.0.0"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/@octokit/graphql/node_modules/@octokit/endpoint": {
- "version": "10.1.4",
- "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.4.tgz",
- "integrity": "sha512-OlYOlZIsfEVZm5HCSR8aSg02T2lbUWOsCQoPKfTXJwDzcHQBrVBGdGXb89dv2Kw2ToZaRtudp8O3ZIYoaOjKlA==",
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz",
+ "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==",
"license": "MIT",
- "peer": true,
"dependencies": {
- "@octokit/types": "^14.0.0",
- "universal-user-agent": "^7.0.2"
+ "@octokit/request": "^8.4.1",
+ "@octokit/types": "^13.0.0",
+ "universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/graphql/node_modules/@octokit/openapi-types": {
- "version": "25.0.0",
- "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.0.0.tgz",
- "integrity": "sha512-FZvktFu7HfOIJf2BScLKIEYjDsw6RKc7rBJCdvCTfKsVnx2GEB/Nbzjr29DUdb7vQhlzS/j8qDzdditP0OC6aw==",
- "license": "MIT",
- "peer": true
- },
- "node_modules/@octokit/graphql/node_modules/@octokit/request": {
- "version": "9.2.3",
- "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.3.tgz",
- "integrity": "sha512-Ma+pZU8PXLOEYzsWf0cn/gY+ME57Wq8f49WTXA8FMHp2Ps9djKw//xYJ1je8Hm0pR2lU9FUGeJRWOtxq6olt4w==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@octokit/endpoint": "^10.1.4",
- "@octokit/request-error": "^6.1.8",
- "@octokit/types": "^14.0.0",
- "fast-content-type-parse": "^2.0.0",
- "universal-user-agent": "^7.0.2"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/@octokit/graphql/node_modules/@octokit/request-error": {
- "version": "6.1.8",
- "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.8.tgz",
- "integrity": "sha512-WEi/R0Jmq+IJKydWlKDmryPcmdYSVjL3ekaiEL1L9eo1sUnqMJ+grqmC9cjk7CA7+b2/T397tO5d8YLOH3qYpQ==",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "@octokit/types": "^14.0.0"
- },
- "engines": {
- "node": ">= 18"
- }
+ "version": "24.2.0",
+ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
+ "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
+ "license": "MIT"
},
"node_modules/@octokit/graphql/node_modules/@octokit/types": {
- "version": "14.0.0",
- "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.0.0.tgz",
- "integrity": "sha512-VVmZP0lEhbo2O1pdq63gZFiGCKkm8PPp8AUOijlwPO6hojEVjspA0MWKP7E4hbvGxzFKNqKr6p0IYtOH/Wf/zA==",
+ "version": "13.10.0",
+ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
+ "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
"license": "MIT",
- "peer": true,
"dependencies": {
- "@octokit/openapi-types": "^25.0.0"
+ "@octokit/openapi-types": "^24.2.0"
}
},
- "node_modules/@octokit/graphql/node_modules/fast-content-type-parse": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-2.0.1.tgz",
- "integrity": "sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/fastify"
- },
- {
- "type": "opencollective",
- "url": "https://opencollective.com/fastify"
- }
- ],
- "license": "MIT",
- "peer": true
- },
- "node_modules/@octokit/graphql/node_modules/universal-user-agent": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz",
- "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==",
- "license": "ISC",
- "peer": true
- },
"node_modules/@octokit/oauth-authorization-url": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-7.1.1.tgz",
@@ -8141,15 +7991,15 @@
}
},
"node_modules/@octokit/plugin-paginate-graphql": {
- "version": "5.2.4",
- "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-graphql/-/plugin-paginate-graphql-5.2.4.tgz",
- "integrity": "sha512-pLZES1jWaOynXKHOqdnwZ5ULeVR6tVVCMm+AUbp0htdcyXDU95WbkYdU4R2ej1wKj5Tu94Mee2Ne0PjPO9cCyA==",
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-graphql/-/plugin-paginate-graphql-4.0.1.tgz",
+ "integrity": "sha512-R8ZQNmrIKKpHWC6V2gum4x9LG2qF1RxRjo27gjQcG3j+vf2tLsEfE7I/wRWEPzYMaenr1M+qDAtNcwZve1ce1A==",
"license": "MIT",
"engines": {
"node": ">= 18"
},
"peerDependencies": {
- "@octokit/core": ">=6"
+ "@octokit/core": ">=5"
}
},
"node_modules/@octokit/plugin-paginate-rest": {
@@ -8302,59 +8152,6 @@
"node": ">= 18"
}
},
- "node_modules/@octokit/rest/node_modules/@octokit/core": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz",
- "integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==",
- "license": "MIT",
- "dependencies": {
- "@octokit/auth-token": "^4.0.0",
- "@octokit/graphql": "^7.1.0",
- "@octokit/request": "^8.4.1",
- "@octokit/request-error": "^5.1.1",
- "@octokit/types": "^13.0.0",
- "before-after-hook": "^2.2.0",
- "universal-user-agent": "^6.0.0"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/@octokit/rest/node_modules/@octokit/graphql": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz",
- "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==",
- "license": "MIT",
- "dependencies": {
- "@octokit/request": "^8.4.1",
- "@octokit/types": "^13.0.0",
- "universal-user-agent": "^6.0.0"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/@octokit/rest/node_modules/@octokit/openapi-types": {
- "version": "24.2.0",
- "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
- "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
- "license": "MIT"
- },
- "node_modules/@octokit/rest/node_modules/@octokit/types": {
- "version": "13.10.0",
- "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
- "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
- "license": "MIT",
- "dependencies": {
- "@octokit/openapi-types": "^24.2.0"
- }
- },
- "node_modules/@octokit/rest/node_modules/before-after-hook": {
- "version": "2.2.3",
- "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
- "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==",
- "license": "Apache-2.0"
- },
"node_modules/@octokit/types": {
"version": "12.4.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.4.0.tgz",
@@ -10860,6 +10657,12 @@
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz",
"integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA=="
},
+ "node_modules/@types/isomorphic-fetch": {
+ "version": "0.0.35",
+ "resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.35.tgz",
+ "integrity": "sha512-DaZNUvLDCAnCTjgwxgiL1eQdxIKEpNLOlTNtAgnZc50bG2copGhRrFN9/PxPBuJe+tZVLCbQ7ls0xveXVRPkvw==",
+ "license": "MIT"
+ },
"node_modules/@types/jmespath": {
"version": "0.15.2",
"resolved": "https://registry.npmjs.org/@types/jmespath/-/jmespath-0.15.2.tgz",
@@ -10893,6 +10696,12 @@
"integrity": "sha512-2h3tFvkbHksiNcDiUdcJ08gXWG10fnahp30GJ2Tbt4vd4pfsbfkoKTaTbYykFoppaJ6DL3914nQ3PU1vVIlBRQ==",
"dev": true
},
+ "node_modules/@types/jssha": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/jssha/-/jssha-2.0.0.tgz",
+ "integrity": "sha512-oBnY3csYnXfqZXDRBJwP1nDDJCW/+VMJ88UHT4DCy0deSXpJIQvMCwYlnmdW4M+u7PiSfQc44LmiFcUbJ8hLEw==",
+ "license": "MIT"
+ },
"node_modules/@types/ldapjs": {
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/@types/ldapjs/-/ldapjs-2.2.5.tgz",
@@ -10984,6 +10793,15 @@
"@types/node": "*"
}
},
+ "node_modules/@types/opossum": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/@types/opossum/-/opossum-4.1.1.tgz",
+ "integrity": "sha512-9TMnd8AWRVtnZMqBbbzceQoJdafErgUViogFaQ3eetsbeLtiFFZ695mepNaLtlfJi4uRP3GmHfe3CJ2DZKaxYA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
"node_modules/@types/passport": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.16.tgz",
@@ -11231,6 +11049,15 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/sshpk": {
+ "version": "1.10.3",
+ "resolved": "https://registry.npmjs.org/@types/sshpk/-/sshpk-1.10.3.tgz",
+ "integrity": "sha512-cru1waDhHZnZuB18E6Dgf2UXf8U93mdOEDcKYe5jTri+fpucidSs7DLmGICpLxN+95aYkwtgeyny9fBFzQVdmA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
"node_modules/@types/tough-cookie": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz",
@@ -12563,6 +12390,12 @@
"fastq": "^1.17.1"
}
},
+ "node_modules/await-semaphore": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/await-semaphore/-/await-semaphore-0.1.3.tgz",
+ "integrity": "sha512-d1W2aNSYcz/sxYO4pMGX9vq65qOTu0P800epMud+6cYYX0QcT7zyqcxec3VWzpgvdXo57UWmVbZpLMjX2m1I7Q==",
+ "license": "MIT"
+ },
"node_modules/aws-sdk": {
"version": "2.1553.0",
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1553.0.tgz",
@@ -12793,17 +12626,31 @@
"node": ">= 10.0.0"
}
},
+ "node_modules/bcrypt-pbkdf": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
+ "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "tweetnacl": "^0.14.3"
+ }
+ },
+ "node_modules/bcrypt-pbkdf/node_modules/tweetnacl": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+ "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
+ "license": "Unlicense"
+ },
"node_modules/bcryptjs": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
"integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ=="
},
"node_modules/before-after-hook": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz",
- "integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==",
- "license": "Apache-2.0",
- "peer": true
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
+ "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==",
+ "license": "Apache-2.0"
},
"node_modules/big-integer": {
"version": "1.6.52",
@@ -14038,6 +13885,18 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/dashdash": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
+ "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
+ "license": "MIT",
+ "dependencies": {
+ "assert-plus": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
"node_modules/data-urls": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz",
@@ -14574,6 +14433,22 @@
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
},
+ "node_modules/ecc-jsbn": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
+ "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
+ "license": "MIT",
+ "dependencies": {
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.1.0"
+ }
+ },
+ "node_modules/ecc-jsbn/node_modules/jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
+ "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==",
+ "license": "MIT"
+ },
"node_modules/ecdsa-sig-formatter": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
@@ -14871,6 +14746,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/es6-promise": {
+ "version": "4.2.6",
+ "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz",
+ "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==",
+ "license": "MIT"
+ },
"node_modules/esbuild": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz",
@@ -16612,6 +16493,15 @@
"resolved": "https://registry.npmjs.org/getopts/-/getopts-2.3.0.tgz",
"integrity": "sha512-5eDf9fuSXwxBL6q5HX+dhDj+dslFGWzU5thZ9kNKUkcPtaPdatmUFKwHFrLb/uf/WpA4BHET+AX3Scl56cAjpA=="
},
+ "node_modules/getpass": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
+ "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
+ "license": "MIT",
+ "dependencies": {
+ "assert-plus": "^1.0.0"
+ }
+ },
"node_modules/github-from-package": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
@@ -17241,12 +17131,26 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
- "node_modules/https-proxy-agent": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
- "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
+ "node_modules/http-signature": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.1.tgz",
+ "integrity": "sha512-Y29YKEc8MQsjch/VzkUVJ+2MXd9WcR42fK5u36CZf4G8bXw2DXMTWuESiB0R6m59JAWxlPPw5/Fri/t/AyyueA==",
+ "license": "MIT",
"dependencies": {
- "agent-base": "6",
+ "assert-plus": "^1.0.0",
+ "jsprim": "^1.2.2",
+ "sshpk": "^1.14.1"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/https-proxy-agent": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
+ "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
+ "dependencies": {
+ "agent-base": "6",
"debug": "4"
},
"engines": {
@@ -17946,6 +17850,16 @@
"node": ">=18"
}
},
+ "node_modules/isomorphic-fetch": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz",
+ "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==",
+ "license": "MIT",
+ "dependencies": {
+ "node-fetch": "^2.6.1",
+ "whatwg-fetch": "^3.4.1"
+ }
+ },
"node_modules/istanbul-lib-coverage": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz",
@@ -18172,6 +18086,12 @@
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
},
+ "node_modules/json-schema": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
+ "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==",
+ "license": "(AFL-2.1 OR BSD-3-Clause)"
+ },
"node_modules/json-schema-ref-resolver": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-schema-ref-resolver/-/json-schema-ref-resolver-1.0.1.tgz",
@@ -18278,6 +18198,44 @@
"npm": ">=6"
}
},
+ "node_modules/jsprim": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
+ "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
+ "license": "MIT",
+ "dependencies": {
+ "assert-plus": "1.0.0",
+ "extsprintf": "1.3.0",
+ "json-schema": "0.4.0",
+ "verror": "1.10.0"
+ },
+ "engines": {
+ "node": ">=0.6.0"
+ }
+ },
+ "node_modules/jsprim/node_modules/extsprintf": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
+ "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==",
+ "engines": [
+ "node >=0.6.0"
+ ],
+ "license": "MIT"
+ },
+ "node_modules/jsprim/node_modules/verror": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
+ "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==",
+ "engines": [
+ "node >=0.6.0"
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "assert-plus": "^1.0.0",
+ "core-util-is": "1.0.2",
+ "extsprintf": "^1.2.0"
+ }
+ },
"node_modules/jsrp": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/jsrp/-/jsrp-0.2.4.tgz",
@@ -18288,6 +18246,16 @@
"randombytes": "^2.0.0"
}
},
+ "node_modules/jssha": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/jssha/-/jssha-2.4.1.tgz",
+ "integrity": "sha512-77DN1YurYgh+7FPCTJ2CQ6hVDHgIWiHxm4Y5/mAdnpETKYagX22pVWMz4xfKF5fcpNfMaztgVj+/B1bt2k23Eg==",
+ "deprecated": "jsSHA versions < 3.0.0 will no longer receive feature updates",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": "*"
+ }
+ },
"node_modules/jwa": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
@@ -19960,205 +19928,1921 @@
}
}
},
- "node_modules/nodemon/node_modules/ms": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
- "dev": true
+ "node_modules/nodemon/node_modules/ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "node_modules/nopt": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
+ "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
+ "dependencies": {
+ "abbrev": "1"
+ },
+ "bin": {
+ "nopt": "bin/nopt.js"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/npm-run-path": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
+ "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
+ "dev": true,
+ "dependencies": {
+ "path-key": "^4.0.0"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/npm-run-path/node_modules/path-key": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
+ "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/npmlog": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz",
+ "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",
+ "dependencies": {
+ "are-we-there-yet": "^2.0.0",
+ "console-control-strings": "^1.1.0",
+ "gauge": "^3.0.0",
+ "set-blocking": "^2.0.0"
+ }
+ },
+ "node_modules/nwsapi": {
+ "version": "2.2.18",
+ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.18.tgz",
+ "integrity": "sha512-p1TRH/edngVEHVbwqWnxUViEmq5znDvyB+Sik5cmuLpGOIfDf/39zLiq3swPF8Vakqn+gvNiOQAZu8djYlQILA=="
+ },
+ "node_modules/oauth": {
+ "version": "0.10.2",
+ "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.10.2.tgz",
+ "integrity": "sha512-JtFnB+8nxDEXgNyniwz573xxbKSOu3R8D40xQKqcjwJ2CDkYqUDI53o6IuzDJBx60Z8VKCm271+t8iFjakrl8Q==",
+ "license": "MIT"
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-hash": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz",
+ "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.1",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
+ "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/object.assign": {
+ "version": "4.1.4",
+ "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz",
+ "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.1.4",
+ "has-symbols": "^1.0.3",
+ "object-keys": "^1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/object.entries": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz",
+ "integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.2.0",
+ "es-abstract": "^1.22.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/object.fromentries": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz",
+ "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.2.0",
+ "es-abstract": "^1.22.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/object.groupby": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz",
+ "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.2.0",
+ "es-abstract": "^1.22.1",
+ "get-intrinsic": "^1.2.1"
+ }
+ },
+ "node_modules/object.values": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz",
+ "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.2.0",
+ "es-abstract": "^1.22.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/obliterator": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz",
+ "integrity": "sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ=="
+ },
+ "node_modules/obuf": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz",
+ "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==",
+ "dev": true
+ },
+ "node_modules/oci-accessgovernancecp": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-accessgovernancecp/-/oci-accessgovernancecp-2.108.0.tgz",
+ "integrity": "sha512-lohjenh/9XOWSt34clBbCMIa460TC1Lxrj+myry0JrFR8P5zzehqjmLDEUpDjpXx0oACP5t+3bhwuDn/GDzj7w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-adm": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-adm/-/oci-adm-2.108.0.tgz",
+ "integrity": "sha512-V8faYUwFeQFYFcl6bqnxlF9CzILH6VAb/kzXH9sHX8R2OYF8vXW7rTH72VlW5vxqEDzX0zYhHu46sJo/C5vkBw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-aianomalydetection": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-aianomalydetection/-/oci-aianomalydetection-2.108.0.tgz",
+ "integrity": "sha512-tJvJ/Mh0owQAIKVsTZyiPXymmUKP1b99yZDYg4rWy3mojrUZ6wHAT5OGgMOa9cSdfTvlkTnyZ194yt54ymG38g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-aidocument": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-aidocument/-/oci-aidocument-2.108.0.tgz",
+ "integrity": "sha512-fLGR1rnbhPOgKZ2NReWiYR83XyNY3wW5jV91Q0twSnFuFbkWGE0b/P/89ire06DMkRvkb/nESuYActhDUFhcGg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-ailanguage": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-ailanguage/-/oci-ailanguage-2.108.0.tgz",
+ "integrity": "sha512-DhwnTXbSs3Z43B4+sK3l7NU+hbOcfk/ZBWfcy32jOA0DsOaH2WUiaUss801IvoE8iaWuAFbNX1odpphgFFHfwg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-aispeech": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-aispeech/-/oci-aispeech-2.108.0.tgz",
+ "integrity": "sha512-WZUUugibvl5qaX8IgiUj/1hIC3PAZIm9uPQnLMGXeFYmO/Zu5YunVJ85T/qTI3U7UY8O3kdGiXsUKFKCTnZc1A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-aivision": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-aivision/-/oci-aivision-2.108.0.tgz",
+ "integrity": "sha512-cgoQ73OfY2+6AELGzXqv4nf9EIUXFx8ENYgRgg6P4DnyFY04NgeUufiZGM2nB4XByxJ862DzBw2YydKlTXPi7A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-analytics": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-analytics/-/oci-analytics-2.108.0.tgz",
+ "integrity": "sha512-p09Hk1fFz85nhvkWaFDEEUNwUJFBQFXQpj4OZzGA8orERJhi1dzd6X1Px1dCHpXTaPG8S8NWk2tRV/uloVd7AQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-announcementsservice": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-announcementsservice/-/oci-announcementsservice-2.108.0.tgz",
+ "integrity": "sha512-rYBcCHP+jZ4CGkJ0mUd6jdFU149AQjxqagoXH/LMUYvSS3ATUf91LlbiWQW22w5k0Otl5SSdMmEiIV7h7NUYyg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-apigateway": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-apigateway/-/oci-apigateway-2.108.0.tgz",
+ "integrity": "sha512-h6fIWU0kDPTxeqOsNJL35nPrDL8yr4YEKyuhJ4SQsA3wY2BqGs//eX+we4tTXHkEFBtbVJdRWYrt7BU8adsG9w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-apmconfig": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-apmconfig/-/oci-apmconfig-2.108.0.tgz",
+ "integrity": "sha512-a7YYSKFjdrH9nrngT1OwQ/40yTnPo1SzVas9ImeFLkUFm/5lC/D8t6Rmv7dlR/WO7U5o7e5dN5zLEDVf9LZqBg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-apmcontrolplane": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-apmcontrolplane/-/oci-apmcontrolplane-2.108.0.tgz",
+ "integrity": "sha512-jIeCJVr+Ci+3Ogifcwe5OYyeQg6otmoT+UiGoMHcUn+gNTgPcG5tSsqQ7C/2KL/qg1P+XEBoDtMen5wBXionPg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-apmsynthetics": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-apmsynthetics/-/oci-apmsynthetics-2.108.0.tgz",
+ "integrity": "sha512-h13UuPx0UUHV+IyoJtsov4KvNwB0l4QJABW8K49xsOkllUd4IO4VomJw1yhrau9OVXe8QE0P2GyCAHdH1rJPfw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-apmtraces": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-apmtraces/-/oci-apmtraces-2.108.0.tgz",
+ "integrity": "sha512-ufH4/WYXd2N6AveLCKDynaCx/T9UgzQ/LOatIbtZ1Q86ywd5aS4vdnzKxWUMdDNI//10z92nWeCZCqGov0HgkA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-appmgmtcontrol": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-appmgmtcontrol/-/oci-appmgmtcontrol-2.108.0.tgz",
+ "integrity": "sha512-JgFGFoJZW0gTtc010K19uIXGOevqpOT575ndRGxpQO04U+41GRDb+IOUe2NYe4ehw1rfYRA4/uUM0xdcbzPPRg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-artifacts": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-artifacts/-/oci-artifacts-2.108.0.tgz",
+ "integrity": "sha512-ZljcFpyjVuQZiu4V/gKTEjxu1pMiQVH9o5k+Ys++cMtQWBvGyMlnxrDwpFRi16vHoXuPxKw2ygvjqM2wNN8M/g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-audit": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-audit/-/oci-audit-2.108.0.tgz",
+ "integrity": "sha512-i7iH6sMzqGi0zl3SwNatnnzqb5CkKXr1sIW8uiamBghhyjIE8sehrW/eQl+hrzKNk/piSvi/5f5ftZ0MIQjxww==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-autoscaling": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-autoscaling/-/oci-autoscaling-2.108.0.tgz",
+ "integrity": "sha512-HCIU06FXuDa3suv/t0q+dchZAPFr6tRswccRIytvVm4eBJHiB6vblEqrJ6jgPzBd6F+y+hPZ4ZlJ1L2MLE6WYA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-bastion": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-bastion/-/oci-bastion-2.108.0.tgz",
+ "integrity": "sha512-6Ys6CAO6K+ylKkjQcyBr7oglRQZWd4RZPJdhFqybIQmeysKzzaY44zoWMah7tcYryu3sKaypsmrypIOTXHIwdA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-bds": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-bds/-/oci-bds-2.108.0.tgz",
+ "integrity": "sha512-eaWmH312PSJd1WiS6eV9KoKUGDzq94UwlaaqslS6Yo8cOLBWhNhrd4yoIcL/rGWpURLAuNfFkqqaIPEUWSzw1A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-blockchain": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-blockchain/-/oci-blockchain-2.108.0.tgz",
+ "integrity": "sha512-KTVP/Nlki8Z5ZekU39N/IMEr7LhXbRtz+8u7e8VnGmiHbrJGEA377KQv0cUDczQ8vyC+7IbWLIGvXUgXYVd93A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-budget": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-budget/-/oci-budget-2.108.0.tgz",
+ "integrity": "sha512-fy6DKzWD+HgDXjx0HzjgKz5nIRrDeZhn8EIiAMaCqUsPFA982iNw8BRwgw5k0tU6BZf/kwDeLUDc3O1NvlhUDQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-capacitymanagement": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-capacitymanagement/-/oci-capacitymanagement-2.108.0.tgz",
+ "integrity": "sha512-CEIoKbD49h7naGRFgyqfDnyEtQZfAl4b9IJsx+jJXvJ2sTmhYJagbWoBA/MkoHoYvRfUE3o2VVM1SkBMKLjE/Q==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-certificates": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-certificates/-/oci-certificates-2.108.0.tgz",
+ "integrity": "sha512-OmeY3hj3VX5r0IkyZg/IMv14CmVnhIUA04aAhtA9F94TlxGKgg6muQ5OppPhnmKrrvuBZhV+8w/3p0BUB0gt1g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-certificatesmanagement": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-certificatesmanagement/-/oci-certificatesmanagement-2.108.0.tgz",
+ "integrity": "sha512-yDkpv49vDkGun6Byju19Uxm5+aR38zA1vEexW33hDWyOghLvZP1Jasu41G6xljytoIIy24wykBTZ3IAnB6I00g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-cims": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-cims/-/oci-cims-2.108.0.tgz",
+ "integrity": "sha512-3lny4DzRAwtBGGs35K7LsVf388V3AQAyuiIhWDGBB71HtgBw9VGrL3sBB3jyO5WCjwE/akKEXJLKPvpjBgZBGw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-cloudbridge": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-cloudbridge/-/oci-cloudbridge-2.108.0.tgz",
+ "integrity": "sha512-R6diQhWNusQ7jJU/z45IyrquJz5iZd1NHovNP9TwtkQw2yPrdIbMjLZYhoWSsVDNOnffn1q1VreYNYkid/4qoA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-cloudguard": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-cloudguard/-/oci-cloudguard-2.108.0.tgz",
+ "integrity": "sha512-0qrH8OM1f1pIHc8tqOpeZfh+DRPlP88FikVf8woCeM8ekD4ysV04+zATAf+w8VVeASkHbYQnrTQB+UgtXMOB7A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-cloudmigrations": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-cloudmigrations/-/oci-cloudmigrations-2.108.0.tgz",
+ "integrity": "sha512-ZITVnShAItKIoB2ONp4+XONUVUjKyh5dMg0Mh2Ik1OL2JpKr6tu5KWWUie15azaDj4TqQ022mSbHfdsV51DEIw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-clusterplacementgroups": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-clusterplacementgroups/-/oci-clusterplacementgroups-2.108.0.tgz",
+ "integrity": "sha512-3TpH2710n4yJFI/oeMyEND719KbgiuP/OD9jjZMiGIDDi9XjGwZnsKNYP6K0kgRriwEDtUNZdFBDtJa69XyB7Q==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-common": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-common/-/oci-common-2.108.0.tgz",
+ "integrity": "sha512-H7kaU/A57ksvmXlLLFnTo91CeG6m3M5nbqYbWgniHl84vEmaM0vHhe5C9jQOpPUuhMdRRB2GareJYBjP79cqBg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "@types/isomorphic-fetch": "0.0.35",
+ "@types/jsonwebtoken": "9.0.0",
+ "@types/jssha": "2.0.0",
+ "@types/opossum": "4.1.1",
+ "@types/sshpk": "1.10.3",
+ "es6-promise": "4.2.6",
+ "http-signature": "1.3.1",
+ "isomorphic-fetch": "3.0.0",
+ "jsonwebtoken": "9.0.0",
+ "jssha": "2.4.1",
+ "opossum": "5.0.1",
+ "sshpk": "1.16.1",
+ "uuid": "3.3.3"
+ }
+ },
+ "node_modules/oci-common/node_modules/@types/jsonwebtoken": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz",
+ "integrity": "sha512-mM4TkDpA9oixqg1Fv2vVpOFyIVLJjm5x4k0V+K/rEsizfjD7Tk7LKk3GTtbB7KCfP0FEHQtsZqFxYA0+sijNVg==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/oci-common/node_modules/jsonwebtoken": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz",
+ "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==",
+ "license": "MIT",
+ "dependencies": {
+ "jws": "^3.2.2",
+ "lodash": "^4.17.21",
+ "ms": "^2.1.1",
+ "semver": "^7.3.8"
+ },
+ "engines": {
+ "node": ">=12",
+ "npm": ">=6"
+ }
+ },
+ "node_modules/oci-common/node_modules/uuid": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
+ "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
+ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
+ "license": "MIT",
+ "bin": {
+ "uuid": "bin/uuid"
+ }
+ },
+ "node_modules/oci-computecloudatcustomer": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-computecloudatcustomer/-/oci-computecloudatcustomer-2.108.0.tgz",
+ "integrity": "sha512-UU7GHrvMm6cJ1LeRbJfazq0/FrKEphePulLhvGn3IMiDxYRuAfON8RNydaJGZ+Q8s1Qv4BdID0//zPO7QkiD2Q==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-computeinstanceagent": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-computeinstanceagent/-/oci-computeinstanceagent-2.108.0.tgz",
+ "integrity": "sha512-1vn2zjyyCOOAtTKiyOG9pm9OxD0VPXZH7HPQP3CRcTalahfFY3WTy0Ti51/Ozk0rOLKUBpyJzcfsknaO87p4LQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-containerengine": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-containerengine/-/oci-containerengine-2.108.0.tgz",
+ "integrity": "sha512-OcQUtL/3rthwVx3rOTC1vJDTc6FL/kr0gQpqbjRtU5HBGnZE7Y7+R+CLWi+WejX6qP4IgU+Wv2T2Jig4tROZEQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-containerinstances": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-containerinstances/-/oci-containerinstances-2.108.0.tgz",
+ "integrity": "sha512-0JFULah06CupSJxrHZeOvdSYn6OkYw+/KY3eCb49K6Ht9/dtumHKTLVvGrr/b9JlAtl8ZPdFOd8hNb9WA/dAGQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-core": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-core/-/oci-core-2.108.0.tgz",
+ "integrity": "sha512-Nuowt0mFE+f1LDT+VFwQt9JRNzTsHkdRd8CPMBgS+czyyI89UsIkAYj9eVzgbyV98Btzv8aX/BF7EGh1BhYJKQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-dashboardservice": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-dashboardservice/-/oci-dashboardservice-2.108.0.tgz",
+ "integrity": "sha512-zmg7hgVjqXJ0zgf/53bxBnpiZ2nbb8InccjElbiApvUhICMw65BsDCh0JDxyZUbfFBORZSVJcWbr3J5PzudE1w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-database": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-database/-/oci-database-2.108.0.tgz",
+ "integrity": "sha512-q4Jb9ZosdVbCFtqqDBy1RY0zqk4hSljtvGu+z5A3DyZ6DfL7ALUah8GweZeVWsX6vvfwrc7H1ca15ksxGwl9Lw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-databasemanagement": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-databasemanagement/-/oci-databasemanagement-2.108.0.tgz",
+ "integrity": "sha512-JQ0ysKWcG21jDGSCiOw1T/uqY+ChGG1SOKa/kMa4stLON86t/DAcjPE343uUtld4fts6GMBDXkGnx8hWW9BaQg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-databasemigration": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-databasemigration/-/oci-databasemigration-2.108.0.tgz",
+ "integrity": "sha512-OIEx0CNTi9m+ydeFCKCOslcWOWoX+xJkWMbiGGESQdjmSSczkMXoAK4Kn+XmUcRxap2DczBCICS+8dafl7Z76w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-databasetools": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-databasetools/-/oci-databasetools-2.108.0.tgz",
+ "integrity": "sha512-CYTfqYOdL/INiTTAfRB+DJS06PUclNL6q1AWMYFgDi++R4jcIueyJDXqqnSzwkt/iBzA8IW72er5N8pvVxgYRw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-datacatalog": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-datacatalog/-/oci-datacatalog-2.108.0.tgz",
+ "integrity": "sha512-T4J175I1229EUpc68HaRMlIhIpQgRf2ajCCNriniwaaz7EWtej4LKRvzaw/eWe3DwHFI4kEb+9WXlpzHj0C7Hw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-dataflow": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-dataflow/-/oci-dataflow-2.108.0.tgz",
+ "integrity": "sha512-GHPiHHdEC0onqBA4GCHFQ8RdijYmro3hLYXztgrI+uMoIEb/ms9ayBptKliEHwlHmEF85or7/sn5JB2xqXGxPQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-dataintegration": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-dataintegration/-/oci-dataintegration-2.108.0.tgz",
+ "integrity": "sha512-/BoQhwoBsrK2wGaO9uV6idnIooPb9GTOuE30p+c02Bm7yuFmXTGgA/mQxIEk6TcBvcJGss+3pWiyDrq03gEyqw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-datalabelingservice": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-datalabelingservice/-/oci-datalabelingservice-2.108.0.tgz",
+ "integrity": "sha512-JE43+obBvanuiJepAGtCrz80giIMB2o8v5sP1Qe0xs7zuB1HtZ1k+tRuof2ipznbnLScCyUZGdROMReE5IiEmQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-datalabelingservicedataplane": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-datalabelingservicedataplane/-/oci-datalabelingservicedataplane-2.108.0.tgz",
+ "integrity": "sha512-m22njdO3pogqpbeOgJM+ArCwJJvWhHB2Nz13/Kj6YXPuQqFv0TUzGHEL2LuhqpNFdM4CvF5Dtb472q4Kav5+/A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-datasafe": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-datasafe/-/oci-datasafe-2.108.0.tgz",
+ "integrity": "sha512-uZ18rhS9FmP//IrRunBQvdwbjdqQiLyKlIdaL0M8BiI+MDrE3ZXL5veZUS8GmD+xeBZyCHV8cqJAvQfcgsi2oA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-datascience": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-datascience/-/oci-datascience-2.108.0.tgz",
+ "integrity": "sha512-nh/LpXBVYvBrS3Rp8K7J/l8JurDm1geFEgu9oNXxJ+fheofpAZ6HHXeRIVadXHARXbgLuu7ta+pmB1IBft6OEg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-dblm": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-dblm/-/oci-dblm-2.108.0.tgz",
+ "integrity": "sha512-RJGrKUtzhWeXono6lUvNrRD/xrR4jVrmVNEgpSFTIkDM0rRlKP2lSqWdfZdB+qTt3QaNjKsRWm9TRxYyrroW+w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-delegateaccesscontrol": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-delegateaccesscontrol/-/oci-delegateaccesscontrol-2.108.0.tgz",
+ "integrity": "sha512-Imri3k0tESbq4xNxlHwqfcRZgvVPxx2Lt29TMuC34mrj2zhNlcKIsg0xgvpmfB3NrEjKz9M/X4MSpIfjzVUJ+w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-demandsignal": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-demandsignal/-/oci-demandsignal-2.108.0.tgz",
+ "integrity": "sha512-ZvpAJf5QnpeQ5rkMGuQIa04Dv0Q4gS+nmyWLXyIipMV5mrbkyWAdWo4crauZxiwBt6yyJe5r3zBkrNTtXWQubg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-desktops": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-desktops/-/oci-desktops-2.108.0.tgz",
+ "integrity": "sha512-sEBs1QzvOj1z6NQjZHln65bXyIqOla34lJLsN260GL2AjcV5V/j/8668FP7InxfRFvrb+2+jcefeI54tZbx+NQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-devops": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-devops/-/oci-devops-2.108.0.tgz",
+ "integrity": "sha512-HgLwTv4+TA/sXIRPGFflyiHQWL9OjQXvej2V+nwiujeiMYsJ66bvTTE3FIm3ku+6apHlD6zQQ8s8VBAJ/IR/bA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-disasterrecovery": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-disasterrecovery/-/oci-disasterrecovery-2.108.0.tgz",
+ "integrity": "sha512-GULI5fQg+8qWzw9Nk2U4p+COOiXBq5+6+XHRjfriEg1EkIwF+TUt71cwyOUaE+jKZQdI/gHz1ViQdy972S318w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-dns": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-dns/-/oci-dns-2.108.0.tgz",
+ "integrity": "sha512-93hiGQU6tNwL++Qq6MNbw9RD6CFLl+6pUPaybnosR+/sjYnh0IinwFSaLChizzevSCWWILTr2h/BETafnDXXXA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-dts": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-dts/-/oci-dts-2.108.0.tgz",
+ "integrity": "sha512-62/xBcPGA6IlAgez0Vrakz7OLav4DTA8SEGpUJPDWdMAAMoJFeSSCVpPh/tVRY3jzjM+3rTTQzmXiI9yix0EaQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-email": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-email/-/oci-email-2.108.0.tgz",
+ "integrity": "sha512-xIZDTjxuOuK3gcMYUPXUf39NOVQB8frrSJvGTa8Lp4aQNDGgkbwpONCbmyJj7pb0tvOag1likbRuQi9M8Cmjwg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-emaildataplane": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-emaildataplane/-/oci-emaildataplane-2.108.0.tgz",
+ "integrity": "sha512-eSKh1yTNTwEF/YfuR2AaTmhyipG3jOBPA7kICx0Syrba4pPqvkNqgJBq1pQcJHH0wBxTZZTag7MlMPs4ibIz5g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-emwarehouse": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-emwarehouse/-/oci-emwarehouse-2.108.0.tgz",
+ "integrity": "sha512-3vqgsNxz5jTXrrlZQT4Vl9zgGMABqD/OViv4oI/8zNS6eHC5zuUDVbGqe9sZNHlO1VtNOzDlRxbJHCzxj1mnwQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-events": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-events/-/oci-events-2.108.0.tgz",
+ "integrity": "sha512-4JoHrafbesO+cIXH9BADXZrZM2gCeUeNMTwZc38FP6rhOTK45CrYYP8Izbe+hzoKXCDsbp4rvLsxOdu9gJg1jQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-filestorage": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-filestorage/-/oci-filestorage-2.108.0.tgz",
+ "integrity": "sha512-XOce/0fDnnsgyRG3vKuHNXpbxAmQ/Erd2KwX9GGPlf6ig4uQHO4X6i2ylVD90OfaPxYbzwdV96j7cTwwlVHfXw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-fleetappsmanagement": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-fleetappsmanagement/-/oci-fleetappsmanagement-2.108.0.tgz",
+ "integrity": "sha512-OHq1Ctm3EJM6jasYvtHO5HaypR14tw8F6BJPOemCd3sRzoUiqIiZ1qxi1USYq5Salpng+FfvL18Qt4XEZhW+9Q==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-fleetsoftwareupdate": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-fleetsoftwareupdate/-/oci-fleetsoftwareupdate-2.108.0.tgz",
+ "integrity": "sha512-M5UEi4Kl1vNGUtnf4eoc74nFzZ8k0engo5L8ufJ/lszPtcMJ0pTMFuHB6A9lOSgaXnaIXRIOEj7aW4Wo9lj+6w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-functions": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-functions/-/oci-functions-2.108.0.tgz",
+ "integrity": "sha512-nD5rVZ3Pve7oTq+Dvpj1uPymRArq45U8Lm7J/EZCwwI9sFTu5ZQyL0nbXNHJRda24W+QdnWeHGQSIB4hcA806A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-fusionapps": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-fusionapps/-/oci-fusionapps-2.108.0.tgz",
+ "integrity": "sha512-B8sNAB6er9LBd0C/l3qYRPLqGzf0s0lgyYWDEZsPT5q+1wS9fSmBAvyAfU9bUrL8GgsCaNC4W96ROfEjQ/ZKwA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-generativeai": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-generativeai/-/oci-generativeai-2.108.0.tgz",
+ "integrity": "sha512-g2EGfBMDzVvo44IEPqLBBHf3pei0DvIOQUT23BgYO08nwfsNmHacuEx8yl6jZvb00/58qN+LjKBQ0807eoHGow==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-generativeaiagent": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-generativeaiagent/-/oci-generativeaiagent-2.108.0.tgz",
+ "integrity": "sha512-LbzrMlJsORYF67rcJl4gMmNXzzKk09HbnyoqxRT96tHYbSC72w7xMCMnc9xN2746K52mxT4ZsyOI+kPcD/XTww==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-generativeaiagentruntime": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-generativeaiagentruntime/-/oci-generativeaiagentruntime-2.108.0.tgz",
+ "integrity": "sha512-+TvJklyLWOlq70arKPnkfiCx8WTEDvb2sZgZiq7arxBJYUL3burg/bLO3Di+XlGaHMyoaBbKLW5tJM77rdFNKg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-generativeaiinference": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-generativeaiinference/-/oci-generativeaiinference-2.108.0.tgz",
+ "integrity": "sha512-OBKKowDh7duUiMRS2LWmLWDGpDz6th7Ef0NznAYGniXAzxf3x1VcGkGYHi/8NEB5GvTzCxbPXYBunA/C0oUL8w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-genericartifactscontent": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-genericartifactscontent/-/oci-genericartifactscontent-2.108.0.tgz",
+ "integrity": "sha512-6hpnmK4TQG5rUtlib89BQjMte4ho6xhkCH+nyWqbUwUTDMn3L5/On8Nk/O3Rchm6/lgObHZ4v+1LNt1vxE96JQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-globallydistributeddatabase": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-globallydistributeddatabase/-/oci-globallydistributeddatabase-2.108.0.tgz",
+ "integrity": "sha512-db79VO9Z/dCyhVCIcvg5suqFoUwo7UhH9zT14T8rPTvSuLm3ISZsEYU6XEshXefsIIV5huzElus/SvCEI/JC8g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-goldengate": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-goldengate/-/oci-goldengate-2.108.0.tgz",
+ "integrity": "sha512-6pn1HAIXsvfcFaiSdXQtTViRXqQtubyktQyY4hXQ0HyDU+Iv9ZaIXrJ8Z/aAWSRVvH3Rw0W7L5Le4Q1ar+FJ9g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-governancerulescontrolplane": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-governancerulescontrolplane/-/oci-governancerulescontrolplane-2.108.0.tgz",
+ "integrity": "sha512-EdtoyGwHAoug/1hHkx3fa/7cOQ55TzAC9lvHJg23uUgM4zHbEjvRuMJjEoyMo6NBWoLk5jM67ESAeczkOCsGaQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-healthchecks": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-healthchecks/-/oci-healthchecks-2.108.0.tgz",
+ "integrity": "sha512-/98NvgW1uKMxyC+6pvLGaVapMkxsh1qhKjBTXJShIkmGKUycXIksCkknMRCeik98FWmvoSWfu9I0dnTewjTq/w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-identity": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-identity/-/oci-identity-2.108.0.tgz",
+ "integrity": "sha512-yetR36jJYFEIthzBe7qBSiZQczKIcYT6SQAejxlAXTwAW5uSsRaR6tmv1H24hB/csjVfhZeHFjeDYP99oxsonQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-identitydataplane": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-identitydataplane/-/oci-identitydataplane-2.108.0.tgz",
+ "integrity": "sha512-WZdy59Lwy85swqYJb6U3pUBUfDNPVPn4mUd/LseezvoDTHwiNTw66DtEQK87XBNMa8O57t4GMdtRV798WqM1fg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-identitydomains": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-identitydomains/-/oci-identitydomains-2.108.0.tgz",
+ "integrity": "sha512-XQtHk2IA51gKvFAkXcKh/w7NhpoAUXMgy7/4ni8OKhR3Ru7bpGI0cea87iV/eNo0n/p3PxtAqy6AQF+/5VHdyA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-integration": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-integration/-/oci-integration-2.108.0.tgz",
+ "integrity": "sha512-wmNN4T536iyf5UJaibyHpaGPrA5jNG0r7CwdN0cxQXOw1BhWV8vLXQfEaE/TRDJEmFahbOvdHdEIBH+IExKMrA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-jms": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-jms/-/oci-jms-2.108.0.tgz",
+ "integrity": "sha512-R7NCobTxuMx8NWx6Vbov5cjBpLct9EW7cFmqurKTWdlWOC98spIujtMOkHnIcB4G5a6PaOWgViXhrjsVSarJaw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-jmsjavadownloads": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-jmsjavadownloads/-/oci-jmsjavadownloads-2.108.0.tgz",
+ "integrity": "sha512-JeVPC3nvB6MxvL9P3fYm8MkCKSWJDWUrn0i6S0iEAVMJwjfoXkamt1UL1P2r9jCxnkJK9nxJh0YnUUXsSUWrYw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-keymanagement": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-keymanagement/-/oci-keymanagement-2.108.0.tgz",
+ "integrity": "sha512-4hbzgIZI6C5TpUhPzt2jJASfke342aoOqH0oYKN1kb2cK+3BfyNFqh0loDgUtWkoKlk94joPAbHaf4ebmYmeHw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-licensemanager": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-licensemanager/-/oci-licensemanager-2.108.0.tgz",
+ "integrity": "sha512-OKjENCbpN6LOHSJLEbomhh9+cMxOMRmkKaJultzGvyMJ0GnULgFC5+6n/de+2/+rchQyai62JhZlU7fiXAUcFw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-limits": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-limits/-/oci-limits-2.108.0.tgz",
+ "integrity": "sha512-q8r56EfgjmFmUP6Jj7Bl668Jv3M+4AQM2kwWDMCWWJVIiyWLEmHURmiLkstnxlT9qfrjsHpyOp6Uy8fdm/idVg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-loadbalancer": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-loadbalancer/-/oci-loadbalancer-2.108.0.tgz",
+ "integrity": "sha512-N+PyjBLP2ng2HFNlL+iuSHvJHGJQmHYIYW8wuZ4sYvA9rz4um/PQMPD6OgRz+kO3dsxF/8dPkwnQ33RwHwxMfQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-lockbox": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-lockbox/-/oci-lockbox-2.108.0.tgz",
+ "integrity": "sha512-CrVmzyvjBpy7yVfOso2x0M16h+p0zNzn75/7QVx9ifwFxBhSJpiztjH0YTADHd1l0KMNXa1ZDsxKq0mOQlYp0Q==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-loganalytics": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-loganalytics/-/oci-loganalytics-2.108.0.tgz",
+ "integrity": "sha512-5uFYU/1uHJYg8evPECvXC6oTZhYwXUk3CKkEcklXQAHptDEMYzVu24S/nBkqgdjHAXWtIHElh8V0lrgboseodA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-logging": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-logging/-/oci-logging-2.108.0.tgz",
+ "integrity": "sha512-A7Gu+hoJGOI2tBrCkLdMHEabQmmUEAPZEUVEq9MrAsTqJYjZi89V7KNiaLx15ARCUaj9ivUYN9eamLfPSQQaJw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-loggingingestion": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-loggingingestion/-/oci-loggingingestion-2.108.0.tgz",
+ "integrity": "sha512-otlfcKBUpAvg81fbyIHMUMNuTuErmrNq/yK2SynwqJUTcZ9EjbaysqCwed67tRDyETqru1/qX2tmI2XCQkATCQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-loggingsearch": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-loggingsearch/-/oci-loggingsearch-2.108.0.tgz",
+ "integrity": "sha512-Pj629/S9LYPH+wkDdi1gazYzv8V7PvvW6OgKsg5zH6XKBhZrD4k3yHmW1nNoEVmR3JHFui4DcK8YBj3Jv2oLCA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-lustrefilestorage": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-lustrefilestorage/-/oci-lustrefilestorage-2.108.0.tgz",
+ "integrity": "sha512-WtQxJp2gQP/K411FHlh2bg8UW8Wx76b+ZA1ApySQR7IiXicDs0kSsfNluKat5DytFnAMt97Qh5pq2KnjwKg88w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-managementagent": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-managementagent/-/oci-managementagent-2.108.0.tgz",
+ "integrity": "sha512-VCmMUoet6AsZXmKneykIxddRr6Wo01Aj1ByCnlg9PaqmWbNNv5PkmdzCDrpV8GNhpn2IyfAp61lr/lwI3imD+Q==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-managementdashboard": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-managementdashboard/-/oci-managementdashboard-2.108.0.tgz",
+ "integrity": "sha512-tVuAB2xRUiSYLjuUBiqtkqvszpmTQrVJLCZB92H+SzaNFeqa2OjoH/qK0jU6LOQuLfMr7SG3atATGYNqFLVMBw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-marketplace": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-marketplace/-/oci-marketplace-2.108.0.tgz",
+ "integrity": "sha512-zMsftpZM6VThpicbhciK/b1irkrJPbqX45aHvj2iS1q+I7h7dG1WD+LMK/K6oS53idzFclHOvBCN0DMg1OYEjw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-marketplaceprivateoffer": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-marketplaceprivateoffer/-/oci-marketplaceprivateoffer-2.108.0.tgz",
+ "integrity": "sha512-JMdMPLpRwiARCgjiEVbyVweYZjmIt2KntqG7o6SEDoIoE2j74poqHjP75M4794pNynFHT4AZJzb/Ryv1hwuWhQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-marketplacepublisher": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-marketplacepublisher/-/oci-marketplacepublisher-2.108.0.tgz",
+ "integrity": "sha512-EjjACVK6JDn3/m1kXadeJa+s7zUsPR9uVq+e6QFwyeB9ro1HnzG+qyYJikoDc/huF3ZYwQFlWcTFR3Q/x4acJg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-mediaservices": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-mediaservices/-/oci-mediaservices-2.108.0.tgz",
+ "integrity": "sha512-AB1dRo+g12Qq6ep/BrtEHjEG49NpePqgDt6/WZSre1BpEcfyONTCMQDaI7HpeUH2OuEsn/duXLEHVLE1w0zQzg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-mngdmac": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-mngdmac/-/oci-mngdmac-2.108.0.tgz",
+ "integrity": "sha512-kZg+mDSIeMQqBhQz0JmcSQKKdMizR975xxkLbLdUXdhtAoCcFMagYm4NqsdHGMbchMJ2JfKpB3ylPexoRyY89g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-monitoring": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-monitoring/-/oci-monitoring-2.108.0.tgz",
+ "integrity": "sha512-nWRALVeyuIzFi7wRSb+hsYl8S7le7jlZKa47eCLlSHziHTJrDUT7PLAeSTdAVkPRzircHAFeD+H1SB8tVsyrzQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-mysql": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-mysql/-/oci-mysql-2.108.0.tgz",
+ "integrity": "sha512-Zr9B8hgwQy1Z+BTStUdrVnjj+2ZkeR3+NFlhxPGt2LvU+vm92XOUD33h6MbogswpJ/cb7RlazKxKQKJtPHfJPw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-networkfirewall": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-networkfirewall/-/oci-networkfirewall-2.108.0.tgz",
+ "integrity": "sha512-TvGwagr0Qyt/BFnxyrVmPnsFryRn9snLXwJPwQU2MMcGlnJHUDcsidhKxV/tJzSHYNINmYy9IXOy4D+E8a+wUA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-networkloadbalancer": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-networkloadbalancer/-/oci-networkloadbalancer-2.108.0.tgz",
+ "integrity": "sha512-XnuIvO4GRyKjRxigAMBl1zjKhxnGMyuo9fkx53nbPaWdmMM0mEbL6csKxTsozQxc29gUtUcZJI/tqvC/yBNQ+g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-nosql": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-nosql/-/oci-nosql-2.108.0.tgz",
+ "integrity": "sha512-OJtPwgNmMPslXj/QIaT7NQQxPUrY1zCAPSZdCBfhlQH/D7x62w5A8BVP+HtkTA4LyN/GgGqnk/L01uni7lng8w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-objectstorage": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-objectstorage/-/oci-objectstorage-2.108.0.tgz",
+ "integrity": "sha512-TjG6tf8RpnCz00loEy8Nhe/FD0P+TOkzyBaVoGODDr6rR1F7PmWL4k3u8rQA7tvTtJsIO//XaSaObcnW7ytM3g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "await-semaphore": "^0.1.3",
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-oce": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-oce/-/oci-oce-2.108.0.tgz",
+ "integrity": "sha512-h+WUIkNpLTCjLLPM3xsMwR7r3K+NzId2Sxh4yIHbzOewRJIk1o/qpZzSyMevnUIL86S9IYPkVvjIVJnU2Dueyw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-ocicontrolcenter": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-ocicontrolcenter/-/oci-ocicontrolcenter-2.108.0.tgz",
+ "integrity": "sha512-I6MfZbsYHkNojoqvzKdkz8vlQu/ZcYm80mZf9XpK9HY00SyY/SfPtwjutyGi46L8dIBVoXHhUNP3hQcVD5T0rQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-ocvp": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-ocvp/-/oci-ocvp-2.108.0.tgz",
+ "integrity": "sha512-JCriglSsxC1YXfUd/3xVxMojZT+b/+Go3hRIxom4gkOJ3Ceo0x7VXfJKeYGnjqERP5YIA2KWztgHQwAgAG0xFA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-oda": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-oda/-/oci-oda-2.108.0.tgz",
+ "integrity": "sha512-QNkLczqrgaVVmnyYTRaiEF3cfohzgIYLyKpBT7Bg4Bu2kP0ljAQV0/BxD1XXpkUpC5atK5wjEq5urUWdybKqZg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-onesubscription": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-onesubscription/-/oci-onesubscription-2.108.0.tgz",
+ "integrity": "sha512-Er6TBhzziC5uHURHLl1AjHjPp2r8wvYH7p59aJ0uyuXucZ0rGVJ9IkmU8T+TNznSx59iEhcmsYvaZyYUPI3RkQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-ons": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-ons/-/oci-ons-2.108.0.tgz",
+ "integrity": "sha512-C1Z/OBjPFeL3wa1M8AHArCbeNqul3GoO9QbEwZQ5qsNyKlF9Ol06UcdXA9vhSl25q+sH905JetuGaa9knIKA1A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-opa": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-opa/-/oci-opa-2.108.0.tgz",
+ "integrity": "sha512-8jB/IqlevkwXlq9DSzTJ+2re+Y6vLCKFyVhQX323Sc/BamrEP2YnCU5HInSy+9GzQWbkBJ872CPvuQxLpUgHCA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-opensearch": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-opensearch/-/oci-opensearch-2.108.0.tgz",
+ "integrity": "sha512-/Mofttk4YRa+/unJEFwis8gFgjQGCh55My5dzeKASBBlRGuSJTHWwJDBkZAsY/Boizen7nb2nvvgzQpB7Q42Zg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-operatoraccesscontrol": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-operatoraccesscontrol/-/oci-operatoraccesscontrol-2.108.0.tgz",
+ "integrity": "sha512-Ln9tyjySUvWA7kHx7EQ6z0+wWuHoYQ7e9AvsxIVCuL6WzVy+CEONknNhqXqfMmSQHexgpXPaVJtTd8HRoISGUA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-opsi": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-opsi/-/oci-opsi-2.108.0.tgz",
+ "integrity": "sha512-AhO4cME5h4dMsZSXlWKU4fAjf+G6KOSDC/q1/MKzsuFOVIw8YaNWEldOai1k+z5VRC1EWmuneFvgnK4EVnaeMA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-optimizer": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-optimizer/-/oci-optimizer-2.108.0.tgz",
+ "integrity": "sha512-FsmroTYeawQAiEraHHt3EG0WiMwjfjYCpSbhl0Rh4kBMEG27BbW6SBzE4J/Aam2ArJLM8NSdakDwAt3y8oJZdA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-osmanagement": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-osmanagement/-/oci-osmanagement-2.108.0.tgz",
+ "integrity": "sha512-FJsODD7muZCnpgGAL3t6rBvbg+cJRvcrjtVkPx147tED2wI1Hxrc/bXAhanC375rn4k8vFvrFjNSKCfF1VCG7A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-osmanagementhub": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-osmanagementhub/-/oci-osmanagementhub-2.108.0.tgz",
+ "integrity": "sha512-u4yPdLxYGoSGMrI3jE5N0ruhH719Sm/Ga6uhONhufGew3g/fszaTQfjvDML9kSo+BtReiaua6gfAidi24dTfVQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-ospgateway": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-ospgateway/-/oci-ospgateway-2.108.0.tgz",
+ "integrity": "sha512-2DGQ903/wtQRvNEwScYTpr+pjcVmumAQw+ihWBV3WQ5bFCZNaFEfSyEu7wvFYxRMI4WvfwjivUmVUmSbTIVMzg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-osubbillingschedule": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-osubbillingschedule/-/oci-osubbillingschedule-2.108.0.tgz",
+ "integrity": "sha512-2iN2hoYUyR9yg/RUR7VnKVmW+N0HHBuO8cVXmgjdoybzS9rDLvAmy/JsoHS0tMt/a4ExAIi9iC228Fwk4x3Sgg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-osuborganizationsubscription": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-osuborganizationsubscription/-/oci-osuborganizationsubscription-2.108.0.tgz",
+ "integrity": "sha512-58WtIRE8+jK6V1Lzt9cToiv2wr4XIX41P3M6ab/vljusW5bJ+trNRrJXugcq6BE3+s9ysebdVY9mLe3O14qNLQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-osubsubscription": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-osubsubscription/-/oci-osubsubscription-2.108.0.tgz",
+ "integrity": "sha512-cCSjWrJVsOTkt2IhokdUkrx95VxLh4HuK51EAfo7ITLuOnMkScoDSFgTB48+Ktx3qjEMG9fNrM9lRxtktTpe3A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-osubusage": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-osubusage/-/oci-osubusage-2.108.0.tgz",
+ "integrity": "sha512-bICbOu3MbKRnhV8iFLOHVhs31bQlmZS8cO8qWCFQgci7dt401mrxj+MFO0Yzq/Hk5unpbuFonLjlHsiD456ZDg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
},
- "node_modules/nopt": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
- "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
+ "node_modules/oci-psql": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-psql/-/oci-psql-2.108.0.tgz",
+ "integrity": "sha512-w3ruZcKn++JnnYiPu6gmnSCjD/NQ1SGCJUIGDcc+O2qI01tfVXa3BI/c2AY7Y5Z+DbRD/efO0hSZt/9mtkS5IQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
"dependencies": {
- "abbrev": "1"
- },
- "bin": {
- "nopt": "bin/nopt.js"
- },
- "engines": {
- "node": ">=6"
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/normalize-path": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
- "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
+ "node_modules/oci-queue": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-queue/-/oci-queue-2.108.0.tgz",
+ "integrity": "sha512-G3VUM2a9X1Gu0KnhYsCQlbH/3kHvbMsOH1IbA/XAJPAmpWp4JcXhFzWzW03/aymkoqoA1Vt3p77u9ltmrhgG7g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/npm-run-path": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
- "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
- "dev": true,
+ "node_modules/oci-recovery": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-recovery/-/oci-recovery-2.108.0.tgz",
+ "integrity": "sha512-6OSclD5wagdrJGZtRvJbE1FJq8wl9igGevDMrd1o5rPJoGd/pCmZBn9bvfLPL1Mw9h0YGSAKZhAeMd3pDCNaIQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
"dependencies": {
- "path-key": "^4.0.0"
- },
- "engines": {
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/npm-run-path/node_modules/path-key": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
- "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
- "dev": true,
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "node_modules/oci-redis": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-redis/-/oci-redis-2.108.0.tgz",
+ "integrity": "sha512-MzCORmjESnRs9BkOc3gnrbNaNOwWgZI+tgK2xTVY65PIy4PyYq5qvwgO3wmnLc4sULI4nIoWpoMSDxYyly7Zgg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-resourcemanager": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-resourcemanager/-/oci-resourcemanager-2.108.0.tgz",
+ "integrity": "sha512-IBfQL1K7YaDyvO1UUM2277aH7gejRv6bcAD6G2kv7D/0PamavlDf1PJ1oGv8kQrPCjoALiBNNohelTEltywNOA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-resourcescheduler": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-resourcescheduler/-/oci-resourcescheduler-2.108.0.tgz",
+ "integrity": "sha512-DI2w49VFfzo1y3y4uaqa5sFqqlpZlyQm6qpuhIaCjjDyrvZpbLLAC8Q9dFKq15PpzA7vlKQPPnBFeoW6YAX4pQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-resourcesearch": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-resourcesearch/-/oci-resourcesearch-2.108.0.tgz",
+ "integrity": "sha512-9HCm5fVmZf9ANW02YL3UYn1xGy5b2WMkABmVjosAs2rsMbRPieoOuu0zKK+d2YG2cXXHc1cGfFALQV9rfRSI2w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-rover": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-rover/-/oci-rover-2.108.0.tgz",
+ "integrity": "sha512-uy3oNTMQDaLLy7EUoOljcXsnSKshQof9ESajQOKq4+EXNiFQ9fa5PNTTVl6g10+GS5Mak4KVLTIU7UnMYqwX9A==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-sch": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-sch/-/oci-sch-2.108.0.tgz",
+ "integrity": "sha512-4W+LA2lXN/rKoj8ZRu5HMzFq0De/VLTtUTVY37srgYBs0mp7z+crX4VenA9sIiytYzrY3cijxsDZOe6EBxnMqQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-sdk": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-sdk/-/oci-sdk-2.108.0.tgz",
+ "integrity": "sha512-wc5FXeAGUxBzTbRohdn7zD9328akY6CZ9qZoMzdXNe7dn65flxn1iO/clsw0zc3StRgy+0NGia1ZvsHIgkWzcg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-accessgovernancecp": "2.108.0",
+ "oci-adm": "2.108.0",
+ "oci-aianomalydetection": "2.108.0",
+ "oci-aidocument": "2.108.0",
+ "oci-ailanguage": "2.108.0",
+ "oci-aispeech": "2.108.0",
+ "oci-aivision": "2.108.0",
+ "oci-analytics": "2.108.0",
+ "oci-announcementsservice": "2.108.0",
+ "oci-apigateway": "2.108.0",
+ "oci-apmconfig": "2.108.0",
+ "oci-apmcontrolplane": "2.108.0",
+ "oci-apmsynthetics": "2.108.0",
+ "oci-apmtraces": "2.108.0",
+ "oci-appmgmtcontrol": "2.108.0",
+ "oci-artifacts": "2.108.0",
+ "oci-audit": "2.108.0",
+ "oci-autoscaling": "2.108.0",
+ "oci-bastion": "2.108.0",
+ "oci-bds": "2.108.0",
+ "oci-blockchain": "2.108.0",
+ "oci-budget": "2.108.0",
+ "oci-capacitymanagement": "2.108.0",
+ "oci-certificates": "2.108.0",
+ "oci-certificatesmanagement": "2.108.0",
+ "oci-cims": "2.108.0",
+ "oci-cloudbridge": "2.108.0",
+ "oci-cloudguard": "2.108.0",
+ "oci-cloudmigrations": "2.108.0",
+ "oci-clusterplacementgroups": "2.108.0",
+ "oci-common": "2.108.0",
+ "oci-computecloudatcustomer": "2.108.0",
+ "oci-computeinstanceagent": "2.108.0",
+ "oci-containerengine": "2.108.0",
+ "oci-containerinstances": "2.108.0",
+ "oci-core": "2.108.0",
+ "oci-dashboardservice": "2.108.0",
+ "oci-database": "2.108.0",
+ "oci-databasemanagement": "2.108.0",
+ "oci-databasemigration": "2.108.0",
+ "oci-databasetools": "2.108.0",
+ "oci-datacatalog": "2.108.0",
+ "oci-dataflow": "2.108.0",
+ "oci-dataintegration": "2.108.0",
+ "oci-datalabelingservice": "2.108.0",
+ "oci-datalabelingservicedataplane": "2.108.0",
+ "oci-datasafe": "2.108.0",
+ "oci-datascience": "2.108.0",
+ "oci-dblm": "2.108.0",
+ "oci-delegateaccesscontrol": "2.108.0",
+ "oci-demandsignal": "2.108.0",
+ "oci-desktops": "2.108.0",
+ "oci-devops": "2.108.0",
+ "oci-disasterrecovery": "2.108.0",
+ "oci-dns": "2.108.0",
+ "oci-dts": "2.108.0",
+ "oci-email": "2.108.0",
+ "oci-emaildataplane": "2.108.0",
+ "oci-emwarehouse": "2.108.0",
+ "oci-events": "2.108.0",
+ "oci-filestorage": "2.108.0",
+ "oci-fleetappsmanagement": "2.108.0",
+ "oci-fleetsoftwareupdate": "2.108.0",
+ "oci-functions": "2.108.0",
+ "oci-fusionapps": "2.108.0",
+ "oci-generativeai": "2.108.0",
+ "oci-generativeaiagent": "2.108.0",
+ "oci-generativeaiagentruntime": "2.108.0",
+ "oci-generativeaiinference": "2.108.0",
+ "oci-genericartifactscontent": "2.108.0",
+ "oci-globallydistributeddatabase": "2.108.0",
+ "oci-goldengate": "2.108.0",
+ "oci-governancerulescontrolplane": "2.108.0",
+ "oci-healthchecks": "2.108.0",
+ "oci-identity": "2.108.0",
+ "oci-identitydataplane": "2.108.0",
+ "oci-identitydomains": "2.108.0",
+ "oci-integration": "2.108.0",
+ "oci-jms": "2.108.0",
+ "oci-jmsjavadownloads": "2.108.0",
+ "oci-keymanagement": "2.108.0",
+ "oci-licensemanager": "2.108.0",
+ "oci-limits": "2.108.0",
+ "oci-loadbalancer": "2.108.0",
+ "oci-lockbox": "2.108.0",
+ "oci-loganalytics": "2.108.0",
+ "oci-logging": "2.108.0",
+ "oci-loggingingestion": "2.108.0",
+ "oci-loggingsearch": "2.108.0",
+ "oci-lustrefilestorage": "2.108.0",
+ "oci-managementagent": "2.108.0",
+ "oci-managementdashboard": "2.108.0",
+ "oci-marketplace": "2.108.0",
+ "oci-marketplaceprivateoffer": "2.108.0",
+ "oci-marketplacepublisher": "2.108.0",
+ "oci-mediaservices": "2.108.0",
+ "oci-mngdmac": "2.108.0",
+ "oci-monitoring": "2.108.0",
+ "oci-mysql": "2.108.0",
+ "oci-networkfirewall": "2.108.0",
+ "oci-networkloadbalancer": "2.108.0",
+ "oci-nosql": "2.108.0",
+ "oci-objectstorage": "2.108.0",
+ "oci-oce": "2.108.0",
+ "oci-ocicontrolcenter": "2.108.0",
+ "oci-ocvp": "2.108.0",
+ "oci-oda": "2.108.0",
+ "oci-onesubscription": "2.108.0",
+ "oci-ons": "2.108.0",
+ "oci-opa": "2.108.0",
+ "oci-opensearch": "2.108.0",
+ "oci-operatoraccesscontrol": "2.108.0",
+ "oci-opsi": "2.108.0",
+ "oci-optimizer": "2.108.0",
+ "oci-osmanagement": "2.108.0",
+ "oci-osmanagementhub": "2.108.0",
+ "oci-ospgateway": "2.108.0",
+ "oci-osubbillingschedule": "2.108.0",
+ "oci-osuborganizationsubscription": "2.108.0",
+ "oci-osubsubscription": "2.108.0",
+ "oci-osubusage": "2.108.0",
+ "oci-psql": "2.108.0",
+ "oci-queue": "2.108.0",
+ "oci-recovery": "2.108.0",
+ "oci-redis": "2.108.0",
+ "oci-resourcemanager": "2.108.0",
+ "oci-resourcescheduler": "2.108.0",
+ "oci-resourcesearch": "2.108.0",
+ "oci-rover": "2.108.0",
+ "oci-sch": "2.108.0",
+ "oci-secrets": "2.108.0",
+ "oci-securityattribute": "2.108.0",
+ "oci-servicecatalog": "2.108.0",
+ "oci-servicemanagerproxy": "2.108.0",
+ "oci-servicemesh": "2.108.0",
+ "oci-stackmonitoring": "2.108.0",
+ "oci-streaming": "2.108.0",
+ "oci-tenantmanagercontrolplane": "2.108.0",
+ "oci-threatintelligence": "2.108.0",
+ "oci-usage": "2.108.0",
+ "oci-usageapi": "2.108.0",
+ "oci-vault": "2.108.0",
+ "oci-vbsinst": "2.108.0",
+ "oci-visualbuilder": "2.108.0",
+ "oci-vnmonitoring": "2.108.0",
+ "oci-vulnerabilityscanning": "2.108.0",
+ "oci-waa": "2.108.0",
+ "oci-waas": "2.108.0",
+ "oci-waf": "2.108.0",
+ "oci-workrequests": "2.108.0",
+ "oci-zpr": "2.108.0"
+ }
+ },
+ "node_modules/oci-secrets": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-secrets/-/oci-secrets-2.108.0.tgz",
+ "integrity": "sha512-GFFCuaKnS8pX7mE4mvZn/3m+rlksbheRNBg0e3dADAE9/G8hcRDabfUcp8ee0I2IOGlfmPx1MqqVxGdOB5qePA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-securityattribute": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-securityattribute/-/oci-securityattribute-2.108.0.tgz",
+ "integrity": "sha512-5q7X2iTIFONcQZLMMyuSPEGwv+/H1zp6+A8pizNEKnt/Ky1Y6J7mVt8rIfjkmW2adjCMbJvjOd/FEx1qpPMSdA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-servicecatalog": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-servicecatalog/-/oci-servicecatalog-2.108.0.tgz",
+ "integrity": "sha512-wawMy6pyaaLGb//qDSRZY3RDlBAdcgiH5rT8HWIvjpty5/LUfAFEoc6GT+hXESJJnTgKPv3jVRsauKGaYY0ThQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-servicemanagerproxy": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-servicemanagerproxy/-/oci-servicemanagerproxy-2.108.0.tgz",
+ "integrity": "sha512-ze38V56A7Lj2bmu0zrJJP/p0zJXawdUZO4vzVNKTRCMuCHA/bpNgxhsqrZftrlh/hJHIvzTUorNqKG6db4rvpw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-servicemesh": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-servicemesh/-/oci-servicemesh-2.108.0.tgz",
+ "integrity": "sha512-PKCePlf3UBtmXXqkCLQb3ckhYcMPwUjigKQHJXLomqRsN/WWS4cjaXFfwPms1LHYiljFaUBBpYPEXXuNBIAxrw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-stackmonitoring": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-stackmonitoring/-/oci-stackmonitoring-2.108.0.tgz",
+ "integrity": "sha512-MnWwot6txJhUFjmToZLg/MqxOy9oUcuosOv1ndRt1KJzgHlVqNDKhlYSzsY3M1I/luLKl56MmGUXEmPByTVNsA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
+ },
+ "node_modules/oci-streaming": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-streaming/-/oci-streaming-2.108.0.tgz",
+ "integrity": "sha512-EJflloCRvhKpmbMWLtDKgYQDiinZgIyyAArl0YChUuLXYs7ntXNdK7vkiz/xYtez1j06JSGVDlhoJGnWHnLLOA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/npmlog": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz",
- "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",
+ "node_modules/oci-tenantmanagercontrolplane": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-tenantmanagercontrolplane/-/oci-tenantmanagercontrolplane-2.108.0.tgz",
+ "integrity": "sha512-qOrkZhRI54+dncswCWrzgYNUhC1v/RVrBm/3M34RrZP3XIUYk42FbWEGmAUIf8CsKqAnMihHGZhYmKLF+CnQEQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
"dependencies": {
- "are-we-there-yet": "^2.0.0",
- "console-control-strings": "^1.1.0",
- "gauge": "^3.0.0",
- "set-blocking": "^2.0.0"
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/nwsapi": {
- "version": "2.2.18",
- "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.18.tgz",
- "integrity": "sha512-p1TRH/edngVEHVbwqWnxUViEmq5znDvyB+Sik5cmuLpGOIfDf/39zLiq3swPF8Vakqn+gvNiOQAZu8djYlQILA=="
+ "node_modules/oci-threatintelligence": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-threatintelligence/-/oci-threatintelligence-2.108.0.tgz",
+ "integrity": "sha512-xU9XRZRfTrXN4+UzsPwQbZXmwyU9IY5CpXvsAO/PjdIZJGwl69CGlxSbbLk0ye9qC+0zdADN8fspHp7u++jJ3w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
},
- "node_modules/oauth": {
- "version": "0.10.2",
- "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.10.2.tgz",
- "integrity": "sha512-JtFnB+8nxDEXgNyniwz573xxbKSOu3R8D40xQKqcjwJ2CDkYqUDI53o6IuzDJBx60Z8VKCm271+t8iFjakrl8Q==",
- "license": "MIT"
+ "node_modules/oci-usage": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-usage/-/oci-usage-2.108.0.tgz",
+ "integrity": "sha512-qjP75B0BchoIHc2VCQF8Yehx69/2F/M0UT74GcGjiNewkjxlJwiDCegj+IeVHZ91OCmb1Dqva3u2zUfwxbaqIw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
},
- "node_modules/object-assign": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
- "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
- "engines": {
- "node": ">=0.10.0"
+ "node_modules/oci-usageapi": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-usageapi/-/oci-usageapi-2.108.0.tgz",
+ "integrity": "sha512-hKcssMA1aHia+EM1rD+tGt/njsUn3nYmHJKMzywLHKYnmsbtVVVli8bKlELBFkLVjkIyKPY7XJQfCRr5TPQBHw==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/object-hash": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz",
- "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==",
- "engines": {
- "node": ">= 6"
+ "node_modules/oci-vault": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-vault/-/oci-vault-2.108.0.tgz",
+ "integrity": "sha512-wDq/hibUkif9rYJOhkY6/D9RXhSCsMuaKQeR0WaO6MdYhe7zbo0uXlADn8nPHWJ257CUBoDcpPMWP+mlWyVq9g==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/object-inspect": {
- "version": "1.13.1",
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
- "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
+ "node_modules/oci-vbsinst": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-vbsinst/-/oci-vbsinst-2.108.0.tgz",
+ "integrity": "sha512-ZH6igsrlPrkC6DS9g6c7F6nSAb6/s7NuT11ENc/i2zG2DtsZBOTkr5l8+/mG5AvzMocKRd7NrcHjR4IMxrnhMQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/object-keys": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
- "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
- "dev": true,
- "engines": {
- "node": ">= 0.4"
+ "node_modules/oci-visualbuilder": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-visualbuilder/-/oci-visualbuilder-2.108.0.tgz",
+ "integrity": "sha512-G2oISBuIwvzl6sJV4KwbZX5G5GwkDmKG4JX2jxp/WNTtawsUz/OfpbpPyx+y5raWCUh3Uji5vWMlDVXfhzzzhg==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/object.assign": {
- "version": "4.1.4",
- "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz",
- "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==",
- "dev": true,
+ "node_modules/oci-vnmonitoring": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-vnmonitoring/-/oci-vnmonitoring-2.108.0.tgz",
+ "integrity": "sha512-8oVv+nQddteOdUiqDZGxBJgwkib1NUt6WifsaP3Y+GJEzV42vNHxvjpmJbMuR7TTW4cjBV8mQS2TbTQmPhX/JQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
"dependencies": {
- "call-bind": "^1.0.2",
- "define-properties": "^1.1.4",
- "has-symbols": "^1.0.3",
- "object-keys": "^1.1.1"
- },
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/object.entries": {
- "version": "1.1.7",
- "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz",
- "integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==",
- "dev": true,
+ "node_modules/oci-vulnerabilityscanning": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-vulnerabilityscanning/-/oci-vulnerabilityscanning-2.108.0.tgz",
+ "integrity": "sha512-duvDY4zrDXWdRWWyBGLpQSvfpjYHfNJHyxxMacHu5l0sZM3iKMjx56288PYSTanicknSJ7dKeh/2R5XlOGO35w==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
"dependencies": {
- "call-bind": "^1.0.2",
- "define-properties": "^1.2.0",
- "es-abstract": "^1.22.1"
- },
- "engines": {
- "node": ">= 0.4"
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/object.fromentries": {
- "version": "2.0.7",
- "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz",
- "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==",
- "dev": true,
+ "node_modules/oci-waa": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-waa/-/oci-waa-2.108.0.tgz",
+ "integrity": "sha512-k0yhzlWvM6ry7/eScX/nIB98q6s+yuMP/GUagja/U1AbVGUjLHBjbhi8hbjqtpfuRaUN3luxMS8nrs0t6ZQesQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
"dependencies": {
- "call-bind": "^1.0.2",
- "define-properties": "^1.2.0",
- "es-abstract": "^1.22.1"
- },
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/object.groupby": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz",
- "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==",
- "dev": true,
+ "node_modules/oci-waas": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-waas/-/oci-waas-2.108.0.tgz",
+ "integrity": "sha512-KtjN2JZ7tN5rAZr5viJQs24xRGBWrjP7ZmeHPkdGW+96rHqExlDNfJAcyk0hhJNECSu/g400aPlQ9djfELXPMA==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
"dependencies": {
- "call-bind": "^1.0.2",
- "define-properties": "^1.2.0",
- "es-abstract": "^1.22.1",
- "get-intrinsic": "^1.2.1"
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/object.values": {
- "version": "1.1.7",
- "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz",
- "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==",
- "dev": true,
+ "node_modules/oci-waf": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-waf/-/oci-waf-2.108.0.tgz",
+ "integrity": "sha512-delccqk+FkW2l9e0Bf9SzD6VYojctk8mJx6IasxGl/w3Dc3C9HoBi2l4tfz2sBgBExDDWAMwxUa3ygCX2N3r8Q==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
"dependencies": {
- "call-bind": "^1.0.2",
- "define-properties": "^1.2.0",
- "es-abstract": "^1.22.1"
- },
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
}
},
- "node_modules/obliterator": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz",
- "integrity": "sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ=="
+ "node_modules/oci-workrequests": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-workrequests/-/oci-workrequests-2.108.0.tgz",
+ "integrity": "sha512-vwIM+cEDZ2BhKX+bOH2POTMTnfFnfjs0QxprHb1F05wu5/a3ea35oCkcchyqa1uHh75tqnO/dGDlp6st6+IeIQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
},
- "node_modules/obuf": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz",
- "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==",
- "dev": true
+ "node_modules/oci-zpr": {
+ "version": "2.108.0",
+ "resolved": "https://registry.npmjs.org/oci-zpr/-/oci-zpr-2.108.0.tgz",
+ "integrity": "sha512-Ktxh08Mozp4LJ5ADuDpfnaMZBSJQ04xSvjCod/kf2G3WTQ7OUctvppY1S7X2kCPnEfNORevkE/LPDDpCnZpGgQ==",
+ "license": "(UPL-1.0 OR Apache-2.0)",
+ "dependencies": {
+ "oci-common": "2.108.0",
+ "oci-workrequests": "2.108.0"
+ }
},
"node_modules/octokit-auth-probot": {
"version": "2.0.0",
@@ -20480,6 +22164,15 @@
"node": ">=0.10"
}
},
+ "node_modules/opossum": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/opossum/-/opossum-5.0.1.tgz",
+ "integrity": "sha512-iUDUQmFl3RanaBVLMDTZ6WtXj/Hk84pwJ5JWoJaQd1lXGifdApHhszI3biZvdBDdpTERCmB6x+7+uNvzhzVZIg==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/optionator": {
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz",
@@ -21602,62 +23295,6 @@
"node": ">=18"
}
},
- "node_modules/probot/node_modules/@octokit/core": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz",
- "integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==",
- "license": "MIT",
- "dependencies": {
- "@octokit/auth-token": "^4.0.0",
- "@octokit/graphql": "^7.1.0",
- "@octokit/request": "^8.4.1",
- "@octokit/request-error": "^5.1.1",
- "@octokit/types": "^13.0.0",
- "before-after-hook": "^2.2.0",
- "universal-user-agent": "^6.0.0"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/probot/node_modules/@octokit/core/node_modules/@octokit/types": {
- "version": "13.10.0",
- "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
- "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
- "license": "MIT",
- "dependencies": {
- "@octokit/openapi-types": "^24.2.0"
- }
- },
- "node_modules/probot/node_modules/@octokit/graphql": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz",
- "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==",
- "license": "MIT",
- "dependencies": {
- "@octokit/request": "^8.4.1",
- "@octokit/types": "^13.0.0",
- "universal-user-agent": "^6.0.0"
- },
- "engines": {
- "node": ">= 18"
- }
- },
- "node_modules/probot/node_modules/@octokit/graphql/node_modules/@octokit/types": {
- "version": "13.10.0",
- "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
- "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
- "license": "MIT",
- "dependencies": {
- "@octokit/openapi-types": "^24.2.0"
- }
- },
- "node_modules/probot/node_modules/@octokit/openapi-types": {
- "version": "24.2.0",
- "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
- "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
- "license": "MIT"
- },
"node_modules/probot/node_modules/@octokit/plugin-retry": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.0.1.tgz",
@@ -21690,12 +23327,6 @@
"@octokit/core": "^5.0.0"
}
},
- "node_modules/probot/node_modules/before-after-hook": {
- "version": "2.2.3",
- "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
- "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==",
- "license": "Apache-2.0"
- },
"node_modules/probot/node_modules/commander": {
"version": "12.1.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz",
@@ -24375,6 +26006,43 @@
"node": ">= 0.6"
}
},
+ "node_modules/sshpk": {
+ "version": "1.16.1",
+ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
+ "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
+ "license": "MIT",
+ "dependencies": {
+ "asn1": "~0.2.3",
+ "assert-plus": "^1.0.0",
+ "bcrypt-pbkdf": "^1.0.0",
+ "dashdash": "^1.12.0",
+ "ecc-jsbn": "~0.1.1",
+ "getpass": "^0.1.1",
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.0.2",
+ "tweetnacl": "~0.14.0"
+ },
+ "bin": {
+ "sshpk-conv": "bin/sshpk-conv",
+ "sshpk-sign": "bin/sshpk-sign",
+ "sshpk-verify": "bin/sshpk-verify"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/sshpk/node_modules/jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
+ "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==",
+ "license": "MIT"
+ },
+ "node_modules/sshpk/node_modules/tweetnacl": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+ "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
+ "license": "Unlicense"
+ },
"node_modules/ssri": {
"version": "10.0.6",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.6.tgz",
@@ -27168,6 +28836,12 @@
"node": ">=18"
}
},
+ "node_modules/whatwg-fetch": {
+ "version": "3.6.20",
+ "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz",
+ "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==",
+ "license": "MIT"
+ },
"node_modules/whatwg-mimetype": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz",
@@ -27709,11 +29383,12 @@
}
},
"node_modules/zod-to-json-schema": {
- "version": "3.22.4",
- "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.22.4.tgz",
- "integrity": "sha512-2Ed5dJ+n/O3cU383xSY28cuVi0BCQhF8nYqWU5paEpl7fVdqdAmiLdqLyfblbNdfOFwFfi/mqU4O1pwc60iBhQ==",
+ "version": "3.24.5",
+ "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz",
+ "integrity": "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==",
+ "license": "ISC",
"peerDependencies": {
- "zod": "^3.22.4"
+ "zod": "^3.24.1"
}
}
}
diff --git a/backend/package.json b/backend/package.json
index c19d304418..30aa9f68c3 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -38,8 +38,8 @@
"build:frontend": "npm run build --prefix ../frontend",
"start": "node --enable-source-maps dist/main.mjs",
"type:check": "tsc --noEmit",
- "lint:fix": "eslint --fix --ext js,ts ./src",
- "lint": "eslint 'src/**/*.ts'",
+ "lint:fix": "node --max-old-space-size=8192 ./node_modules/.bin/eslint --fix --ext js,ts ./src",
+ "lint": "node --max-old-space-size=8192 ./node_modules/.bin/eslint 'src/**/*.ts'",
"test:unit": "vitest run -c vitest.unit.config.ts",
"test:e2e": "vitest run -c vitest.e2e.config.ts --bail=1",
"test:e2e-watch": "vitest -c vitest.e2e.config.ts --bail=1",
@@ -152,7 +152,8 @@
"@infisical/quic": "^1.0.8",
"@node-saml/passport-saml": "^5.0.1",
"@octokit/auth-app": "^7.1.1",
- "@octokit/plugin-paginate-graphql": "^5.2.4",
+ "@octokit/core": "^5.2.1",
+ "@octokit/plugin-paginate-graphql": "^4.0.1",
"@octokit/plugin-retry": "^5.0.5",
"@octokit/rest": "^20.0.2",
"@octokit/webhooks-types": "^7.3.1",
@@ -208,6 +209,7 @@
"mysql2": "^3.9.8",
"nanoid": "^3.3.8",
"nodemailer": "^6.9.9",
+ "oci-sdk": "^2.108.0",
"odbc": "^2.4.9",
"openid-client": "^5.6.5",
"ora": "^7.0.1",
@@ -240,6 +242,6 @@
"tweetnacl-util": "^0.15.1",
"uuid": "^9.0.1",
"zod": "^3.22.4",
- "zod-to-json-schema": "^3.22.4"
+ "zod-to-json-schema": "^3.24.5"
}
}
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.ts
index f83555c508..69a7d21292 100644
--- a/backend/src/@types/fastify.d.ts
+++ b/backend/src/@types/fastify.d.ts
@@ -67,6 +67,9 @@ import { TIdentityAzureAuthServiceFactory } from "@app/services/identity-azure-a
import { TIdentityGcpAuthServiceFactory } from "@app/services/identity-gcp-auth/identity-gcp-auth-service";
import { TIdentityJwtAuthServiceFactory } from "@app/services/identity-jwt-auth/identity-jwt-auth-service";
import { TIdentityKubernetesAuthServiceFactory } from "@app/services/identity-kubernetes-auth/identity-kubernetes-auth-service";
+import { TIdentityLdapAuthServiceFactory } from "@app/services/identity-ldap-auth/identity-ldap-auth-service";
+import { TAllowedFields } from "@app/services/identity-ldap-auth/identity-ldap-auth-types";
+import { TIdentityOciAuthServiceFactory } from "@app/services/identity-oci-auth/identity-oci-auth-service";
import { TIdentityOidcAuthServiceFactory } from "@app/services/identity-oidc-auth/identity-oidc-auth-service";
import { TIdentityProjectServiceFactory } from "@app/services/identity-project/identity-project-service";
import { TIdentityTokenAuthServiceFactory } from "@app/services/identity-token-auth/identity-token-auth-service";
@@ -79,6 +82,7 @@ import { TOrgServiceFactory } from "@app/services/org/org-service";
import { TOrgAdminServiceFactory } from "@app/services/org-admin/org-admin-service";
import { TPkiAlertServiceFactory } from "@app/services/pki-alert/pki-alert-service";
import { TPkiCollectionServiceFactory } from "@app/services/pki-collection/pki-collection-service";
+import { TPkiSubscriberServiceFactory } from "@app/services/pki-subscriber/pki-subscriber-service";
import { TProjectServiceFactory } from "@app/services/project/project-service";
import { TProjectBotServiceFactory } from "@app/services/project-bot/project-bot-service";
import { TProjectEnvServiceFactory } from "@app/services/project-env/project-env-service";
@@ -147,6 +151,13 @@ declare module "fastify" {
providerAuthToken: string;
externalProviderAccessToken?: string;
};
+ passportMachineIdentity: {
+ identityId: string;
+ user: {
+ uid: string;
+ mail?: string;
+ };
+ };
kmipUser: {
projectId: string;
clientId: string;
@@ -154,7 +165,9 @@ declare module "fastify" {
};
auditLogInfo: Pick<TCreateAuditLogDTO, "userAgent" | "userAgentType" | "ipAddress" | "actor">;
ssoConfig: Awaited<ReturnType<TSamlConfigServiceFactory["getSaml"]>>;
- ldapConfig: Awaited<ReturnType<TLdapConfigServiceFactory["getLdapCfg"]>>;
+ ldapConfig: Awaited<ReturnType<TLdapConfigServiceFactory["getLdapCfg"]>> & {
+ allowedFields?: TAllowedFields[];
+ };
}
interface FastifyInstance {
@@ -198,8 +211,10 @@ declare module "fastify" {
identityGcpAuth: TIdentityGcpAuthServiceFactory;
identityAwsAuth: TIdentityAwsAuthServiceFactory;
identityAzureAuth: TIdentityAzureAuthServiceFactory;
+ identityOciAuth: TIdentityOciAuthServiceFactory;
identityOidcAuth: TIdentityOidcAuthServiceFactory;
identityJwtAuth: TIdentityJwtAuthServiceFactory;
+ identityLdapAuth: TIdentityLdapAuthServiceFactory;
accessApprovalPolicy: TAccessApprovalPolicyServiceFactory;
accessApprovalRequest: TAccessApprovalRequestServiceFactory;
secretApprovalPolicy: TSecretApprovalPolicyServiceFactory;
@@ -221,6 +236,7 @@ declare module "fastify" {
certificateAuthorityCrl: TCertificateAuthorityCrlServiceFactory;
certificateEst: TCertificateEstServiceFactory;
pkiCollection: TPkiCollectionServiceFactory;
+ pkiSubscriber: TPkiSubscriberServiceFactory;
secretScanning: TSecretScanningServiceFactory;
license: TLicenseServiceFactory;
trustedIp: TTrustedIpServiceFactory;
diff --git a/backend/src/@types/knex.d.ts b/backend/src/@types/knex.d.ts
index 928fddc360..7482794c83 100644
--- a/backend/src/@types/knex.d.ts
+++ b/backend/src/@types/knex.d.ts
@@ -137,6 +137,9 @@ import {
TIdentityMetadata,
TIdentityMetadataInsert,
TIdentityMetadataUpdate,
+ TIdentityOciAuths,
+ TIdentityOciAuthsInsert,
+ TIdentityOciAuthsUpdate,
TIdentityOidcAuths,
TIdentityOidcAuthsInsert,
TIdentityOidcAuthsUpdate,
@@ -227,6 +230,9 @@ import {
TPkiCollections,
TPkiCollectionsInsert,
TPkiCollectionsUpdate,
+ TPkiSubscribers,
+ TPkiSubscribersInsert,
+ TPkiSubscribersUpdate,
TProjectBots,
TProjectBotsInsert,
TProjectBotsUpdate,
@@ -450,6 +456,11 @@ import {
TWorkflowIntegrationsInsert,
TWorkflowIntegrationsUpdate
} from "@app/db/schemas";
+import {
+ TIdentityLdapAuths,
+ TIdentityLdapAuthsInsert,
+ TIdentityLdapAuthsUpdate
+} from "@app/db/schemas/identity-ldap-auths";
import {
TMicrosoftTeamsIntegrations,
TMicrosoftTeamsIntegrationsInsert,
@@ -577,6 +588,11 @@ declare module "knex/types/tables" {
TPkiCollectionItemsInsert,
TPkiCollectionItemsUpdate
>;
+ [TableName.PkiSubscriber]: KnexOriginal.CompositeTableType<
+ TPkiSubscribers,
+ TPkiSubscribersInsert,
+ TPkiSubscribersUpdate
+ >;
[TableName.UserGroupMembership]: KnexOriginal.CompositeTableType<
TUserGroupMembership,
TUserGroupMembershipInsert,
@@ -743,6 +759,11 @@ declare module "knex/types/tables" {
TIdentityAzureAuthsInsert,
TIdentityAzureAuthsUpdate
>;
+ [TableName.IdentityOciAuth]: KnexOriginal.CompositeTableType<
+ TIdentityOciAuths,
+ TIdentityOciAuthsInsert,
+ TIdentityOciAuthsUpdate
+ >;
[TableName.IdentityOidcAuth]: KnexOriginal.CompositeTableType<
TIdentityOidcAuths,
TIdentityOidcAuthsInsert,
@@ -753,6 +774,11 @@ declare module "knex/types/tables" {
TIdentityJwtAuthsInsert,
TIdentityJwtAuthsUpdate
>;
+ [TableName.IdentityLdapAuth]: KnexOriginal.CompositeTableType<
+ TIdentityLdapAuths,
+ TIdentityLdapAuthsInsert,
+ TIdentityLdapAuthsUpdate
+ >;
[TableName.IdentityUaClientSecret]: KnexOriginal.CompositeTableType<
TIdentityUaClientSecrets,
TIdentityUaClientSecretsInsert,
diff --git a/backend/src/db/migrations/20250429232917_store-cert-secret-key-and-chain.ts b/backend/src/db/migrations/20250429232917_store-cert-secret-key-and-chain.ts
new file mode 100644
index 0000000000..f90b2d593d
--- /dev/null
+++ b/backend/src/db/migrations/20250429232917_store-cert-secret-key-and-chain.ts
@@ -0,0 +1,33 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+
+export async function up(knex: Knex): Promise<void> {
+ if (!(await knex.schema.hasColumn(TableName.CertificateBody, "encryptedCertificateChain"))) {
+ await knex.schema.alterTable(TableName.CertificateBody, (t) => {
+ t.binary("encryptedCertificateChain").nullable();
+ });
+ }
+
+ if (!(await knex.schema.hasTable(TableName.CertificateSecret))) {
+ await knex.schema.createTable(TableName.CertificateSecret, (t) => {
+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
+ t.timestamps(true, true, true);
+ t.uuid("certId").notNullable().unique();
+ t.foreign("certId").references("id").inTable(TableName.Certificate).onDelete("CASCADE");
+ t.binary("encryptedPrivateKey").notNullable();
+ });
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ if (await knex.schema.hasTable(TableName.CertificateSecret)) {
+ await knex.schema.dropTable(TableName.CertificateSecret);
+ }
+
+ if (await knex.schema.hasColumn(TableName.CertificateBody, "encryptedCertificateChain")) {
+ await knex.schema.alterTable(TableName.CertificateBody, (t) => {
+ t.dropColumn("encryptedCertificateChain");
+ });
+ }
+}
diff --git a/backend/src/db/migrations/20250501164905_add-groups-to-ssh-host-login-user-mappings.ts b/backend/src/db/migrations/20250501164905_add-groups-to-ssh-host-login-user-mappings.ts
new file mode 100644
index 0000000000..4f08146f9d
--- /dev/null
+++ b/backend/src/db/migrations/20250501164905_add-groups-to-ssh-host-login-user-mappings.ts
@@ -0,0 +1,22 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+
+export async function up(knex: Knex): Promise<void> {
+ if (!(await knex.schema.hasColumn(TableName.SshHostLoginUserMapping, "groupId"))) {
+ await knex.schema.alterTable(TableName.SshHostLoginUserMapping, (t) => {
+ t.uuid("groupId").nullable();
+ t.foreign("groupId").references("id").inTable(TableName.Groups).onDelete("CASCADE");
+ t.unique(["sshHostLoginUserId", "groupId"]);
+ });
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ if (await knex.schema.hasColumn(TableName.SshHostLoginUserMapping, "groupId")) {
+ await knex.schema.alterTable(TableName.SshHostLoginUserMapping, (t) => {
+ t.dropUnique(["sshHostLoginUserId", "groupId"]);
+ t.dropColumn("groupId");
+ });
+ }
+}
diff --git a/backend/src/db/migrations/20250505203703_project-templates-type-col.ts b/backend/src/db/migrations/20250505203703_project-templates-type-col.ts
new file mode 100644
index 0000000000..d1ef14d722
--- /dev/null
+++ b/backend/src/db/migrations/20250505203703_project-templates-type-col.ts
@@ -0,0 +1,22 @@
+import { Knex } from "knex";
+
+import { ProjectType, TableName } from "../schemas";
+
+export async function up(knex: Knex): Promise<void> {
+ if (!(await knex.schema.hasColumn(TableName.ProjectTemplates, "type"))) {
+ await knex.schema.alterTable(TableName.ProjectTemplates, (t) => {
+ // defaulting to sm for migration to set existing, new ones will always be specified on creation
+ t.string("type").defaultTo(ProjectType.SecretManager).notNullable();
+ t.jsonb("environments").nullable().alter();
+ });
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ if (await knex.schema.hasColumn(TableName.ProjectTemplates, "type")) {
+ await knex.schema.alterTable(TableName.ProjectTemplates, (t) => {
+ t.dropColumn("type");
+ // not reverting nullable environments
+ });
+ }
+}
diff --git a/backend/src/db/migrations/20250507003056_identity-ldap-auth.ts b/backend/src/db/migrations/20250507003056_identity-ldap-auth.ts
new file mode 100644
index 0000000000..da99120220
--- /dev/null
+++ b/backend/src/db/migrations/20250507003056_identity-ldap-auth.ts
@@ -0,0 +1,39 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";
+
+export async function up(knex: Knex): Promise<void> {
+ if (!(await knex.schema.hasTable(TableName.IdentityLdapAuth))) {
+ await knex.schema.createTable(TableName.IdentityLdapAuth, (t) => {
+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
+
+ t.bigInteger("accessTokenTTL").defaultTo(7200).notNullable();
+ t.bigInteger("accessTokenMaxTTL").defaultTo(7200).notNullable();
+ t.bigInteger("accessTokenNumUsesLimit").defaultTo(0).notNullable();
+ t.jsonb("accessTokenTrustedIps").notNullable();
+
+ t.uuid("identityId").notNullable().unique();
+ t.foreign("identityId").references("id").inTable(TableName.Identity).onDelete("CASCADE");
+
+ t.binary("encryptedBindDN").notNullable();
+ t.binary("encryptedBindPass").notNullable();
+ t.binary("encryptedLdapCaCertificate").nullable();
+
+ t.string("url").notNullable();
+ t.string("searchBase").notNullable();
+ t.string("searchFilter").notNullable();
+
+ t.jsonb("allowedFields").nullable();
+
+ t.timestamps(true, true, true);
+ });
+ }
+
+ await createOnUpdateTrigger(knex, TableName.IdentityLdapAuth);
+}
+
+export async function down(knex: Knex): Promise<void> {
+ await knex.schema.dropTableIfExists(TableName.IdentityLdapAuth);
+ await dropOnUpdateTrigger(knex, TableName.IdentityLdapAuth);
+}
diff --git a/backend/src/db/migrations/20250508160957_pki-subscriber.ts b/backend/src/db/migrations/20250508160957_pki-subscriber.ts
new file mode 100644
index 0000000000..0e1b50f034
--- /dev/null
+++ b/backend/src/db/migrations/20250508160957_pki-subscriber.ts
@@ -0,0 +1,46 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";
+
+export async function up(knex: Knex): Promise<void> {
+ if (!(await knex.schema.hasTable(TableName.PkiSubscriber))) {
+ await knex.schema.createTable(TableName.PkiSubscriber, (t) => {
+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
+ t.timestamps(true, true, true);
+ t.string("projectId").notNullable();
+ t.foreign("projectId").references("id").inTable(TableName.Project).onDelete("CASCADE");
+ t.uuid("caId").nullable();
+ t.foreign("caId").references("id").inTable(TableName.CertificateAuthority).onDelete("SET NULL");
+ t.string("name").notNullable();
+ t.string("commonName").notNullable();
+ t.specificType("subjectAlternativeNames", "text[]").notNullable();
+ t.string("ttl").notNullable();
+ t.specificType("keyUsages", "text[]").notNullable();
+ t.specificType("extendedKeyUsages", "text[]").notNullable();
+ t.string("status").notNullable(); // active / disabled
+ t.unique(["projectId", "name"]);
+ });
+ await createOnUpdateTrigger(knex, TableName.PkiSubscriber);
+ }
+
+ const hasSubscriberCol = await knex.schema.hasColumn(TableName.Certificate, "pkiSubscriberId");
+ if (!hasSubscriberCol) {
+ await knex.schema.alterTable(TableName.Certificate, (t) => {
+ t.uuid("pkiSubscriberId").nullable();
+ t.foreign("pkiSubscriberId").references("id").inTable(TableName.PkiSubscriber).onDelete("SET NULL");
+ });
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ const hasSubscriberCol = await knex.schema.hasColumn(TableName.Certificate, "pkiSubscriberId");
+ if (hasSubscriberCol) {
+ await knex.schema.alterTable(TableName.Certificate, (t) => {
+ t.dropColumn("pkiSubscriberId");
+ });
+ }
+
+ await knex.schema.dropTableIfExists(TableName.PkiSubscriber);
+ await dropOnUpdateTrigger(knex, TableName.PkiSubscriber);
+}
diff --git a/backend/src/db/migrations/20250508210717_identity-oci-auth.ts b/backend/src/db/migrations/20250508210717_identity-oci-auth.ts
new file mode 100644
index 0000000000..9512807d16
--- /dev/null
+++ b/backend/src/db/migrations/20250508210717_identity-oci-auth.ts
@@ -0,0 +1,30 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";
+
+export async function up(knex: Knex): Promise<void> {
+ if (!(await knex.schema.hasTable(TableName.IdentityOciAuth))) {
+ await knex.schema.createTable(TableName.IdentityOciAuth, (t) => {
+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
+ t.bigInteger("accessTokenTTL").defaultTo(7200).notNullable();
+ t.bigInteger("accessTokenMaxTTL").defaultTo(7200).notNullable();
+ t.bigInteger("accessTokenNumUsesLimit").defaultTo(0).notNullable();
+ t.jsonb("accessTokenTrustedIps").notNullable();
+ t.timestamps(true, true, true);
+ t.uuid("identityId").notNullable().unique();
+ t.foreign("identityId").references("id").inTable(TableName.Identity).onDelete("CASCADE");
+ t.string("type").notNullable();
+
+ t.string("tenancyOcid").notNullable();
+ t.string("allowedUsernames").nullable();
+ });
+ }
+
+ await createOnUpdateTrigger(knex, TableName.IdentityOciAuth);
+}
+
+export async function down(knex: Knex): Promise<void> {
+ await knex.schema.dropTableIfExists(TableName.IdentityOciAuth);
+ await dropOnUpdateTrigger(knex, TableName.IdentityOciAuth);
+}
diff --git a/backend/src/db/migrations/20250512103022_identity-kubernetes-auth-gateway.ts b/backend/src/db/migrations/20250512103022_identity-kubernetes-auth-gateway.ts
new file mode 100644
index 0000000000..fcd9bfc3e9
--- /dev/null
+++ b/backend/src/db/migrations/20250512103022_identity-kubernetes-auth-gateway.ts
@@ -0,0 +1,25 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+
+export async function up(knex: Knex): Promise<void> {
+ const hasGatewayIdColumn = await knex.schema.hasColumn(TableName.IdentityKubernetesAuth, "gatewayId");
+
+ if (!hasGatewayIdColumn) {
+ await knex.schema.alterTable(TableName.IdentityKubernetesAuth, (table) => {
+ table.uuid("gatewayId").nullable();
+ table.foreign("gatewayId").references("id").inTable(TableName.Gateway).onDelete("SET NULL");
+ });
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ const hasGatewayIdColumn = await knex.schema.hasColumn(TableName.IdentityKubernetesAuth, "gatewayId");
+
+ if (hasGatewayIdColumn) {
+ await knex.schema.alterTable(TableName.IdentityKubernetesAuth, (table) => {
+ table.dropForeign("gatewayId");
+ table.dropColumn("gatewayId");
+ });
+ }
+}
diff --git a/backend/src/db/migrations/20250513081738_remove-gateway-project-link.ts b/backend/src/db/migrations/20250513081738_remove-gateway-project-link.ts
new file mode 100644
index 0000000000..3b3c5322ec
--- /dev/null
+++ b/backend/src/db/migrations/20250513081738_remove-gateway-project-link.ts
@@ -0,0 +1,110 @@
+import { Knex } from "knex";
+
+import { inMemoryKeyStore } from "@app/keystore/memory";
+import { selectAllTableCols } from "@app/lib/knex";
+import { initLogger } from "@app/lib/logger";
+import { KmsDataKey } from "@app/services/kms/kms-types";
+
+import { TableName } from "../schemas";
+import { getMigrationEnvConfig } from "./utils/env-config";
+import { getMigrationEncryptionServices } from "./utils/services";
+
+// Note(daniel): We aren't dropping tables or columns in this migrations so we can easily rollback if needed.
+// In the future we need to drop the projectGatewayId on the dynamic secrets table, and drop the project_gateways table entirely.
+
+const BATCH_SIZE = 500;
+
+export async function up(knex: Knex): Promise<void> {
+ // eslint-disable-next-line no-param-reassign
+ knex.replicaNode = () => {
+ return knex;
+ };
+
+ if (!(await knex.schema.hasColumn(TableName.DynamicSecret, "gatewayId"))) {
+ await knex.schema.alterTable(TableName.DynamicSecret, (table) => {
+ table.uuid("gatewayId").nullable();
+ table.foreign("gatewayId").references("id").inTable(TableName.Gateway).onDelete("SET NULL");
+
+ table.index("gatewayId");
+ });
+
+ const existingDynamicSecretsWithProjectGatewayId = await knex(TableName.DynamicSecret)
+ .select(selectAllTableCols(TableName.DynamicSecret))
+ .whereNotNull(`${TableName.DynamicSecret}.projectGatewayId`)
+ .join(TableName.ProjectGateway, `${TableName.ProjectGateway}.id`, `${TableName.DynamicSecret}.projectGatewayId`)
+ .whereNotNull(`${TableName.ProjectGateway}.gatewayId`)
+ .select(
+ knex.ref("projectId").withSchema(TableName.ProjectGateway).as("projectId"),
+ knex.ref("gatewayId").withSchema(TableName.ProjectGateway).as("projectGatewayGatewayId")
+ );
+
+ initLogger();
+ const envConfig = getMigrationEnvConfig();
+ const keyStore = inMemoryKeyStore();
+ const { kmsService } = await getMigrationEncryptionServices({ envConfig, keyStore, db: knex });
+
+ const updatedDynamicSecrets = await Promise.all(
+ existingDynamicSecretsWithProjectGatewayId.map(async (existingDynamicSecret) => {
+ if (!existingDynamicSecret.projectGatewayGatewayId) {
+ const result = {
+ ...existingDynamicSecret,
+ gatewayId: null
+ };
+
+ const { projectId, projectGatewayGatewayId, ...rest } = result;
+ return rest;
+ }
+
+ const { decryptor: secretManagerDecryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId: existingDynamicSecret.projectId
+ });
+ const { encryptor: secretManagerEncryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId: existingDynamicSecret.projectId
+ });
+
+ let decryptedStoredInput = JSON.parse(
+ secretManagerDecryptor({ cipherTextBlob: Buffer.from(existingDynamicSecret.encryptedInput) }).toString()
+ ) as object;
+
+ // We're not removing the existing projectGatewayId from the input so we can easily rollback without having to re-encrypt the input
+ decryptedStoredInput = {
+ ...decryptedStoredInput,
+ gatewayId: existingDynamicSecret.projectGatewayGatewayId
+ };
+
+ const encryptedInput = secretManagerEncryptor({
+ plainText: Buffer.from(JSON.stringify(decryptedStoredInput))
+ }).cipherTextBlob;
+
+ const result = {
+ ...existingDynamicSecret,
+ encryptedInput,
+ gatewayId: existingDynamicSecret.projectGatewayGatewayId
+ };
+
+ const { projectId, projectGatewayGatewayId, ...rest } = result;
+ return rest;
+ })
+ );
+
+ for (let i = 0; i < updatedDynamicSecrets.length; i += BATCH_SIZE) {
+ // eslint-disable-next-line no-await-in-loop
+ await knex(TableName.DynamicSecret)
+ .insert(updatedDynamicSecrets.slice(i, i + BATCH_SIZE))
+ .onConflict("id")
+ .merge();
+ }
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ // no re-encryption needed as we keep the old projectGatewayId in the input
+ if (await knex.schema.hasColumn(TableName.DynamicSecret, "gatewayId")) {
+ await knex.schema.alterTable(TableName.DynamicSecret, (table) => {
+ table.dropForeign("gatewayId");
+ table.dropColumn("gatewayId");
+ });
+ }
+}
diff --git a/backend/src/db/migrations/20250515164622_select-org-products.ts b/backend/src/db/migrations/20250515164622_select-org-products.ts
new file mode 100644
index 0000000000..c290a4ee2f
--- /dev/null
+++ b/backend/src/db/migrations/20250515164622_select-org-products.ts
@@ -0,0 +1,53 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+
+export async function up(knex: Knex): Promise<void> {
+ const columns = await knex.table(TableName.Organization).columnInfo();
+
+ await knex.schema.alterTable(TableName.Organization, (t) => {
+ if (!columns.secretsProductEnabled) {
+ t.boolean("secretsProductEnabled").defaultTo(true);
+ }
+ if (!columns.pkiProductEnabled) {
+ t.boolean("pkiProductEnabled").defaultTo(true);
+ }
+ if (!columns.kmsProductEnabled) {
+ t.boolean("kmsProductEnabled").defaultTo(true);
+ }
+ if (!columns.sshProductEnabled) {
+ t.boolean("sshProductEnabled").defaultTo(true);
+ }
+ if (!columns.scannerProductEnabled) {
+ t.boolean("scannerProductEnabled").defaultTo(true);
+ }
+ if (!columns.shareSecretsProductEnabled) {
+ t.boolean("shareSecretsProductEnabled").defaultTo(true);
+ }
+ });
+}
+
+export async function down(knex: Knex): Promise<void> {
+ const columns = await knex.table(TableName.Organization).columnInfo();
+
+ await knex.schema.alterTable(TableName.Organization, (t) => {
+ if (columns.secretsProductEnabled) {
+ t.dropColumn("secretsProductEnabled");
+ }
+ if (columns.pkiProductEnabled) {
+ t.dropColumn("pkiProductEnabled");
+ }
+ if (columns.kmsProductEnabled) {
+ t.dropColumn("kmsProductEnabled");
+ }
+ if (columns.sshProductEnabled) {
+ t.dropColumn("sshProductEnabled");
+ }
+ if (columns.scannerProductEnabled) {
+ t.dropColumn("scannerProductEnabled");
+ }
+ if (columns.shareSecretsProductEnabled) {
+ t.dropColumn("shareSecretsProductEnabled");
+ }
+ });
+}
diff --git a/backend/src/db/migrations/20250516021501_toggle-secret-sharing-on-project.ts b/backend/src/db/migrations/20250516021501_toggle-secret-sharing-on-project.ts
new file mode 100644
index 0000000000..2600ae0f0c
--- /dev/null
+++ b/backend/src/db/migrations/20250516021501_toggle-secret-sharing-on-project.ts
@@ -0,0 +1,21 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+
+export async function up(knex: Knex): Promise<void> {
+ const hasSecretSharingColumn = await knex.schema.hasColumn(TableName.Project, "secretSharing");
+ if (!hasSecretSharingColumn) {
+ await knex.schema.table(TableName.Project, (table) => {
+ table.boolean("secretSharing").notNullable().defaultTo(true);
+ });
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ const hasSecretSharingColumn = await knex.schema.hasColumn(TableName.Project, "secretSharing");
+ if (hasSecretSharingColumn) {
+ await knex.schema.table(TableName.Project, (table) => {
+ table.dropColumn("secretSharing");
+ });
+ }
+}
diff --git a/backend/src/db/migrations/20250516192508_secret-sharing-limits-for-org.ts b/backend/src/db/migrations/20250516192508_secret-sharing-limits-for-org.ts
new file mode 100644
index 0000000000..f68c1c29bb
--- /dev/null
+++ b/backend/src/db/migrations/20250516192508_secret-sharing-limits-for-org.ts
@@ -0,0 +1,35 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+
+export async function up(knex: Knex): Promise<void> {
+ const hasLifetimeColumn = await knex.schema.hasColumn(TableName.Organization, "maxSharedSecretLifetime");
+ const hasViewLimitColumn = await knex.schema.hasColumn(TableName.Organization, "maxSharedSecretViewLimit");
+
+ if (!hasLifetimeColumn || !hasViewLimitColumn) {
+ await knex.schema.alterTable(TableName.Organization, (t) => {
+ if (!hasLifetimeColumn) {
+ t.integer("maxSharedSecretLifetime").nullable().defaultTo(2592000); // 30 days in seconds
+ }
+ if (!hasViewLimitColumn) {
+ t.integer("maxSharedSecretViewLimit").nullable();
+ }
+ });
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ const hasLifetimeColumn = await knex.schema.hasColumn(TableName.Organization, "maxSharedSecretLifetime");
+ const hasViewLimitColumn = await knex.schema.hasColumn(TableName.Organization, "maxSharedSecretViewLimit");
+
+ if (hasLifetimeColumn || hasViewLimitColumn) {
+ await knex.schema.alterTable(TableName.Organization, (t) => {
+ if (hasLifetimeColumn) {
+ t.dropColumn("maxSharedSecretLifetime");
+ }
+ if (hasViewLimitColumn) {
+ t.dropColumn("maxSharedSecretViewLimit");
+ }
+ });
+ }
+}
diff --git a/backend/src/db/migrations/20250517002223_secret-share-to-specific-emails.ts b/backend/src/db/migrations/20250517002223_secret-share-to-specific-emails.ts
new file mode 100644
index 0000000000..6a02ae4ebd
--- /dev/null
+++ b/backend/src/db/migrations/20250517002223_secret-share-to-specific-emails.ts
@@ -0,0 +1,43 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+
+export async function up(knex: Knex): Promise<void> {
+ if (await knex.schema.hasTable(TableName.SecretSharing)) {
+ const hasEncryptedSalt = await knex.schema.hasColumn(TableName.SecretSharing, "encryptedSalt");
+ const hasAuthorizedEmails = await knex.schema.hasColumn(TableName.SecretSharing, "authorizedEmails");
+
+ if (!hasEncryptedSalt || !hasAuthorizedEmails) {
+ await knex.schema.alterTable(TableName.SecretSharing, (t) => {
+ // These two columns are only needed when secrets are shared with a specific list of emails
+
+ if (!hasEncryptedSalt) {
+ t.binary("encryptedSalt").nullable();
+ }
+
+ if (!hasAuthorizedEmails) {
+ t.json("authorizedEmails").nullable();
+ }
+ });
+ }
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ if (await knex.schema.hasTable(TableName.SecretSharing)) {
+ const hasEncryptedSalt = await knex.schema.hasColumn(TableName.SecretSharing, "encryptedSalt");
+ const hasAuthorizedEmails = await knex.schema.hasColumn(TableName.SecretSharing, "authorizedEmails");
+
+ if (hasEncryptedSalt || hasAuthorizedEmails) {
+ await knex.schema.alterTable(TableName.SecretSharing, (t) => {
+ if (hasEncryptedSalt) {
+ t.dropColumn("encryptedSalt");
+ }
+
+ if (hasAuthorizedEmails) {
+ t.dropColumn("authorizedEmails");
+ }
+ });
+ }
+ }
+}
diff --git a/backend/src/db/schemas/certificate-bodies.ts b/backend/src/db/schemas/certificate-bodies.ts
index 75afbddbdb..10171e3837 100644
--- a/backend/src/db/schemas/certificate-bodies.ts
+++ b/backend/src/db/schemas/certificate-bodies.ts
@@ -14,7 +14,8 @@ export const CertificateBodiesSchema = z.object({
createdAt: z.date(),
updatedAt: z.date(),
certId: z.string().uuid(),
- encryptedCertificate: zodBuffer
+ encryptedCertificate: zodBuffer,
+ encryptedCertificateChain: zodBuffer.nullable().optional()
});
export type TCertificateBodies = z.infer<typeof CertificateBodiesSchema>;
diff --git a/backend/src/db/schemas/certificate-secrets.ts b/backend/src/db/schemas/certificate-secrets.ts
index f8cad74f14..75e6377b29 100644
--- a/backend/src/db/schemas/certificate-secrets.ts
+++ b/backend/src/db/schemas/certificate-secrets.ts
@@ -5,6 +5,8 @@
import { z } from "zod";
+import { zodBuffer } from "@app/lib/zod";
+
import { TImmutableDBKeys } from "./models";
export const CertificateSecretsSchema = z.object({
@@ -12,8 +14,7 @@ export const CertificateSecretsSchema = z.object({
createdAt: z.date(),
updatedAt: z.date(),
certId: z.string().uuid(),
- pk: z.string(),
- sk: z.string()
+ encryptedPrivateKey: zodBuffer
});
export type TCertificateSecrets = z.infer<typeof CertificateSecretsSchema>;
diff --git a/backend/src/db/schemas/certificates.ts b/backend/src/db/schemas/certificates.ts
index 533f9b898d..cbd4f64f9c 100644
--- a/backend/src/db/schemas/certificates.ts
+++ b/backend/src/db/schemas/certificates.ts
@@ -24,7 +24,8 @@ export const CertificatesSchema = z.object({
caCertId: z.string().uuid(),
certificateTemplateId: z.string().uuid().nullable().optional(),
keyUsages: z.string().array().nullable().optional(),
- extendedKeyUsages: z.string().array().nullable().optional()
+ extendedKeyUsages: z.string().array().nullable().optional(),
+ pkiSubscriberId: z.string().uuid().nullable().optional()
});
export type TCertificates = z.infer<typeof CertificatesSchema>;
diff --git a/backend/src/db/schemas/dynamic-secrets.ts b/backend/src/db/schemas/dynamic-secrets.ts
index 913a6d4755..350a32b7a5 100644
--- a/backend/src/db/schemas/dynamic-secrets.ts
+++ b/backend/src/db/schemas/dynamic-secrets.ts
@@ -27,7 +27,8 @@ export const DynamicSecretsSchema = z.object({
createdAt: z.date(),
updatedAt: z.date(),
encryptedInput: zodBuffer,
- projectGatewayId: z.string().uuid().nullable().optional()
+ projectGatewayId: z.string().uuid().nullable().optional(),
+ gatewayId: z.string().uuid().nullable().optional()
});
export type TDynamicSecrets = z.infer<typeof DynamicSecretsSchema>;
diff --git a/backend/src/db/schemas/identity-kubernetes-auths.ts b/backend/src/db/schemas/identity-kubernetes-auths.ts
index 448cec386f..3c9dd400c1 100644
--- a/backend/src/db/schemas/identity-kubernetes-auths.ts
+++ b/backend/src/db/schemas/identity-kubernetes-auths.ts
@@ -29,7 +29,8 @@ export const IdentityKubernetesAuthsSchema = z.object({
allowedNames: z.string(),
allowedAudience: z.string(),
encryptedKubernetesTokenReviewerJwt: zodBuffer.nullable().optional(),
- encryptedKubernetesCaCertificate: zodBuffer.nullable().optional()
+ encryptedKubernetesCaCertificate: zodBuffer.nullable().optional(),
+ gatewayId: z.string().uuid().nullable().optional()
});
export type TIdentityKubernetesAuths = z.infer<typeof IdentityKubernetesAuthsSchema>;
diff --git a/backend/src/db/schemas/identity-ldap-auths.ts b/backend/src/db/schemas/identity-ldap-auths.ts
new file mode 100644
index 0000000000..d5b15fc6a5
--- /dev/null
+++ b/backend/src/db/schemas/identity-ldap-auths.ts
@@ -0,0 +1,32 @@
+// 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 { zodBuffer } from "@app/lib/zod";
+
+import { TImmutableDBKeys } from "./models";
+
+export const IdentityLdapAuthsSchema = z.object({
+ id: z.string().uuid(),
+ accessTokenTTL: z.coerce.number().default(7200),
+ accessTokenMaxTTL: z.coerce.number().default(7200),
+ accessTokenNumUsesLimit: z.coerce.number().default(0),
+ accessTokenTrustedIps: z.unknown(),
+ identityId: z.string().uuid(),
+ encryptedBindDN: zodBuffer,
+ encryptedBindPass: zodBuffer,
+ encryptedLdapCaCertificate: zodBuffer.nullable().optional(),
+ url: z.string(),
+ searchBase: z.string(),
+ searchFilter: z.string(),
+ allowedFields: z.unknown().nullable().optional(),
+ createdAt: z.date(),
+ updatedAt: z.date()
+});
+
+export type TIdentityLdapAuths = z.infer<typeof IdentityLdapAuthsSchema>;
+export type TIdentityLdapAuthsInsert = Omit<z.input<typeof IdentityLdapAuthsSchema>, TImmutableDBKeys>;
+export type TIdentityLdapAuthsUpdate = Partial<Omit<z.input<typeof IdentityLdapAuthsSchema>, TImmutableDBKeys>>;
diff --git a/backend/src/db/schemas/identity-oci-auths.ts b/backend/src/db/schemas/identity-oci-auths.ts
new file mode 100644
index 0000000000..e0be86b78a
--- /dev/null
+++ b/backend/src/db/schemas/identity-oci-auths.ts
@@ -0,0 +1,26 @@
+// 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 IdentityOciAuthsSchema = z.object({
+ id: z.string().uuid(),
+ accessTokenTTL: z.coerce.number().default(7200),
+ accessTokenMaxTTL: z.coerce.number().default(7200),
+ accessTokenNumUsesLimit: z.coerce.number().default(0),
+ accessTokenTrustedIps: z.unknown(),
+ createdAt: z.date(),
+ updatedAt: z.date(),
+ identityId: z.string().uuid(),
+ type: z.string(),
+ tenancyOcid: z.string(),
+ allowedUsernames: z.string().nullable().optional()
+});
+
+export type TIdentityOciAuths = z.infer<typeof IdentityOciAuthsSchema>;
+export type TIdentityOciAuthsInsert = Omit<z.input<typeof IdentityOciAuthsSchema>, TImmutableDBKeys>;
+export type TIdentityOciAuthsUpdate = Partial<Omit<z.input<typeof IdentityOciAuthsSchema>, TImmutableDBKeys>>;
diff --git a/backend/src/db/schemas/index.ts b/backend/src/db/schemas/index.ts
index 5755697cc5..ea22fb9fe3 100644
--- a/backend/src/db/schemas/index.ts
+++ b/backend/src/db/schemas/index.ts
@@ -43,6 +43,7 @@ export * from "./identity-gcp-auths";
export * from "./identity-jwt-auths";
export * from "./identity-kubernetes-auths";
export * from "./identity-metadata";
+export * from "./identity-oci-auths";
export * from "./identity-oidc-auths";
export * from "./identity-org-memberships";
export * from "./identity-project-additional-privilege";
@@ -75,6 +76,7 @@ export * from "./organizations";
export * from "./pki-alerts";
export * from "./pki-collection-items";
export * from "./pki-collections";
+export * from "./pki-subscribers";
export * from "./project-bots";
export * from "./project-environments";
export * from "./project-gateways";
diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.ts
index 47c5cad540..dd8578cd9f 100644
--- a/backend/src/db/schemas/models.ts
+++ b/backend/src/db/schemas/models.ts
@@ -21,6 +21,7 @@ export enum TableName {
CertificateBody = "certificate_bodies",
CertificateSecret = "certificate_secrets",
CertificateTemplate = "certificate_templates",
+ PkiSubscriber = "pki_subscribers",
PkiAlert = "pki_alerts",
PkiCollection = "pki_collections",
PkiCollectionItem = "pki_collection_items",
@@ -78,8 +79,10 @@ export enum TableName {
IdentityAzureAuth = "identity_azure_auths",
IdentityUaClientSecret = "identity_ua_client_secrets",
IdentityAwsAuth = "identity_aws_auths",
+ IdentityOciAuth = "identity_oci_auths",
IdentityOidcAuth = "identity_oidc_auths",
IdentityJwtAuth = "identity_jwt_auths",
+ IdentityLdapAuth = "identity_ldap_auths",
IdentityOrgMembership = "identity_org_memberships",
IdentityProjectMembership = "identity_project_memberships",
IdentityProjectMembershipRole = "identity_project_membership_role",
@@ -191,11 +194,16 @@ export enum OrgMembershipStatus {
}
export enum ProjectMembershipRole {
+ // general
Admin = "admin",
Member = "member",
Custom = "custom",
Viewer = "viewer",
- NoAccess = "no-access"
+ NoAccess = "no-access",
+ // ssh
+ SshHostBootstrapper = "ssh-host-bootstrapper",
+ // kms
+ KmsCryptographicOperator = "cryptographic-operator"
}
export enum SecretEncryptionAlgo {
@@ -232,8 +240,10 @@ export enum IdentityAuthMethod {
GCP_AUTH = "gcp-auth",
AWS_AUTH = "aws-auth",
AZURE_AUTH = "azure-auth",
+ OCI_AUTH = "oci-auth",
OIDC_AUTH = "oidc-auth",
- JWT_AUTH = "jwt-auth"
+ JWT_AUTH = "jwt-auth",
+ LDAP_AUTH = "ldap-auth"
}
export enum ProjectType {
diff --git a/backend/src/db/schemas/organizations.ts b/backend/src/db/schemas/organizations.ts
index 8d8279802d..fb07287079 100644
--- a/backend/src/db/schemas/organizations.ts
+++ b/backend/src/db/schemas/organizations.ts
@@ -28,7 +28,15 @@ export const OrganizationsSchema = z.object({
privilegeUpgradeInitiatedByUsername: z.string().nullable().optional(),
privilegeUpgradeInitiatedAt: z.date().nullable().optional(),
bypassOrgAuthEnabled: z.boolean().default(false),
- userTokenExpiration: z.string().nullable().optional()
+ userTokenExpiration: z.string().nullable().optional(),
+ secretsProductEnabled: z.boolean().default(true).nullable().optional(),
+ pkiProductEnabled: z.boolean().default(true).nullable().optional(),
+ kmsProductEnabled: z.boolean().default(true).nullable().optional(),
+ sshProductEnabled: z.boolean().default(true).nullable().optional(),
+ scannerProductEnabled: z.boolean().default(true).nullable().optional(),
+ shareSecretsProductEnabled: z.boolean().default(true).nullable().optional(),
+ maxSharedSecretLifetime: z.number().default(2592000).nullable().optional(),
+ maxSharedSecretViewLimit: z.number().nullable().optional()
});
export type TOrganizations = z.infer<typeof OrganizationsSchema>;
diff --git a/backend/src/db/schemas/pki-subscribers.ts b/backend/src/db/schemas/pki-subscribers.ts
new file mode 100644
index 0000000000..08db198062
--- /dev/null
+++ b/backend/src/db/schemas/pki-subscribers.ts
@@ -0,0 +1,27 @@
+// 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 PkiSubscribersSchema = z.object({
+ id: z.string().uuid(),
+ createdAt: z.date(),
+ updatedAt: z.date(),
+ projectId: z.string(),
+ caId: z.string().uuid().nullable().optional(),
+ name: z.string(),
+ commonName: z.string(),
+ subjectAlternativeNames: z.string().array(),
+ ttl: z.string(),
+ keyUsages: z.string().array(),
+ extendedKeyUsages: z.string().array(),
+ status: z.string()
+});
+
+export type TPkiSubscribers = z.infer<typeof PkiSubscribersSchema>;
+export type TPkiSubscribersInsert = Omit<z.input<typeof PkiSubscribersSchema>, TImmutableDBKeys>;
+export type TPkiSubscribersUpdate = Partial<Omit<z.input<typeof PkiSubscribersSchema>, TImmutableDBKeys>>;
diff --git a/backend/src/db/schemas/project-templates.ts b/backend/src/db/schemas/project-templates.ts
index 68f37d256d..f12386165a 100644
--- a/backend/src/db/schemas/project-templates.ts
+++ b/backend/src/db/schemas/project-templates.ts
@@ -12,10 +12,11 @@ export const ProjectTemplatesSchema = z.object({
name: z.string(),
description: z.string().nullable().optional(),
roles: z.unknown(),
- environments: z.unknown(),
+ environments: z.unknown().nullable().optional(),
orgId: z.string().uuid(),
createdAt: z.date(),
- updatedAt: z.date()
+ updatedAt: z.date(),
+ type: z.string().default("secret-manager")
});
export type TProjectTemplates = z.infer<typeof ProjectTemplatesSchema>;
diff --git a/backend/src/db/schemas/projects.ts b/backend/src/db/schemas/projects.ts
index 2403d6cf49..c1e96e8ced 100644
--- a/backend/src/db/schemas/projects.ts
+++ b/backend/src/db/schemas/projects.ts
@@ -27,7 +27,8 @@ export const ProjectsSchema = z.object({
description: z.string().nullable().optional(),
type: z.string(),
enforceCapitalization: z.boolean().default(false),
- hasDeleteProtection: z.boolean().default(true).nullable().optional()
+ hasDeleteProtection: z.boolean().default(false).nullable().optional(),
+ secretSharing: z.boolean().default(true)
});
export type TProjects = z.infer<typeof ProjectsSchema>;
diff --git a/backend/src/db/schemas/secret-sharing.ts b/backend/src/db/schemas/secret-sharing.ts
index 24ea266772..7de34708c5 100644
--- a/backend/src/db/schemas/secret-sharing.ts
+++ b/backend/src/db/schemas/secret-sharing.ts
@@ -27,7 +27,9 @@ export const SecretSharingSchema = z.object({
password: z.string().nullable().optional(),
encryptedSecret: zodBuffer.nullable().optional(),
identifier: z.string().nullable().optional(),
- type: z.string().default("share")
+ type: z.string().default("share"),
+ encryptedSalt: zodBuffer.nullable().optional(),
+ authorizedEmails: z.unknown().nullable().optional()
});
export type TSecretSharing = z.infer<typeof SecretSharingSchema>;
diff --git a/backend/src/db/schemas/ssh-host-login-user-mappings.ts b/backend/src/db/schemas/ssh-host-login-user-mappings.ts
index 6edb0d5a37..fd5fa460cd 100644
--- a/backend/src/db/schemas/ssh-host-login-user-mappings.ts
+++ b/backend/src/db/schemas/ssh-host-login-user-mappings.ts
@@ -12,7 +12,8 @@ export const SshHostLoginUserMappingsSchema = z.object({
createdAt: z.date(),
updatedAt: z.date(),
sshHostLoginUserId: z.string().uuid(),
- userId: z.string().uuid().nullable().optional()
+ userId: z.string().uuid().nullable().optional(),
+ groupId: z.string().uuid().nullable().optional()
});
export type TSshHostLoginUserMappings = z.infer<typeof SshHostLoginUserMappingsSchema>;
diff --git a/backend/src/ee/routes/v1/access-approval-request-router.ts b/backend/src/ee/routes/v1/access-approval-request-router.ts
index 8a7ccfdeff..b0914d5c45 100644
--- a/backend/src/ee/routes/v1/access-approval-request-router.ts
+++ b/backend/src/ee/routes/v1/access-approval-request-router.ts
@@ -2,6 +2,7 @@ import { z } from "zod";
import { AccessApprovalRequestsReviewersSchema, AccessApprovalRequestsSchema, UsersSchema } from "@app/db/schemas";
import { ApprovalStatus } from "@app/ee/services/access-approval-request/access-approval-request-types";
+import { writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -18,6 +19,9 @@ export const registerAccessApprovalRequestRouter = async (server: FastifyZodProv
server.route({
url: "/",
method: "POST",
+ config: {
+ rateLimit: writeLimit
+ },
schema: {
body: z.object({
permissions: z.any().array(),
diff --git a/backend/src/ee/routes/v1/gateway-router.ts b/backend/src/ee/routes/v1/gateway-router.ts
index c916e229eb..40e9c15801 100644
--- a/backend/src/ee/routes/v1/gateway-router.ts
+++ b/backend/src/ee/routes/v1/gateway-router.ts
@@ -121,14 +121,7 @@ export const registerGatewayRouter = async (server: FastifyZodProvider) => {
identity: z.object({
name: z.string(),
id: z.string()
- }),
- projects: z
- .object({
- name: z.string(),
- id: z.string(),
- slug: z.string()
- })
- .array()
+ })
}).array()
})
}
@@ -158,17 +151,15 @@ export const registerGatewayRouter = async (server: FastifyZodProvider) => {
identity: z.object({
name: z.string(),
id: z.string()
- }),
- projectGatewayId: z.string()
+ })
}).array()
})
}
},
onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.JWT]),
handler: async (req) => {
- const gateways = await server.services.gateway.getProjectGateways({
- projectId: req.params.projectId,
- projectPermission: req.permission
+ const gateways = await server.services.gateway.listGateways({
+ orgPermission: req.permission
});
return { gateways };
}
@@ -216,8 +207,7 @@ export const registerGatewayRouter = async (server: FastifyZodProvider) => {
id: z.string()
}),
body: z.object({
- name: slugSchema({ field: "name" }).optional(),
- projectIds: z.string().array().optional()
+ name: slugSchema({ field: "name" }).optional()
}),
response: {
200: z.object({
@@ -230,8 +220,7 @@ export const registerGatewayRouter = async (server: FastifyZodProvider) => {
const gateway = await server.services.gateway.updateGatewayById({
orgPermission: req.permission,
id: req.params.id,
- name: req.body.name,
- projectIds: req.body.projectIds
+ name: req.body.name
});
return { gateway };
}
diff --git a/backend/src/ee/routes/v1/ldap-router.ts b/backend/src/ee/routes/v1/ldap-router.ts
index 5f80ad02b8..57c5736df5 100644
--- a/backend/src/ee/routes/v1/ldap-router.ts
+++ b/backend/src/ee/routes/v1/ldap-router.ts
@@ -98,6 +98,9 @@ export const registerLdapRouter = async (server: FastifyZodProvider) => {
server.route({
url: "/login",
method: "POST",
+ config: {
+ rateLimit: writeLimit
+ },
schema: {
body: z.object({
organizationSlug: z.string().trim()
diff --git a/backend/src/ee/routes/v1/project-template-router.ts b/backend/src/ee/routes/v1/project-template-router.ts
index 08d16414b9..5d33b4d58f 100644
--- a/backend/src/ee/routes/v1/project-template-router.ts
+++ b/backend/src/ee/routes/v1/project-template-router.ts
@@ -1,9 +1,8 @@
import { z } from "zod";
-import { ProjectMembershipRole, ProjectTemplatesSchema } from "@app/db/schemas";
+import { ProjectMembershipRole, ProjectTemplatesSchema, ProjectType } from "@app/db/schemas";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ProjectPermissionV2Schema } from "@app/ee/services/permission/project-permission";
-import { ProjectTemplateDefaultEnvironments } from "@app/ee/services/project-template/project-template-constants";
import { isInfisicalProjectTemplate } from "@app/ee/services/project-template/project-template-fns";
import { ApiDocsTags, ProjectTemplates } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -35,6 +34,7 @@ const SanitizedProjectTemplateSchema = ProjectTemplatesSchema.extend({
position: z.number().min(1)
})
.array()
+ .nullable()
});
const ProjectTemplateRolesSchema = z
@@ -104,6 +104,9 @@ export const registerProjectTemplateRouter = async (server: FastifyZodProvider)
hide: false,
tags: [ApiDocsTags.ProjectTemplates],
description: "List project templates for the current organization.",
+ querystring: z.object({
+ type: z.nativeEnum(ProjectType).optional().describe(ProjectTemplates.LIST.type)
+ }),
response: {
200: z.object({
projectTemplates: SanitizedProjectTemplateSchema.array()
@@ -112,7 +115,8 @@ export const registerProjectTemplateRouter = async (server: FastifyZodProvider)
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
- const projectTemplates = await server.services.projectTemplate.listProjectTemplatesByOrg(req.permission);
+ const { type } = req.query;
+ const projectTemplates = await server.services.projectTemplate.listProjectTemplatesByOrg(req.permission, type);
const auditTemplates = projectTemplates.filter((template) => !isInfisicalProjectTemplate(template.name));
@@ -184,6 +188,7 @@ export const registerProjectTemplateRouter = async (server: FastifyZodProvider)
tags: [ApiDocsTags.ProjectTemplates],
description: "Create a project template.",
body: z.object({
+ type: z.nativeEnum(ProjectType).describe(ProjectTemplates.CREATE.type),
name: slugSchema({ field: "name" })
.refine((val) => !isInfisicalProjectTemplate(val), {
message: `The requested project template name is reserved.`
@@ -191,9 +196,7 @@ export const registerProjectTemplateRouter = async (server: FastifyZodProvider)
.describe(ProjectTemplates.CREATE.name),
description: z.string().max(256).trim().optional().describe(ProjectTemplates.CREATE.description),
roles: ProjectTemplateRolesSchema.default([]).describe(ProjectTemplates.CREATE.roles),
- environments: ProjectTemplateEnvironmentsSchema.default(ProjectTemplateDefaultEnvironments).describe(
- ProjectTemplates.CREATE.environments
- )
+ environments: ProjectTemplateEnvironmentsSchema.describe(ProjectTemplates.CREATE.environments).optional()
}),
response: {
200: z.object({
diff --git a/backend/src/ee/routes/v1/saml-router.ts b/backend/src/ee/routes/v1/saml-router.ts
index f2df2fb896..8648ade7c3 100644
--- a/backend/src/ee/routes/v1/saml-router.ts
+++ b/backend/src/ee/routes/v1/saml-router.ts
@@ -166,6 +166,9 @@ export const registerSamlRouter = async (server: FastifyZodProvider) => {
server.route({
url: "/redirect/saml2/organizations/:orgSlug",
method: "GET",
+ config: {
+ rateLimit: readLimit
+ },
schema: {
params: z.object({
orgSlug: z.string().trim()
@@ -192,6 +195,9 @@ export const registerSamlRouter = async (server: FastifyZodProvider) => {
server.route({
url: "/redirect/saml2/:samlConfigId",
method: "GET",
+ config: {
+ rateLimit: readLimit
+ },
schema: {
params: z.object({
samlConfigId: z.string().trim()
@@ -218,6 +224,9 @@ export const registerSamlRouter = async (server: FastifyZodProvider) => {
server.route({
url: "/saml2/:samlConfigId",
method: "POST",
+ config: {
+ rateLimit: writeLimit
+ },
schema: {
params: z.object({
samlConfigId: z.string().trim()
diff --git a/backend/src/ee/routes/v1/scim-router.ts b/backend/src/ee/routes/v1/scim-router.ts
index cd5f2f9f38..5fa0d19e82 100644
--- a/backend/src/ee/routes/v1/scim-router.ts
+++ b/backend/src/ee/routes/v1/scim-router.ts
@@ -196,6 +196,9 @@ export const registerScimRouter = async (server: FastifyZodProvider) => {
server.route({
url: "/Users",
method: "POST",
+ config: {
+ rateLimit: writeLimit
+ },
schema: {
body: z.object({
schemas: z.array(z.string()),
diff --git a/backend/src/ee/routes/v1/secret-scanning-router.ts b/backend/src/ee/routes/v1/secret-scanning-router.ts
index f144a6c006..1bc8e3998b 100644
--- a/backend/src/ee/routes/v1/secret-scanning-router.ts
+++ b/backend/src/ee/routes/v1/secret-scanning-router.ts
@@ -1,11 +1,11 @@
import { z } from "zod";
import { GitAppOrgSchema, SecretScanningGitRisksSchema } from "@app/db/schemas";
+import { canUseSecretScanning } from "@app/ee/services/secret-scanning/secret-scanning-fns";
import {
SecretScanningResolvedStatus,
SecretScanningRiskStatus
} from "@app/ee/services/secret-scanning/secret-scanning-types";
-import { getConfig } from "@app/lib/config/env";
import { BadRequestError } from "@app/lib/errors";
import { OrderByDirection } from "@app/lib/types";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -23,14 +23,14 @@ export const registerSecretScanningRouter = async (server: FastifyZodProvider) =
body: z.object({ organizationId: z.string().trim() }),
response: {
200: z.object({
- sessionId: z.string()
+ sessionId: z.string(),
+ gitAppSlug: z.string()
})
}
},
onRequest: verifyAuth([AuthMode.JWT]),
handler: async (req) => {
- const appCfg = getConfig();
- if (!appCfg.SECRET_SCANNING_ORG_WHITELIST?.includes(req.auth.orgId)) {
+ if (!canUseSecretScanning(req.auth.orgId)) {
throw new BadRequestError({
message: "Secret scanning is temporarily unavailable."
});
diff --git a/backend/src/ee/routes/v1/ssh-certificate-template-router.ts b/backend/src/ee/routes/v1/ssh-certificate-template-router.ts
index e44693643e..26e8cad3b6 100644
--- a/backend/src/ee/routes/v1/ssh-certificate-template-router.ts
+++ b/backend/src/ee/routes/v1/ssh-certificate-template-router.ts
@@ -97,7 +97,7 @@ export const registerSshCertificateTemplateRouter = async (server: FastifyZodPro
allowCustomKeyIds: z.boolean().describe(SSH_CERTIFICATE_TEMPLATES.CREATE.allowCustomKeyIds)
})
.refine((data) => ms(data.maxTTL) >= ms(data.ttl), {
- message: "Max TLL must be greater than or equal to TTL",
+ message: "Max TTL must be greater than or equal to TTL",
path: ["maxTTL"]
}),
response: {
diff --git a/backend/src/ee/routes/v1/ssh-host-router.ts b/backend/src/ee/routes/v1/ssh-host-router.ts
index 93748c27f0..4c749f6f58 100644
--- a/backend/src/ee/routes/v1/ssh-host-router.ts
+++ b/backend/src/ee/routes/v1/ssh-host-router.ts
@@ -73,7 +73,7 @@ export const registerSshHostRouter = async (server: FastifyZodProvider) => {
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
- const host = await server.services.sshHost.getSshHost({
+ const host = await server.services.sshHost.getSshHostById({
sshHostId: req.params.sshHostId,
actor: req.permission.type,
actorId: req.permission.id,
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 6bd4d26073..1b8b725a67 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -19,9 +19,10 @@ import { TProjectPermission } from "@app/lib/types";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { TCreateAppConnectionDTO, TUpdateAppConnectionDTO } from "@app/services/app-connection/app-connection-types";
import { ActorType } from "@app/services/auth/auth-type";
-import { CertKeyAlgorithm } from "@app/services/certificate/certificate-types";
+import { CertExtendedKeyUsage, CertKeyAlgorithm, CertKeyUsage } from "@app/services/certificate/certificate-types";
import { CaStatus } from "@app/services/certificate-authority/certificate-authority-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
+import { TAllowedFields } from "@app/services/identity-ldap-auth/identity-ldap-auth-types";
import { PkiItemType } from "@app/services/pki-collection/pki-collection-types";
import { SecretSync, SecretSyncImportBehavior } from "@app/services/secret-sync/secret-sync-enums";
import {
@@ -119,44 +120,66 @@ export enum EventType {
CREATE_TOKEN_IDENTITY_TOKEN_AUTH = "create-token-identity-token-auth",
UPDATE_TOKEN_IDENTITY_TOKEN_AUTH = "update-token-identity-token-auth",
GET_TOKENS_IDENTITY_TOKEN_AUTH = "get-tokens-identity-token-auth",
+
ADD_IDENTITY_TOKEN_AUTH = "add-identity-token-auth",
UPDATE_IDENTITY_TOKEN_AUTH = "update-identity-token-auth",
GET_IDENTITY_TOKEN_AUTH = "get-identity-token-auth",
REVOKE_IDENTITY_TOKEN_AUTH = "revoke-identity-token-auth",
+
LOGIN_IDENTITY_KUBERNETES_AUTH = "login-identity-kubernetes-auth",
ADD_IDENTITY_KUBERNETES_AUTH = "add-identity-kubernetes-auth",
UPDATE_IDENTITY_KUBENETES_AUTH = "update-identity-kubernetes-auth",
GET_IDENTITY_KUBERNETES_AUTH = "get-identity-kubernetes-auth",
REVOKE_IDENTITY_KUBERNETES_AUTH = "revoke-identity-kubernetes-auth",
+
LOGIN_IDENTITY_OIDC_AUTH = "login-identity-oidc-auth",
ADD_IDENTITY_OIDC_AUTH = "add-identity-oidc-auth",
UPDATE_IDENTITY_OIDC_AUTH = "update-identity-oidc-auth",
GET_IDENTITY_OIDC_AUTH = "get-identity-oidc-auth",
REVOKE_IDENTITY_OIDC_AUTH = "revoke-identity-oidc-auth",
+
LOGIN_IDENTITY_JWT_AUTH = "login-identity-jwt-auth",
ADD_IDENTITY_JWT_AUTH = "add-identity-jwt-auth",
UPDATE_IDENTITY_JWT_AUTH = "update-identity-jwt-auth",
GET_IDENTITY_JWT_AUTH = "get-identity-jwt-auth",
REVOKE_IDENTITY_JWT_AUTH = "revoke-identity-jwt-auth",
+
CREATE_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRET = "create-identity-universal-auth-client-secret",
REVOKE_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRET = "revoke-identity-universal-auth-client-secret",
+
GET_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRETS = "get-identity-universal-auth-client-secret",
GET_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRET_BY_ID = "get-identity-universal-auth-client-secret-by-id",
+
LOGIN_IDENTITY_GCP_AUTH = "login-identity-gcp-auth",
ADD_IDENTITY_GCP_AUTH = "add-identity-gcp-auth",
UPDATE_IDENTITY_GCP_AUTH = "update-identity-gcp-auth",
REVOKE_IDENTITY_GCP_AUTH = "revoke-identity-gcp-auth",
GET_IDENTITY_GCP_AUTH = "get-identity-gcp-auth",
+
LOGIN_IDENTITY_AWS_AUTH = "login-identity-aws-auth",
ADD_IDENTITY_AWS_AUTH = "add-identity-aws-auth",
UPDATE_IDENTITY_AWS_AUTH = "update-identity-aws-auth",
REVOKE_IDENTITY_AWS_AUTH = "revoke-identity-aws-auth",
GET_IDENTITY_AWS_AUTH = "get-identity-aws-auth",
+
+ LOGIN_IDENTITY_OCI_AUTH = "login-identity-oci-auth",
+ ADD_IDENTITY_OCI_AUTH = "add-identity-oci-auth",
+ UPDATE_IDENTITY_OCI_AUTH = "update-identity-oci-auth",
+ REVOKE_IDENTITY_OCI_AUTH = "revoke-identity-oci-auth",
+ GET_IDENTITY_OCI_AUTH = "get-identity-oci-auth",
+
LOGIN_IDENTITY_AZURE_AUTH = "login-identity-azure-auth",
ADD_IDENTITY_AZURE_AUTH = "add-identity-azure-auth",
UPDATE_IDENTITY_AZURE_AUTH = "update-identity-azure-auth",
GET_IDENTITY_AZURE_AUTH = "get-identity-azure-auth",
REVOKE_IDENTITY_AZURE_AUTH = "revoke-identity-azure-auth",
+
+ LOGIN_IDENTITY_LDAP_AUTH = "login-identity-ldap-auth",
+ ADD_IDENTITY_LDAP_AUTH = "add-identity-ldap-auth",
+ UPDATE_IDENTITY_LDAP_AUTH = "update-identity-ldap-auth",
+ GET_IDENTITY_LDAP_AUTH = "get-identity-ldap-auth",
+ REVOKE_IDENTITY_LDAP_AUTH = "revoke-identity-ldap-auth",
+
CREATE_ENVIRONMENT = "create-environment",
UPDATE_ENVIRONMENT = "update-environment",
DELETE_ENVIRONMENT = "delete-environment",
@@ -224,6 +247,8 @@ export enum EventType {
DELETE_CERT = "delete-cert",
REVOKE_CERT = "revoke-cert",
GET_CERT_BODY = "get-cert-body",
+ GET_CERT_PRIVATE_KEY = "get-cert-private-key",
+ GET_CERT_BUNDLE = "get-cert-bundle",
CREATE_PKI_ALERT = "create-pki-alert",
GET_PKI_ALERT = "get-pki-alert",
UPDATE_PKI_ALERT = "update-pki-alert",
@@ -235,6 +260,13 @@ export enum EventType {
GET_PKI_COLLECTION_ITEMS = "get-pki-collection-items",
ADD_PKI_COLLECTION_ITEM = "add-pki-collection-item",
DELETE_PKI_COLLECTION_ITEM = "delete-pki-collection-item",
+ CREATE_PKI_SUBSCRIBER = "create-pki-subscriber",
+ UPDATE_PKI_SUBSCRIBER = "update-pki-subscriber",
+ DELETE_PKI_SUBSCRIBER = "delete-pki-subscriber",
+ GET_PKI_SUBSCRIBER = "get-pki-subscriber",
+ ISSUE_PKI_SUBSCRIBER_CERT = "issue-pki-subscriber-cert",
+ SIGN_PKI_SUBSCRIBER_CERT = "sign-pki-subscriber-cert",
+ LIST_PKI_SUBSCRIBER_CERTS = "list-pki-subscriber-certs",
CREATE_KMS = "create-kms",
UPDATE_KMS = "update-kms",
DELETE_KMS = "delete-kms",
@@ -991,6 +1023,55 @@ interface GetIdentityAwsAuthEvent {
};
}
+interface LoginIdentityOciAuthEvent {
+ type: EventType.LOGIN_IDENTITY_OCI_AUTH;
+ metadata: {
+ identityId: string;
+ identityOciAuthId: string;
+ identityAccessTokenId: string;
+ };
+}
+
+interface AddIdentityOciAuthEvent {
+ type: EventType.ADD_IDENTITY_OCI_AUTH;
+ metadata: {
+ identityId: string;
+ tenancyOcid: string;
+ allowedUsernames: string | null;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: Array<TIdentityTrustedIp>;
+ };
+}
+
+interface DeleteIdentityOciAuthEvent {
+ type: EventType.REVOKE_IDENTITY_OCI_AUTH;
+ metadata: {
+ identityId: string;
+ };
+}
+
+interface UpdateIdentityOciAuthEvent {
+ type: EventType.UPDATE_IDENTITY_OCI_AUTH;
+ metadata: {
+ identityId: string;
+ tenancyOcid?: string;
+ allowedUsernames: string | null;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: Array<TIdentityTrustedIp>;
+ };
+}
+
+interface GetIdentityOciAuthEvent {
+ type: EventType.GET_IDENTITY_OCI_AUTH;
+ metadata: {
+ identityId: string;
+ };
+}
+
interface LoginIdentityAzureAuthEvent {
type: EventType.LOGIN_IDENTITY_AZURE_AUTH;
metadata: {
@@ -1040,6 +1121,55 @@ interface GetIdentityAzureAuthEvent {
};
}
+interface LoginIdentityLdapAuthEvent {
+ type: EventType.LOGIN_IDENTITY_LDAP_AUTH;
+ metadata: {
+ identityId: string;
+ ldapUsername: string;
+ ldapEmail?: string;
+ };
+}
+
+interface AddIdentityLdapAuthEvent {
+ type: EventType.ADD_IDENTITY_LDAP_AUTH;
+ metadata: {
+ identityId: string;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: Array<TIdentityTrustedIp>;
+ allowedFields?: TAllowedFields[];
+ url: string;
+ };
+}
+
+interface UpdateIdentityLdapAuthEvent {
+ type: EventType.UPDATE_IDENTITY_LDAP_AUTH;
+ metadata: {
+ identityId: string;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: Array<TIdentityTrustedIp>;
+ allowedFields?: TAllowedFields[];
+ url?: string;
+ };
+}
+
+interface GetIdentityLdapAuthEvent {
+ type: EventType.GET_IDENTITY_LDAP_AUTH;
+ metadata: {
+ identityId: string;
+ };
+}
+
+interface RevokeIdentityLdapAuthEvent {
+ type: EventType.REVOKE_IDENTITY_LDAP_AUTH;
+ metadata: {
+ identityId: string;
+ };
+}
+
interface LoginIdentityOidcAuthEvent {
type: EventType.LOGIN_IDENTITY_OIDC_AUTH;
metadata: {
@@ -1798,6 +1928,24 @@ interface GetCertBody {
};
}
+interface GetCertPrivateKey {
+ type: EventType.GET_CERT_PRIVATE_KEY;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
+interface GetCertBundle {
+ type: EventType.GET_CERT_BUNDLE;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
interface CreatePkiAlert {
type: EventType.CREATE_PKI_ALERT;
metadata: {
@@ -1887,6 +2035,77 @@ interface DeletePkiCollectionItem {
};
}
+interface CreatePkiSubscriber {
+ type: EventType.CREATE_PKI_SUBSCRIBER;
+ metadata: {
+ pkiSubscriberId: string;
+ caId?: string;
+ name: string;
+ commonName: string;
+ ttl: string;
+ subjectAlternativeNames: string[];
+ keyUsages: CertKeyUsage[];
+ extendedKeyUsages: CertExtendedKeyUsage[];
+ };
+}
+
+interface UpdatePkiSubscriber {
+ type: EventType.UPDATE_PKI_SUBSCRIBER;
+ metadata: {
+ pkiSubscriberId: string;
+ caId?: string;
+ name?: string;
+ commonName?: string;
+ ttl?: string;
+ subjectAlternativeNames?: string[];
+ keyUsages?: CertKeyUsage[];
+ extendedKeyUsages?: CertExtendedKeyUsage[];
+ };
+}
+
+interface DeletePkiSubscriber {
+ type: EventType.DELETE_PKI_SUBSCRIBER;
+ metadata: {
+ pkiSubscriberId: string;
+ name: string;
+ };
+}
+
+interface GetPkiSubscriber {
+ type: EventType.GET_PKI_SUBSCRIBER;
+ metadata: {
+ pkiSubscriberId: string;
+ name: string;
+ };
+}
+
+interface IssuePkiSubscriberCert {
+ type: EventType.ISSUE_PKI_SUBSCRIBER_CERT;
+ metadata: {
+ subscriberId: string;
+ name: string;
+ serialNumber: string;
+ };
+}
+
+interface SignPkiSubscriberCert {
+ type: EventType.SIGN_PKI_SUBSCRIBER_CERT;
+ metadata: {
+ subscriberId: string;
+ name: string;
+ serialNumber: string;
+ };
+}
+
+interface ListPkiSubscriberCerts {
+ type: EventType.LIST_PKI_SUBSCRIBER_CERTS;
+ metadata: {
+ subscriberId: string;
+ name: string;
+ projectId: string;
+ };
+}
+
interface CreateKmsEvent {
type: EventType.CREATE_KMS;
metadata: {
@@ -2823,6 +3042,11 @@ export type Event =
| UpdateIdentityAwsAuthEvent
| GetIdentityAwsAuthEvent
| DeleteIdentityAwsAuthEvent
+ | LoginIdentityOciAuthEvent
+ | AddIdentityOciAuthEvent
+ | UpdateIdentityOciAuthEvent
+ | GetIdentityOciAuthEvent
+ | DeleteIdentityOciAuthEvent
| LoginIdentityAzureAuthEvent
| AddIdentityAzureAuthEvent
| DeleteIdentityAzureAuthEvent
@@ -2838,6 +3062,11 @@ export type Event =
| UpdateIdentityJwtAuthEvent
| GetIdentityJwtAuthEvent
| DeleteIdentityJwtAuthEvent
+ | LoginIdentityLdapAuthEvent
+ | AddIdentityLdapAuthEvent
+ | UpdateIdentityLdapAuthEvent
+ | GetIdentityLdapAuthEvent
+ | RevokeIdentityLdapAuthEvent
| CreateEnvironmentEvent
| GetEnvironmentEvent
| UpdateEnvironmentEvent
@@ -2897,6 +3126,8 @@ export type Event =
| DeleteCert
| RevokeCert
| GetCertBody
+ | GetCertPrivateKey
+ | GetCertBundle
| CreatePkiAlert
| GetPkiAlert
| UpdatePkiAlert
@@ -2908,6 +3139,13 @@ export type Event =
| GetPkiCollectionItems
| AddPkiCollectionItem
| DeletePkiCollectionItem
+ | CreatePkiSubscriber
+ | UpdatePkiSubscriber
+ | DeletePkiSubscriber
+ | GetPkiSubscriber
+ | IssuePkiSubscriberCert
+ | SignPkiSubscriberCert
+ | ListPkiSubscriberCerts
| CreateKmsEvent
| UpdateKmsEvent
| DeleteKmsEvent
diff --git a/backend/src/ee/services/dynamic-secret/dynamic-secret-fns.ts b/backend/src/ee/services/dynamic-secret/dynamic-secret-fns.ts
index 05d4922401..f653d0c0cd 100644
--- a/backend/src/ee/services/dynamic-secret/dynamic-secret-fns.ts
+++ b/backend/src/ee/services/dynamic-secret/dynamic-secret-fns.ts
@@ -24,8 +24,16 @@ export const verifyHostInputValidity = async (host: string, isGateway = false) =
if (net.isIPv4(el)) {
exclusiveIps.push(el);
} else {
- const resolvedIps = await dns.resolve4(el);
- exclusiveIps.push(...resolvedIps);
+ try {
+ const resolvedIps = await dns.resolve4(el);
+ exclusiveIps.push(...resolvedIps);
+ } catch (error) {
+ // only try lookup if not found
+ if ((error as { code: string })?.code !== "ENOTFOUND") throw error;
+
+ const resolvedIps = (await dns.lookup(el, { all: true, family: 4 })).map(({ address }) => address);
+ exclusiveIps.push(...resolvedIps);
+ }
}
}
}
@@ -38,8 +46,16 @@ export const verifyHostInputValidity = async (host: string, isGateway = false) =
if (normalizedHost === "localhost" || normalizedHost === "host.docker.internal") {
throw new BadRequestError({ message: "Invalid db host" });
}
- const resolvedIps = await dns.resolve4(host);
- inputHostIps.push(...resolvedIps);
+ try {
+ const resolvedIps = await dns.resolve4(host);
+ inputHostIps.push(...resolvedIps);
+ } catch (error) {
+ // only try lookup if not found
+ if ((error as { code: string })?.code !== "ENOTFOUND") throw error;
+
+ const resolvedIps = (await dns.lookup(host, { all: true, family: 4 })).map(({ address }) => address);
+ inputHostIps.push(...resolvedIps);
+ }
}
if (!isGateway && !(appCfg.DYNAMIC_SECRET_ALLOW_INTERNAL_IP || appCfg.ALLOW_INTERNAL_IP_CONNECTIONS)) {
diff --git a/backend/src/ee/services/dynamic-secret/dynamic-secret-service.ts b/backend/src/ee/services/dynamic-secret/dynamic-secret-service.ts
index 44c18b0015..c39f07b5ca 100644
--- a/backend/src/ee/services/dynamic-secret/dynamic-secret-service.ts
+++ b/backend/src/ee/services/dynamic-secret/dynamic-secret-service.ts
@@ -17,7 +17,8 @@ import { TSecretFolderDALFactory } from "@app/services/secret-folder/secret-fold
import { TDynamicSecretLeaseDALFactory } from "../dynamic-secret-lease/dynamic-secret-lease-dal";
import { TDynamicSecretLeaseQueueServiceFactory } from "../dynamic-secret-lease/dynamic-secret-lease-queue";
-import { TProjectGatewayDALFactory } from "../gateway/project-gateway-dal";
+import { TGatewayDALFactory } from "../gateway/gateway-dal";
+import { OrgPermissionGatewayActions, OrgPermissionSubjects } from "../permission/org-permission";
import { TDynamicSecretDALFactory } from "./dynamic-secret-dal";
import {
DynamicSecretStatus,
@@ -44,9 +45,9 @@ type TDynamicSecretServiceFactoryDep = {
licenseService: Pick<TLicenseServiceFactory, "getPlan">;
folderDAL: Pick<TSecretFolderDALFactory, "findBySecretPath" | "findBySecretPathMultiEnv">;
projectDAL: Pick<TProjectDALFactory, "findProjectBySlug">;
- permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
+ permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getOrgPermission">;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
- projectGatewayDAL: Pick<TProjectGatewayDALFactory, "findOne">;
+ gatewayDAL: Pick<TGatewayDALFactory, "findOne" | "find">;
resourceMetadataDAL: Pick<TResourceMetadataDALFactory, "insertMany" | "delete">;
};
@@ -62,7 +63,7 @@ export const dynamicSecretServiceFactory = ({
dynamicSecretQueueService,
projectDAL,
kmsService,
- projectGatewayDAL,
+ gatewayDAL,
resourceMetadataDAL
}: TDynamicSecretServiceFactoryDep) => {
const create = async ({
@@ -117,15 +118,31 @@ export const dynamicSecretServiceFactory = ({
const inputs = await selectedProvider.validateProviderInputs(provider.inputs);
let selectedGatewayId: string | null = null;
- if (inputs && typeof inputs === "object" && "projectGatewayId" in inputs && inputs.projectGatewayId) {
- const projectGatewayId = inputs.projectGatewayId as string;
+ if (inputs && typeof inputs === "object" && "gatewayId" in inputs && inputs.gatewayId) {
+ const gatewayId = inputs.gatewayId as string;
- const projectGateway = await projectGatewayDAL.findOne({ id: projectGatewayId, projectId });
- if (!projectGateway)
+ const [gateway] = await gatewayDAL.find({ id: gatewayId, orgId: actorOrgId });
+
+ if (!gateway) {
throw new NotFoundError({
- message: `Project gateway with ${projectGatewayId} not found`
+ message: `Gateway with ID ${gatewayId} not found`
});
- selectedGatewayId = projectGateway.id;
+ }
+
+ const { permission: orgPermission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ gateway.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
+ ForbiddenError.from(orgPermission).throwUnlessCan(
+ OrgPermissionGatewayActions.AttachGateways,
+ OrgPermissionSubjects.Gateway
+ );
+
+ selectedGatewayId = gateway.id;
}
const isConnected = await selectedProvider.validateConnection(provider.inputs);
@@ -146,7 +163,7 @@ export const dynamicSecretServiceFactory = ({
defaultTTL,
folderId: folder.id,
name,
- projectGatewayId: selectedGatewayId
+ gatewayId: selectedGatewayId
},
tx
);
@@ -255,20 +272,30 @@ export const dynamicSecretServiceFactory = ({
const updatedInput = await selectedProvider.validateProviderInputs(newInput);
let selectedGatewayId: string | null = null;
- if (
- updatedInput &&
- typeof updatedInput === "object" &&
- "projectGatewayId" in updatedInput &&
- updatedInput?.projectGatewayId
- ) {
- const projectGatewayId = updatedInput.projectGatewayId as string;
-
- const projectGateway = await projectGatewayDAL.findOne({ id: projectGatewayId, projectId });
- if (!projectGateway)
+ if (updatedInput && typeof updatedInput === "object" && "gatewayId" in updatedInput && updatedInput?.gatewayId) {
+ const gatewayId = updatedInput.gatewayId as string;
+
+ const [gateway] = await gatewayDAL.find({ id: gatewayId, orgId: actorOrgId });
+ if (!gateway) {
throw new NotFoundError({
- message: `Project gateway with ${projectGatewayId} not found`
+ message: `Gateway with ID ${gatewayId} not found`
});
- selectedGatewayId = projectGateway.id;
+ }
+
+ const { permission: orgPermission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ gateway.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
+ ForbiddenError.from(orgPermission).throwUnlessCan(
+ OrgPermissionGatewayActions.AttachGateways,
+ OrgPermissionSubjects.Gateway
+ );
+
+ selectedGatewayId = gateway.id;
}
const isConnected = await selectedProvider.validateConnection(newInput);
@@ -284,7 +311,7 @@ export const dynamicSecretServiceFactory = ({
defaultTTL,
name: newName ?? name,
status: null,
- projectGatewayId: selectedGatewayId
+ gatewayId: selectedGatewayId
},
tx
);
diff --git a/backend/src/ee/services/dynamic-secret/providers/index.ts b/backend/src/ee/services/dynamic-secret/providers/index.ts
index faa671980f..737aaadea8 100644
--- a/backend/src/ee/services/dynamic-secret/providers/index.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/index.ts
@@ -18,7 +18,7 @@ import { SqlDatabaseProvider } from "./sql-database";
import { TotpProvider } from "./totp";
type TBuildDynamicSecretProviderDTO = {
- gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTls">;
+ gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">;
};
export const buildDynamicSecretProviders = ({
diff --git a/backend/src/ee/services/dynamic-secret/providers/models.ts b/backend/src/ee/services/dynamic-secret/providers/models.ts
index 449f6d8f62..0c6eaf1515 100644
--- a/backend/src/ee/services/dynamic-secret/providers/models.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/models.ts
@@ -137,7 +137,7 @@ export const DynamicSecretSqlDBSchema = z.object({
revocationStatement: z.string().trim(),
renewStatement: z.string().trim().optional(),
ca: z.string().optional(),
- projectGatewayId: z.string().nullable().optional()
+ gatewayId: z.string().nullable().optional()
});
export const DynamicSecretCassandraSchema = z.object({
diff --git a/backend/src/ee/services/dynamic-secret/providers/sql-database.ts b/backend/src/ee/services/dynamic-secret/providers/sql-database.ts
index 178ca4ef9d..3ae85ed7b7 100644
--- a/backend/src/ee/services/dynamic-secret/providers/sql-database.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/sql-database.ts
@@ -112,14 +112,14 @@ const generateUsername = (provider: SqlProviders) => {
};
type TSqlDatabaseProviderDTO = {
- gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTls">;
+ gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">;
};
export const SqlDatabaseProvider = ({ gatewayService }: TSqlDatabaseProviderDTO): TDynamicProviderFns => {
const validateProviderInputs = async (inputs: unknown) => {
const providerInputs = await DynamicSecretSqlDBSchema.parseAsync(inputs);
- const [hostIp] = await verifyHostInputValidity(providerInputs.host, Boolean(providerInputs.projectGatewayId));
+ const [hostIp] = await verifyHostInputValidity(providerInputs.host, Boolean(providerInputs.gatewayId));
validateHandlebarTemplate("SQL creation", providerInputs.creationStatement, {
allowedExpressions: (val) => ["username", "password", "expiration", "database"].includes(val)
});
@@ -168,7 +168,7 @@ export const SqlDatabaseProvider = ({ gatewayService }: TSqlDatabaseProviderDTO)
providerInputs: z.infer<typeof DynamicSecretSqlDBSchema>,
gatewayCallback: (host: string, port: number) => Promise<void>
) => {
- const relayDetails = await gatewayService.fnGetGatewayClientTls(providerInputs.projectGatewayId as string);
+ const relayDetails = await gatewayService.fnGetGatewayClientTlsByGatewayId(providerInputs.gatewayId as string);
const [relayHost, relayPort] = relayDetails.relayAddress.split(":");
await withGatewayProxy(
async (port) => {
@@ -202,7 +202,7 @@ export const SqlDatabaseProvider = ({ gatewayService }: TSqlDatabaseProviderDTO)
await db.destroy();
};
- if (providerInputs.projectGatewayId) {
+ if (providerInputs.gatewayId) {
await gatewayProxyWrapper(providerInputs, gatewayCallback);
} else {
await gatewayCallback();
@@ -238,7 +238,7 @@ export const SqlDatabaseProvider = ({ gatewayService }: TSqlDatabaseProviderDTO)
await db.destroy();
}
};
- if (providerInputs.projectGatewayId) {
+ if (providerInputs.gatewayId) {
await gatewayProxyWrapper(providerInputs, gatewayCallback);
} else {
await gatewayCallback();
@@ -265,7 +265,7 @@ export const SqlDatabaseProvider = ({ gatewayService }: TSqlDatabaseProviderDTO)
await db.destroy();
}
};
- if (providerInputs.projectGatewayId) {
+ if (providerInputs.gatewayId) {
await gatewayProxyWrapper(providerInputs, gatewayCallback);
} else {
await gatewayCallback();
@@ -301,7 +301,7 @@ export const SqlDatabaseProvider = ({ gatewayService }: TSqlDatabaseProviderDTO)
await db.destroy();
}
};
- if (providerInputs.projectGatewayId) {
+ if (providerInputs.gatewayId) {
await gatewayProxyWrapper(providerInputs, gatewayCallback);
} else {
await gatewayCallback();
diff --git a/backend/src/ee/services/gateway/gateway-dal.ts b/backend/src/ee/services/gateway/gateway-dal.ts
index fbf5558e43..31b4b727b9 100644
--- a/backend/src/ee/services/gateway/gateway-dal.ts
+++ b/backend/src/ee/services/gateway/gateway-dal.ts
@@ -1,37 +1,34 @@
-import { Knex } from "knex";
-
import { TDbClient } from "@app/db";
import { GatewaysSchema, TableName, TGateways } from "@app/db/schemas";
import { DatabaseError } from "@app/lib/errors";
-import {
- buildFindFilter,
- ormify,
- selectAllTableCols,
- sqlNestRelationships,
- TFindFilter,
- TFindOpt
-} from "@app/lib/knex";
+import { buildFindFilter, ormify, selectAllTableCols, TFindFilter, TFindOpt } from "@app/lib/knex";
export type TGatewayDALFactory = ReturnType<typeof gatewayDALFactory>;
export const gatewayDALFactory = (db: TDbClient) => {
const orm = ormify(db, TableName.Gateway);
- const find = async (filter: TFindFilter<TGateways>, { offset, limit, sort, tx }: TFindOpt<TGateways> = {}) => {
+ const find = async (
+ filter: TFindFilter<TGateways> & { orgId?: string },
+ { offset, limit, sort, tx }: TFindOpt<TGateways> = {}
+ ) => {
try {
const query = (tx || db)(TableName.Gateway)
// eslint-disable-next-line @typescript-eslint/no-misused-promises
- .where(buildFindFilter(filter))
+ .where(buildFindFilter(filter, TableName.Gateway, ["orgId"]))
.join(TableName.Identity, `${TableName.Identity}.id`, `${TableName.Gateway}.identityId`)
- .leftJoin(TableName.ProjectGateway, `${TableName.ProjectGateway}.gatewayId`, `${TableName.Gateway}.id`)
- .leftJoin(TableName.Project, `${TableName.Project}.id`, `${TableName.ProjectGateway}.projectId`)
+ .join(
+ TableName.IdentityOrgMembership,
+ `${TableName.IdentityOrgMembership}.identityId`,
+ `${TableName.Gateway}.identityId`
+ )
.select(selectAllTableCols(TableName.Gateway))
- .select(
- db.ref("name").withSchema(TableName.Identity).as("identityName"),
- db.ref("name").withSchema(TableName.Project).as("projectName"),
- db.ref("slug").withSchema(TableName.Project).as("projectSlug"),
- db.ref("id").withSchema(TableName.Project).as("projectId")
- );
+ .select(db.ref("orgId").withSchema(TableName.IdentityOrgMembership).as("identityOrgId"))
+ .select(db.ref("name").withSchema(TableName.Identity).as("identityName"));
+
+ if (filter.orgId) {
+ void query.where(`${TableName.IdentityOrgMembership}.orgId`, filter.orgId);
+ }
if (limit) void query.limit(limit);
if (offset) void query.offset(offset);
if (sort) {
@@ -39,48 +36,16 @@ export const gatewayDALFactory = (db: TDbClient) => {
}
const docs = await query;
- return sqlNestRelationships({
- data: docs,
- key: "id",
- parentMapper: (data) => ({
- ...GatewaysSchema.parse(data),
- identity: { id: data.identityId, name: data.identityName }
- }),
- childrenMapper: [
- {
- key: "projectId",
- label: "projects" as const,
- mapper: ({ projectId, projectName, projectSlug }) => ({
- id: projectId,
- name: projectName,
- slug: projectSlug
- })
- }
- ]
- });
- } catch (error) {
- throw new DatabaseError({ error, name: `${TableName.Gateway}: Find` });
- }
- };
- const findByProjectId = async (projectId: string, tx?: Knex) => {
- try {
- const query = (tx || db)(TableName.Gateway)
- .join(TableName.Identity, `${TableName.Identity}.id`, `${TableName.Gateway}.identityId`)
- .join(TableName.ProjectGateway, `${TableName.ProjectGateway}.gatewayId`, `${TableName.Gateway}.id`)
- .select(selectAllTableCols(TableName.Gateway))
- .select(
- db.ref("name").withSchema(TableName.Identity).as("identityName"),
- db.ref("id").withSchema(TableName.ProjectGateway).as("projectGatewayId")
- )
- .where({ [`${TableName.ProjectGateway}.projectId` as "projectId"]: projectId });
-
- const docs = await query;
- return docs.map((el) => ({ ...el, identity: { id: el.identityId, name: el.identityName } }));
+ return docs.map((el) => ({
+ ...GatewaysSchema.parse(el),
+ orgId: el.identityOrgId as string, // todo(daniel): figure out why typescript is not inferring this as a string
+ identity: { id: el.identityId, name: el.identityName }
+ }));
} catch (error) {
- throw new DatabaseError({ error, name: `${TableName.Gateway}: Find by project id` });
+ throw new DatabaseError({ error, name: `${TableName.Gateway}: Find` });
}
};
- return { ...orm, find, findByProjectId };
+ return { ...orm, find };
};
diff --git a/backend/src/ee/services/gateway/gateway-service.ts b/backend/src/ee/services/gateway/gateway-service.ts
index 5a17bc0282..25f0b384a1 100644
--- a/backend/src/ee/services/gateway/gateway-service.ts
+++ b/backend/src/ee/services/gateway/gateway-service.ts
@@ -4,7 +4,6 @@ import { ForbiddenError } from "@casl/ability";
import * as x509 from "@peculiar/x509";
import { z } from "zod";
-import { ActionProjectType } from "@app/db/schemas";
import { KeyStorePrefixes, PgSqlLock, TKeyStoreFactory } from "@app/keystore/keystore";
import { getConfig } from "@app/lib/config/env";
import { BadRequestError, NotFoundError } from "@app/lib/errors";
@@ -27,17 +26,14 @@ import { TGatewayDALFactory } from "./gateway-dal";
import {
TExchangeAllocatedRelayAddressDTO,
TGetGatewayByIdDTO,
- TGetProjectGatewayByIdDTO,
THeartBeatDTO,
TListGatewaysDTO,
TUpdateGatewayByIdDTO
} from "./gateway-types";
import { TOrgGatewayConfigDALFactory } from "./org-gateway-config-dal";
-import { TProjectGatewayDALFactory } from "./project-gateway-dal";
type TGatewayServiceFactoryDep = {
gatewayDAL: TGatewayDALFactory;
- projectGatewayDAL: TProjectGatewayDALFactory;
orgGatewayConfigDAL: Pick<TOrgGatewayConfigDALFactory, "findOne" | "create" | "transaction" | "findById">;
licenseService: Pick<TLicenseServiceFactory, "onPremFeatures" | "getPlan">;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey" | "decryptWithRootKey">;
@@ -57,8 +53,7 @@ export const gatewayServiceFactory = ({
kmsService,
permissionService,
orgGatewayConfigDAL,
- keyStore,
- projectGatewayDAL
+ keyStore
}: TGatewayServiceFactoryDep) => {
const $validateOrgAccessToGateway = async (orgId: string, actorId: string, actorAuthMethod: ActorAuthMethod) => {
// if (!licenseService.onPremFeatures.gateway) {
@@ -526,7 +521,7 @@ export const gatewayServiceFactory = ({
return gateway;
};
- const updateGatewayById = async ({ orgPermission, id, name, projectIds }: TUpdateGatewayByIdDTO) => {
+ const updateGatewayById = async ({ orgPermission, id, name }: TUpdateGatewayByIdDTO) => {
const { permission } = await permissionService.getOrgPermission(
orgPermission.type,
orgPermission.id,
@@ -543,15 +538,6 @@ export const gatewayServiceFactory = ({
const [gateway] = await gatewayDAL.update({ id, orgGatewayRootCaId: orgGatewayConfig.id }, { name });
if (!gateway) throw new NotFoundError({ message: `Gateway with ID ${id} not found.` });
- if (projectIds) {
- await projectGatewayDAL.transaction(async (tx) => {
- await projectGatewayDAL.delete({ gatewayId: gateway.id }, tx);
- await projectGatewayDAL.insertMany(
- projectIds.map((el) => ({ gatewayId: gateway.id, projectId: el })),
- tx
- );
- });
- }
return gateway;
};
@@ -576,27 +562,7 @@ export const gatewayServiceFactory = ({
return gateway;
};
- const getProjectGateways = async ({ projectId, projectPermission }: TGetProjectGatewayByIdDTO) => {
- await permissionService.getProjectPermission({
- projectId,
- actor: projectPermission.type,
- actorId: projectPermission.id,
- actorOrgId: projectPermission.orgId,
- actorAuthMethod: projectPermission.authMethod,
- actionProjectType: ActionProjectType.Any
- });
-
- const gateways = await gatewayDAL.findByProjectId(projectId);
- return gateways;
- };
-
- // this has no permission check and used for dynamic secrets directly
- // assumes permission check is already done
- const fnGetGatewayClientTls = async (projectGatewayId: string) => {
- const projectGateway = await projectGatewayDAL.findById(projectGatewayId);
- if (!projectGateway) throw new NotFoundError({ message: `Project gateway with ID ${projectGatewayId} not found.` });
-
- const { gatewayId } = projectGateway;
+ const fnGetGatewayClientTlsByGatewayId = async (gatewayId: string) => {
const gateway = await gatewayDAL.findById(gatewayId);
if (!gateway) throw new NotFoundError({ message: `Gateway with ID ${gatewayId} not found.` });
@@ -645,8 +611,7 @@ export const gatewayServiceFactory = ({
getGatewayById,
updateGatewayById,
deleteGatewayById,
- getProjectGateways,
- fnGetGatewayClientTls,
+ fnGetGatewayClientTlsByGatewayId,
heartbeat
};
};
diff --git a/backend/src/ee/services/gateway/gateway-types.ts b/backend/src/ee/services/gateway/gateway-types.ts
index 220dc71475..823028154f 100644
--- a/backend/src/ee/services/gateway/gateway-types.ts
+++ b/backend/src/ee/services/gateway/gateway-types.ts
@@ -20,7 +20,6 @@ export type TGetGatewayByIdDTO = {
export type TUpdateGatewayByIdDTO = {
id: string;
name?: string;
- projectIds?: string[];
orgPermission: OrgServiceActor;
};
diff --git a/backend/src/ee/services/gateway/project-gateway-dal.ts b/backend/src/ee/services/gateway/project-gateway-dal.ts
deleted file mode 100644
index 44c36f5f66..0000000000
--- a/backend/src/ee/services/gateway/project-gateway-dal.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { TDbClient } from "@app/db";
-import { TableName } from "@app/db/schemas";
-import { ormify } from "@app/lib/knex";
-
-export type TProjectGatewayDALFactory = ReturnType<typeof projectGatewayDALFactory>;
-
-export const projectGatewayDALFactory = (db: TDbClient) => {
- const orm = ormify(db, TableName.ProjectGateway);
- return orm;
-};
diff --git a/backend/src/ee/services/github-org-sync/github-org-sync-service.ts b/backend/src/ee/services/github-org-sync/github-org-sync-service.ts
index 22a0783995..867feb4a47 100644
--- a/backend/src/ee/services/github-org-sync/github-org-sync-service.ts
+++ b/backend/src/ee/services/github-org-sync/github-org-sync-service.ts
@@ -1,6 +1,6 @@
import { ForbiddenError } from "@casl/ability";
import { Octokit } from "@octokit/core";
-import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";
+import { paginateGraphql } from "@octokit/plugin-paginate-graphql";
import { Octokit as OctokitRest } from "@octokit/rest";
import { OrgMembershipRole } from "@app/db/schemas";
@@ -18,7 +18,7 @@ import { TPermissionServiceFactory } from "../permission/permission-service";
import { TGithubOrgSyncDALFactory } from "./github-org-sync-dal";
import { TCreateGithubOrgSyncDTO, TDeleteGithubOrgSyncDTO, TUpdateGithubOrgSyncDTO } from "./github-org-sync-types";
-const OctokitWithPlugin = Octokit.plugin(paginateGraphQL);
+const OctokitWithPlugin = Octokit.plugin(paginateGraphql);
type TGithubOrgSyncServiceFactoryDep = {
githubOrgSyncDAL: TGithubOrgSyncDALFactory;
diff --git a/backend/src/ee/services/group/group-dal.ts b/backend/src/ee/services/group/group-dal.ts
index 2458454da7..1d33cafd6f 100644
--- a/backend/src/ee/services/group/group-dal.ts
+++ b/backend/src/ee/services/group/group-dal.ts
@@ -157,10 +157,23 @@ export const groupDALFactory = (db: TDbClient) => {
}
};
+ const findGroupsByProjectId = async (projectId: string, tx?: Knex) => {
+ try {
+ const docs = await (tx || db.replicaNode())(TableName.Groups)
+ .join(TableName.GroupProjectMembership, `${TableName.Groups}.id`, `${TableName.GroupProjectMembership}.groupId`)
+ .where(`${TableName.GroupProjectMembership}.projectId`, projectId)
+ .select(selectAllTableCols(TableName.Groups));
+ return docs;
+ } catch (error) {
+ throw new DatabaseError({ error, name: "Find groups by project id" });
+ }
+ };
+
return {
findGroups,
findByOrgId,
findAllGroupPossibleMembers,
+ findGroupsByProjectId,
...groupOrm
};
};
diff --git a/backend/src/ee/services/group/user-group-membership-dal.ts b/backend/src/ee/services/group/user-group-membership-dal.ts
index be654b338c..5ee97e4573 100644
--- a/backend/src/ee/services/group/user-group-membership-dal.ts
+++ b/backend/src/ee/services/group/user-group-membership-dal.ts
@@ -176,7 +176,8 @@ export const userGroupMembershipDALFactory = (db: TDbClient) => {
db.ref("name").withSchema(TableName.Groups).as("groupName"),
db.ref("id").withSchema(TableName.OrgMembership).as("orgMembershipId"),
db.ref("firstName").withSchema(TableName.Users).as("firstName"),
- db.ref("lastName").withSchema(TableName.Users).as("lastName")
+ db.ref("lastName").withSchema(TableName.Users).as("lastName"),
+ db.ref("slug").withSchema(TableName.Groups).as("groupSlug")
);
return docs;
diff --git a/backend/src/ee/services/hsm/hsm-fns.ts b/backend/src/ee/services/hsm/hsm-fns.ts
index ef975a371c..8eec7ceb77 100644
--- a/backend/src/ee/services/hsm/hsm-fns.ts
+++ b/backend/src/ee/services/hsm/hsm-fns.ts
@@ -24,9 +24,13 @@ export const initializeHsmModule = (envConfig: Pick<TEnvConfig, "isHsmConfigured
isInitialized = true;
logger.info("PKCS#11 module initialized");
- } catch (err) {
- logger.error(err, "Failed to initialize PKCS#11 module");
- throw err;
+ } catch (error) {
+ if (error instanceof pkcs11js.Pkcs11Error && error.code === pkcs11js.CKR_CRYPTOKI_ALREADY_INITIALIZED) {
+ logger.info("Skipping HSM initialization because it's already initialized.");
+ } else {
+ logger.error(error, "Failed to initialize PKCS#11 module");
+ throw error;
+ }
}
};
diff --git a/backend/src/ee/services/ldap-config/ldap-config-types.ts b/backend/src/ee/services/ldap-config/ldap-config-types.ts
index 86f4bf0d56..941335fa4e 100644
--- a/backend/src/ee/services/ldap-config/ldap-config-types.ts
+++ b/backend/src/ee/services/ldap-config/ldap-config-types.ts
@@ -14,6 +14,11 @@ export type TLDAPConfig = {
caCert: string;
};
+export type TTestLDAPConfigDTO = Omit<
+ TLDAPConfig,
+ "organization" | "id" | "groupSearchBase" | "groupSearchFilter" | "isActive" | "uniqueUserAttribute" | "searchBase"
+>;
+
export type TCreateLdapCfgDTO = {
orgId: string;
isActive: boolean;
diff --git a/backend/src/ee/services/ldap-config/ldap-fns.ts b/backend/src/ee/services/ldap-config/ldap-fns.ts
index 44af718ed5..01b70b4db2 100644
--- a/backend/src/ee/services/ldap-config/ldap-fns.ts
+++ b/backend/src/ee/services/ldap-config/ldap-fns.ts
@@ -2,15 +2,14 @@ import ldapjs from "ldapjs";
import { logger } from "@app/lib/logger";
-import { TLDAPConfig } from "./ldap-config-types";
+import { TLDAPConfig, TTestLDAPConfigDTO } from "./ldap-config-types";
export const isValidLdapFilter = (filter: string) => {
try {
ldapjs.parseFilter(filter);
return true;
} catch (error) {
- logger.error("Invalid LDAP filter");
- logger.error(error);
+ logger.error(error, "Invalid LDAP filter");
return false;
}
};
@@ -20,7 +19,7 @@ export const isValidLdapFilter = (filter: string) => {
* @param ldapConfig - The LDAP configuration to test
* @returns {Boolean} isConnected - Whether or not the connection was successful
*/
-export const testLDAPConfig = async (ldapConfig: TLDAPConfig): Promise<boolean> => {
+export const testLDAPConfig = async (ldapConfig: TTestLDAPConfigDTO): Promise<boolean> => {
return new Promise((resolve) => {
const ldapClient = ldapjs.createClient({
url: ldapConfig.url,
diff --git a/backend/src/ee/services/oidc/oidc-config-service.ts b/backend/src/ee/services/oidc/oidc-config-service.ts
index bc60dff252..6accb69e96 100644
--- a/backend/src/ee/services/oidc/oidc-config-service.ts
+++ b/backend/src/ee/services/oidc/oidc-config-service.ts
@@ -714,13 +714,15 @@ export const oidcConfigServiceFactory = ({
}
}
+ const groups = typeof claims.groups === "string" ? [claims.groups] : (claims.groups as string[] | undefined);
+
oidcLogin({
email: claims.email,
externalId: claims.sub,
firstName: claims.given_name ?? "",
lastName: claims.family_name ?? "",
orgId: org.id,
- groups: claims.groups as string[] | undefined,
+ groups,
callbackPort,
manageGroupMemberships: oidcCfg.manageGroupMemberships
})
diff --git a/backend/src/ee/services/permission/default-roles.ts b/backend/src/ee/services/permission/default-roles.ts
new file mode 100644
index 0000000000..4268fd10ff
--- /dev/null
+++ b/backend/src/ee/services/permission/default-roles.ts
@@ -0,0 +1,473 @@
+import { AbilityBuilder, createMongoAbility, MongoAbility } from "@casl/ability";
+
+import {
+ ProjectPermissionActions,
+ ProjectPermissionCertificateActions,
+ ProjectPermissionCmekActions,
+ ProjectPermissionCommitsActions,
+ ProjectPermissionDynamicSecretActions,
+ ProjectPermissionGroupActions,
+ ProjectPermissionIdentityActions,
+ ProjectPermissionKmipActions,
+ ProjectPermissionMemberActions,
+ ProjectPermissionPkiSubscriberActions,
+ ProjectPermissionSecretActions,
+ ProjectPermissionSecretRotationActions,
+ ProjectPermissionSecretSyncActions,
+ ProjectPermissionSet,
+ ProjectPermissionSshHostActions,
+ ProjectPermissionSub
+} from "@app/ee/services/permission/project-permission";
+
+const buildAdminPermissionRules = () => {
+ const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
+
+ // Admins get full access to everything
+ [
+ ProjectPermissionSub.SecretFolders,
+ ProjectPermissionSub.SecretImports,
+ ProjectPermissionSub.SecretApproval,
+ ProjectPermissionSub.Role,
+ ProjectPermissionSub.Integrations,
+ ProjectPermissionSub.Webhooks,
+ ProjectPermissionSub.ServiceTokens,
+ ProjectPermissionSub.Settings,
+ ProjectPermissionSub.Environments,
+ ProjectPermissionSub.Tags,
+ ProjectPermissionSub.AuditLogs,
+ ProjectPermissionSub.IpAllowList,
+ ProjectPermissionSub.CertificateAuthorities,
+ ProjectPermissionSub.CertificateTemplates,
+ ProjectPermissionSub.PkiAlerts,
+ ProjectPermissionSub.PkiCollections,
+ ProjectPermissionSub.SshCertificateAuthorities,
+ ProjectPermissionSub.SshCertificates,
+ ProjectPermissionSub.SshCertificateTemplates,
+ ProjectPermissionSub.SshHostGroups
+ ].forEach((el) => {
+ can(
+ [
+ ProjectPermissionActions.Read,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Delete
+ ],
+ el
+ );
+ });
+
+ can(
+ [
+ ProjectPermissionCertificateActions.Read,
+ ProjectPermissionCertificateActions.Edit,
+ ProjectPermissionCertificateActions.Create,
+ ProjectPermissionCertificateActions.Delete,
+ ProjectPermissionCertificateActions.ReadPrivateKey
+ ],
+ ProjectPermissionSub.Certificates
+ );
+
+ can(
+ [ProjectPermissionCommitsActions.Read, ProjectPermissionCommitsActions.PerformRollback],
+ ProjectPermissionSub.Commits
+ );
+
+ can(
+ [
+ ProjectPermissionSshHostActions.Edit,
+ ProjectPermissionSshHostActions.Read,
+ ProjectPermissionSshHostActions.Create,
+ ProjectPermissionSshHostActions.Delete,
+ ProjectPermissionSshHostActions.IssueHostCert
+ ],
+ ProjectPermissionSub.SshHosts
+ );
+
+ can(
+ [
+ ProjectPermissionPkiSubscriberActions.Edit,
+ ProjectPermissionPkiSubscriberActions.Read,
+ ProjectPermissionPkiSubscriberActions.Create,
+ ProjectPermissionPkiSubscriberActions.Delete,
+ ProjectPermissionPkiSubscriberActions.IssueCert,
+ ProjectPermissionPkiSubscriberActions.ListCerts
+ ],
+ ProjectPermissionSub.PkiSubscribers
+ );
+
+ can(
+ [
+ ProjectPermissionMemberActions.Create,
+ ProjectPermissionMemberActions.Edit,
+ ProjectPermissionMemberActions.Delete,
+ ProjectPermissionMemberActions.Read,
+ ProjectPermissionMemberActions.GrantPrivileges,
+ ProjectPermissionMemberActions.AssumePrivileges
+ ],
+ ProjectPermissionSub.Member
+ );
+
+ can(
+ [
+ ProjectPermissionGroupActions.Create,
+ ProjectPermissionGroupActions.Edit,
+ ProjectPermissionGroupActions.Delete,
+ ProjectPermissionGroupActions.Read,
+ ProjectPermissionGroupActions.GrantPrivileges
+ ],
+ ProjectPermissionSub.Groups
+ );
+
+ can(
+ [
+ ProjectPermissionIdentityActions.Create,
+ ProjectPermissionIdentityActions.Edit,
+ ProjectPermissionIdentityActions.Delete,
+ ProjectPermissionIdentityActions.Read,
+ ProjectPermissionIdentityActions.GrantPrivileges,
+ ProjectPermissionIdentityActions.AssumePrivileges
+ ],
+ ProjectPermissionSub.Identity
+ );
+
+ can(
+ [
+ ProjectPermissionSecretActions.DescribeSecret,
+ ProjectPermissionSecretActions.ReadValue,
+ ProjectPermissionSecretActions.Create,
+ ProjectPermissionSecretActions.Edit,
+ ProjectPermissionSecretActions.Delete
+ ],
+ ProjectPermissionSub.Secrets
+ );
+
+ can(
+ [
+ ProjectPermissionDynamicSecretActions.ReadRootCredential,
+ ProjectPermissionDynamicSecretActions.EditRootCredential,
+ ProjectPermissionDynamicSecretActions.CreateRootCredential,
+ ProjectPermissionDynamicSecretActions.DeleteRootCredential,
+ ProjectPermissionDynamicSecretActions.Lease
+ ],
+ ProjectPermissionSub.DynamicSecrets
+ );
+
+ can([ProjectPermissionActions.Edit, ProjectPermissionActions.Delete], ProjectPermissionSub.Project);
+ can([ProjectPermissionActions.Read, ProjectPermissionActions.Create], ProjectPermissionSub.SecretRollback);
+ can([ProjectPermissionActions.Edit], ProjectPermissionSub.Kms);
+ can(
+ [
+ ProjectPermissionCmekActions.Create,
+ ProjectPermissionCmekActions.Edit,
+ ProjectPermissionCmekActions.Delete,
+ ProjectPermissionCmekActions.Read,
+ ProjectPermissionCmekActions.Encrypt,
+ ProjectPermissionCmekActions.Decrypt,
+ ProjectPermissionCmekActions.Sign,
+ ProjectPermissionCmekActions.Verify
+ ],
+ ProjectPermissionSub.Cmek
+ );
+ can(
+ [
+ ProjectPermissionSecretSyncActions.Create,
+ ProjectPermissionSecretSyncActions.Edit,
+ ProjectPermissionSecretSyncActions.Delete,
+ ProjectPermissionSecretSyncActions.Read,
+ ProjectPermissionSecretSyncActions.SyncSecrets,
+ ProjectPermissionSecretSyncActions.ImportSecrets,
+ ProjectPermissionSecretSyncActions.RemoveSecrets
+ ],
+ ProjectPermissionSub.SecretSyncs
+ );
+
+ can(
+ [
+ ProjectPermissionKmipActions.CreateClients,
+ ProjectPermissionKmipActions.UpdateClients,
+ ProjectPermissionKmipActions.DeleteClients,
+ ProjectPermissionKmipActions.ReadClients,
+ ProjectPermissionKmipActions.GenerateClientCertificates
+ ],
+ ProjectPermissionSub.Kmip
+ );
+
+ can(
+ [
+ ProjectPermissionSecretRotationActions.Create,
+ ProjectPermissionSecretRotationActions.Edit,
+ ProjectPermissionSecretRotationActions.Delete,
+ ProjectPermissionSecretRotationActions.Read,
+ ProjectPermissionSecretRotationActions.ReadGeneratedCredentials,
+ ProjectPermissionSecretRotationActions.RotateSecrets
+ ],
+ ProjectPermissionSub.SecretRotation
+ );
+
+ return rules;
+};
+
+const buildMemberPermissionRules = () => {
+ const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
+
+ can(
+ [
+ ProjectPermissionSecretActions.DescribeSecret,
+ ProjectPermissionSecretActions.ReadValue,
+ ProjectPermissionSecretActions.Edit,
+ ProjectPermissionSecretActions.Create,
+ ProjectPermissionSecretActions.Delete
+ ],
+ ProjectPermissionSub.Secrets
+ );
+ can(
+ [
+ ProjectPermissionActions.Read,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Delete
+ ],
+ ProjectPermissionSub.SecretFolders
+ );
+ can(
+ [
+ ProjectPermissionDynamicSecretActions.ReadRootCredential,
+ ProjectPermissionDynamicSecretActions.EditRootCredential,
+ ProjectPermissionDynamicSecretActions.CreateRootCredential,
+ ProjectPermissionDynamicSecretActions.DeleteRootCredential,
+ ProjectPermissionDynamicSecretActions.Lease
+ ],
+ ProjectPermissionSub.DynamicSecrets
+ );
+ can(
+ [
+ ProjectPermissionActions.Read,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Delete
+ ],
+ ProjectPermissionSub.SecretImports
+ );
+
+ can(
+ [ProjectPermissionCommitsActions.Read, ProjectPermissionCommitsActions.PerformRollback],
+ ProjectPermissionSub.Commits
+ );
+
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.SecretApproval);
+ can([ProjectPermissionSecretRotationActions.Read], ProjectPermissionSub.SecretRotation);
+
+ can([ProjectPermissionActions.Read, ProjectPermissionActions.Create], ProjectPermissionSub.SecretRollback);
+
+ can([ProjectPermissionMemberActions.Read, ProjectPermissionMemberActions.Create], ProjectPermissionSub.Member);
+
+ can([ProjectPermissionGroupActions.Read], ProjectPermissionSub.Groups);
+
+ can(
+ [
+ ProjectPermissionActions.Read,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Delete
+ ],
+ ProjectPermissionSub.Integrations
+ );
+
+ can(
+ [
+ ProjectPermissionActions.Read,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Delete
+ ],
+ ProjectPermissionSub.Webhooks
+ );
+
+ can(
+ [
+ ProjectPermissionIdentityActions.Read,
+ ProjectPermissionIdentityActions.Edit,
+ ProjectPermissionIdentityActions.Create,
+ ProjectPermissionIdentityActions.Delete
+ ],
+ ProjectPermissionSub.Identity
+ );
+
+ can(
+ [
+ ProjectPermissionActions.Read,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Delete
+ ],
+ ProjectPermissionSub.ServiceTokens
+ );
+
+ can(
+ [
+ ProjectPermissionActions.Read,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Delete
+ ],
+ ProjectPermissionSub.Settings
+ );
+
+ can(
+ [
+ ProjectPermissionActions.Read,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Delete
+ ],
+ ProjectPermissionSub.Environments
+ );
+
+ can(
+ [
+ ProjectPermissionActions.Read,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Delete
+ ],
+ ProjectPermissionSub.Tags
+ );
+
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.Role);
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.AuditLogs);
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.IpAllowList);
+
+ // double check if all CRUD are needed for CA and Certificates
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.CertificateAuthorities);
+
+ can(
+ [
+ ProjectPermissionCertificateActions.Read,
+ ProjectPermissionCertificateActions.Edit,
+ ProjectPermissionCertificateActions.Create,
+ ProjectPermissionCertificateActions.Delete
+ ],
+ ProjectPermissionSub.Certificates
+ );
+
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.CertificateTemplates);
+
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.PkiAlerts);
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.PkiCollections);
+
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.SshCertificates);
+ can([ProjectPermissionActions.Create], ProjectPermissionSub.SshCertificates);
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.SshCertificateTemplates);
+
+ can([ProjectPermissionSshHostActions.Read], ProjectPermissionSub.SshHosts);
+ can([ProjectPermissionPkiSubscriberActions.Read], ProjectPermissionSub.PkiSubscribers);
+
+ can(
+ [
+ ProjectPermissionCmekActions.Create,
+ ProjectPermissionCmekActions.Edit,
+ ProjectPermissionCmekActions.Delete,
+ ProjectPermissionCmekActions.Read,
+ ProjectPermissionCmekActions.Encrypt,
+ ProjectPermissionCmekActions.Decrypt,
+ ProjectPermissionCmekActions.Sign,
+ ProjectPermissionCmekActions.Verify
+ ],
+ ProjectPermissionSub.Cmek
+ );
+
+ can(
+ [
+ ProjectPermissionSecretSyncActions.Create,
+ ProjectPermissionSecretSyncActions.Edit,
+ ProjectPermissionSecretSyncActions.Delete,
+ ProjectPermissionSecretSyncActions.Read,
+ ProjectPermissionSecretSyncActions.SyncSecrets,
+ ProjectPermissionSecretSyncActions.ImportSecrets,
+ ProjectPermissionSecretSyncActions.RemoveSecrets
+ ],
+ ProjectPermissionSub.SecretSyncs
+ );
+
+ return rules;
+};
+
+const buildViewerPermissionRules = () => {
+ const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
+
+ can(
+ [ProjectPermissionSecretActions.DescribeSecret, ProjectPermissionSecretActions.ReadValue],
+ ProjectPermissionSub.Secrets
+ );
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretFolders);
+ can(ProjectPermissionDynamicSecretActions.ReadRootCredential, ProjectPermissionSub.DynamicSecrets);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretImports);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
+ can(ProjectPermissionSecretRotationActions.Read, ProjectPermissionSub.SecretRotation);
+ can(ProjectPermissionMemberActions.Read, ProjectPermissionSub.Member);
+ can(ProjectPermissionGroupActions.Read, ProjectPermissionSub.Groups);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.Role);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.Webhooks);
+ can(ProjectPermissionIdentityActions.Read, ProjectPermissionSub.Identity);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.ServiceTokens);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.Settings);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.Environments);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.AuditLogs);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.IpAllowList);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.CertificateAuthorities);
+ can(ProjectPermissionCertificateActions.Read, ProjectPermissionSub.Certificates);
+ can(ProjectPermissionCmekActions.Read, ProjectPermissionSub.Cmek);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.SshCertificates);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.SshCertificateTemplates);
+ can(ProjectPermissionSecretSyncActions.Read, ProjectPermissionSub.SecretSyncs);
+ can(ProjectPermissionActions.Read, ProjectPermissionSub.Commits);
+
+ return rules;
+};
+
+const buildNoAccessProjectPermission = () => {
+ const { rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
+ return rules;
+};
+
+const buildSshHostBootstrapPermissionRules = () => {
+ const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
+
+ can(
+ [ProjectPermissionSshHostActions.Create, ProjectPermissionSshHostActions.IssueHostCert],
+ ProjectPermissionSub.SshHosts
+ );
+
+ return rules;
+};
+
+const buildCryptographicOperatorPermissionRules = () => {
+ const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
+
+ can(
+ [
+ ProjectPermissionCmekActions.Encrypt,
+ ProjectPermissionCmekActions.Decrypt,
+ ProjectPermissionCmekActions.Sign,
+ ProjectPermissionCmekActions.Verify
+ ],
+ ProjectPermissionSub.Cmek
+ );
+
+ return rules;
+};
+
+// General
+export const projectAdminPermissions = buildAdminPermissionRules();
+export const projectMemberPermissions = buildMemberPermissionRules();
+export const projectViewerPermission = buildViewerPermissionRules();
+export const projectNoAccessPermissions = buildNoAccessProjectPermission();
+
+// SSH
+export const sshHostBootstrapPermissions = buildSshHostBootstrapPermissionRules();
+
+// KMS
+export const cryptographicOperatorPermissions = buildCryptographicOperatorPermissionRules();
diff --git a/backend/src/ee/services/permission/org-permission.ts b/backend/src/ee/services/permission/org-permission.ts
index 7026899c75..612914bcc9 100644
--- a/backend/src/ee/services/permission/org-permission.ts
+++ b/backend/src/ee/services/permission/org-permission.ts
@@ -41,7 +41,8 @@ export enum OrgPermissionGatewayActions {
CreateGateways = "create-gateways",
ListGateways = "list-gateways",
EditGateways = "edit-gateways",
- DeleteGateways = "delete-gateways"
+ DeleteGateways = "delete-gateways",
+ AttachGateways = "attach-gateways"
}
export enum OrgPermissionIdentityActions {
@@ -337,6 +338,7 @@ const buildAdminPermission = () => {
can(OrgPermissionGatewayActions.CreateGateways, OrgPermissionSubjects.Gateway);
can(OrgPermissionGatewayActions.EditGateways, OrgPermissionSubjects.Gateway);
can(OrgPermissionGatewayActions.DeleteGateways, OrgPermissionSubjects.Gateway);
+ can(OrgPermissionGatewayActions.AttachGateways, OrgPermissionSubjects.Gateway);
can(OrgPermissionAdminConsoleAction.AccessAllProjects, OrgPermissionSubjects.AdminConsole);
@@ -378,6 +380,7 @@ const buildMemberPermission = () => {
can(OrgPermissionAppConnectionActions.Connect, OrgPermissionSubjects.AppConnections);
can(OrgPermissionGatewayActions.ListGateways, OrgPermissionSubjects.Gateway);
can(OrgPermissionGatewayActions.CreateGateways, OrgPermissionSubjects.Gateway);
+ can(OrgPermissionGatewayActions.AttachGateways, OrgPermissionSubjects.Gateway);
return rules;
};
diff --git a/backend/src/ee/services/permission/permission-dal.ts b/backend/src/ee/services/permission/permission-dal.ts
index 891d7193e3..7a17108a2b 100644
--- a/backend/src/ee/services/permission/permission-dal.ts
+++ b/backend/src/ee/services/permission/permission-dal.ts
@@ -132,7 +132,7 @@ export const permissionDALFactory = (db: TDbClient) => {
}
};
- const getProjectGroupPermissions = async (projectId: string) => {
+ const getProjectGroupPermissions = async (projectId: string, filterGroupId?: string) => {
try {
const docs = await db
.replicaNode()(TableName.GroupProjectMembership)
@@ -148,6 +148,11 @@ export const permissionDALFactory = (db: TDbClient) => {
`groupCustomRoles.id`
)
.where(`${TableName.GroupProjectMembership}.projectId`, "=", projectId)
+ .where((bd) => {
+ if (filterGroupId) {
+ void bd.where(`${TableName.GroupProjectMembership}.groupId`, "=", filterGroupId);
+ }
+ })
.select(
db.ref("id").withSchema(TableName.GroupProjectMembership).as("membershipId"),
db.ref("id").withSchema(TableName.Groups).as("groupId"),
diff --git a/backend/src/ee/services/permission/permission-service.ts b/backend/src/ee/services/permission/permission-service.ts
index 3d2f96f828..a1acaeb211 100644
--- a/backend/src/ee/services/permission/permission-service.ts
+++ b/backend/src/ee/services/permission/permission-service.ts
@@ -12,6 +12,14 @@ import {
TIdentityProjectMemberships,
TProjectMemberships
} from "@app/db/schemas";
+import {
+ cryptographicOperatorPermissions,
+ projectAdminPermissions,
+ projectMemberPermissions,
+ projectNoAccessPermissions,
+ projectViewerPermission,
+ sshHostBootstrapPermissions
+} from "@app/ee/services/permission/default-roles";
import { conditionsMatcher } from "@app/lib/casl";
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
import { objectify } from "@app/lib/fn";
@@ -32,14 +40,7 @@ import {
TGetServiceTokenProjectPermissionArg,
TGetUserProjectPermissionArg
} from "./permission-service-types";
-import {
- buildServiceTokenProjectPermission,
- projectAdminPermissions,
- projectMemberPermissions,
- projectNoAccessPermissions,
- ProjectPermissionSet,
- projectViewerPermission
-} from "./project-permission";
+import { buildServiceTokenProjectPermission, ProjectPermissionSet } from "./project-permission";
type TPermissionServiceFactoryDep = {
orgRoleDAL: Pick<TOrgRoleDALFactory, "findOne">;
@@ -95,6 +96,10 @@ export const permissionServiceFactory = ({
return projectViewerPermission;
case ProjectMembershipRole.NoAccess:
return projectNoAccessPermissions;
+ case ProjectMembershipRole.SshHostBootstrapper:
+ return sshHostBootstrapPermissions;
+ case ProjectMembershipRole.KmsCryptographicOperator:
+ return cryptographicOperatorPermissions;
case ProjectMembershipRole.Custom: {
return unpackRules<RawRuleOf<MongoAbility<ProjectPermissionSet>>>(
permissions as PackRule<RawRuleOf<MongoAbility<ProjectPermissionSet>>>[]
@@ -625,6 +630,34 @@ export const permissionServiceFactory = ({
return { permission };
};
+ const checkGroupProjectPermission = async ({
+ groupId,
+ projectId,
+ checkPermissions
+ }: {
+ groupId: string;
+ projectId: string;
+ checkPermissions: ProjectPermissionSet;
+ }) => {
+ const rawGroupProjectPermissions = await permissionDAL.getProjectGroupPermissions(projectId, groupId);
+ const groupPermissions = rawGroupProjectPermissions.map((groupProjectPermission) => {
+ const rolePermissions =
+ groupProjectPermission.roles?.map(({ role, permissions }) => ({ role, permissions })) || [];
+ const rules = buildProjectPermissionRules(rolePermissions);
+ const permission = createMongoAbility<ProjectPermissionSet>(rules, {
+ conditionsMatcher
+ });
+
+ return {
+ permission,
+ id: groupProjectPermission.groupId,
+ name: groupProjectPermission.username,
+ membershipId: groupProjectPermission.id
+ };
+ });
+ return groupPermissions.some((groupPermission) => groupPermission.permission.can(...checkPermissions));
+ };
+
return {
getUserOrgPermission,
getOrgPermission,
@@ -634,6 +667,7 @@ export const permissionServiceFactory = ({
getOrgPermissionByRole,
getProjectPermissionByRole,
buildOrgPermission,
- buildProjectPermissionRules
+ buildProjectPermissionRules,
+ checkGroupProjectPermission
};
};
diff --git a/backend/src/ee/services/permission/project-permission.ts b/backend/src/ee/services/permission/project-permission.ts
index aab0c86672..74b73ad5c1 100644
--- a/backend/src/ee/services/permission/project-permission.ts
+++ b/backend/src/ee/services/permission/project-permission.ts
@@ -22,6 +22,14 @@ export enum ProjectPermissionCommitsActions {
PerformRollback = "perform-rollback"
}
+export enum ProjectPermissionCertificateActions {
+ Read = "read",
+ Create = "create",
+ Edit = "edit",
+ Delete = "delete",
+ ReadPrivateKey = "read-private-key"
+}
+
export enum ProjectPermissionSecretActions {
DescribeAndReadValue = "read",
DescribeSecret = "describeSecret",
@@ -84,6 +92,15 @@ export enum ProjectPermissionSshHostActions {
IssueHostCert = "issue-host-cert"
}
+export enum ProjectPermissionPkiSubscriberActions {
+ Read = "read",
+ Create = "create",
+ Edit = "edit",
+ Delete = "delete",
+ IssueCert = "issue-cert",
+ ListCerts = "list-certs"
+}
+
export enum ProjectPermissionSecretSyncActions {
Read = "read",
Create = "create",
@@ -141,6 +158,7 @@ export enum ProjectPermissionSub {
SshCertificateTemplates = "ssh-certificate-templates",
SshHosts = "ssh-hosts",
SshHostGroups = "ssh-host-groups",
+ PkiSubscribers = "pki-subscribers",
PkiAlerts = "pki-alerts",
PkiCollections = "pki-collections",
Kms = "kms",
@@ -188,6 +206,11 @@ export type SshHostSubjectFields = {
hostname: string;
};
+export type PkiSubscriberSubjectFields = {
+ name: string;
+ // (dangtony98): consider adding [commonName] as a subject field in the future
+};
+
export type ProjectPermissionSet =
| [
ProjectPermissionSecretActions,
@@ -238,7 +261,7 @@ export type ProjectPermissionSet =
ProjectPermissionSub.Identity | (ForcedSubject<ProjectPermissionSub.Identity> & IdentityManagementSubjectFields)
]
| [ProjectPermissionActions, ProjectPermissionSub.CertificateAuthorities]
- | [ProjectPermissionActions, ProjectPermissionSub.Certificates]
+ | [ProjectPermissionCertificateActions, ProjectPermissionSub.Certificates]
| [ProjectPermissionActions, ProjectPermissionSub.CertificateTemplates]
| [ProjectPermissionActions, ProjectPermissionSub.SshCertificateAuthorities]
| [ProjectPermissionActions, ProjectPermissionSub.SshCertificates]
@@ -247,6 +270,13 @@ export type ProjectPermissionSet =
ProjectPermissionSshHostActions,
ProjectPermissionSub.SshHosts | (ForcedSubject<ProjectPermissionSub.SshHosts> & SshHostSubjectFields)
]
+ | [
+ ProjectPermissionPkiSubscriberActions,
+ (
+ | ProjectPermissionSub.PkiSubscribers
+ | (ForcedSubject<ProjectPermissionSub.PkiSubscribers> & PkiSubscriberSubjectFields)
+ )
+ ]
| [ProjectPermissionActions, ProjectPermissionSub.SshHostGroups]
| [ProjectPermissionActions, ProjectPermissionSub.PkiAlerts]
| [ProjectPermissionActions, ProjectPermissionSub.PkiCollections]
@@ -398,6 +428,21 @@ const SshHostConditionSchema = z
})
.partial();
+const PkiSubscriberConditionSchema = z
+ .object({
+ name: z.union([
+ z.string(),
+ z
+ .object({
+ [PermissionConditionOperators.$EQ]: PermissionConditionSchema[PermissionConditionOperators.$EQ],
+ [PermissionConditionOperators.$GLOB]: PermissionConditionSchema[PermissionConditionOperators.$GLOB],
+ [PermissionConditionOperators.$IN]: PermissionConditionSchema[PermissionConditionOperators.$IN]
+ })
+ .partial()
+ ])
+ })
+ .partial();
+
const GeneralPermissionSchema = [
z.object({
subject: z.literal(ProjectPermissionSub.SecretApproval).describe("The entity this permission pertains to."),
@@ -485,7 +530,7 @@ const GeneralPermissionSchema = [
}),
z.object({
subject: z.literal(ProjectPermissionSub.Certificates).describe("The entity this permission pertains to."),
- action: CASL_ACTION_SCHEMA_NATIVE_ENUM(ProjectPermissionActions).describe(
+ action: CASL_ACTION_SCHEMA_NATIVE_ENUM(ProjectPermissionCertificateActions).describe(
"Describe what action an entity can take."
)
}),
@@ -668,6 +713,16 @@ export const ProjectPermissionV2Schema = z.discriminatedUnion("subject", [
"When specified, only matching conditions will be allowed to access given resource."
).optional()
}),
+ z.object({
+ subject: z.literal(ProjectPermissionSub.PkiSubscribers).describe("The entity this permission pertains to."),
+ action: CASL_ACTION_SCHEMA_NATIVE_ENUM(ProjectPermissionPkiSubscriberActions).describe(
+ "Describe what action an entity can take."
+ ),
+ inverted: z.boolean().optional().describe("Whether rule allows or forbids."),
+ conditions: PkiSubscriberConditionSchema.describe(
+ "When specified, only matching conditions will be allowed to access given resource."
+ ).optional()
+ }),
z.object({
subject: z.literal(ProjectPermissionSub.SecretRotation).describe("The entity this permission pertains to."),
inverted: z.boolean().optional().describe("Whether rule allows or forbids."),
@@ -683,404 +738,6 @@ export const ProjectPermissionV2Schema = z.discriminatedUnion("subject", [
export type TProjectPermissionV2Schema = z.infer<typeof ProjectPermissionV2Schema>;
-const buildAdminPermissionRules = () => {
- const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
-
- // Admins get full access to everything
- [
- ProjectPermissionSub.SecretFolders,
- ProjectPermissionSub.SecretImports,
- ProjectPermissionSub.SecretApproval,
- ProjectPermissionSub.Role,
- ProjectPermissionSub.Integrations,
- ProjectPermissionSub.Webhooks,
- ProjectPermissionSub.ServiceTokens,
- ProjectPermissionSub.Settings,
- ProjectPermissionSub.Environments,
- ProjectPermissionSub.Tags,
- ProjectPermissionSub.AuditLogs,
- ProjectPermissionSub.IpAllowList,
- ProjectPermissionSub.CertificateAuthorities,
- ProjectPermissionSub.Certificates,
- ProjectPermissionSub.CertificateTemplates,
- ProjectPermissionSub.PkiAlerts,
- ProjectPermissionSub.PkiCollections,
- ProjectPermissionSub.SshCertificateAuthorities,
- ProjectPermissionSub.SshCertificates,
- ProjectPermissionSub.SshCertificateTemplates,
- ProjectPermissionSub.SshHostGroups
- ].forEach((el) => {
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- el
- );
- });
-
- can(
- [
- ProjectPermissionSshHostActions.Edit,
- ProjectPermissionSshHostActions.Read,
- ProjectPermissionSshHostActions.Create,
- ProjectPermissionSshHostActions.Delete,
- ProjectPermissionSshHostActions.IssueHostCert
- ],
- ProjectPermissionSub.SshHosts
- );
-
- can(
- [
- ProjectPermissionMemberActions.Create,
- ProjectPermissionMemberActions.Edit,
- ProjectPermissionMemberActions.Delete,
- ProjectPermissionMemberActions.Read,
- ProjectPermissionMemberActions.GrantPrivileges,
- ProjectPermissionMemberActions.AssumePrivileges
- ],
- ProjectPermissionSub.Member
- );
-
- can(
- [
- ProjectPermissionGroupActions.Create,
- ProjectPermissionGroupActions.Edit,
- ProjectPermissionGroupActions.Delete,
- ProjectPermissionGroupActions.Read,
- ProjectPermissionGroupActions.GrantPrivileges
- ],
- ProjectPermissionSub.Groups
- );
-
- can(
- [
- ProjectPermissionIdentityActions.Create,
- ProjectPermissionIdentityActions.Edit,
- ProjectPermissionIdentityActions.Delete,
- ProjectPermissionIdentityActions.Read,
- ProjectPermissionIdentityActions.GrantPrivileges,
- ProjectPermissionIdentityActions.AssumePrivileges
- ],
- ProjectPermissionSub.Identity
- );
-
- can(
- [
- ProjectPermissionSecretActions.DescribeAndReadValue,
- ProjectPermissionSecretActions.DescribeSecret,
- ProjectPermissionSecretActions.ReadValue,
- ProjectPermissionSecretActions.Create,
- ProjectPermissionSecretActions.Edit,
- ProjectPermissionSecretActions.Delete
- ],
- ProjectPermissionSub.Secrets
- );
-
- can(
- [
- ProjectPermissionDynamicSecretActions.ReadRootCredential,
- ProjectPermissionDynamicSecretActions.EditRootCredential,
- ProjectPermissionDynamicSecretActions.CreateRootCredential,
- ProjectPermissionDynamicSecretActions.DeleteRootCredential,
- ProjectPermissionDynamicSecretActions.Lease
- ],
- ProjectPermissionSub.DynamicSecrets
- );
-
- can([ProjectPermissionActions.Edit, ProjectPermissionActions.Delete], ProjectPermissionSub.Project);
- can([ProjectPermissionActions.Read, ProjectPermissionActions.Create], ProjectPermissionSub.SecretRollback);
- can([ProjectPermissionActions.Edit], ProjectPermissionSub.Kms);
- can(
- [
- ProjectPermissionCmekActions.Create,
- ProjectPermissionCmekActions.Edit,
- ProjectPermissionCmekActions.Delete,
- ProjectPermissionCmekActions.Read,
- ProjectPermissionCmekActions.Encrypt,
- ProjectPermissionCmekActions.Decrypt,
- ProjectPermissionCmekActions.Sign,
- ProjectPermissionCmekActions.Verify
- ],
- ProjectPermissionSub.Cmek
- );
- can(
- [
- ProjectPermissionSecretSyncActions.Create,
- ProjectPermissionSecretSyncActions.Edit,
- ProjectPermissionSecretSyncActions.Delete,
- ProjectPermissionSecretSyncActions.Read,
- ProjectPermissionSecretSyncActions.SyncSecrets,
- ProjectPermissionSecretSyncActions.ImportSecrets,
- ProjectPermissionSecretSyncActions.RemoveSecrets
- ],
- ProjectPermissionSub.SecretSyncs
- );
-
- can(
- [
- ProjectPermissionKmipActions.CreateClients,
- ProjectPermissionKmipActions.UpdateClients,
- ProjectPermissionKmipActions.DeleteClients,
- ProjectPermissionKmipActions.ReadClients,
- ProjectPermissionKmipActions.GenerateClientCertificates
- ],
- ProjectPermissionSub.Kmip
- );
-
- can(
- [
- ProjectPermissionSecretRotationActions.Create,
- ProjectPermissionSecretRotationActions.Edit,
- ProjectPermissionSecretRotationActions.Delete,
- ProjectPermissionSecretRotationActions.Read,
- ProjectPermissionSecretRotationActions.ReadGeneratedCredentials,
- ProjectPermissionSecretRotationActions.RotateSecrets
- ],
- ProjectPermissionSub.SecretRotation
- );
-
- can(
- [ProjectPermissionCommitsActions.Read, ProjectPermissionCommitsActions.PerformRollback],
- ProjectPermissionSub.Commits
- );
-
- return rules;
-};
-
-export const projectAdminPermissions = buildAdminPermissionRules();
-
-const buildMemberPermissionRules = () => {
- const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
-
- can(
- [
- ProjectPermissionSecretActions.DescribeAndReadValue,
- ProjectPermissionSecretActions.DescribeSecret,
- ProjectPermissionSecretActions.ReadValue,
- ProjectPermissionSecretActions.Edit,
- ProjectPermissionSecretActions.Create,
- ProjectPermissionSecretActions.Delete
- ],
- ProjectPermissionSub.Secrets
- );
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- ProjectPermissionSub.SecretFolders
- );
- can(
- [
- ProjectPermissionDynamicSecretActions.ReadRootCredential,
- ProjectPermissionDynamicSecretActions.EditRootCredential,
- ProjectPermissionDynamicSecretActions.CreateRootCredential,
- ProjectPermissionDynamicSecretActions.DeleteRootCredential,
- ProjectPermissionDynamicSecretActions.Lease
- ],
- ProjectPermissionSub.DynamicSecrets
- );
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- ProjectPermissionSub.SecretImports
- );
-
- can([ProjectPermissionActions.Read], ProjectPermissionSub.SecretApproval);
- can([ProjectPermissionSecretRotationActions.Read], ProjectPermissionSub.SecretRotation);
-
- can([ProjectPermissionActions.Read, ProjectPermissionActions.Create], ProjectPermissionSub.SecretRollback);
-
- can([ProjectPermissionMemberActions.Read, ProjectPermissionMemberActions.Create], ProjectPermissionSub.Member);
-
- can([ProjectPermissionGroupActions.Read], ProjectPermissionSub.Groups);
-
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- ProjectPermissionSub.Integrations
- );
-
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- ProjectPermissionSub.Webhooks
- );
-
- can(
- [
- ProjectPermissionIdentityActions.Read,
- ProjectPermissionIdentityActions.Edit,
- ProjectPermissionIdentityActions.Create,
- ProjectPermissionIdentityActions.Delete
- ],
- ProjectPermissionSub.Identity
- );
-
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- ProjectPermissionSub.ServiceTokens
- );
-
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- ProjectPermissionSub.Settings
- );
-
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- ProjectPermissionSub.Environments
- );
-
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- ProjectPermissionSub.Tags
- );
-
- can([ProjectPermissionActions.Read], ProjectPermissionSub.Role);
- can([ProjectPermissionActions.Read], ProjectPermissionSub.AuditLogs);
- can([ProjectPermissionActions.Read], ProjectPermissionSub.IpAllowList);
-
- // double check if all CRUD are needed for CA and Certificates
- can([ProjectPermissionActions.Read], ProjectPermissionSub.CertificateAuthorities);
-
- can(
- [
- ProjectPermissionActions.Read,
- ProjectPermissionActions.Edit,
- ProjectPermissionActions.Create,
- ProjectPermissionActions.Delete
- ],
- ProjectPermissionSub.Certificates
- );
-
- can([ProjectPermissionActions.Read], ProjectPermissionSub.CertificateTemplates);
-
- can([ProjectPermissionActions.Read], ProjectPermissionSub.PkiAlerts);
- can([ProjectPermissionActions.Read], ProjectPermissionSub.PkiCollections);
-
- can([ProjectPermissionActions.Read], ProjectPermissionSub.SshCertificates);
- can([ProjectPermissionActions.Create], ProjectPermissionSub.SshCertificates);
- can([ProjectPermissionActions.Read], ProjectPermissionSub.SshCertificateTemplates);
-
- can([ProjectPermissionSshHostActions.Read], ProjectPermissionSub.SshHosts);
-
- can(
- [
- ProjectPermissionCmekActions.Create,
- ProjectPermissionCmekActions.Edit,
- ProjectPermissionCmekActions.Delete,
- ProjectPermissionCmekActions.Read,
- ProjectPermissionCmekActions.Encrypt,
- ProjectPermissionCmekActions.Decrypt,
- ProjectPermissionCmekActions.Sign,
- ProjectPermissionCmekActions.Verify
- ],
- ProjectPermissionSub.Cmek
- );
-
- can(
- [
- ProjectPermissionSecretSyncActions.Create,
- ProjectPermissionSecretSyncActions.Edit,
- ProjectPermissionSecretSyncActions.Delete,
- ProjectPermissionSecretSyncActions.Read,
- ProjectPermissionSecretSyncActions.SyncSecrets,
- ProjectPermissionSecretSyncActions.ImportSecrets,
- ProjectPermissionSecretSyncActions.RemoveSecrets
- ],
- ProjectPermissionSub.SecretSyncs
- );
-
- can(
- [ProjectPermissionCommitsActions.Read, ProjectPermissionCommitsActions.PerformRollback],
- ProjectPermissionSub.Commits
- );
-
- return rules;
-};
-
-export const projectMemberPermissions = buildMemberPermissionRules();
-
-const buildViewerPermissionRules = () => {
- const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
-
- can(ProjectPermissionSecretActions.DescribeAndReadValue, ProjectPermissionSub.Secrets);
- can(ProjectPermissionSecretActions.DescribeSecret, ProjectPermissionSub.Secrets);
- can(ProjectPermissionSecretActions.ReadValue, ProjectPermissionSub.Secrets);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretFolders);
- can(ProjectPermissionDynamicSecretActions.ReadRootCredential, ProjectPermissionSub.DynamicSecrets);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretImports);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretApproval);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.SecretRollback);
- can(ProjectPermissionSecretRotationActions.Read, ProjectPermissionSub.SecretRotation);
- can(ProjectPermissionMemberActions.Read, ProjectPermissionSub.Member);
- can(ProjectPermissionGroupActions.Read, ProjectPermissionSub.Groups);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.Role);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.Webhooks);
- can(ProjectPermissionIdentityActions.Read, ProjectPermissionSub.Identity);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.ServiceTokens);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.Settings);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.Environments);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.AuditLogs);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.IpAllowList);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.CertificateAuthorities);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
- can(ProjectPermissionCmekActions.Read, ProjectPermissionSub.Cmek);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.SshCertificates);
- can(ProjectPermissionActions.Read, ProjectPermissionSub.SshCertificateTemplates);
- can(ProjectPermissionSecretSyncActions.Read, ProjectPermissionSub.SecretSyncs);
- can(ProjectPermissionCommitsActions.Read, ProjectPermissionSub.Commits);
-
- return rules;
-};
-
-export const projectViewerPermission = buildViewerPermissionRules();
-
-const buildNoAccessProjectPermission = () => {
- const { rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);
- return rules;
-};
-
export const buildServiceTokenProjectPermission = (
scopes: Array<{ secretPath: string; environment: string }>,
permission: string[]
@@ -1122,8 +779,6 @@ export const buildServiceTokenProjectPermission = (
return build({ conditionsMatcher });
};
-export const projectNoAccessPermissions = buildNoAccessProjectPermission();
-
/* eslint-disable */
/**
diff --git a/backend/src/ee/services/project-template/project-template-fns.ts b/backend/src/ee/services/project-template/project-template-fns.ts
index 2ca78e8762..8e8ebfa135 100644
--- a/backend/src/ee/services/project-template/project-template-fns.ts
+++ b/backend/src/ee/services/project-template/project-template-fns.ts
@@ -1,22 +1,27 @@
-import { ProjectTemplateDefaultEnvironments } from "@app/ee/services/project-template/project-template-constants";
+import { ProjectType } from "@app/db/schemas";
import {
InfisicalProjectTemplate,
TUnpackedPermission
} from "@app/ee/services/project-template/project-template-types";
import { getPredefinedRoles } from "@app/services/project-role/project-role-fns";
-export const getDefaultProjectTemplate = (orgId: string) => ({
+import { ProjectTemplateDefaultEnvironments } from "./project-template-constants";
+
+export const getDefaultProjectTemplate = (orgId: string, type: ProjectType) => ({
id: "b11b49a9-09a9-4443-916a-4246f9ff2c69", // random ID to appease zod
+ type,
name: InfisicalProjectTemplate.Default,
createdAt: new Date(),
updatedAt: new Date(),
- description: "Infisical's default project template",
- environments: ProjectTemplateDefaultEnvironments,
- roles: [...getPredefinedRoles("project-template")].map(({ name, slug, permissions }) => ({
- name,
- slug,
- permissions: permissions as TUnpackedPermission[]
- })),
+ description: `Infisical's ${type} default project template`,
+ environments: type === ProjectType.SecretManager ? ProjectTemplateDefaultEnvironments : null,
+ roles: [...getPredefinedRoles({ projectId: "project-template", projectType: type })].map(
+ ({ name, slug, permissions }) => ({
+ name,
+ slug,
+ permissions: permissions as TUnpackedPermission[]
+ })
+ ),
orgId
});
diff --git a/backend/src/ee/services/project-template/project-template-service.ts b/backend/src/ee/services/project-template/project-template-service.ts
index b2430ac14c..5b61639772 100644
--- a/backend/src/ee/services/project-template/project-template-service.ts
+++ b/backend/src/ee/services/project-template/project-template-service.ts
@@ -1,10 +1,11 @@
import { ForbiddenError } from "@casl/ability";
import { packRules } from "@casl/ability/extra";
-import { TProjectTemplates } from "@app/db/schemas";
+import { ProjectType, TProjectTemplates } from "@app/db/schemas";
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
+import { ProjectTemplateDefaultEnvironments } from "@app/ee/services/project-template/project-template-constants";
import { getDefaultProjectTemplate } from "@app/ee/services/project-template/project-template-fns";
import {
TCreateProjectTemplateDTO,
@@ -32,11 +33,13 @@ const $unpackProjectTemplate = ({ roles, environments, ...rest }: TProjectTempla
...rest,
environments: environments as TProjectTemplateEnvironment[],
roles: [
- ...getPredefinedRoles("project-template").map(({ name, slug, permissions }) => ({
- name,
- slug,
- permissions: permissions as TUnpackedPermission[]
- })),
+ ...getPredefinedRoles({ projectId: "project-template", projectType: rest.type as ProjectType }).map(
+ ({ name, slug, permissions }) => ({
+ name,
+ slug,
+ permissions: permissions as TUnpackedPermission[]
+ })
+ ),
...(roles as TProjectTemplateRole[]).map((role) => ({
...role,
permissions: unpackPermissions(role.permissions)
@@ -49,7 +52,7 @@ export const projectTemplateServiceFactory = ({
permissionService,
projectTemplateDAL
}: TProjectTemplatesServiceFactoryDep) => {
- const listProjectTemplatesByOrg = async (actor: OrgServiceActor) => {
+ const listProjectTemplatesByOrg = async (actor: OrgServiceActor, type?: ProjectType) => {
const plan = await licenseService.getPlan(actor.orgId);
if (!plan.projectTemplates)
@@ -68,11 +71,14 @@ export const projectTemplateServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Read, OrgPermissionSubjects.ProjectTemplates);
const projectTemplates = await projectTemplateDAL.find({
- orgId: actor.orgId
+ orgId: actor.orgId,
+ ...(type ? { type } : {})
});
return [
- getDefaultProjectTemplate(actor.orgId),
+ ...(type
+ ? [getDefaultProjectTemplate(actor.orgId, type)]
+ : Object.values(ProjectType).map((projectType) => getDefaultProjectTemplate(actor.orgId, projectType))),
...projectTemplates.map((template) => $unpackProjectTemplate(template))
];
};
@@ -134,7 +140,7 @@ export const projectTemplateServiceFactory = ({
};
const createProjectTemplate = async (
- { roles, environments, ...params }: TCreateProjectTemplateDTO,
+ { roles, environments, type, ...params }: TCreateProjectTemplateDTO,
actor: OrgServiceActor
) => {
const plan = await licenseService.getPlan(actor.orgId);
@@ -154,6 +160,17 @@ export const projectTemplateServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Create, OrgPermissionSubjects.ProjectTemplates);
+ if (environments && type !== ProjectType.SecretManager) {
+ throw new BadRequestError({ message: "Cannot configure environments for non-SecretManager project templates" });
+ }
+
+ if (environments && plan.environmentLimit !== null && environments.length > plan.environmentLimit) {
+ throw new BadRequestError({
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+ message: `Failed to create project template due to environment count exceeding your current limit of ${plan.environmentLimit}. Contact Infisical to increase limit.`
+ });
+ }
+
const isConflictingName = Boolean(
await projectTemplateDAL.findOne({
name: params.name,
@@ -169,8 +186,10 @@ export const projectTemplateServiceFactory = ({
const projectTemplate = await projectTemplateDAL.create({
...params,
roles: JSON.stringify(roles.map((role) => ({ ...role, permissions: packRules(role.permissions) }))),
- environments: JSON.stringify(environments),
- orgId: actor.orgId
+ environments:
+ type === ProjectType.SecretManager ? JSON.stringify(environments ?? ProjectTemplateDefaultEnvironments) : null,
+ orgId: actor.orgId,
+ type
});
return $unpackProjectTemplate(projectTemplate);
@@ -202,6 +221,19 @@ export const projectTemplateServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Edit, OrgPermissionSubjects.ProjectTemplates);
+ if (projectTemplate.type !== ProjectType.SecretManager && environments)
+ throw new BadRequestError({ message: "Cannot configure environments for non-SecretManager project templates" });
+
+ if (projectTemplate.type === ProjectType.SecretManager && environments === null)
+ throw new BadRequestError({ message: "Environments cannot be removed for SecretManager project templates" });
+
+ if (environments && plan.environmentLimit !== null && environments.length > plan.environmentLimit) {
+ throw new BadRequestError({
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+ message: `Failed to update project template due to environment count exceeding your current limit of ${plan.environmentLimit}. Contact Infisical to increase limit.`
+ });
+ }
+
if (params.name && projectTemplate.name !== params.name) {
const isConflictingName = Boolean(
await projectTemplateDAL.findOne({
diff --git a/backend/src/ee/services/project-template/project-template-types.ts b/backend/src/ee/services/project-template/project-template-types.ts
index c2764dc531..d53b2375e1 100644
--- a/backend/src/ee/services/project-template/project-template-types.ts
+++ b/backend/src/ee/services/project-template/project-template-types.ts
@@ -1,6 +1,6 @@
import { z } from "zod";
-import { TProjectEnvironments } from "@app/db/schemas";
+import { ProjectType, TProjectEnvironments } from "@app/db/schemas";
import { TProjectPermissionV2Schema } from "@app/ee/services/permission/project-permission";
import { UnpackedPermissionSchema } from "@app/server/routes/sanitizedSchema/permission";
@@ -15,8 +15,9 @@ export type TProjectTemplateRole = {
export type TCreateProjectTemplateDTO = {
name: string;
description?: string;
+ type: ProjectType;
roles: TProjectTemplateRole[];
- environments: TProjectTemplateEnvironment[];
+ environments?: TProjectTemplateEnvironment[] | null;
};
export type TUpdateProjectTemplateDTO = Partial<TCreateProjectTemplateDTO>;
diff --git a/backend/src/ee/services/secret-approval-request/secret-approval-request-dal.ts b/backend/src/ee/services/secret-approval-request/secret-approval-request-dal.ts
index be4a7ab3b5..3877cbaf89 100644
--- a/backend/src/ee/services/secret-approval-request/secret-approval-request-dal.ts
+++ b/backend/src/ee/services/secret-approval-request/secret-approval-request-dal.ts
@@ -334,7 +334,7 @@ export const secretApprovalRequestDALFactory = (db: TDbClient) => {
db.ref("secretId").withSchema(TableName.SecretApprovalRequestSecret).as("commitSecretId"),
db.ref("id").withSchema(TableName.SecretApprovalRequestSecret).as("commitId"),
db.raw(
- `DENSE_RANK() OVER (partition by ${TableName.Environment}."projectId" ORDER BY ${TableName.SecretApprovalRequest}."id" DESC) as rank`
+ `DENSE_RANK() OVER (PARTITION BY ${TableName.Environment}."projectId" ORDER BY ${TableName.SecretApprovalRequest}."createdAt" DESC) as rank`
),
db.ref("secretPath").withSchema(TableName.SecretApprovalPolicy).as("policySecretPath"),
db.ref("enforcementLevel").withSchema(TableName.SecretApprovalPolicy).as("policyEnforcementLevel"),
@@ -483,7 +483,7 @@ export const secretApprovalRequestDALFactory = (db: TDbClient) => {
db.ref("secretId").withSchema(TableName.SecretApprovalRequestSecretV2).as("commitSecretId"),
db.ref("id").withSchema(TableName.SecretApprovalRequestSecretV2).as("commitId"),
db.raw(
- `DENSE_RANK() OVER (partition by ${TableName.Environment}."projectId" ORDER BY ${TableName.SecretApprovalRequest}."id" DESC) as rank`
+ `DENSE_RANK() OVER (PARTITION BY ${TableName.Environment}."projectId" ORDER BY ${TableName.SecretApprovalRequest}."createdAt" DESC) as rank`
),
db.ref("secretPath").withSchema(TableName.SecretApprovalPolicy).as("policySecretPath"),
db.ref("allowedSelfApprovals").withSchema(TableName.SecretApprovalPolicy).as("policyAllowedSelfApprovals"),
diff --git a/backend/src/ee/services/secret-scanning/secret-scanning-fns.ts b/backend/src/ee/services/secret-scanning/secret-scanning-fns.ts
new file mode 100644
index 0000000000..b1e2e0bbb0
--- /dev/null
+++ b/backend/src/ee/services/secret-scanning/secret-scanning-fns.ts
@@ -0,0 +1,11 @@
+import { getConfig } from "@app/lib/config/env";
+
+export const canUseSecretScanning = (orgId: string) => {
+ const appCfg = getConfig();
+
+ if (!appCfg.isCloud) {
+ return true;
+ }
+
+ return appCfg.SECRET_SCANNING_ORG_WHITELIST?.includes(orgId);
+};
diff --git a/backend/src/ee/services/secret-scanning/secret-scanning-service.ts b/backend/src/ee/services/secret-scanning/secret-scanning-service.ts
index c5e7be9d89..7d41091fc3 100644
--- a/backend/src/ee/services/secret-scanning/secret-scanning-service.ts
+++ b/backend/src/ee/services/secret-scanning/secret-scanning-service.ts
@@ -12,6 +12,7 @@ import { NotFoundError } from "@app/lib/errors";
import { TGitAppDALFactory } from "./git-app-dal";
import { TGitAppInstallSessionDALFactory } from "./git-app-install-session-dal";
import { TSecretScanningDALFactory } from "./secret-scanning-dal";
+import { canUseSecretScanning } from "./secret-scanning-fns";
import { TSecretScanningQueueFactory } from "./secret-scanning-queue";
import {
SecretScanningRiskStatus,
@@ -47,12 +48,14 @@ export const secretScanningServiceFactory = ({
actorAuthMethod,
actorOrgId
}: TInstallAppSessionDTO) => {
+ const appCfg = getConfig();
+
const { permission } = await permissionService.getOrgPermission(actor, actorId, orgId, actorAuthMethod, actorOrgId);
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Create, OrgPermissionSubjects.SecretScanning);
const sessionId = crypto.randomBytes(16).toString("hex");
await gitAppInstallSessionDAL.upsert({ orgId, sessionId, userId: actorId });
- return { sessionId };
+ return { sessionId, gitAppSlug: appCfg.SECRET_SCANNING_GIT_APP_SLUG };
};
const linkInstallationToOrg = async ({
@@ -91,7 +94,8 @@ export const secretScanningServiceFactory = ({
const {
data: { repositories }
} = await octokit.apps.listReposAccessibleToInstallation();
- if (appCfg.SECRET_SCANNING_ORG_WHITELIST?.includes(actorOrgId)) {
+
+ if (canUseSecretScanning(actorOrgId)) {
await Promise.all(
repositories.map(({ id, full_name }) =>
secretScanningQueue.startFullRepoScan({
@@ -102,6 +106,7 @@ export const secretScanningServiceFactory = ({
)
);
}
+
return { installatedApp };
};
@@ -164,7 +169,6 @@ export const secretScanningServiceFactory = ({
};
const handleRepoPushEvent = async (payload: WebhookEventMap["push"]) => {
- const appCfg = getConfig();
const { commits, repository, installation, pusher } = payload;
if (!commits || !repository || !installation || !pusher) {
return;
@@ -175,7 +179,7 @@ export const secretScanningServiceFactory = ({
});
if (!installationLink) return;
- if (appCfg.SECRET_SCANNING_ORG_WHITELIST?.includes(installationLink.orgId)) {
+ if (canUseSecretScanning(installationLink.orgId)) {
await secretScanningQueue.startPushEventScan({
commits,
pusher: { name: pusher.name, email: pusher.email },
diff --git a/backend/src/ee/services/ssh-host-group/ssh-host-group-dal.ts b/backend/src/ee/services/ssh-host-group/ssh-host-group-dal.ts
index 08242d4cb6..2f57cce3a2 100644
--- a/backend/src/ee/services/ssh-host-group/ssh-host-group-dal.ts
+++ b/backend/src/ee/services/ssh-host-group/ssh-host-group-dal.ts
@@ -28,6 +28,7 @@ export const sshHostGroupDALFactory = (db: TDbClient) => {
`${TableName.SshHostLoginUserMapping}.sshHostLoginUserId`
)
.leftJoin(TableName.Users, `${TableName.SshHostLoginUserMapping}.userId`, `${TableName.Users}.id`)
+ .leftJoin(TableName.Groups, `${TableName.SshHostLoginUserMapping}.groupId`, `${TableName.Groups}.id`)
.where(`${TableName.SshHostGroup}.projectId`, projectId)
.select(
db.ref("id").withSchema(TableName.SshHostGroup).as("sshHostGroupId"),
@@ -35,7 +36,8 @@ export const sshHostGroupDALFactory = (db: TDbClient) => {
db.ref("name").withSchema(TableName.SshHostGroup),
db.ref("loginUser").withSchema(TableName.SshHostLoginUser),
db.ref("username").withSchema(TableName.Users),
- db.ref("userId").withSchema(TableName.SshHostLoginUserMapping)
+ db.ref("userId").withSchema(TableName.SshHostLoginUserMapping),
+ db.ref("slug").withSchema(TableName.Groups).as("groupSlug")
)
.orderBy(`${TableName.SshHostGroup}.updatedAt`, "desc");
@@ -69,7 +71,8 @@ export const sshHostGroupDALFactory = (db: TDbClient) => {
const loginMappings = Object.entries(loginMappingGrouped).map(([loginUser, entries]) => ({
loginUser,
allowedPrincipals: {
- usernames: unique(entries.map((e) => e.username)).filter(Boolean)
+ usernames: unique(entries.map((e) => e.username)).filter(Boolean),
+ groups: unique(entries.map((e) => e.groupSlug)).filter(Boolean)
}
}));
return {
@@ -99,6 +102,7 @@ export const sshHostGroupDALFactory = (db: TDbClient) => {
`${TableName.SshHostLoginUserMapping}.sshHostLoginUserId`
)
.leftJoin(TableName.Users, `${TableName.SshHostLoginUserMapping}.userId`, `${TableName.Users}.id`)
+ .leftJoin(TableName.Groups, `${TableName.SshHostLoginUserMapping}.groupId`, `${TableName.Groups}.id`)
.where(`${TableName.SshHostGroup}.id`, sshHostGroupId)
.select(
db.ref("id").withSchema(TableName.SshHostGroup).as("sshHostGroupId"),
@@ -106,7 +110,8 @@ export const sshHostGroupDALFactory = (db: TDbClient) => {
db.ref("name").withSchema(TableName.SshHostGroup),
db.ref("loginUser").withSchema(TableName.SshHostLoginUser),
db.ref("username").withSchema(TableName.Users),
- db.ref("userId").withSchema(TableName.SshHostLoginUserMapping)
+ db.ref("userId").withSchema(TableName.SshHostLoginUserMapping),
+ db.ref("slug").withSchema(TableName.Groups).as("groupSlug")
);
if (rows.length === 0) return null;
@@ -121,7 +126,8 @@ export const sshHostGroupDALFactory = (db: TDbClient) => {
const loginMappings = Object.entries(loginMappingGrouped).map(([loginUser, entries]) => ({
loginUser,
allowedPrincipals: {
- usernames: unique(entries.map((e) => e.username)).filter(Boolean)
+ usernames: unique(entries.map((e) => e.username)).filter(Boolean),
+ groups: unique(entries.map((e) => e.groupSlug)).filter(Boolean)
}
}));
diff --git a/backend/src/ee/services/ssh-host-group/ssh-host-group-service.ts b/backend/src/ee/services/ssh-host-group/ssh-host-group-service.ts
index 751116895b..1137660d63 100644
--- a/backend/src/ee/services/ssh-host-group/ssh-host-group-service.ts
+++ b/backend/src/ee/services/ssh-host-group/ssh-host-group-service.ts
@@ -12,6 +12,7 @@ import { BadRequestError, NotFoundError } from "@app/lib/errors";
import { TProjectDALFactory } from "@app/services/project/project-dal";
import { TUserDALFactory } from "@app/services/user/user-dal";
+import { TGroupDALFactory } from "../group/group-dal";
import { TLicenseServiceFactory } from "../license/license-service";
import { createSshLoginMappings } from "../ssh-host/ssh-host-fns";
import {
@@ -43,8 +44,12 @@ type TSshHostGroupServiceFactoryDep = {
sshHostLoginUserDAL: Pick<TSshHostLoginUserDALFactory, "create" | "transaction" | "delete">;
sshHostLoginUserMappingDAL: Pick<TSshHostLoginUserMappingDALFactory, "insertMany">;
userDAL: Pick<TUserDALFactory, "find">;
- permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getUserProjectPermission">;
+ permissionService: Pick<
+ TPermissionServiceFactory,
+ "getProjectPermission" | "getUserProjectPermission" | "checkGroupProjectPermission"
+ >;
licenseService: Pick<TLicenseServiceFactory, "getPlan">;
+ groupDAL: Pick<TGroupDALFactory, "findGroupsByProjectId">;
};
export type TSshHostGroupServiceFactory = ReturnType<typeof sshHostGroupServiceFactory>;
@@ -58,7 +63,8 @@ export const sshHostGroupServiceFactory = ({
sshHostLoginUserMappingDAL,
userDAL,
permissionService,
- licenseService
+ licenseService,
+ groupDAL
}: TSshHostGroupServiceFactoryDep) => {
const createSshHostGroup = async ({
projectId,
@@ -127,6 +133,7 @@ export const sshHostGroupServiceFactory = ({
loginMappings,
sshHostLoginUserDAL,
sshHostLoginUserMappingDAL,
+ groupDAL,
userDAL,
permissionService,
projectId,
@@ -179,13 +186,42 @@ export const sshHostGroupServiceFactory = ({
});
const updatedSshHostGroup = await sshHostGroupDAL.transaction(async (tx) => {
- await sshHostGroupDAL.updateById(
- sshHostGroupId,
- {
- name
- },
- tx
- );
+ if (name && name !== sshHostGroup.name) {
+ // (dangtony98): room to optimize check to ensure that
+ // the SSH host group name is unique across the whole org
+ const project = await projectDAL.findById(sshHostGroup.projectId, tx);
+ if (!project) throw new NotFoundError({ message: `Project with ID '${sshHostGroup.projectId}' not found` });
+ const projects = await projectDAL.find(
+ {
+ orgId: project.orgId
+ },
+ { tx }
+ );
+
+ const existingSshHostGroup = await sshHostGroupDAL.find(
+ {
+ name,
+ $in: {
+ projectId: projects.map((p) => p.id)
+ }
+ },
+ { tx }
+ );
+
+ if (existingSshHostGroup.length) {
+ throw new BadRequestError({
+ message: `SSH host group with name '${name}' already exists in the organization`
+ });
+ }
+ await sshHostGroupDAL.updateById(
+ sshHostGroupId,
+ {
+ name
+ },
+ tx
+ );
+ }
+
if (loginMappings) {
await sshHostLoginUserDAL.delete({ sshHostGroupId: sshHostGroup.id }, tx);
if (loginMappings.length) {
@@ -194,6 +230,7 @@ export const sshHostGroupServiceFactory = ({
loginMappings,
sshHostLoginUserDAL,
sshHostLoginUserMappingDAL,
+ groupDAL,
userDAL,
permissionService,
projectId: sshHostGroup.projectId,
diff --git a/backend/src/ee/services/ssh-host-group/ssh-host-group-types.ts b/backend/src/ee/services/ssh-host-group/ssh-host-group-types.ts
index 3485b5d26e..52f805f024 100644
--- a/backend/src/ee/services/ssh-host-group/ssh-host-group-types.ts
+++ b/backend/src/ee/services/ssh-host-group/ssh-host-group-types.ts
@@ -9,12 +9,7 @@ export type TCreateSshHostGroupDTO = {
export type TUpdateSshHostGroupDTO = {
sshHostGroupId: string;
name?: string;
- loginMappings?: {
- loginUser: string;
- allowedPrincipals: {
- usernames: string[];
- };
- }[];
+ loginMappings?: TLoginMapping[];
} & Omit<TProjectPermission, "projectId">;
export type TGetSshHostGroupDTO = {
diff --git a/backend/src/ee/services/ssh-host/ssh-host-dal.ts b/backend/src/ee/services/ssh-host/ssh-host-dal.ts
index e66f7da7a6..3b8564ce27 100644
--- a/backend/src/ee/services/ssh-host/ssh-host-dal.ts
+++ b/backend/src/ee/services/ssh-host/ssh-host-dal.ts
@@ -31,8 +31,18 @@ export const sshHostDALFactory = (db: TDbClient) => {
`${TableName.SshHostLoginUser}.id`,
`${TableName.SshHostLoginUserMapping}.sshHostLoginUserId`
)
+ .leftJoin(TableName.Users, `${TableName.Users}.id`, `${TableName.SshHostLoginUserMapping}.userId`)
+ .leftJoin(
+ TableName.UserGroupMembership,
+ `${TableName.UserGroupMembership}.groupId`,
+ `${TableName.SshHostLoginUserMapping}.groupId`
+ )
.whereIn(`${TableName.SshHost}.projectId`, projectIds)
- .andWhere(`${TableName.SshHostLoginUserMapping}.userId`, userId)
+ .andWhere((bd) => {
+ void bd
+ .where(`${TableName.SshHostLoginUserMapping}.userId`, userId)
+ .orWhere(`${TableName.UserGroupMembership}.userId`, userId);
+ })
.select(
db.ref("id").withSchema(TableName.SshHost).as("sshHostId"),
db.ref("projectId").withSchema(TableName.SshHost),
@@ -58,8 +68,17 @@ export const sshHostDALFactory = (db: TDbClient) => {
`${TableName.SshHostLoginUserMapping}.sshHostLoginUserId`
)
.join(TableName.SshHost, `${TableName.SshHostGroupMembership}.sshHostId`, `${TableName.SshHost}.id`)
+ .leftJoin(
+ TableName.UserGroupMembership,
+ `${TableName.UserGroupMembership}.groupId`,
+ `${TableName.SshHostLoginUserMapping}.groupId`
+ )
.whereIn(`${TableName.SshHost}.projectId`, projectIds)
- .andWhere(`${TableName.SshHostLoginUserMapping}.userId`, userId)
+ .andWhere((bd) => {
+ void bd
+ .where(`${TableName.SshHostLoginUserMapping}.userId`, userId)
+ .orWhere(`${TableName.UserGroupMembership}.userId`, userId);
+ })
.select(
db.ref("id").withSchema(TableName.SshHost).as("sshHostId"),
db.ref("projectId").withSchema(TableName.SshHost),
@@ -133,6 +152,7 @@ export const sshHostDALFactory = (db: TDbClient) => {
`${TableName.SshHostLoginUserMapping}.sshHostLoginUserId`
)
.leftJoin(TableName.Users, `${TableName.SshHostLoginUserMapping}.userId`, `${TableName.Users}.id`)
+ .leftJoin(TableName.Groups, `${TableName.SshHostLoginUserMapping}.groupId`, `${TableName.Groups}.id`)
.where(`${TableName.SshHost}.projectId`, projectId)
.select(
db.ref("id").withSchema(TableName.SshHost).as("sshHostId"),
@@ -144,6 +164,7 @@ export const sshHostDALFactory = (db: TDbClient) => {
db.ref("loginUser").withSchema(TableName.SshHostLoginUser),
db.ref("username").withSchema(TableName.Users),
db.ref("userId").withSchema(TableName.SshHostLoginUserMapping),
+ db.ref("slug").withSchema(TableName.Groups).as("groupSlug"),
db.ref("userSshCaId").withSchema(TableName.SshHost),
db.ref("hostSshCaId").withSchema(TableName.SshHost)
)
@@ -163,10 +184,12 @@ export const sshHostDALFactory = (db: TDbClient) => {
`${TableName.SshHostLoginUserMapping}.sshHostLoginUserId`
)
.leftJoin(TableName.Users, `${TableName.SshHostLoginUserMapping}.userId`, `${TableName.Users}.id`)
+ .leftJoin(TableName.Groups, `${TableName.SshHostLoginUserMapping}.groupId`, `${TableName.Groups}.id`)
.select(
db.ref("sshHostId").withSchema(TableName.SshHostGroupMembership),
db.ref("loginUser").withSchema(TableName.SshHostLoginUser),
- db.ref("username").withSchema(TableName.Users)
+ db.ref("username").withSchema(TableName.Users),
+ db.ref("slug").withSchema(TableName.Groups).as("groupSlug")
)
.whereIn(`${TableName.SshHostGroupMembership}.sshHostId`, hostIds);
@@ -185,7 +208,8 @@ export const sshHostDALFactory = (db: TDbClient) => {
const directMappings = Object.entries(loginMappingGrouped).map(([loginUser, entries]) => ({
loginUser,
allowedPrincipals: {
- usernames: unique(entries.map((e) => e.username)).filter(Boolean)
+ usernames: unique(entries.map((e) => e.username)).filter(Boolean),
+ groups: unique(entries.map((e) => e.groupSlug)).filter(Boolean)
},
source: LoginMappingSource.HOST
}));
@@ -197,7 +221,8 @@ export const sshHostDALFactory = (db: TDbClient) => {
const groupMappings = Object.entries(inheritedGrouped).map(([loginUser, entries]) => ({
loginUser,
allowedPrincipals: {
- usernames: unique(entries.map((e) => e.username)).filter(Boolean)
+ usernames: unique(entries.map((e) => e.username)).filter(Boolean),
+ groups: unique(entries.map((e) => e.groupSlug)).filter(Boolean)
},
source: LoginMappingSource.HOST_GROUP
}));
@@ -229,6 +254,7 @@ export const sshHostDALFactory = (db: TDbClient) => {
`${TableName.SshHostLoginUserMapping}.sshHostLoginUserId`
)
.leftJoin(TableName.Users, `${TableName.SshHostLoginUserMapping}.userId`, `${TableName.Users}.id`)
+ .leftJoin(TableName.Groups, `${TableName.SshHostLoginUserMapping}.groupId`, `${TableName.Groups}.id`)
.where(`${TableName.SshHost}.id`, sshHostId)
.select(
db.ref("id").withSchema(TableName.SshHost).as("sshHostId"),
@@ -241,7 +267,8 @@ export const sshHostDALFactory = (db: TDbClient) => {
db.ref("username").withSchema(TableName.Users),
db.ref("userId").withSchema(TableName.SshHostLoginUserMapping),
db.ref("userSshCaId").withSchema(TableName.SshHost),
- db.ref("hostSshCaId").withSchema(TableName.SshHost)
+ db.ref("hostSshCaId").withSchema(TableName.SshHost),
+ db.ref("slug").withSchema(TableName.Groups).as("groupSlug")
);
if (rows.length === 0) return null;
@@ -257,7 +284,8 @@ export const sshHostDALFactory = (db: TDbClient) => {
const directMappings = Object.entries(directGrouped).map(([loginUser, entries]) => ({
loginUser,
allowedPrincipals: {
- usernames: unique(entries.map((e) => e.username)).filter(Boolean)
+ usernames: unique(entries.map((e) => e.username)).filter(Boolean),
+ groups: unique(entries.map((e) => e.groupSlug)).filter(Boolean)
},
source: LoginMappingSource.HOST
}));
@@ -275,10 +303,12 @@ export const sshHostDALFactory = (db: TDbClient) => {
`${TableName.SshHostLoginUserMapping}.sshHostLoginUserId`
)
.leftJoin(TableName.Users, `${TableName.SshHostLoginUserMapping}.userId`, `${TableName.Users}.id`)
+ .leftJoin(TableName.Groups, `${TableName.SshHostLoginUserMapping}.groupId`, `${TableName.Groups}.id`)
.where(`${TableName.SshHostGroupMembership}.sshHostId`, sshHostId)
.select(
db.ref("loginUser").withSchema(TableName.SshHostLoginUser),
- db.ref("username").withSchema(TableName.Users)
+ db.ref("username").withSchema(TableName.Users),
+ db.ref("slug").withSchema(TableName.Groups).as("groupSlug")
);
const groupGrouped = groupBy(
@@ -289,7 +319,8 @@ export const sshHostDALFactory = (db: TDbClient) => {
const groupMappings = Object.entries(groupGrouped).map(([loginUser, entries]) => ({
loginUser,
allowedPrincipals: {
- usernames: unique(entries.map((e) => e.username)).filter(Boolean)
+ usernames: unique(entries.map((e) => e.username)).filter(Boolean),
+ groups: unique(entries.map((e) => e.groupSlug)).filter(Boolean)
},
source: LoginMappingSource.HOST_GROUP
}));
diff --git a/backend/src/ee/services/ssh-host/ssh-host-fns.ts b/backend/src/ee/services/ssh-host/ssh-host-fns.ts
index 9b9ce26422..dec15e093f 100644
--- a/backend/src/ee/services/ssh-host/ssh-host-fns.ts
+++ b/backend/src/ee/services/ssh-host/ssh-host-fns.ts
@@ -3,6 +3,7 @@ import { Knex } from "knex";
import { ActionProjectType } from "@app/db/schemas";
import { BadRequestError } from "@app/lib/errors";
+import { ProjectPermissionSshHostActions, ProjectPermissionSub } from "../permission/project-permission";
import { TCreateSshLoginMappingsDTO } from "./ssh-host-types";
/**
@@ -15,6 +16,7 @@ export const createSshLoginMappings = async ({
loginMappings,
sshHostLoginUserDAL,
sshHostLoginUserMappingDAL,
+ groupDAL,
userDAL,
permissionService,
projectId,
@@ -35,7 +37,7 @@ export const createSshLoginMappings = async ({
tx
);
- if (allowedPrincipals.usernames.length > 0) {
+ if (allowedPrincipals.usernames && allowedPrincipals.usernames.length > 0) {
const users = await userDAL.find(
{
$in: {
@@ -74,6 +76,41 @@ export const createSshLoginMappings = async ({
tx
);
}
+
+ if (allowedPrincipals.groups && allowedPrincipals.groups.length > 0) {
+ const projectGroups = await groupDAL.findGroupsByProjectId(projectId);
+ const groups = projectGroups.filter((g) => allowedPrincipals.groups?.includes(g.slug));
+
+ if (groups.length !== allowedPrincipals.groups?.length) {
+ throw new BadRequestError({
+ message: `Invalid group slugs: ${allowedPrincipals.groups
+ .filter((g) => !projectGroups.some((pg) => pg.slug === g))
+ .join(", ")}`
+ });
+ }
+
+ for await (const group of groups) {
+ // check that each group has access to the SSH project and have read access to hosts
+ const hasPermission = await permissionService.checkGroupProjectPermission({
+ groupId: group.id,
+ projectId,
+ checkPermissions: [ProjectPermissionSshHostActions.Read, ProjectPermissionSub.SshHosts]
+ });
+ if (!hasPermission) {
+ throw new BadRequestError({
+ message: `Group ${group.slug} does not have access to the SSH project`
+ });
+ }
+ }
+
+ await sshHostLoginUserMappingDAL.insertMany(
+ groups.map((group) => ({
+ sshHostLoginUserId: sshHostLoginUser.id,
+ groupId: group.id
+ })),
+ tx
+ );
+ }
}
};
diff --git a/backend/src/ee/services/ssh-host/ssh-host-schema.ts b/backend/src/ee/services/ssh-host/ssh-host-schema.ts
index a9b674991b..c8acb37bf5 100644
--- a/backend/src/ee/services/ssh-host/ssh-host-schema.ts
+++ b/backend/src/ee/services/ssh-host/ssh-host-schema.ts
@@ -15,7 +15,24 @@ export const sanitizedSshHost = SshHostsSchema.pick({
export const loginMappingSchema = z.object({
loginUser: z.string().trim(),
- allowedPrincipals: z.object({
- usernames: z.array(z.string().trim()).transform((usernames) => Array.from(new Set(usernames)))
- })
+ allowedPrincipals: z
+ .object({
+ usernames: z
+ .array(z.string().trim())
+ .transform((usernames) => Array.from(new Set(usernames)))
+ .optional(),
+ groups: z
+ .array(z.string().trim())
+ .transform((groups) => Array.from(new Set(groups)))
+ .optional()
+ })
+ .refine(
+ (data) => {
+ return (data.usernames && data.usernames.length > 0) || (data.groups && data.groups.length > 0);
+ },
+ {
+ message: "At least one username or group must be provided",
+ path: ["allowedPrincipals"]
+ }
+ )
});
diff --git a/backend/src/ee/services/ssh-host/ssh-host-service.ts b/backend/src/ee/services/ssh-host/ssh-host-service.ts
index 87f4862bb6..e41a8b403b 100644
--- a/backend/src/ee/services/ssh-host/ssh-host-service.ts
+++ b/backend/src/ee/services/ssh-host/ssh-host-service.ts
@@ -1,6 +1,7 @@
import { ForbiddenError, subject } from "@casl/ability";
import { ActionProjectType, ProjectType } from "@app/db/schemas";
+import { TGroupDALFactory } from "@app/ee/services/group/group-dal";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
import { ProjectPermissionSshHostActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
import { TSshCertificateAuthorityDALFactory } from "@app/ee/services/ssh/ssh-certificate-authority-dal";
@@ -19,6 +20,7 @@ import { TProjectDALFactory } from "@app/services/project/project-dal";
import { TProjectSshConfigDALFactory } from "@app/services/project/project-ssh-config-dal";
import { TUserDALFactory } from "@app/services/user/user-dal";
+import { TUserGroupMembershipDALFactory } from "../group/user-group-membership-dal";
import {
convertActorToPrincipals,
createSshCert,
@@ -39,12 +41,14 @@ import {
type TSshHostServiceFactoryDep = {
userDAL: Pick<TUserDALFactory, "findById" | "find">;
+ groupDAL: Pick<TGroupDALFactory, "findGroupsByProjectId">;
projectDAL: Pick<TProjectDALFactory, "find">;
projectSshConfigDAL: Pick<TProjectSshConfigDALFactory, "findOne">;
sshCertificateAuthorityDAL: Pick<TSshCertificateAuthorityDALFactory, "findOne">;
sshCertificateAuthoritySecretDAL: Pick<TSshCertificateAuthoritySecretDALFactory, "findOne">;
sshCertificateDAL: Pick<TSshCertificateDALFactory, "create" | "transaction">;
sshCertificateBodyDAL: Pick<TSshCertificateBodyDALFactory, "create">;
+ userGroupMembershipDAL: Pick<TUserGroupMembershipDALFactory, "findGroupMembershipsByUserIdInOrg">;
sshHostDAL: Pick<
TSshHostDALFactory,
| "transaction"
@@ -58,7 +62,10 @@ type TSshHostServiceFactoryDep = {
>;
sshHostLoginUserDAL: TSshHostLoginUserDALFactory;
sshHostLoginUserMappingDAL: TSshHostLoginUserMappingDALFactory;
- permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getUserProjectPermission">;
+ permissionService: Pick<
+ TPermissionServiceFactory,
+ "getProjectPermission" | "getUserProjectPermission" | "checkGroupProjectPermission"
+ >;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
};
@@ -66,6 +73,8 @@ export type TSshHostServiceFactory = ReturnType<typeof sshHostServiceFactory>;
export const sshHostServiceFactory = ({
userDAL,
+ userGroupMembershipDAL,
+ groupDAL,
projectDAL,
projectSshConfigDAL,
sshCertificateAuthorityDAL,
@@ -208,6 +217,7 @@ export const sshHostServiceFactory = ({
loginMappings,
sshHostLoginUserDAL,
sshHostLoginUserMappingDAL,
+ groupDAL,
userDAL,
permissionService,
projectId,
@@ -278,6 +288,7 @@ export const sshHostServiceFactory = ({
loginMappings,
sshHostLoginUserDAL,
sshHostLoginUserMappingDAL,
+ groupDAL,
userDAL,
permissionService,
projectId: host.projectId,
@@ -324,7 +335,7 @@ export const sshHostServiceFactory = ({
return host;
};
- const getSshHost = async ({ sshHostId, actorId, actorAuthMethod, actor, actorOrgId }: TGetSshHostDTO) => {
+ const getSshHostById = async ({ sshHostId, actorId, actorAuthMethod, actor, actorOrgId }: TGetSshHostDTO) => {
const host = await sshHostDAL.findSshHostByIdWithLoginMappings(sshHostId);
if (!host) {
throw new NotFoundError({
@@ -387,10 +398,14 @@ export const sshHostServiceFactory = ({
userDAL
});
+ const userGroups = await userGroupMembershipDAL.findGroupMembershipsByUserIdInOrg(actorId, actorOrgId);
+ const userGroupSlugs = userGroups.map((g) => g.groupSlug);
+
const mapping = host.loginMappings.find(
(m) =>
m.loginUser === loginUser &&
- m.allowedPrincipals.usernames.some((allowed) => internalPrincipals.includes(allowed))
+ (m.allowedPrincipals.usernames?.some((allowed) => internalPrincipals.includes(allowed)) ||
+ m.allowedPrincipals.groups?.some((allowed) => userGroupSlugs.includes(allowed)))
);
if (!mapping) {
@@ -616,7 +631,7 @@ export const sshHostServiceFactory = ({
createSshHost,
updateSshHost,
deleteSshHost,
- getSshHost,
+ getSshHostById,
issueSshHostUserCert,
issueSshHostHostCert,
getSshHostUserCaPk,
diff --git a/backend/src/ee/services/ssh-host/ssh-host-types.ts b/backend/src/ee/services/ssh-host/ssh-host-types.ts
index 9846920b78..c0a780fbb8 100644
--- a/backend/src/ee/services/ssh-host/ssh-host-types.ts
+++ b/backend/src/ee/services/ssh-host/ssh-host-types.ts
@@ -7,12 +7,15 @@ import { TProjectPermission } from "@app/lib/types";
import { ActorAuthMethod } from "@app/services/auth/auth-type";
import { TUserDALFactory } from "@app/services/user/user-dal";
+import { TGroupDALFactory } from "../group/group-dal";
+
export type TListSshHostsDTO = Omit<TProjectPermission, "projectId">;
export type TLoginMapping = {
loginUser: string;
allowedPrincipals: {
- usernames: string[];
+ usernames?: string[];
+ groups?: string[];
};
};
@@ -63,7 +66,8 @@ type BaseCreateSshLoginMappingsDTO = {
sshHostLoginUserDAL: Pick<TSshHostLoginUserDALFactory, "create" | "transaction">;
sshHostLoginUserMappingDAL: Pick<TSshHostLoginUserMappingDALFactory, "insertMany">;
userDAL: Pick<TUserDALFactory, "find">;
- permissionService: Pick<TPermissionServiceFactory, "getUserProjectPermission">;
+ permissionService: Pick<TPermissionServiceFactory, "getUserProjectPermission" | "checkGroupProjectPermission">;
+ groupDAL: Pick<TGroupDALFactory, "findGroupsByProjectId">;
projectId: string;
actorAuthMethod: ActorAuthMethod;
actorOrgId: string;
diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.ts
index ac28e9ade5..6da6c4fa43 100644
--- a/backend/src/keystore/keystore.ts
+++ b/backend/src/keystore/keystore.ts
@@ -1,6 +1,8 @@
import { Redis } from "ioredis";
import { pgAdvisoryLockHashText } from "@app/lib/crypto/hashtext";
+import { applyJitter } from "@app/lib/dates";
+import { delay as delayMs } from "@app/lib/delay";
import { Redlock, Settings } from "@app/lib/red-lock";
export const PgSqlLock = {
@@ -48,6 +50,13 @@ export const KeyStoreTtls = {
AccessTokenStatusUpdateInSeconds: 120
};
+type TDeleteItems = {
+ pattern: string;
+ batchSize?: number;
+ delay?: number;
+ jitter?: number;
+};
+
type TWaitTillReady = {
key: string;
waitingCb?: () => void;
@@ -75,6 +84,35 @@ export const keyStoreFactory = (redisUrl: string) => {
const deleteItem = async (key: string) => redis.del(key);
+ const deleteItems = async ({ pattern, batchSize = 500, delay = 1500, jitter = 200 }: TDeleteItems) => {
+ let cursor = "0";
+ let totalDeleted = 0;
+
+ do {
+ // Await in loop is needed so that Redis is not overwhelmed
+ // eslint-disable-next-line no-await-in-loop
+ const [nextCursor, keys] = await redis.scan(cursor, "MATCH", pattern, "COUNT", 1000); // Count should be 1000 - 5000 for prod loads
+ cursor = nextCursor;
+
+ for (let i = 0; i < keys.length; i += batchSize) {
+ const batch = keys.slice(i, i + batchSize);
+ const pipeline = redis.pipeline();
+ for (const key of batch) {
+ pipeline.unlink(key);
+ }
+ // eslint-disable-next-line no-await-in-loop
+ await pipeline.exec();
+ totalDeleted += batch.length;
+ console.log("BATCH DONE");
+
+ // eslint-disable-next-line no-await-in-loop
+ await delayMs(Math.max(0, applyJitter(delay, jitter)));
+ }
+ } while (cursor !== "0");
+
+ return totalDeleted;
+ };
+
const incrementBy = async (key: string, value: number) => redis.incrby(key, value);
const setExpiry = async (key: string, expiryInSeconds: number) => redis.expire(key, expiryInSeconds);
@@ -94,7 +132,7 @@ export const keyStoreFactory = (redisUrl: string) => {
// eslint-disable-next-line
await new Promise((resolve) => {
waitingCb?.();
- setTimeout(resolve, Math.max(0, delay + Math.floor((Math.random() * 2 - 1) * jitter)));
+ setTimeout(resolve, Math.max(0, applyJitter(delay, jitter)));
});
attempts += 1;
// eslint-disable-next-line
@@ -108,6 +146,7 @@ export const keyStoreFactory = (redisUrl: string) => {
setExpiry,
setItemWithExpiry,
deleteItem,
+ deleteItems,
incrementBy,
acquireLock(resources: string[], duration: number, settings?: Partial<Settings>) {
return redisLock.acquire(resources, duration, settings);
diff --git a/backend/src/keystore/memory.ts b/backend/src/keystore/memory.ts
index 10b28ffeca..84cd06c036 100644
--- a/backend/src/keystore/memory.ts
+++ b/backend/src/keystore/memory.ts
@@ -1,3 +1,7 @@
+import RE2 from "re2";
+
+import { applyJitter } from "@app/lib/dates";
+import { delay as delayMs } from "@app/lib/delay";
import { Lock } from "@app/lib/red-lock";
import { TKeyStoreFactory } from "./keystore";
@@ -19,6 +23,27 @@ export const inMemoryKeyStore = (): TKeyStoreFactory => {
delete store[key];
return 1;
},
+ deleteItems: async ({ pattern, batchSize = 500, delay = 1500, jitter = 200 }) => {
+ const regex = new RE2(`^${pattern.replace(/[-[\]/{}()+?.\\^$|]/g, "\\$&").replace(/\*/g, ".*")}$`);
+ let totalDeleted = 0;
+ const keys = Object.keys(store);
+
+ for (let i = 0; i < keys.length; i += batchSize) {
+ const batch = keys.slice(i, i + batchSize);
+
+ for (const key of batch) {
+ if (regex.test(key)) {
+ delete store[key];
+ totalDeleted += 1;
+ }
+ }
+
+ // eslint-disable-next-line no-await-in-loop
+ await delayMs(Math.max(0, applyJitter(delay, jitter)));
+ }
+
+ return totalDeleted;
+ },
getItem: async (key) => {
const value = store[key];
if (typeof value === "string") {
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 10454ab9ba..3fad36facc 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -14,10 +14,12 @@ export enum ApiDocsTags {
UniversalAuth = "Universal Auth",
GcpAuth = "GCP Auth",
AwsAuth = "AWS Auth",
+ OciAuth = "OCI Auth",
AzureAuth = "Azure Auth",
KubernetesAuth = "Kubernetes Auth",
JwtAuth = "JWT Auth",
OidcAuth = "OIDC Auth",
+ LdapAuth = "LDAP Auth",
Groups = "Groups",
Organizations = "Organizations",
Projects = "Projects",
@@ -45,6 +47,7 @@ export enum ApiDocsTags {
PkiCertificateTemplates = "PKI Certificate Templates",
PkiCertificateCollections = "PKI Certificate Collections",
PkiAlerting = "PKI Alerting",
+ PkiSubscribers = "PKI Subscribers",
SshCertificates = "SSH Certificates",
SshCertificateAuthorities = "SSH Certificate Authorities",
SshCertificateTemplates = "SSH Certificate Templates",
@@ -184,6 +187,49 @@ export const UNIVERSAL_AUTH = {
}
} as const;
+export const LDAP_AUTH = {
+ LOGIN: {
+ identityId: "The ID of the identity to login.",
+ username: "The username of the LDAP user to login.",
+ password: "The password of the LDAP user to login."
+ },
+ ATTACH: {
+ identityId: "The ID of the identity to attach the configuration onto.",
+ url: "The URL of the LDAP server.",
+ allowedFields:
+ "The comma-separated array of key/value pairs of required fields that the LDAP entry must have in order to authenticate.",
+ searchBase: "The base DN to search for the LDAP user.",
+ searchFilter: "The filter to use to search for the LDAP user.",
+ bindDN: "The DN of the user to bind to the LDAP server.",
+ bindPass: "The password of the user to bind to the LDAP server.",
+ ldapCaCertificate: "The PEM-encoded CA certificate for the LDAP server.",
+ accessTokenTTL: "The lifetime for an access token in seconds.",
+ accessTokenMaxTTL: "The maximum lifetime for an access token in seconds.",
+ accessTokenNumUsesLimit: "The maximum number of times that an access token can be used.",
+ accessTokenTrustedIps: "The IPs or CIDR ranges that access tokens can be used from."
+ },
+ UPDATE: {
+ identityId: "The ID of the identity to update the configuration for.",
+ url: "The new URL of the LDAP server.",
+ allowedFields: "The comma-separated list of allowed fields to return from the LDAP user.",
+ searchBase: "The new base DN to search for the LDAP user.",
+ searchFilter: "The new filter to use to search for the LDAP user.",
+ bindDN: "The new DN of the user to bind to the LDAP server.",
+ bindPass: "The new password of the user to bind to the LDAP server.",
+ ldapCaCertificate: "The new PEM-encoded CA certificate for the LDAP server.",
+ accessTokenTTL: "The new lifetime for an access token in seconds.",
+ accessTokenMaxTTL: "The new maximum lifetime for an access token in seconds.",
+ accessTokenNumUsesLimit: "The new maximum number of times that an access token can be used.",
+ accessTokenTrustedIps: "The new IPs or CIDR ranges that access tokens can be used from."
+ },
+ RETRIEVE: {
+ identityId: "The ID of the identity to retrieve the configuration for."
+ },
+ REVOKE: {
+ identityId: "The ID of the identity to revoke the configuration for."
+ }
+} as const;
+
export const AWS_AUTH = {
LOGIN: {
identityId: "The ID of the identity to login.",
@@ -226,6 +272,40 @@ export const AWS_AUTH = {
}
} as const;
+export const OCI_AUTH = {
+ LOGIN: {
+ identityId: "The ID of the identity to login.",
+ userOcid: "The OCID of the user attempting login.",
+ headers: "The headers of the signed request."
+ },
+ ATTACH: {
+ identityId: "The ID of the identity to attach the configuration onto.",
+ tenancyOcid: "The OCID of your tenancy.",
+ allowedUsernames:
+ "The comma-separated list of trusted OCI account usernames that are allowed to authenticate with Infisical.",
+ accessTokenTTL: "The lifetime for an access token in seconds.",
+ accessTokenMaxTTL: "The maximum lifetime for an access token in seconds.",
+ accessTokenNumUsesLimit: "The maximum number of times that an access token can be used.",
+ accessTokenTrustedIps: "The IPs or CIDR ranges that access tokens can be used from."
+ },
+ UPDATE: {
+ identityId: "The ID of the identity to update the auth method for.",
+ tenancyOcid: "The OCID of your tenancy.",
+ allowedUsernames:
+ "The comma-separated list of trusted OCI account usernames that are allowed to authenticate with Infisical.",
+ accessTokenTTL: "The new lifetime for an access token in seconds.",
+ accessTokenMaxTTL: "The new maximum lifetime for an access token in seconds.",
+ accessTokenNumUsesLimit: "The new maximum number of times that an access token can be used.",
+ accessTokenTrustedIps: "The new IPs or CIDR ranges that access tokens can be used from."
+ },
+ RETRIEVE: {
+ identityId: "The ID of the identity to retrieve the auth method for."
+ },
+ REVOKE: {
+ identityId: "The ID of the identity to revoke the auth method for."
+ }
+} as const;
+
export const AZURE_AUTH = {
LOGIN: {
identityId: "The ID of the identity to login."
@@ -313,6 +393,7 @@ export const KUBERNETES_AUTH = {
allowedNames: "The comma-separated list of trusted service account names that can authenticate with Infisical.",
allowedAudience:
"The optional audience claim that the service account JWT token must have to authenticate with Infisical.",
+ gatewayId: "The ID of the gateway to use when performing kubernetes API requests.",
accessTokenTrustedIps: "The IPs or CIDR ranges that access tokens can be used from.",
accessTokenTTL: "The lifetime for an access token in seconds.",
accessTokenMaxTTL: "The maximum lifetime for an access token in seconds.",
@@ -329,6 +410,7 @@ export const KUBERNETES_AUTH = {
allowedNames: "The new comma-separated list of trusted service account names that can authenticate with Infisical.",
allowedAudience:
"The new optional audience claim that the service account JWT token must have to authenticate with Infisical.",
+ gatewayId: "The ID of the gateway to use when performing kubernetes API requests.",
accessTokenTrustedIps: "The new IPs or CIDR ranges that access tokens can be used from.",
accessTokenTTL: "The new lifetime for an acccess token in seconds.",
accessTokenMaxTTL: "The new maximum lifetime for an acccess token in seconds.",
@@ -526,7 +608,8 @@ export const PROJECTS = {
projectDescription: "An optional description label for the project.",
autoCapitalization: "Disable or enable auto-capitalization for the project.",
slug: "An optional slug for the project. (must be unique within the organization)",
- hasDeleteProtection: "Enable or disable delete protection for the project."
+ hasDeleteProtection: "Enable or disable delete protection for the project.",
+ secretSharing: "Enable or disable secret sharing for the project."
},
GET_KEY: {
workspaceId: "The ID of the project to get the key from."
@@ -595,6 +678,9 @@ export const PROJECTS = {
commonName: "The common name of the certificate to filter by.",
offset: "The offset to start from. If you enter 10, it will start from the 10th certificate.",
limit: "The number of certificates to return."
+ },
+ LIST_PKI_SUBSCRIBERS: {
+ projectId: "The ID of the project to list PKI subscribers for."
}
} as const;
@@ -1434,7 +1520,7 @@ export const SSH_HOSTS = {
loginUser: "A login user on the remote machine (e.g. 'ec2-user', 'deploy', 'admin')",
allowedPrincipals: "A list of allowed principals that can log in as the login user.",
loginMappings:
- "A list of login mappings for the SSH host. Each login mapping contains a login user and a list of corresponding allowed principals being usernames of users in the Infisical SSH project.",
+ "A list of login mappings for the SSH host. Each login mapping contains a login user and a list of corresponding allowed principals being usernames of users or groups slugs in the Infisical SSH project.",
userSshCaId:
"The ID of the SSH CA to use for user certificates. If not specified, the default user SSH CA will be used if it exists.",
hostSshCaId:
@@ -1449,7 +1535,7 @@ export const SSH_HOSTS = {
loginUser: "A login user on the remote machine (e.g. 'ec2-user', 'deploy', 'admin')",
allowedPrincipals: "A list of allowed principals that can log in as the login user.",
loginMappings:
- "A list of login mappings for the SSH host. Each login mapping contains a login user and a list of corresponding allowed principals being usernames of users in the Infisical SSH project."
+ "A list of login mappings for the SSH host. Each login mapping contains a login user and a list of corresponding allowed principals being usernames of users or groups slugs in the Infisical SSH project."
},
DELETE: {
sshHostId: "The ID of the SSH host to delete."
@@ -1619,7 +1705,8 @@ export const CERTIFICATES = {
serialNumber: "The serial number of the certificate to get the certificate body and certificate chain for.",
certificate: "The certificate body of the certificate.",
certificateChain: "The certificate chain of the certificate.",
- serialNumberRes: "The serial number of the certificate."
+ serialNumberRes: "The serial number of the certificate.",
+ privateKey: "The private key of the certificate."
}
};
@@ -1686,6 +1773,67 @@ export const ALERTS = {
}
};
+export const PKI_SUBSCRIBERS = {
+ GET: {
+ subscriberName: "The name of the PKI subscriber to get.",
+ projectId: "The ID of the project to get the PKI subscriber for."
+ },
+ CREATE: {
+ projectId: "The ID of the project to create the PKI subscriber in.",
+ caId: "The ID of the CA that will issue certificates for the PKI subscriber.",
+ name: "The name of the PKI subscriber.",
+ commonName: "The common name (CN) to be used on certificates issued for this subscriber.",
+ status: "The status of the PKI subscriber. This can be one of active or disabled.",
+ ttl: "The time to live for the certificates issued for this subscriber such as 1m, 1h, 1d, 1y, ...",
+ subjectAlternativeNames:
+ "A list of Subject Alternative Names (SANs) to be used on certificates issued for this subscriber; these can be host names or email addresses.",
+ keyUsages: "The key usage extension to be used on certificates issued for this subscriber.",
+ extendedKeyUsages: "The extended key usage extension to be used on certificates issued for this subscriber."
+ },
+ UPDATE: {
+ projectId: "The ID of the project to update the PKI subscriber in.",
+ subscriberName: "The name of the PKI subscriber to update.",
+ caId: "The ID of the CA that will issue certificates for the PKI subscriber to update to.",
+ name: "The name of the PKI subscriber to update to.",
+ commonName: "The common name (CN) to be used on certificates issued for this subscriber to update to.",
+ status: "The status of the PKI subscriber to update to. This can be one of active or disabled.",
+ ttl: "The time to live for the certificates issued for this subscriber such as 1m, 1h, 1d, 1y, ...",
+ subjectAlternativeNames:
+ "A comma-delimited list of Subject Alternative Names (SANs) to be used on certificates issued for this subscriber; these can be host names or email addresses.",
+ keyUsages: "The key usage extension to be used on certificates issued for this subscriber to update to.",
+ extendedKeyUsages:
+ "The extended key usage extension to be used on certificates issued for this subscriber to update to."
+ },
+ DELETE: {
+ subscriberName: "The name of the PKI subscriber to delete.",
+ projectId: "The ID of the project of the PKI subscriber to delete."
+ },
+ ISSUE_CERT: {
+ subscriberName: "The name of the PKI subscriber to issue the certificate for.",
+ projectId: "The ID of the project of the PKI subscriber to issue the certificate for.",
+ certificate: "The issued certificate.",
+ issuingCaCertificate: "The certificate of the issuing CA.",
+ certificateChain: "The certificate chain of the issued certificate.",
+ privateKey: "The private key of the issued certificate.",
+ serialNumber: "The serial number of the issued certificate."
+ },
+ SIGN_CERT: {
+ subscriberName: "The name of the PKI subscriber to sign the certificate for.",
+ projectId: "The ID of the project of the PKI subscriber to sign the certificate for.",
+ csr: "The CSR to be used to sign the certificate.",
+ certificate: "The signed certificate.",
+ issuingCaCertificate: "The certificate of the issuing CA.",
+ certificateChain: "The certificate chain of the signed certificate.",
+ serialNumber: "The serial number of the signed certificate."
+ },
+ LIST_CERTS: {
+ subscriberName: "The name of the PKI subscriber to list the certificates for.",
+ projectId: "The ID of the project of the PKI subscriber to list the certificates for.",
+ offset: "The offset to start from.",
+ limit: "The number of certificates to return."
+ }
+};
+
export const PKI_COLLECTIONS = {
CREATE: {
projectId: "The ID of the project to create the PKI collection in.",
@@ -1821,8 +1969,12 @@ export const KMS = {
};
export const ProjectTemplates = {
+ LIST: {
+ type: "The type of project template to list."
+ },
CREATE: {
name: "The name of the project template to be created. Must be slug-friendly.",
+ type: "The type of project template to be created.",
description: "An optional description of the project template.",
roles: "The roles to be created when the template is applied to a project.",
environments: "The environments to be created when the template is applied to a project."
@@ -1925,6 +2077,13 @@ export const AppConnections = {
AZURE_CLIENT_SECRETS: {
code: "The OAuth code to use to connect with Azure Client Secrets.",
tenantId: "The Tenant ID to use to connect with Azure Client Secrets."
+ },
+ OCI: {
+ userOcid: "The OCID (Oracle Cloud Identifier) of the user making the request.",
+ tenancyOcid: "The OCID (Oracle Cloud Identifier) of the tenancy in Oracle Cloud Infrastructure.",
+ region: "The region identifier in Oracle Cloud Infrastructure where the vault is located.",
+ fingerprint: "The fingerprint of the public key uploaded to the user's API keys.",
+ privateKey: "The private key content in PEM format used to sign API requests."
}
}
};
@@ -1988,6 +2147,7 @@ export const SecretSyncs = {
const destinationName = SECRET_SYNC_NAME_MAP[destination];
return {
initialSyncBehavior: `Specify how Infisical should resolve the initial sync to the ${destinationName} destination.`,
+ keySchema: `Specify the format to use for structuring secret keys in the ${destinationName} destination.`,
disableSecretDeletion: `Enable this flag to prevent removal of secrets from the ${destinationName} destination when syncing.`
};
},
@@ -2072,6 +2232,11 @@ export const SecretSyncs = {
TEAMCITY: {
project: "The TeamCity project to sync secrets to.",
buildConfig: "The TeamCity build configuration to sync secrets to."
+ },
+ OCI_VAULT: {
+ compartmentOcid: "The OCID (Oracle Cloud Identifier) of the compartment where the vault is located.",
+ vaultOcid: "The OCID (Oracle Cloud Identifier) of the vault to sync secrets to.",
+ keyOcid: "The OCID (Oracle Cloud Identifier) of the encryption key to use when creating secrets in the vault."
}
}
};
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts
index 74da0b3998..e6d9dd624e 100644
--- a/backend/src/lib/config/env.ts
+++ b/backend/src/lib/config/env.ts
@@ -146,6 +146,7 @@ const envSchema = z
SECRET_SCANNING_GIT_APP_ID: zpStr(z.string().optional()),
SECRET_SCANNING_PRIVATE_KEY: zpStr(z.string().optional()),
SECRET_SCANNING_ORG_WHITELIST: zpStr(z.string().optional()),
+ SECRET_SCANNING_GIT_APP_SLUG: zpStr(z.string().default("infisical-radar")),
// LICENSE
LICENSE_SERVER_URL: zpStr(z.string().optional().default("https://portal.infisical.com")),
LICENSE_SERVER_KEY: zpStr(z.string().optional()),
diff --git a/backend/src/lib/delay/index.ts b/backend/src/lib/delay/index.ts
new file mode 100644
index 0000000000..32cb8ebfca
--- /dev/null
+++ b/backend/src/lib/delay/index.ts
@@ -0,0 +1,4 @@
+export const delay = (ms: number) =>
+ new Promise<void>((resolve) => {
+ setTimeout(resolve, ms);
+ });
diff --git a/backend/src/lib/gateway/index.ts b/backend/src/lib/gateway/index.ts
index 84d801ddae..7a94c63840 100644
--- a/backend/src/lib/gateway/index.ts
+++ b/backend/src/lib/gateway/index.ts
@@ -174,6 +174,8 @@ const setupProxyServer = async ({
return new Promise((resolve, reject) => {
const server = net.createServer();
+ let streamClosed = false;
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
server.on("connection", async (clientConn) => {
try {
@@ -202,9 +204,15 @@ const setupProxyServer = async ({
// Handle client connection close
clientConn.on("end", () => {
- writer.close().catch((err) => {
- logger.error(err);
- });
+ if (!streamClosed) {
+ try {
+ writer.close().catch((err) => {
+ logger.debug(err, "Error closing writer (already closed)");
+ });
+ } catch (error) {
+ logger.debug(error, "Error in writer close");
+ }
+ }
});
clientConn.on("error", (clientConnErr) => {
@@ -249,14 +257,29 @@ const setupProxyServer = async ({
setupCopy();
// Handle connection closure
clientConn.on("close", () => {
- stream.destroy().catch((err) => {
- proxyErrorMsg.push((err as Error)?.message);
- });
+ if (!streamClosed) {
+ streamClosed = true;
+ stream.destroy().catch((err) => {
+ logger.debug(err, "Stream already destroyed during close event");
+ });
+ }
});
const cleanup = async () => {
- clientConn?.destroy();
- await stream.destroy();
+ try {
+ clientConn?.destroy();
+ } catch (err) {
+ logger.debug(err, "Error destroying client connection");
+ }
+
+ if (!streamClosed) {
+ streamClosed = true;
+ try {
+ await stream.destroy();
+ } catch (err) {
+ logger.debug(err, "Error destroying stream (might be already closed)");
+ }
+ }
};
clientConn.on("error", (clientConnErr) => {
@@ -301,8 +324,17 @@ const setupProxyServer = async ({
server,
port: address.port,
cleanup: async () => {
- server.close();
- await quicClient?.destroy();
+ try {
+ server.close();
+ } catch (err) {
+ logger.debug(err, "Error closing server");
+ }
+
+ try {
+ await quicClient?.destroy();
+ } catch (err) {
+ logger.debug(err, "Error destroying QUIC client");
+ }
},
getProxyError: () => proxyErrorMsg.join(",")
});
@@ -320,10 +352,10 @@ interface ProxyOptions {
orgId: string;
}
-export const withGatewayProxy = async (
- callback: (port: number) => Promise<void>,
+export const withGatewayProxy = async <T>(
+ callback: (port: number) => Promise<T>,
options: ProxyOptions
-): Promise<void> => {
+): Promise<T> => {
const { relayHost, relayPort, targetHost, targetPort, tlsOptions, identityId, orgId } = options;
// Setup the proxy server
@@ -339,7 +371,7 @@ export const withGatewayProxy = async (
try {
// Execute the callback with the allocated port
- await callback(port);
+ return await callback(port);
} catch (err) {
const proxyErrorMessage = getProxyError();
if (proxyErrorMessage) {
diff --git a/backend/src/lib/knex/index.ts b/backend/src/lib/knex/index.ts
index b1e0117098..2e17bff206 100644
--- a/backend/src/lib/knex/index.ts
+++ b/backend/src/lib/knex/index.ts
@@ -32,13 +32,13 @@ export const buildFindFilter =
<R extends object = object>(
{ $in, $notNull, $search, $complex, ...filter }: TFindFilter<R>,
tableName?: TableName,
- excludeKeys?: Array<keyof R>
+ excludeKeys?: string[]
) =>
(bd: Knex.QueryBuilder<R, R>) => {
const processedFilter = tableName
? Object.fromEntries(
Object.entries(filter)
- .filter(([key]) => !excludeKeys || !excludeKeys.includes(key as keyof R))
+ .filter(([key]) => !excludeKeys || !excludeKeys.includes(key))
.map(([key, value]) => [`${tableName}.${key}`, value])
)
: filter;
diff --git a/backend/src/lib/logger/logger.ts b/backend/src/lib/logger/logger.ts
index 170a0285fe..afde8ef97d 100644
--- a/backend/src/lib/logger/logger.ts
+++ b/backend/src/lib/logger/logger.ts
@@ -84,7 +84,9 @@ const redactedKeys = [
"secrets",
"key",
"password",
- "config"
+ "config",
+ "bindPass",
+ "bindDN"
];
const UNKNOWN_REQUEST_ID = "UNKNOWN_REQUEST_ID";
diff --git a/backend/src/queue/queue-service.ts b/backend/src/queue/queue-service.ts
index f02519e3ac..80a3a4fbca 100644
--- a/backend/src/queue/queue-service.ts
+++ b/backend/src/queue/queue-service.ts
@@ -25,6 +25,7 @@ import {
TQueueSecretSyncSyncSecretsByIdDTO,
TQueueSendSecretSyncActionFailedNotificationsDTO
} from "@app/services/secret-sync/secret-sync-types";
+import { CacheType } from "@app/services/super-admin/super-admin-types";
import { TWebhookPayloads } from "@app/services/webhook/webhook-types";
export enum QueueName {
@@ -50,7 +51,8 @@ export enum QueueName {
ImportSecretsFromExternalSource = "import-secrets-from-external-source",
AppConnectionSecretSync = "app-connection-secret-sync",
SecretRotationV2 = "secret-rotation-v2",
- FolderTreeCheckpoint = "folder-tree-checkpoint"
+ FolderTreeCheckpoint = "folder-tree-checkpoint",
+ InvalidateCache = "invalidate-cache"
}
export enum QueueJobs {
@@ -83,7 +85,8 @@ export enum QueueJobs {
SecretRotationV2QueueRotations = "secret-rotation-v2-queue-rotations",
SecretRotationV2RotateSecrets = "secret-rotation-v2-rotate-secrets",
SecretRotationV2SendNotification = "secret-rotation-v2-send-notification",
- CreateFolderTreeCheckpoint = "create-folder-tree-checkpoint"
+ CreateFolderTreeCheckpoint = "create-folder-tree-checkpoint",
+ InvalidateCache = "invalidate-cache"
}
export type TQueueJobTypes = {
@@ -242,6 +245,14 @@ export type TQueueJobTypes = {
name: QueueJobs.SecretRotationV2SendNotification;
payload: TSecretRotationSendNotificationJobPayload;
};
+ [QueueName.InvalidateCache]: {
+ name: QueueJobs.InvalidateCache;
+ payload: {
+ data: {
+ type: CacheType;
+ };
+ };
+ };
};
export type TQueueServiceFactory = ReturnType<typeof queueServiceFactory>;
diff --git a/backend/src/server/config/rateLimiter.ts b/backend/src/server/config/rateLimiter.ts
index 681442d1b6..b12c9b0d32 100644
--- a/backend/src/server/config/rateLimiter.ts
+++ b/backend/src/server/config/rateLimiter.ts
@@ -100,3 +100,18 @@ export const publicSshCaLimit: RateLimitOptions = {
max: 30, // conservative default
keyGenerator: (req) => req.realIp
};
+
+export const invalidateCacheLimit: RateLimitOptions = {
+ timeWindow: 60 * 1000,
+ hook: "preValidation",
+ max: 2,
+ keyGenerator: (req) => req.realIp
+};
+
+// Makes spamming "request access" harder, preventing email DDoS
+export const requestAccessLimit: RateLimitOptions = {
+ timeWindow: 60 * 1000,
+ hook: "preValidation",
+ max: 10,
+ keyGenerator: (req) => req.realIp
+};
diff --git a/backend/src/server/lib/caching.ts b/backend/src/server/lib/caching.ts
new file mode 100644
index 0000000000..513f2f6358
--- /dev/null
+++ b/backend/src/server/lib/caching.ts
@@ -0,0 +1,8 @@
+import { FastifyReply } from "fastify";
+
+export const addNoCacheHeaders = (reply: FastifyReply) => {
+ void reply.header("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
+ void reply.header("Pragma", "no-cache");
+ void reply.header("Expires", "0");
+ void reply.header("Surrogate-Control", "no-store");
+};
diff --git a/backend/src/server/plugins/fastify-zod.ts b/backend/src/server/plugins/fastify-zod.ts
index 4e898a9b5b..f9b9f4f599 100644
--- a/backend/src/server/plugins/fastify-zod.ts
+++ b/backend/src/server/plugins/fastify-zod.ts
@@ -5,7 +5,7 @@
import type { FastifySchema, FastifySchemaCompiler, FastifyTypeProvider } from "fastify";
import type { FastifySerializerCompiler } from "fastify/types/schema";
import type { z, ZodAny, ZodTypeAny } from "zod";
-import { zodToJsonSchema } from "zod-to-json-schema";
+import { PostProcessCallback, zodToJsonSchema } from "zod-to-json-schema";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type FreeformRecord = Record<string, any>;
@@ -28,9 +28,25 @@ interface Schema extends FastifySchema {
hide?: boolean;
}
+// Credit: https://github.com/StefanTerdell/zod-to-json-schema
+const jsonDescription: PostProcessCallback = (jsonSchema, def) => {
+ if (def.description) {
+ try {
+ return {
+ ...jsonSchema,
+ description: undefined,
+ ...JSON.parse(def.description)
+ };
+ } catch {}
+ }
+
+ return jsonSchema;
+};
+
const zodToJsonSchemaOptions = {
target: "openApi3",
- $refStrategy: "none"
+ $refStrategy: "none",
+ postProcess: jsonDescription
} as const;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
diff --git a/backend/src/server/plugins/serve-ui.ts b/backend/src/server/plugins/serve-ui.ts
index 9f91d9774e..22c0977260 100644
--- a/backend/src/server/plugins/serve-ui.ts
+++ b/backend/src/server/plugins/serve-ui.ts
@@ -57,7 +57,9 @@ export const registerServeUI = async (
reply.callNotFound();
return;
}
- return reply.sendFile("index.html");
+ // reference: https://github.com/fastify/fastify-static?tab=readme-ov-file#managing-cache-control-headers
+ // to avoid ui bundle skew on new deployment
+ return reply.sendFile("index.html", { maxAge: 0, immutable: false });
}
});
}
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index aeecaee7b5..331bd00e98 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -32,7 +32,6 @@ import { externalKmsServiceFactory } from "@app/ee/services/external-kms/externa
import { gatewayDALFactory } from "@app/ee/services/gateway/gateway-dal";
import { gatewayServiceFactory } from "@app/ee/services/gateway/gateway-service";
import { orgGatewayConfigDALFactory } from "@app/ee/services/gateway/org-gateway-config-dal";
-import { projectGatewayDALFactory } from "@app/ee/services/gateway/project-gateway-dal";
import { githubOrgSyncDALFactory } from "@app/ee/services/github-org-sync/github-org-sync-dal";
import { githubOrgSyncServiceFactory } from "@app/ee/services/github-org-sync/github-org-sync-service";
import { groupDALFactory } from "@app/ee/services/group/group-dal";
@@ -126,6 +125,7 @@ import { tokenDALFactory } from "@app/services/auth-token/auth-token-dal";
import { tokenServiceFactory } from "@app/services/auth-token/auth-token-service";
import { certificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";
import { certificateDALFactory } from "@app/services/certificate/certificate-dal";
+import { certificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";
import { certificateServiceFactory } from "@app/services/certificate/certificate-service";
import { certificateAuthorityCertDALFactory } from "@app/services/certificate-authority/certificate-authority-cert-dal";
import { certificateAuthorityDALFactory } from "@app/services/certificate-authority/certificate-authority-dal";
@@ -167,6 +167,10 @@ import { identityJwtAuthDALFactory } from "@app/services/identity-jwt-auth/ident
import { identityJwtAuthServiceFactory } from "@app/services/identity-jwt-auth/identity-jwt-auth-service";
import { identityKubernetesAuthDALFactory } from "@app/services/identity-kubernetes-auth/identity-kubernetes-auth-dal";
import { identityKubernetesAuthServiceFactory } from "@app/services/identity-kubernetes-auth/identity-kubernetes-auth-service";
+import { identityLdapAuthDALFactory } from "@app/services/identity-ldap-auth/identity-ldap-auth-dal";
+import { identityLdapAuthServiceFactory } from "@app/services/identity-ldap-auth/identity-ldap-auth-service";
+import { identityOciAuthDALFactory } from "@app/services/identity-oci-auth/identity-oci-auth-dal";
+import { identityOciAuthServiceFactory } from "@app/services/identity-oci-auth/identity-oci-auth-service";
import { identityOidcAuthDALFactory } from "@app/services/identity-oidc-auth/identity-oidc-auth-dal";
import { identityOidcAuthServiceFactory } from "@app/services/identity-oidc-auth/identity-oidc-auth-service";
import { identityProjectDALFactory } from "@app/services/identity-project/identity-project-dal";
@@ -202,6 +206,8 @@ import { pkiAlertServiceFactory } from "@app/services/pki-alert/pki-alert-servic
import { pkiCollectionDALFactory } from "@app/services/pki-collection/pki-collection-dal";
import { pkiCollectionItemDALFactory } from "@app/services/pki-collection/pki-collection-item-dal";
import { pkiCollectionServiceFactory } from "@app/services/pki-collection/pki-collection-service";
+import { pkiSubscriberDALFactory } from "@app/services/pki-subscriber/pki-subscriber-dal";
+import { pkiSubscriberServiceFactory } from "@app/services/pki-subscriber/pki-subscriber-service";
import { projectDALFactory } from "@app/services/project/project-dal";
import { projectQueueFactory } from "@app/services/project/project-queue";
import { projectServiceFactory } from "@app/services/project/project-service";
@@ -249,6 +255,7 @@ import { projectSlackConfigDALFactory } from "@app/services/slack/project-slack-
import { slackIntegrationDALFactory } from "@app/services/slack/slack-integration-dal";
import { slackServiceFactory } from "@app/services/slack/slack-service";
import { TSmtpService } from "@app/services/smtp/smtp-service";
+import { invalidateCacheQueueFactory } from "@app/services/super-admin/invalidate-cache-queue";
import { superAdminDALFactory } from "@app/services/super-admin/super-admin-dal";
import { getServerCfg, superAdminServiceFactory } from "@app/services/super-admin/super-admin-service";
import { telemetryDALFactory } from "@app/services/telemetry/telemetry-dal";
@@ -357,9 +364,11 @@ export const registerRoutes = async (
const identityUaClientSecretDAL = identityUaClientSecretDALFactory(db);
const identityAwsAuthDAL = identityAwsAuthDALFactory(db);
const identityGcpAuthDAL = identityGcpAuthDALFactory(db);
+ const identityOciAuthDAL = identityOciAuthDALFactory(db);
const identityOidcAuthDAL = identityOidcAuthDALFactory(db);
const identityJwtAuthDAL = identityJwtAuthDALFactory(db);
const identityAzureAuthDAL = identityAzureAuthDALFactory(db);
+ const identityLdapAuthDAL = identityLdapAuthDALFactory(db);
const auditLogDAL = auditLogDALFactory(auditLogDb ?? db);
const auditLogStreamDAL = auditLogStreamDALFactory(db);
@@ -437,7 +446,6 @@ export const registerRoutes = async (
const orgGatewayConfigDAL = orgGatewayConfigDALFactory(db);
const gatewayDAL = gatewayDALFactory(db);
- const projectGatewayDAL = projectGatewayDALFactory(db);
const secretReminderRecipientsDAL = secretReminderRecipientsDALFactory(db);
const githubOrgSyncDAL = githubOrgSyncDALFactory(db);
@@ -649,6 +657,11 @@ export const registerRoutes = async (
queueService
});
+ const invalidateCacheQueue = invalidateCacheQueueFactory({
+ keyStore,
+ queueService
+ });
+
const userService = userServiceFactory({
userDAL,
userAliasDAL,
@@ -760,7 +773,8 @@ export const registerRoutes = async (
keyStore,
licenseService,
kmsService,
- microsoftTeamsService
+ microsoftTeamsService,
+ invalidateCacheQueue
});
const orgAdminService = orgAdminServiceFactory({
@@ -851,14 +865,17 @@ export const registerRoutes = async (
const certificateDAL = certificateDALFactory(db);
const certificateBodyDAL = certificateBodyDALFactory(db);
+ const certificateSecretDAL = certificateSecretDALFactory(db);
const pkiAlertDAL = pkiAlertDALFactory(db);
const pkiCollectionDAL = pkiCollectionDALFactory(db);
const pkiCollectionItemDAL = pkiCollectionItemDALFactory(db);
+ const pkiSubscriberDAL = pkiSubscriberDALFactory(db);
const certificateService = certificateServiceFactory({
certificateDAL,
certificateBodyDAL,
+ certificateSecretDAL,
certificateAuthorityDAL,
certificateAuthorityCertDAL,
certificateAuthorityCrlDAL,
@@ -896,6 +913,8 @@ export const registerRoutes = async (
const sshHostService = sshHostServiceFactory({
userDAL,
+ groupDAL,
+ userGroupMembershipDAL,
projectDAL,
projectSshConfigDAL,
sshCertificateAuthorityDAL,
@@ -918,7 +937,8 @@ export const registerRoutes = async (
sshHostLoginUserMappingDAL,
userDAL,
permissionService,
- licenseService
+ licenseService,
+ groupDAL
});
const certificateAuthorityService = certificateAuthorityServiceFactory({
@@ -930,6 +950,7 @@ export const registerRoutes = async (
certificateAuthorityQueue,
certificateDAL,
certificateBodyDAL,
+ certificateSecretDAL,
pkiCollectionDAL,
pkiCollectionItemDAL,
projectDAL,
@@ -984,6 +1005,20 @@ export const registerRoutes = async (
projectDAL
});
+ const pkiSubscriberService = pkiSubscriberServiceFactory({
+ pkiSubscriberDAL,
+ certificateAuthorityDAL,
+ certificateAuthorityCertDAL,
+ certificateAuthoritySecretDAL,
+ certificateAuthorityCrlDAL,
+ certificateDAL,
+ certificateBodyDAL,
+ certificateSecretDAL,
+ projectDAL,
+ kmsService,
+ permissionService
+ });
+
const projectTemplateService = projectTemplateServiceFactory({
licenseService,
permissionService,
@@ -1083,6 +1118,7 @@ export const registerRoutes = async (
projectRoleDAL,
folderDAL,
licenseService,
+ pkiSubscriberDAL,
certificateAuthorityDAL,
certificateDAL,
pkiAlertDAL,
@@ -1430,12 +1466,24 @@ export const registerRoutes = async (
identityUaDAL,
licenseService
});
+
+ const gatewayService = gatewayServiceFactory({
+ permissionService,
+ gatewayDAL,
+ kmsService,
+ licenseService,
+ orgGatewayConfigDAL,
+ keyStore
+ });
+
const identityKubernetesAuthService = identityKubernetesAuthServiceFactory({
identityKubernetesAuthDAL,
identityOrgMembershipDAL,
identityAccessTokenDAL,
permissionService,
licenseService,
+ gatewayService,
+ gatewayDAL,
kmsService
});
const identityGcpAuthService = identityGcpAuthServiceFactory({
@@ -1462,6 +1510,14 @@ export const registerRoutes = async (
licenseService
});
+ const identityOciAuthService = identityOciAuthServiceFactory({
+ identityAccessTokenDAL,
+ identityOciAuthDAL,
+ identityOrgMembershipDAL,
+ licenseService,
+ permissionService
+ });
+
const identityOidcAuthService = identityOidcAuthServiceFactory({
identityOidcAuthDAL,
identityOrgMembershipDAL,
@@ -1480,14 +1536,14 @@ export const registerRoutes = async (
kmsService
});
- const gatewayService = gatewayServiceFactory({
+ const identityLdapAuthService = identityLdapAuthServiceFactory({
+ identityLdapAuthDAL,
permissionService,
- gatewayDAL,
kmsService,
+ identityAccessTokenDAL,
+ identityOrgMembershipDAL,
licenseService,
- orgGatewayConfigDAL,
- keyStore,
- projectGatewayDAL
+ identityDAL
});
const dynamicSecretProviders = buildDynamicSecretProviders({
@@ -1511,7 +1567,7 @@ export const registerRoutes = async (
permissionService,
licenseService,
kmsService,
- projectGatewayDAL,
+ gatewayDAL,
resourceMetadataDAL
});
@@ -1741,8 +1797,10 @@ export const registerRoutes = async (
identityGcpAuth: identityGcpAuthService,
identityAwsAuth: identityAwsAuthService,
identityAzureAuth: identityAzureAuthService,
+ identityOciAuth: identityOciAuthService,
identityOidcAuth: identityOidcAuthService,
identityJwtAuth: identityJwtAuthService,
+ identityLdapAuth: identityLdapAuthService,
accessApprovalPolicy: accessApprovalPolicyService,
accessApprovalRequest: accessApprovalRequestService,
secretApprovalPolicy: secretApprovalPolicyService,
@@ -1766,6 +1824,7 @@ export const registerRoutes = async (
certificateEst: certificateEstService,
pkiAlert: pkiAlertService,
pkiCollection: pkiCollectionService,
+ pkiSubscriber: pkiSubscriberService,
secretScanning: secretScanningService,
license: licenseService,
trustedIp: trustedIpService,
@@ -1809,6 +1868,10 @@ export const registerRoutes = async (
if (licenseSyncJob) {
cronJobs.push(licenseSyncJob);
}
+ const microsoftTeamsSyncJob = await microsoftTeamsService.initializeBackgroundSync();
+ if (microsoftTeamsSyncJob) {
+ cronJobs.push(microsoftTeamsSyncJob);
+ }
}
server.decorate<FastifyZodProvider["store"]>("store", {
diff --git a/backend/src/server/routes/sanitizedSchemas.ts b/backend/src/server/routes/sanitizedSchemas.ts
index da300981c9..87d82c2419 100644
--- a/backend/src/server/routes/sanitizedSchemas.ts
+++ b/backend/src/server/routes/sanitizedSchemas.ts
@@ -261,7 +261,8 @@ export const SanitizedProjectSchema = ProjectsSchema.pick({
pitVersionLimit: true,
kmsCertificateKeyId: true,
auditLogsRetentionDays: true,
- hasDeleteProtection: true
+ hasDeleteProtection: true,
+ secretSharing: true
});
export const SanitizedTagSchema = SecretTagsSchema.pick({
diff --git a/backend/src/server/routes/v1/admin-router.ts b/backend/src/server/routes/v1/admin-router.ts
index a55aa2ba44..8610a611bf 100644
--- a/backend/src/server/routes/v1/admin-router.ts
+++ b/backend/src/server/routes/v1/admin-router.ts
@@ -4,13 +4,14 @@ import { z } from "zod";
import { IdentitiesSchema, OrganizationsSchema, SuperAdminSchema, UsersSchema } from "@app/db/schemas";
import { getConfig } from "@app/lib/config/env";
import { BadRequestError } from "@app/lib/errors";
-import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { invalidateCacheLimit, readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifySuperAdmin } from "@app/server/plugins/auth/superAdmin";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
import { RootKeyEncryptionStrategy } from "@app/services/kms/kms-types";
import { getServerCfg } from "@app/services/super-admin/super-admin-service";
-import { LoginMethod } from "@app/services/super-admin/super-admin-types";
+import { CacheType, LoginMethod } from "@app/services/super-admin/super-admin-types";
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const registerAdminRouter = async (server: FastifyZodProvider) => {
@@ -548,4 +549,69 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => {
};
}
});
+
+ server.route({
+ method: "POST",
+ url: "/invalidate-cache",
+ config: {
+ rateLimit: invalidateCacheLimit
+ },
+ schema: {
+ body: z.object({
+ type: z.nativeEnum(CacheType)
+ }),
+ response: {
+ 200: z.object({
+ message: z.string()
+ })
+ }
+ },
+ onRequest: (req, res, done) => {
+ verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN])(req, res, () => {
+ verifySuperAdmin(req, res, done);
+ });
+ },
+ handler: async (req) => {
+ await server.services.superAdmin.invalidateCache(req.body.type);
+
+ await server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.InvalidateCache,
+ distinctId: getTelemetryDistinctId(req),
+ properties: {
+ ...req.auditLogInfo
+ }
+ });
+
+ return {
+ message: "Cache invalidation job started"
+ };
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: "/invalidating-cache-status",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ response: {
+ 200: z.object({
+ invalidating: z.boolean()
+ })
+ }
+ },
+ onRequest: (req, res, done) => {
+ verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN])(req, res, () => {
+ verifySuperAdmin(req, res, done);
+ });
+ },
+ handler: async () => {
+ const invalidating = await server.services.superAdmin.checkIfInvalidatingCache();
+
+ return {
+ invalidating
+ };
+ }
+ });
};
diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
index f6c260ea5c..b9ce3deb8d 100644
--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
@@ -38,6 +38,7 @@ import {
} from "@app/services/app-connection/humanitec";
import { LdapConnectionListItemSchema, SanitizedLdapConnectionSchema } from "@app/services/app-connection/ldap";
import { MsSqlConnectionListItemSchema, SanitizedMsSqlConnectionSchema } from "@app/services/app-connection/mssql";
+import { OCIConnectionListItemSchema, SanitizedOCIConnectionSchema } from "@app/services/app-connection/oci";
import {
PostgresConnectionListItemSchema,
SanitizedPostgresConnectionSchema
@@ -76,7 +77,8 @@ const SanitizedAppConnectionSchema = z.union([
...SanitizedAzureClientSecretsConnectionSchema.options,
...SanitizedWindmillConnectionSchema.options,
...SanitizedLdapConnectionSchema.options,
- ...SanitizedTeamCityConnectionSchema.options
+ ...SanitizedTeamCityConnectionSchema.options,
+ ...SanitizedOCIConnectionSchema.options
]);
const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
@@ -97,7 +99,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
AzureClientSecretsConnectionListItemSchema,
WindmillConnectionListItemSchema,
LdapConnectionListItemSchema,
- TeamCityConnectionListItemSchema
+ TeamCityConnectionListItemSchema,
+ OCIConnectionListItemSchema
]);
export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.ts
index eeae5e5e33..6f6fa19917 100644
--- a/backend/src/server/routes/v1/app-connection-routers/index.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts
@@ -13,6 +13,7 @@ import { registerHCVaultConnectionRouter } from "./hc-vault-connection-router";
import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";
import { registerLdapConnectionRouter } from "./ldap-connection-router";
import { registerMsSqlConnectionRouter } from "./mssql-connection-router";
+import { registerOCIConnectionRouter } from "./oci-connection-router";
import { registerPostgresConnectionRouter } from "./postgres-connection-router";
import { registerTeamCityConnectionRouter } from "./teamcity-connection-router";
import { registerTerraformCloudConnectionRouter } from "./terraform-cloud-router";
@@ -40,5 +41,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
[AppConnection.Auth0]: registerAuth0ConnectionRouter,
[AppConnection.HCVault]: registerHCVaultConnectionRouter,
[AppConnection.LDAP]: registerLdapConnectionRouter,
- [AppConnection.TeamCity]: registerTeamCityConnectionRouter
+ [AppConnection.TeamCity]: registerTeamCityConnectionRouter,
+ [AppConnection.OCI]: registerOCIConnectionRouter
};
diff --git a/backend/src/server/routes/v1/app-connection-routers/oci-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/oci-connection-router.ts
new file mode 100644
index 0000000000..d78eee3d95
--- /dev/null
+++ b/backend/src/server/routes/v1/app-connection-routers/oci-connection-router.ts
@@ -0,0 +1,123 @@
+import z from "zod";
+
+import { readLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ CreateOCIConnectionSchema,
+ SanitizedOCIConnectionSchema,
+ UpdateOCIConnectionSchema
+} from "@app/services/app-connection/oci";
+import { AuthMode } from "@app/services/auth/auth-type";
+
+import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
+
+export const registerOCIConnectionRouter = async (server: FastifyZodProvider) => {
+ registerAppConnectionEndpoints({
+ app: AppConnection.OCI,
+ server,
+ sanitizedResponseSchema: SanitizedOCIConnectionSchema,
+ createSchema: CreateOCIConnectionSchema,
+ updateSchema: UpdateOCIConnectionSchema
+ });
+
+ // The following endpoints are for internal Infisical App use only and not part of the public API
+ server.route({
+ method: "GET",
+ url: `/:connectionId/compartments`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ response: {
+ 200: z
+ .object({
+ id: z.string(),
+ name: z.string()
+ })
+ .array()
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+
+ const compartments = await server.services.appConnection.oci.listCompartments(connectionId, req.permission);
+ return compartments;
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: `/:connectionId/vaults`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ querystring: z.object({
+ compartmentOcid: z.string().min(1, "Compartment OCID required")
+ }),
+ response: {
+ 200: z
+ .object({
+ id: z.string(),
+ displayName: z.string()
+ })
+ .array()
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+ const { compartmentOcid } = req.query;
+
+ const vaults = await server.services.appConnection.oci.listVaults(
+ { connectionId, compartmentOcid },
+ req.permission
+ );
+ return vaults;
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: `/:connectionId/vault-keys`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ querystring: z.object({
+ compartmentOcid: z.string().min(1, "Compartment OCID required"),
+ vaultOcid: z.string().min(1, "Vault OCID required")
+ }),
+ response: {
+ 200: z
+ .object({
+ id: z.string(),
+ displayName: z.string()
+ })
+ .array()
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+ const { compartmentOcid, vaultOcid } = req.query;
+
+ const keys = await server.services.appConnection.oci.listVaultKeys(
+ { connectionId, compartmentOcid, vaultOcid },
+ req.permission
+ );
+ return keys;
+ }
+ });
+};
diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.ts
index ea33e948f6..0e4cec8e1f 100644
--- a/backend/src/server/routes/v1/certificate-router.ts
+++ b/backend/src/server/routes/v1/certificate-router.ts
@@ -1,3 +1,4 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
import { z } from "zod";
import { CertificatesSchema } from "@app/db/schemas";
@@ -5,6 +6,7 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, CERTIFICATE_AUTHORITIES, CERTIFICATES } from "@app/lib/api-docs";
import { ms } from "@app/lib/ms";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { addNoCacheHeaders } from "@app/server/lib/caching";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -64,6 +66,111 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
}
});
+ // TODO: In the future add support for other formats outside of PEM (such as DER). Adding a "format" query param may be best.
+ server.route({
+ method: "GET",
+ url: "/:serialNumber/private-key",
+ config: {
+ rateLimit: readLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiCertificates],
+ description: "Get certificate private key",
+ params: z.object({
+ serialNumber: z.string().trim().describe(CERTIFICATES.GET.serialNumber)
+ }),
+ response: {
+ 200: z.string().trim()
+ }
+ },
+ handler: async (req, reply) => {
+ const { ca, cert, certPrivateKey } = await server.services.certificate.getCertPrivateKey({
+ serialNumber: req.params.serialNumber,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.GET_CERT_PRIVATE_KEY,
+ metadata: {
+ certId: cert.id,
+ cn: cert.commonName,
+ serialNumber: cert.serialNumber
+ }
+ }
+ });
+
+ addNoCacheHeaders(reply);
+
+ return certPrivateKey;
+ }
+ });
+
+ // TODO: In the future add support for other formats outside of PEM (such as DER). Adding a "format" query param may be best.
+ server.route({
+ method: "GET",
+ url: "/:serialNumber/bundle",
+ config: {
+ rateLimit: readLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiCertificates],
+ description: "Get certificate bundle including the certificate, chain, and private key.",
+ params: z.object({
+ serialNumber: z.string().trim().describe(CERTIFICATES.GET_CERT.serialNumber)
+ }),
+ response: {
+ 200: z.object({
+ certificate: z.string().trim().describe(CERTIFICATES.GET_CERT.certificate),
+ certificateChain: z.string().trim().nullable().describe(CERTIFICATES.GET_CERT.certificateChain),
+ privateKey: z.string().trim().nullable().describe(CERTIFICATES.GET_CERT.privateKey),
+ serialNumber: z.string().trim().describe(CERTIFICATES.GET_CERT.serialNumberRes)
+ })
+ }
+ },
+ handler: async (req, reply) => {
+ const { certificate, certificateChain, serialNumber, cert, ca, privateKey } =
+ await server.services.certificate.getCertBundle({
+ serialNumber: req.params.serialNumber,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.GET_CERT_BUNDLE,
+ metadata: {
+ certId: cert.id,
+ cn: cert.commonName,
+ serialNumber: cert.serialNumber
+ }
+ }
+ });
+
+ addNoCacheHeaders(reply);
+
+ return {
+ certificate,
+ certificateChain,
+ serialNumber,
+ privateKey
+ };
+ }
+ });
+
server.route({
method: "POST",
url: "/issue-certificate",
@@ -411,7 +518,7 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
response: {
200: z.object({
certificate: z.string().trim().describe(CERTIFICATES.GET_CERT.certificate),
- certificateChain: z.string().trim().describe(CERTIFICATES.GET_CERT.certificateChain),
+ certificateChain: z.string().trim().nullable().describe(CERTIFICATES.GET_CERT.certificateChain),
serialNumber: z.string().trim().describe(CERTIFICATES.GET_CERT.serialNumberRes)
})
}
@@ -429,7 +536,7 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
...req.auditLogInfo,
projectId: ca.projectId,
event: {
- type: EventType.DELETE_CERT,
+ type: EventType.GET_CERT_BODY,
metadata: {
certId: cert.id,
cn: cert.commonName,
diff --git a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
index 21759e0cda..d9ef620878 100644
--- a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
@@ -3,6 +3,7 @@ import { z } from "zod";
import { IdentityKubernetesAuthsSchema } from "@app/db/schemas";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, KUBERNETES_AUTH } from "@app/lib/api-docs";
+import { CharacterType, characterValidator } from "@app/lib/validator/validate-string";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -21,7 +22,8 @@ const IdentityKubernetesAuthResponseSchema = IdentityKubernetesAuthsSchema.pick(
kubernetesHost: true,
allowedNamespaces: true,
allowedNames: true,
- allowedAudience: true
+ allowedAudience: true,
+ gatewayId: true
}).extend({
caCert: z.string(),
tokenReviewerJwt: z.string().optional().nullable()
@@ -100,12 +102,32 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}),
body: z
.object({
- kubernetesHost: z.string().trim().min(1).describe(KUBERNETES_AUTH.ATTACH.kubernetesHost),
+ kubernetesHost: z
+ .string()
+ .trim()
+ .min(1)
+ .describe(KUBERNETES_AUTH.ATTACH.kubernetesHost)
+ .refine(
+ (val) =>
+ characterValidator([
+ CharacterType.Alphabets,
+ CharacterType.Numbers,
+ CharacterType.Colon,
+ CharacterType.Period,
+ CharacterType.ForwardSlash,
+ CharacterType.Hyphen
+ ])(val),
+ {
+ message:
+ "Kubernetes host must only contain alphabets, numbers, colons, periods, hyphen, and forward slashes."
+ }
+ ),
caCert: z.string().trim().default("").describe(KUBERNETES_AUTH.ATTACH.caCert),
tokenReviewerJwt: z.string().trim().optional().describe(KUBERNETES_AUTH.ATTACH.tokenReviewerJwt),
allowedNamespaces: z.string().describe(KUBERNETES_AUTH.ATTACH.allowedNamespaces), // TODO: validation
allowedNames: z.string().describe(KUBERNETES_AUTH.ATTACH.allowedNames),
allowedAudience: z.string().describe(KUBERNETES_AUTH.ATTACH.allowedAudience),
+ gatewayId: z.string().uuid().optional().nullable().describe(KUBERNETES_AUTH.ATTACH.gatewayId),
accessTokenTrustedIps: z
.object({
ipAddress: z.string().trim()
@@ -199,12 +221,36 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}),
body: z
.object({
- kubernetesHost: z.string().trim().min(1).optional().describe(KUBERNETES_AUTH.UPDATE.kubernetesHost),
+ kubernetesHost: z
+ .string()
+ .trim()
+ .min(1)
+ .optional()
+ .describe(KUBERNETES_AUTH.UPDATE.kubernetesHost)
+ .refine(
+ (val) => {
+ if (!val) return true;
+
+ return characterValidator([
+ CharacterType.Alphabets,
+ CharacterType.Numbers,
+ CharacterType.Colon,
+ CharacterType.Period,
+ CharacterType.ForwardSlash,
+ CharacterType.Hyphen
+ ])(val);
+ },
+ {
+ message:
+ "Kubernetes host must only contain alphabets, numbers, colons, periods, hyphen, and forward slashes."
+ }
+ ),
caCert: z.string().trim().optional().describe(KUBERNETES_AUTH.UPDATE.caCert),
tokenReviewerJwt: z.string().trim().nullable().optional().describe(KUBERNETES_AUTH.UPDATE.tokenReviewerJwt),
allowedNamespaces: z.string().optional().describe(KUBERNETES_AUTH.UPDATE.allowedNamespaces), // TODO: validation
allowedNames: z.string().optional().describe(KUBERNETES_AUTH.UPDATE.allowedNames),
allowedAudience: z.string().optional().describe(KUBERNETES_AUTH.UPDATE.allowedAudience),
+ gatewayId: z.string().uuid().optional().nullable().describe(KUBERNETES_AUTH.UPDATE.gatewayId),
accessTokenTrustedIps: z
.object({
ipAddress: z.string().trim()
diff --git a/backend/src/server/routes/v1/identity-ldap-auth-router.ts b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
new file mode 100644
index 0000000000..3da8a425b2
--- /dev/null
+++ b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
@@ -0,0 +1,497 @@
+/* eslint-disable @typescript-eslint/no-explicit-any */
+/* eslint-disable @typescript-eslint/no-unsafe-return */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+/* eslint-disable @typescript-eslint/no-unsafe-argument */
+// All the any rules are disabled because passport typesense with fastify is really poor
+
+import { Authenticator } from "@fastify/passport";
+import fastifySession from "@fastify/session";
+import { FastifyRequest } from "fastify";
+import { IncomingMessage } from "http";
+import LdapStrategy from "passport-ldapauth";
+import { z } from "zod";
+
+import { IdentityLdapAuthsSchema } from "@app/db/schemas/identity-ldap-auths";
+import { EventType } from "@app/ee/services/audit-log/audit-log-types";
+import { isValidLdapFilter } from "@app/ee/services/ldap-config/ldap-fns";
+import { ApiDocsTags, LDAP_AUTH } from "@app/lib/api-docs";
+import { getConfig } from "@app/lib/config/env";
+import { UnauthorizedError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
+import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { AuthMode } from "@app/services/auth/auth-type";
+import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
+import { AllowedFieldsSchema } from "@app/services/identity-ldap-auth/identity-ldap-auth-types";
+import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+
+export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider) => {
+ const appCfg = getConfig();
+ const passport = new Authenticator({ key: "ldap-identity-auth", userProperty: "passportMachineIdentity" });
+ await server.register(fastifySession, { secret: appCfg.COOKIE_SECRET_SIGN_KEY });
+ await server.register(passport.initialize());
+ await server.register(passport.secureSession());
+
+ const getLdapPassportOpts = (req: FastifyRequest, done: any) => {
+ const { identityId } = req.body as {
+ identityId: string;
+ };
+
+ process.nextTick(async () => {
+ try {
+ const { ldapConfig, opts } = await server.services.identityLdapAuth.getLdapConfig(identityId);
+ req.ldapConfig = {
+ ...ldapConfig,
+ isActive: true,
+ groupSearchBase: "",
+ uniqueUserAttribute: "",
+ groupSearchFilter: ""
+ };
+
+ done(null, opts);
+ } catch (err) {
+ logger.error(err, "Error in LDAP verification callback");
+ done(err);
+ }
+ });
+ };
+
+ passport.use(
+ new LdapStrategy(
+ getLdapPassportOpts as any,
+ // eslint-disable-next-line
+ async (req: IncomingMessage, user, cb) => {
+ try {
+ const requestBody = (req as unknown as FastifyRequest).body as {
+ username: string;
+ password: string;
+ identityId: string;
+ };
+
+ if (!requestBody.username || !requestBody.password) {
+ return cb(new UnauthorizedError({ message: "Invalid request. Missing username or password." }), false);
+ }
+
+ if (!requestBody.identityId) {
+ return cb(new UnauthorizedError({ message: "Invalid request. Missing identity ID." }), false);
+ }
+
+ const { ldapConfig } = req as unknown as FastifyRequest;
+
+ if (ldapConfig.allowedFields) {
+ for (const field of ldapConfig.allowedFields) {
+ if (!user[field.key]) {
+ return cb(
+ new UnauthorizedError({ message: `Invalid request. Missing field ${field.key} on user.` }),
+ false
+ );
+ }
+
+ const value = field.value.split(",");
+
+ if (!value.includes(user[field.key])) {
+ return cb(
+ new UnauthorizedError({
+ message: `Invalid request. User field '${field.key}' does not match required fields.`
+ }),
+ false
+ );
+ }
+ }
+ }
+
+ return cb(null, { identityId: requestBody.identityId, user });
+ } catch (error) {
+ logger.error(error, "Error in LDAP verification callback");
+ return cb(error, false);
+ }
+ }
+ )
+ );
+
+ server.route({
+ method: "POST",
+ url: "/ldap-auth/login",
+ config: {
+ rateLimit: writeLimit
+ },
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.LdapAuth],
+ description: "Login with LDAP Auth",
+ body: z.object({
+ identityId: z.string().trim().describe(LDAP_AUTH.LOGIN.identityId),
+ username: z.string().describe(LDAP_AUTH.LOGIN.username),
+ password: z.string().describe(LDAP_AUTH.LOGIN.password)
+ }),
+ response: {
+ 200: z.object({
+ accessToken: z.string(),
+ expiresIn: z.coerce.number(),
+ accessTokenMaxTTL: z.coerce.number(),
+ tokenType: z.literal("Bearer")
+ })
+ }
+ },
+ preValidation: passport.authenticate("ldapauth", {
+ failWithError: true,
+ session: false
+ }) as any,
+
+ errorHandler: (error) => {
+ if (error.name === "AuthenticationError") {
+ throw new UnauthorizedError({ message: "Invalid credentials" });
+ }
+
+ throw error;
+ },
+
+ handler: async (req) => {
+ if (!req.passportMachineIdentity?.identityId) {
+ throw new UnauthorizedError({ message: "Invalid request. Missing identity ID or LDAP entry details." });
+ }
+
+ const { identityId, user } = req.passportMachineIdentity;
+
+ const { accessToken, identityLdapAuth, identityMembershipOrg } = await server.services.identityLdapAuth.login({
+ identityId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: identityMembershipOrg?.orgId,
+ event: {
+ type: EventType.LOGIN_IDENTITY_LDAP_AUTH,
+ metadata: {
+ identityId,
+ ldapEmail: user.mail,
+ ldapUsername: user.uid
+ }
+ }
+ });
+
+ return {
+ accessToken,
+ tokenType: "Bearer" as const,
+ expiresIn: identityLdapAuth.accessTokenTTL,
+ accessTokenMaxTTL: identityLdapAuth.accessTokenMaxTTL
+ };
+ }
+ });
+
+ server.route({
+ method: "POST",
+ url: "/ldap-auth/identities/:identityId",
+ config: {
+ rateLimit: writeLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.LdapAuth],
+ description: "Attach LDAP Auth configuration onto identity",
+ security: [
+ {
+ bearerAuth: []
+ }
+ ],
+ params: z.object({
+ identityId: z.string().trim().describe(LDAP_AUTH.ATTACH.identityId)
+ }),
+ body: z
+ .object({
+ url: z.string().trim().min(1).describe(LDAP_AUTH.ATTACH.url),
+ bindDN: z.string().trim().min(1).describe(LDAP_AUTH.ATTACH.bindDN),
+ bindPass: z.string().trim().min(1).describe(LDAP_AUTH.ATTACH.bindPass),
+ searchBase: z.string().trim().min(1).describe(LDAP_AUTH.ATTACH.searchBase),
+ searchFilter: z
+ .string()
+ .trim()
+ .min(1)
+ .default("(uid={{username}})")
+ .refine(isValidLdapFilter, "Invalid LDAP search filter")
+ .describe(LDAP_AUTH.ATTACH.searchFilter),
+ allowedFields: AllowedFieldsSchema.array().optional().describe(LDAP_AUTH.ATTACH.allowedFields),
+ ldapCaCertificate: z.string().trim().optional().describe(LDAP_AUTH.ATTACH.ldapCaCertificate),
+ accessTokenTrustedIps: z
+ .object({
+ ipAddress: z.string().trim()
+ })
+ .array()
+ .min(1)
+ .default([{ ipAddress: "0.0.0.0/0" }, { ipAddress: "::/0" }])
+ .describe(LDAP_AUTH.ATTACH.accessTokenTrustedIps),
+ accessTokenTTL: z
+ .number()
+ .int()
+ .min(0)
+ .max(315360000)
+ .default(2592000)
+ .describe(LDAP_AUTH.ATTACH.accessTokenTTL),
+ accessTokenMaxTTL: z
+ .number()
+ .int()
+ .min(1)
+ .max(315360000)
+ .default(2592000)
+ .describe(LDAP_AUTH.ATTACH.accessTokenMaxTTL),
+ accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(LDAP_AUTH.ATTACH.accessTokenNumUsesLimit)
+ })
+ .refine(
+ (val) => val.accessTokenTTL <= val.accessTokenMaxTTL,
+ "Access Token TTL cannot be greater than Access Token Max TTL."
+ ),
+ response: {
+ 200: z.object({
+ identityLdapAuth: IdentityLdapAuthsSchema.omit({
+ encryptedBindDN: true,
+ encryptedBindPass: true,
+ encryptedLdapCaCertificate: true
+ })
+ })
+ }
+ },
+ handler: async (req) => {
+ const identityLdapAuth = await server.services.identityLdapAuth.attachLdapAuth({
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId,
+ ...req.body,
+ identityId: req.params.identityId,
+ isActorSuperAdmin: isSuperAdmin(req.auth)
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ event: {
+ type: EventType.ADD_IDENTITY_LDAP_AUTH,
+ metadata: {
+ identityId: req.params.identityId,
+ url: identityLdapAuth.url,
+ accessTokenMaxTTL: identityLdapAuth.accessTokenMaxTTL,
+ accessTokenTTL: identityLdapAuth.accessTokenTTL,
+ accessTokenNumUsesLimit: identityLdapAuth.accessTokenNumUsesLimit,
+ allowedFields: req.body.allowedFields
+ }
+ }
+ });
+
+ return { identityLdapAuth };
+ }
+ });
+
+ server.route({
+ method: "PATCH",
+ url: "/ldap-auth/identities/:identityId",
+ config: {
+ rateLimit: writeLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.LdapAuth],
+ description: "Update LDAP Auth configuration on identity",
+ security: [
+ {
+ bearerAuth: []
+ }
+ ],
+ params: z.object({
+ identityId: z.string().trim().describe(LDAP_AUTH.UPDATE.identityId)
+ }),
+ body: z
+ .object({
+ url: z.string().trim().min(1).optional().describe(LDAP_AUTH.UPDATE.url),
+ bindDN: z.string().trim().min(1).optional().describe(LDAP_AUTH.UPDATE.bindDN),
+ bindPass: z.string().trim().min(1).optional().describe(LDAP_AUTH.UPDATE.bindPass),
+ searchBase: z.string().trim().min(1).optional().describe(LDAP_AUTH.UPDATE.searchBase),
+ searchFilter: z
+ .string()
+ .trim()
+ .min(1)
+ .optional()
+ .refine((v) => v === undefined || isValidLdapFilter(v), "Invalid LDAP search filter")
+ .describe(LDAP_AUTH.UPDATE.searchFilter),
+ allowedFields: AllowedFieldsSchema.array().optional().describe(LDAP_AUTH.UPDATE.allowedFields),
+ accessTokenTrustedIps: z
+ .object({
+ ipAddress: z.string().trim()
+ })
+ .array()
+ .min(1)
+ .optional()
+ .describe(LDAP_AUTH.UPDATE.accessTokenTrustedIps),
+ accessTokenTTL: z.number().int().min(0).max(315360000).optional().describe(LDAP_AUTH.UPDATE.accessTokenTTL),
+ accessTokenNumUsesLimit: z
+ .number()
+ .int()
+ .min(0)
+ .optional()
+ .describe(LDAP_AUTH.UPDATE.accessTokenNumUsesLimit),
+ accessTokenMaxTTL: z
+ .number()
+ .int()
+ .max(315360000)
+ .min(0)
+ .optional()
+ .describe(LDAP_AUTH.UPDATE.accessTokenMaxTTL)
+ })
+ .refine(
+ (val) => (val.accessTokenMaxTTL && val.accessTokenTTL ? val.accessTokenTTL <= val.accessTokenMaxTTL : true),
+ "Access Token TTL cannot be greater than Access Token Max TTL."
+ ),
+ response: {
+ 200: z.object({
+ identityLdapAuth: IdentityLdapAuthsSchema.omit({
+ encryptedBindDN: true,
+ encryptedBindPass: true,
+ encryptedLdapCaCertificate: true
+ })
+ })
+ }
+ },
+ handler: async (req) => {
+ const identityLdapAuth = await server.services.identityLdapAuth.updateLdapAuth({
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId,
+ ...req.body,
+ identityId: req.params.identityId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ event: {
+ type: EventType.UPDATE_IDENTITY_LDAP_AUTH,
+ metadata: {
+ identityId: req.params.identityId,
+ url: identityLdapAuth.url,
+ accessTokenMaxTTL: identityLdapAuth.accessTokenMaxTTL,
+ accessTokenTTL: identityLdapAuth.accessTokenTTL,
+ accessTokenNumUsesLimit: identityLdapAuth.accessTokenNumUsesLimit,
+ accessTokenTrustedIps: identityLdapAuth.accessTokenTrustedIps as TIdentityTrustedIp[],
+ allowedFields: req.body.allowedFields
+ }
+ }
+ });
+
+ return { identityLdapAuth };
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: "/ldap-auth/identities/:identityId",
+ config: {
+ rateLimit: readLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.LdapAuth],
+ description: "Retrieve LDAP Auth configuration on identity",
+ security: [
+ {
+ bearerAuth: []
+ }
+ ],
+ params: z.object({
+ identityId: z.string().trim().describe(LDAP_AUTH.RETRIEVE.identityId)
+ }),
+ response: {
+ 200: z.object({
+ identityLdapAuth: IdentityLdapAuthsSchema.omit({
+ encryptedBindDN: true,
+ encryptedBindPass: true,
+ encryptedLdapCaCertificate: true
+ }).extend({
+ bindDN: z.string(),
+ bindPass: z.string(),
+ ldapCaCertificate: z.string().optional()
+ })
+ })
+ }
+ },
+ handler: async (req) => {
+ const identityLdapAuth = await server.services.identityLdapAuth.getLdapAuth({
+ identityId: req.params.identityId,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorOrgId: req.permission.orgId,
+ actorAuthMethod: req.permission.authMethod
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ event: {
+ type: EventType.GET_IDENTITY_LDAP_AUTH,
+ metadata: {
+ identityId: identityLdapAuth.identityId
+ }
+ }
+ });
+
+ return { identityLdapAuth };
+ }
+ });
+
+ server.route({
+ method: "DELETE",
+ url: "/ldap-auth/identities/:identityId",
+ config: {
+ rateLimit: writeLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.LdapAuth],
+ description: "Delete LDAP Auth configuration on identity",
+ security: [
+ {
+ bearerAuth: []
+ }
+ ],
+ params: z.object({
+ identityId: z.string().trim().describe(LDAP_AUTH.REVOKE.identityId)
+ }),
+ response: {
+ 200: z.object({
+ identityLdapAuth: IdentityLdapAuthsSchema.omit({
+ encryptedBindDN: true,
+ encryptedBindPass: true,
+ encryptedLdapCaCertificate: true
+ })
+ })
+ }
+ },
+ handler: async (req) => {
+ const identityLdapAuth = await server.services.identityLdapAuth.revokeIdentityLdapAuth({
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId,
+ identityId: req.params.identityId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ event: {
+ type: EventType.REVOKE_IDENTITY_LDAP_AUTH,
+ metadata: {
+ identityId: identityLdapAuth.identityId
+ }
+ }
+ });
+
+ return { identityLdapAuth };
+ }
+ });
+};
diff --git a/backend/src/server/routes/v1/identity-oci-auth-router.ts b/backend/src/server/routes/v1/identity-oci-auth-router.ts
new file mode 100644
index 0000000000..de9866c85e
--- /dev/null
+++ b/backend/src/server/routes/v1/identity-oci-auth-router.ts
@@ -0,0 +1,338 @@
+import { z } from "zod";
+
+import { IdentityOciAuthsSchema } from "@app/db/schemas";
+import { EventType } from "@app/ee/services/audit-log/audit-log-types";
+import { ApiDocsTags, OCI_AUTH } from "@app/lib/api-docs";
+import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { AuthMode } from "@app/services/auth/auth-type";
+import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
+import { validateTenancy, validateUsernames } from "@app/services/identity-oci-auth/identity-oci-auth-validators";
+import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+
+export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider) => {
+ server.route({
+ method: "POST",
+ url: "/oci-auth/login",
+ config: {
+ rateLimit: writeLimit
+ },
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.OciAuth],
+ description: "Login with OCI Auth",
+ body: z.object({
+ identityId: z.string().trim().describe(OCI_AUTH.LOGIN.identityId),
+ userOcid: z.string().trim().describe(OCI_AUTH.LOGIN.userOcid),
+ headers: z
+ .object({
+ authorization: z.string(),
+ host: z.string(),
+ "x-date": z.string()
+ })
+ .describe(OCI_AUTH.LOGIN.headers)
+ }),
+ response: {
+ 200: z.object({
+ accessToken: z.string(),
+ expiresIn: z.coerce.number(),
+ accessTokenMaxTTL: z.coerce.number(),
+ tokenType: z.literal("Bearer")
+ })
+ }
+ },
+ handler: async (req) => {
+ const { identityOciAuth, accessToken, identityAccessToken, identityMembershipOrg } =
+ await server.services.identityOciAuth.login(req.body);
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: identityMembershipOrg?.orgId,
+ event: {
+ type: EventType.LOGIN_IDENTITY_OCI_AUTH,
+ metadata: {
+ identityId: identityOciAuth.identityId,
+ identityAccessTokenId: identityAccessToken.id,
+ identityOciAuthId: identityOciAuth.id
+ }
+ }
+ });
+
+ return {
+ accessToken,
+ tokenType: "Bearer" as const,
+ expiresIn: identityOciAuth.accessTokenTTL,
+ accessTokenMaxTTL: identityOciAuth.accessTokenMaxTTL
+ };
+ }
+ });
+
+ server.route({
+ method: "POST",
+ url: "/oci-auth/identities/:identityId",
+ config: {
+ rateLimit: writeLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.OciAuth],
+ description: "Attach OCI Auth configuration onto identity",
+ security: [
+ {
+ bearerAuth: []
+ }
+ ],
+ params: z.object({
+ identityId: z.string().trim().describe(OCI_AUTH.ATTACH.identityId)
+ }),
+ body: z
+ .object({
+ tenancyOcid: validateTenancy.describe(OCI_AUTH.ATTACH.tenancyOcid),
+ allowedUsernames: validateUsernames.describe(OCI_AUTH.ATTACH.allowedUsernames),
+ accessTokenTrustedIps: z
+ .object({
+ ipAddress: z.string().trim()
+ })
+ .array()
+ .min(1)
+ .default([{ ipAddress: "0.0.0.0/0" }, { ipAddress: "::/0" }])
+ .describe(OCI_AUTH.ATTACH.accessTokenTrustedIps),
+ accessTokenTTL: z
+ .number()
+ .int()
+ .min(0)
+ .max(315360000)
+ .default(2592000)
+ .describe(OCI_AUTH.ATTACH.accessTokenTTL),
+ accessTokenMaxTTL: z
+ .number()
+ .int()
+ .min(1)
+ .max(315360000)
+ .default(2592000)
+ .describe(OCI_AUTH.ATTACH.accessTokenMaxTTL),
+ accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(OCI_AUTH.ATTACH.accessTokenNumUsesLimit)
+ })
+ .refine(
+ (val) => val.accessTokenTTL <= val.accessTokenMaxTTL,
+ "Access Token TTL cannot be greater than Access Token Max TTL."
+ ),
+ response: {
+ 200: z.object({
+ identityOciAuth: IdentityOciAuthsSchema
+ })
+ }
+ },
+ handler: async (req) => {
+ const identityOciAuth = await server.services.identityOciAuth.attachOciAuth({
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId,
+ ...req.body,
+ identityId: req.params.identityId,
+ isActorSuperAdmin: isSuperAdmin(req.auth)
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: identityOciAuth.orgId,
+ event: {
+ type: EventType.ADD_IDENTITY_OCI_AUTH,
+ metadata: {
+ identityId: identityOciAuth.identityId,
+ tenancyOcid: identityOciAuth.tenancyOcid,
+ allowedUsernames: identityOciAuth.allowedUsernames || null,
+ accessTokenTTL: identityOciAuth.accessTokenTTL,
+ accessTokenMaxTTL: identityOciAuth.accessTokenMaxTTL,
+ accessTokenTrustedIps: identityOciAuth.accessTokenTrustedIps as TIdentityTrustedIp[],
+ accessTokenNumUsesLimit: identityOciAuth.accessTokenNumUsesLimit
+ }
+ }
+ });
+
+ return { identityOciAuth };
+ }
+ });
+
+ server.route({
+ method: "PATCH",
+ url: "/oci-auth/identities/:identityId",
+ config: {
+ rateLimit: writeLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.OciAuth],
+ description: "Update OCI Auth configuration on identity",
+ security: [
+ {
+ bearerAuth: []
+ }
+ ],
+ params: z.object({
+ identityId: z.string().describe(OCI_AUTH.UPDATE.identityId)
+ }),
+ body: z
+ .object({
+ tenancyOcid: validateTenancy.describe(OCI_AUTH.UPDATE.tenancyOcid),
+ allowedUsernames: validateUsernames.describe(OCI_AUTH.UPDATE.allowedUsernames),
+ accessTokenTrustedIps: z
+ .object({
+ ipAddress: z.string().trim()
+ })
+ .array()
+ .min(1)
+ .optional()
+ .describe(OCI_AUTH.UPDATE.accessTokenTrustedIps),
+ accessTokenTTL: z.number().int().min(0).max(315360000).optional().describe(OCI_AUTH.UPDATE.accessTokenTTL),
+ accessTokenNumUsesLimit: z.number().int().min(0).optional().describe(OCI_AUTH.UPDATE.accessTokenNumUsesLimit),
+ accessTokenMaxTTL: z
+ .number()
+ .int()
+ .max(315360000)
+ .min(0)
+ .optional()
+ .describe(OCI_AUTH.UPDATE.accessTokenMaxTTL)
+ })
+ .refine(
+ (val) => (val.accessTokenMaxTTL && val.accessTokenTTL ? val.accessTokenTTL <= val.accessTokenMaxTTL : true),
+ "Access Token TTL cannot be greater than Access Token Max TTL."
+ ),
+ response: {
+ 200: z.object({
+ identityOciAuth: IdentityOciAuthsSchema
+ })
+ }
+ },
+ handler: async (req) => {
+ const identityOciAuth = await server.services.identityOciAuth.updateOciAuth({
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId,
+ ...req.body,
+ identityId: req.params.identityId,
+ allowedUsernames: req.body.allowedUsernames || null
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: identityOciAuth.orgId,
+ event: {
+ type: EventType.UPDATE_IDENTITY_OCI_AUTH,
+ metadata: {
+ identityId: identityOciAuth.identityId,
+ tenancyOcid: identityOciAuth.tenancyOcid,
+ allowedUsernames: identityOciAuth.allowedUsernames || null,
+ accessTokenTTL: identityOciAuth.accessTokenTTL,
+ accessTokenMaxTTL: identityOciAuth.accessTokenMaxTTL,
+ accessTokenTrustedIps: identityOciAuth.accessTokenTrustedIps as TIdentityTrustedIp[],
+ accessTokenNumUsesLimit: identityOciAuth.accessTokenNumUsesLimit
+ }
+ }
+ });
+
+ return { identityOciAuth };
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: "/oci-auth/identities/:identityId",
+ config: {
+ rateLimit: readLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.OciAuth],
+ description: "Retrieve OCI Auth configuration on identity",
+ security: [
+ {
+ bearerAuth: []
+ }
+ ],
+ params: z.object({
+ identityId: z.string().describe(OCI_AUTH.RETRIEVE.identityId)
+ }),
+ response: {
+ 200: z.object({
+ identityOciAuth: IdentityOciAuthsSchema
+ })
+ }
+ },
+ handler: async (req) => {
+ const identityOciAuth = await server.services.identityOciAuth.getOciAuth({
+ identityId: req.params.identityId,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorOrgId: req.permission.orgId,
+ actorAuthMethod: req.permission.authMethod
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: identityOciAuth.orgId,
+ event: {
+ type: EventType.GET_IDENTITY_OCI_AUTH,
+ metadata: {
+ identityId: identityOciAuth.identityId
+ }
+ }
+ });
+ return { identityOciAuth };
+ }
+ });
+
+ server.route({
+ method: "DELETE",
+ url: "/oci-auth/identities/:identityId",
+ config: {
+ rateLimit: writeLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.OciAuth],
+ description: "Delete OCI Auth configuration on identity",
+ security: [
+ {
+ bearerAuth: []
+ }
+ ],
+ params: z.object({
+ identityId: z.string().describe(OCI_AUTH.REVOKE.identityId)
+ }),
+ response: {
+ 200: z.object({
+ identityOciAuth: IdentityOciAuthsSchema
+ })
+ }
+ },
+ handler: async (req) => {
+ const identityOciAuth = await server.services.identityOciAuth.revokeIdentityOciAuth({
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId,
+ identityId: req.params.identityId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: identityOciAuth.orgId,
+ event: {
+ type: EventType.REVOKE_IDENTITY_OCI_AUTH,
+ metadata: {
+ identityId: identityOciAuth.identityId
+ }
+ }
+ });
+
+ return { identityOciAuth };
+ }
+ });
+};
diff --git a/backend/src/server/routes/v1/identity-router.ts b/backend/src/server/routes/v1/identity-router.ts
index 7731aad987..0e127796aa 100644
--- a/backend/src/server/routes/v1/identity-router.ts
+++ b/backend/src/server/routes/v1/identity-router.ts
@@ -52,7 +52,8 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
response: {
200: z.object({
identity: IdentitiesSchema.extend({
- authMethods: z.array(z.string())
+ authMethods: z.array(z.string()),
+ metadata: z.object({ id: z.string(), key: z.string(), value: z.string() }).array()
})
})
}
@@ -123,7 +124,9 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
}),
response: {
200: z.object({
- identity: IdentitiesSchema
+ identity: IdentitiesSchema.extend({
+ metadata: z.object({ id: z.string(), key: z.string(), value: z.string() }).array()
+ })
})
}
},
@@ -227,8 +230,8 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
identity: IdentityOrgMembershipsSchema.extend({
metadata: z
.object({
- key: z.string().trim().min(1),
id: z.string().trim().min(1),
+ key: z.string().trim().min(1),
value: z.string().trim().min(1)
})
.array()
diff --git a/backend/src/server/routes/v1/index.ts b/backend/src/server/routes/v1/index.ts
index a502995556..018e457fa9 100644
--- a/backend/src/server/routes/v1/index.ts
+++ b/backend/src/server/routes/v1/index.ts
@@ -19,6 +19,8 @@ import { registerIdentityAzureAuthRouter } from "./identity-azure-auth-router";
import { registerIdentityGcpAuthRouter } from "./identity-gcp-auth-router";
import { registerIdentityJwtAuthRouter } from "./identity-jwt-auth-router";
import { registerIdentityKubernetesRouter } from "./identity-kubernetes-auth-router";
+import { registerIdentityLdapAuthRouter } from "./identity-ldap-auth-router";
+import { registerIdentityOciAuthRouter } from "./identity-oci-auth-router";
import { registerIdentityOidcAuthRouter } from "./identity-oidc-auth-router";
import { registerIdentityRouter } from "./identity-router";
import { registerIdentityTokenAuthRouter } from "./identity-token-auth-router";
@@ -32,6 +34,7 @@ import { registerOrgRouter } from "./organization-router";
import { registerPasswordRouter } from "./password-router";
import { registerPkiAlertRouter } from "./pki-alert-router";
import { registerPkiCollectionRouter } from "./pki-collection-router";
+import { registerPkiSubscriberRouter } from "./pki-subscriber-router";
import { registerProjectEnvRouter } from "./project-env-router";
import { registerProjectKeyRouter } from "./project-key-router";
import { registerProjectMembershipRouter } from "./project-membership-router";
@@ -61,8 +64,10 @@ export const registerV1Routes = async (server: FastifyZodProvider) => {
await authRouter.register(registerIdentityAccessTokenRouter);
await authRouter.register(registerIdentityAwsAuthRouter);
await authRouter.register(registerIdentityAzureAuthRouter);
+ await authRouter.register(registerIdentityOciAuthRouter);
await authRouter.register(registerIdentityOidcAuthRouter);
await authRouter.register(registerIdentityJwtAuthRouter);
+ await authRouter.register(registerIdentityLdapAuthRouter);
},
{ prefix: "/auth" }
);
@@ -103,6 +108,7 @@ export const registerV1Routes = async (server: FastifyZodProvider) => {
await pkiRouter.register(registerCertificateTemplateRouter, { prefix: "/certificate-templates" });
await pkiRouter.register(registerPkiAlertRouter, { prefix: "/alerts" });
await pkiRouter.register(registerPkiCollectionRouter, { prefix: "/collections" });
+ await pkiRouter.register(registerPkiSubscriberRouter, { prefix: "/subscribers" });
},
{ prefix: "/pki" }
);
diff --git a/backend/src/server/routes/v1/org-admin-router.ts b/backend/src/server/routes/v1/org-admin-router.ts
index 2d28b09bdd..cc0543d4c0 100644
--- a/backend/src/server/routes/v1/org-admin-router.ts
+++ b/backend/src/server/routes/v1/org-admin-router.ts
@@ -2,7 +2,7 @@ import { z } from "zod";
import { ProjectMembershipsSchema } from "@app/db/schemas";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
-import { readLimit } from "@app/server/config/rateLimiter";
+import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -47,7 +47,7 @@ export const registerOrgAdminRouter = async (server: FastifyZodProvider) => {
method: "POST",
url: "/projects/:projectId/grant-admin-access",
config: {
- rateLimit: readLimit
+ rateLimit: writeLimit
},
schema: {
params: z.object({
diff --git a/backend/src/server/routes/v1/organization-router.ts b/backend/src/server/routes/v1/organization-router.ts
index da1a251ff3..c489d685da 100644
--- a/backend/src/server/routes/v1/organization-router.ts
+++ b/backend/src/server/routes/v1/organization-router.ts
@@ -275,6 +275,23 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
},
{ message: "Duration value must be at least 1" }
)
+ .optional(),
+ secretsProductEnabled: z.boolean().optional(),
+ pkiProductEnabled: z.boolean().optional(),
+ kmsProductEnabled: z.boolean().optional(),
+ sshProductEnabled: z.boolean().optional(),
+ scannerProductEnabled: z.boolean().optional(),
+ shareSecretsProductEnabled: z.boolean().optional(),
+ maxSharedSecretLifetime: z
+ .number()
+ .min(300, "Max Shared Secret lifetime cannot be under 5 minutes")
+ .max(2592000, "Max Shared Secret lifetime cannot exceed 30 days")
+ .optional(),
+ maxSharedSecretViewLimit: z
+ .number()
+ .min(1, "Max Shared Secret view count cannot be lower than 1")
+ .max(1000, "Max Shared Secret view count cannot exceed 1000")
+ .nullable()
.optional()
}),
response: {
diff --git a/backend/src/server/routes/v1/pki-subscriber-router.ts b/backend/src/server/routes/v1/pki-subscriber-router.ts
new file mode 100644
index 0000000000..d04b8b4bb9
--- /dev/null
+++ b/backend/src/server/routes/v1/pki-subscriber-router.ts
@@ -0,0 +1,478 @@
+import { z } from "zod";
+
+import { CertificatesSchema } from "@app/db/schemas";
+import { EventType } from "@app/ee/services/audit-log/audit-log-types";
+import { ApiDocsTags, PKI_SUBSCRIBERS } from "@app/lib/api-docs";
+import { ms } from "@app/lib/ms";
+import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { AuthMode } from "@app/services/auth/auth-type";
+import { CertExtendedKeyUsage, CertKeyUsage } from "@app/services/certificate/certificate-types";
+import { validateAltNameField } from "@app/services/certificate-authority/certificate-authority-validators";
+import { sanitizedPkiSubscriber } from "@app/services/pki-subscriber/pki-subscriber-schema";
+import { PkiSubscriberStatus } from "@app/services/pki-subscriber/pki-subscriber-types";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
+
+export const registerPkiSubscriberRouter = async (server: FastifyZodProvider) => {
+ server.route({
+ method: "GET",
+ url: "/:subscriberName",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiSubscribers],
+ description: "Get PKI Subscriber",
+ params: z.object({
+ subscriberName: z.string().describe(PKI_SUBSCRIBERS.GET.subscriberName)
+ }),
+ querystring: z.object({
+ projectId: z.string().describe(PKI_SUBSCRIBERS.GET.projectId)
+ }),
+ response: {
+ 200: sanitizedPkiSubscriber
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const subscriber = await server.services.pkiSubscriber.getSubscriber({
+ subscriberName: req.params.subscriberName,
+ projectId: req.query.projectId,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: subscriber.projectId,
+ event: {
+ type: EventType.GET_PKI_SUBSCRIBER,
+ metadata: {
+ pkiSubscriberId: subscriber.id,
+ name: subscriber.name
+ }
+ }
+ });
+
+ return subscriber;
+ }
+ });
+
+ server.route({
+ method: "POST",
+ url: "/",
+ config: {
+ rateLimit: writeLimit
+ },
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiSubscribers],
+ description: "Create PKI Subscriber",
+ body: z.object({
+ projectId: z.string().trim().describe(PKI_SUBSCRIBERS.CREATE.projectId),
+ caId: z
+ .string()
+ .trim()
+ .uuid("CA ID must be a valid UUID")
+ .min(1, "CA ID is required")
+ .describe(PKI_SUBSCRIBERS.CREATE.caId),
+ name: slugSchema({ min: 1, max: 64, field: "name" }).describe(PKI_SUBSCRIBERS.CREATE.name),
+ commonName: z.string().trim().min(1).describe(PKI_SUBSCRIBERS.CREATE.commonName),
+ status: z
+ .nativeEnum(PkiSubscriberStatus)
+ .default(PkiSubscriberStatus.ACTIVE)
+ .describe(PKI_SUBSCRIBERS.CREATE.status),
+ ttl: z
+ .string()
+ .trim()
+ .refine((val) => ms(val) > 0, "TTL must be a positive number")
+ .describe(PKI_SUBSCRIBERS.CREATE.ttl),
+ subjectAlternativeNames: validateAltNameField
+ .array()
+ .default([])
+ .transform((arr) => Array.from(new Set(arr)))
+ .describe(PKI_SUBSCRIBERS.CREATE.subjectAlternativeNames),
+ keyUsages: z
+ .nativeEnum(CertKeyUsage)
+ .array()
+ .default([CertKeyUsage.DIGITAL_SIGNATURE, CertKeyUsage.KEY_ENCIPHERMENT])
+ .transform((arr) => Array.from(new Set(arr)))
+ .describe(PKI_SUBSCRIBERS.CREATE.keyUsages),
+ extendedKeyUsages: z
+ .nativeEnum(CertExtendedKeyUsage)
+ .array()
+ .default([])
+ .transform((arr) => Array.from(new Set(arr)))
+ .describe(PKI_SUBSCRIBERS.CREATE.extendedKeyUsages)
+ }),
+ response: {
+ 200: sanitizedPkiSubscriber
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const subscriber = await server.services.pkiSubscriber.createSubscriber({
+ ...req.body,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: subscriber.projectId,
+ event: {
+ type: EventType.CREATE_PKI_SUBSCRIBER,
+ metadata: {
+ pkiSubscriberId: subscriber.id,
+ caId: subscriber.caId ?? undefined,
+ name: subscriber.name,
+ commonName: subscriber.commonName,
+ ttl: subscriber.ttl,
+ subjectAlternativeNames: subscriber.subjectAlternativeNames,
+ keyUsages: subscriber.keyUsages as CertKeyUsage[],
+ extendedKeyUsages: subscriber.extendedKeyUsages as CertExtendedKeyUsage[]
+ }
+ }
+ });
+
+ return subscriber;
+ }
+ });
+
+ server.route({
+ method: "PATCH",
+ url: "/:subscriberName",
+ config: {
+ rateLimit: writeLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiSubscribers],
+ description: "Update PKI Subscriber",
+ params: z.object({
+ subscriberName: z.string().trim().describe(PKI_SUBSCRIBERS.UPDATE.subscriberName)
+ }),
+ body: z.object({
+ projectId: z.string().trim().describe(PKI_SUBSCRIBERS.UPDATE.projectId),
+ caId: z
+ .string()
+ .trim()
+ .uuid("CA ID must be a valid UUID")
+ .min(1, "CA ID is required")
+ .optional()
+ .describe(PKI_SUBSCRIBERS.UPDATE.caId),
+ name: slugSchema({ min: 1, max: 64, field: "name" }).describe(PKI_SUBSCRIBERS.UPDATE.name).optional(),
+ commonName: z.string().trim().min(1).describe(PKI_SUBSCRIBERS.UPDATE.commonName).optional(),
+ status: z.nativeEnum(PkiSubscriberStatus).optional().describe(PKI_SUBSCRIBERS.UPDATE.status),
+ subjectAlternativeNames: validateAltNameField
+ .array()
+ .optional()
+ .describe(PKI_SUBSCRIBERS.UPDATE.subjectAlternativeNames),
+ ttl: z
+ .string()
+ .trim()
+ .refine((val) => ms(val) > 0, "TTL must be a positive number")
+ .optional()
+ .describe(PKI_SUBSCRIBERS.UPDATE.ttl),
+ keyUsages: z
+ .nativeEnum(CertKeyUsage)
+ .array()
+ .transform((arr) => Array.from(new Set(arr)))
+ .optional()
+ .describe(PKI_SUBSCRIBERS.UPDATE.keyUsages),
+ extendedKeyUsages: z
+ .nativeEnum(CertExtendedKeyUsage)
+ .array()
+ .transform((arr) => Array.from(new Set(arr)))
+ .optional()
+ .describe(PKI_SUBSCRIBERS.UPDATE.extendedKeyUsages)
+ }),
+ response: {
+ 200: sanitizedPkiSubscriber
+ }
+ },
+ handler: async (req) => {
+ const subscriber = await server.services.pkiSubscriber.updateSubscriber({
+ subscriberName: req.params.subscriberName,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId,
+ ...req.body
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: subscriber.projectId,
+ event: {
+ type: EventType.UPDATE_PKI_SUBSCRIBER,
+ metadata: {
+ pkiSubscriberId: subscriber.id,
+ caId: subscriber.caId ?? undefined,
+ name: subscriber.name,
+ commonName: subscriber.commonName,
+ ttl: subscriber.ttl,
+ subjectAlternativeNames: subscriber.subjectAlternativeNames,
+ keyUsages: subscriber.keyUsages as CertKeyUsage[],
+ extendedKeyUsages: subscriber.extendedKeyUsages as CertExtendedKeyUsage[]
+ }
+ }
+ });
+
+ return subscriber;
+ }
+ });
+
+ server.route({
+ method: "DELETE",
+ url: "/:subscriberName",
+ config: {
+ rateLimit: writeLimit
+ },
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiSubscribers],
+ description: "Delete PKI Subscriber",
+ params: z.object({
+ subscriberName: z.string().describe(PKI_SUBSCRIBERS.DELETE.subscriberName)
+ }),
+ body: z.object({
+ projectId: z.string().trim().describe(PKI_SUBSCRIBERS.DELETE.projectId)
+ }),
+ response: {
+ 200: sanitizedPkiSubscriber
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const subscriber = await server.services.pkiSubscriber.deleteSubscriber({
+ subscriberName: req.params.subscriberName,
+ projectId: req.body.projectId,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: subscriber.projectId,
+ event: {
+ type: EventType.DELETE_PKI_SUBSCRIBER,
+ metadata: {
+ pkiSubscriberId: subscriber.id,
+ name: subscriber.name
+ }
+ }
+ });
+
+ return subscriber;
+ }
+ });
+
+ server.route({
+ method: "POST",
+ url: "/:subscriberName/issue-certificate",
+ config: {
+ rateLimit: writeLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiSubscribers],
+ description: "Issue certificate",
+ params: z.object({
+ subscriberName: z.string().describe(PKI_SUBSCRIBERS.ISSUE_CERT.subscriberName)
+ }),
+ body: z.object({
+ projectId: z.string().trim().describe(PKI_SUBSCRIBERS.ISSUE_CERT.projectId)
+ }),
+ response: {
+ 200: z.object({
+ certificate: z.string().trim().describe(PKI_SUBSCRIBERS.ISSUE_CERT.certificate),
+ issuingCaCertificate: z.string().trim().describe(PKI_SUBSCRIBERS.ISSUE_CERT.issuingCaCertificate),
+ certificateChain: z.string().trim().describe(PKI_SUBSCRIBERS.ISSUE_CERT.certificateChain),
+ privateKey: z.string().trim().describe(PKI_SUBSCRIBERS.ISSUE_CERT.privateKey),
+ serialNumber: z.string().trim().describe(PKI_SUBSCRIBERS.ISSUE_CERT.serialNumber)
+ })
+ }
+ },
+ handler: async (req) => {
+ const { certificate, certificateChain, issuingCaCertificate, privateKey, serialNumber, subscriber } =
+ await server.services.pkiSubscriber.issueSubscriberCert({
+ subscriberName: req.params.subscriberName,
+ projectId: req.body.projectId,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: subscriber.projectId,
+ event: {
+ type: EventType.ISSUE_PKI_SUBSCRIBER_CERT,
+ metadata: {
+ subscriberId: subscriber.id,
+ name: subscriber.name,
+ serialNumber
+ }
+ }
+ });
+
+ await server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.IssueCert,
+ distinctId: getTelemetryDistinctId(req),
+ properties: {
+ subscriberId: subscriber.id,
+ commonName: subscriber.commonName,
+ ...req.auditLogInfo
+ }
+ });
+
+ return {
+ certificate,
+ certificateChain,
+ issuingCaCertificate,
+ privateKey,
+ serialNumber
+ };
+ }
+ });
+
+ server.route({
+ method: "POST",
+ url: "/:subscriberName/sign-certificate",
+ config: {
+ rateLimit: writeLimit
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiSubscribers],
+ description: "Sign certificate",
+ params: z.object({
+ subscriberName: z.string().describe(PKI_SUBSCRIBERS.SIGN_CERT.subscriberName)
+ }),
+ body: z.object({
+ projectId: z.string().trim().describe(PKI_SUBSCRIBERS.SIGN_CERT.projectId),
+ csr: z.string().trim().min(1).max(3000).describe(PKI_SUBSCRIBERS.SIGN_CERT.csr)
+ }),
+ response: {
+ 200: z.object({
+ certificate: z.string().trim().describe(PKI_SUBSCRIBERS.SIGN_CERT.certificate),
+ issuingCaCertificate: z.string().trim().describe(PKI_SUBSCRIBERS.SIGN_CERT.issuingCaCertificate),
+ certificateChain: z.string().trim().describe(PKI_SUBSCRIBERS.SIGN_CERT.certificateChain),
+ serialNumber: z.string().trim().describe(PKI_SUBSCRIBERS.ISSUE_CERT.serialNumber)
+ })
+ }
+ },
+ handler: async (req) => {
+ const { certificate, certificateChain, issuingCaCertificate, serialNumber, subscriber } =
+ await server.services.pkiSubscriber.signSubscriberCert({
+ subscriberName: req.params.subscriberName,
+ projectId: req.body.projectId,
+ csr: req.body.csr,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: subscriber.projectId,
+ event: {
+ type: EventType.SIGN_PKI_SUBSCRIBER_CERT,
+ metadata: {
+ subscriberId: subscriber.id,
+ name: subscriber.name,
+ serialNumber
+ }
+ }
+ });
+
+ await server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.SignCert,
+ distinctId: getTelemetryDistinctId(req),
+ properties: {
+ subscriberId: subscriber.id,
+ commonName: subscriber.commonName,
+ ...req.auditLogInfo
+ }
+ });
+
+ return {
+ certificate,
+ certificateChain,
+ issuingCaCertificate,
+ serialNumber
+ };
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: "/:subscriberName/certificates",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiSubscribers],
+ description: "List PKI Subscriber certificates",
+ params: z.object({
+ subscriberName: z.string().describe(PKI_SUBSCRIBERS.GET.subscriberName)
+ }),
+ querystring: z.object({
+ projectId: z.string().trim().describe(PKI_SUBSCRIBERS.LIST_CERTS.projectId),
+ offset: z.coerce.number().min(0).max(100).default(0).describe(PKI_SUBSCRIBERS.LIST_CERTS.offset),
+ limit: z.coerce.number().min(1).max(100).default(25).describe(PKI_SUBSCRIBERS.LIST_CERTS.limit)
+ }),
+ response: {
+ 200: z.object({
+ certificates: z.array(CertificatesSchema),
+ totalCount: z.number()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const { totalCount, certificates } = await server.services.pkiSubscriber.listSubscriberCerts({
+ subscriberName: req.params.subscriberName,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId,
+ ...req.query
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: req.query.projectId,
+ event: {
+ type: EventType.LIST_PKI_SUBSCRIBER_CERTS,
+ metadata: {
+ subscriberId: req.params.subscriberName,
+ name: req.params.subscriberName,
+ projectId: req.query.projectId
+ }
+ }
+ });
+
+ return {
+ certificates,
+ totalCount
+ };
+ }
+ });
+};
diff --git a/backend/src/server/routes/v1/project-router.ts b/backend/src/server/routes/v1/project-router.ts
index fdc7295484..2e983cb830 100644
--- a/backend/src/server/routes/v1/project-router.ts
+++ b/backend/src/server/routes/v1/project-router.ts
@@ -19,7 +19,7 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, PROJECTS } from "@app/lib/api-docs";
import { CharacterType, characterValidator } from "@app/lib/validator/validate-string";
import { re2Validator } from "@app/lib/zod";
-import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { readLimit, requestAccessLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
import { validateMicrosoftTeamsChannelsSchema } from "@app/services/microsoft-teams/microsoft-teams-fns";
@@ -346,7 +346,8 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
"Project slug can only contain lowercase letters and numbers, with optional single hyphens (-) or underscores (_) between words. Cannot start or end with a hyphen or underscore."
})
.optional()
- .describe(PROJECTS.UPDATE.slug)
+ .describe(PROJECTS.UPDATE.slug),
+ secretSharing: z.boolean().optional().describe(PROJECTS.UPDATE.secretSharing)
}),
response: {
200: z.object({
@@ -366,7 +367,8 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
description: req.body.description,
autoCapitalization: req.body.autoCapitalization,
hasDeleteProtection: req.body.hasDeleteProtection,
- slug: req.body.slug
+ slug: req.body.slug,
+ secretSharing: req.body.secretSharing
},
actorAuthMethod: req.permission.authMethod,
actorId: req.permission.id,
@@ -511,7 +513,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
})
}
},
- onRequest: verifyAuth([AuthMode.JWT]),
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
const workspace = await server.services.project.updateAuditLogsRetention({
actorId: req.permission.id,
@@ -1006,7 +1008,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
method: "POST",
url: "/:workspaceId/project-access",
config: {
- rateLimit: writeLimit
+ rateLimit: requestAccessLimit
},
schema: {
params: z.object({
diff --git a/backend/src/server/routes/v1/secret-sharing-router.ts b/backend/src/server/routes/v1/secret-sharing-router.ts
index 37c8a052f6..e712ee1388 100644
--- a/backend/src/server/routes/v1/secret-sharing-router.ts
+++ b/backend/src/server/routes/v1/secret-sharing-router.ts
@@ -62,7 +62,9 @@ export const registerSecretSharingRouter = async (server: FastifyZodProvider) =>
}),
body: z.object({
hashedHex: z.string().min(1).optional(),
- password: z.string().optional()
+ password: z.string().optional(),
+ email: z.string().optional(),
+ hash: z.string().optional()
}),
response: {
200: z.object({
@@ -88,7 +90,9 @@ export const registerSecretSharingRouter = async (server: FastifyZodProvider) =>
sharedSecretId: req.params.id,
hashedHex: req.body.hashedHex,
password: req.body.password,
- orgId: req.permission?.orgId
+ orgId: req.permission?.orgId,
+ email: req.body.email,
+ hash: req.body.hash
});
if (sharedSecret.secret?.orgId) {
@@ -151,7 +155,8 @@ export const registerSecretSharingRouter = async (server: FastifyZodProvider) =>
secretValue: z.string(),
expiresAt: z.string(),
expiresAfterViews: z.number().min(1).optional(),
- accessType: z.nativeEnum(SecretSharingAccessType).default(SecretSharingAccessType.Organization)
+ accessType: z.nativeEnum(SecretSharingAccessType).default(SecretSharingAccessType.Organization),
+ emails: z.string().email().array().max(100).optional()
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/secret-sync-routers/index.ts b/backend/src/server/routes/v1/secret-sync-routers/index.ts
index 75b3ac68e8..b5bd62ad66 100644
--- a/backend/src/server/routes/v1/secret-sync-routers/index.ts
+++ b/backend/src/server/routes/v1/secret-sync-routers/index.ts
@@ -10,6 +10,7 @@ import { registerGcpSyncRouter } from "./gcp-sync-router";
import { registerGitHubSyncRouter } from "./github-sync-router";
import { registerHCVaultSyncRouter } from "./hc-vault-sync-router";
import { registerHumanitecSyncRouter } from "./humanitec-sync-router";
+import { registerOCIVaultSyncRouter } from "./oci-vault-sync-router";
import { registerTeamCitySyncRouter } from "./teamcity-sync-router";
import { registerTerraformCloudSyncRouter } from "./terraform-cloud-sync-router";
import { registerVercelSyncRouter } from "./vercel-sync-router";
@@ -31,5 +32,6 @@ export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: Fastif
[SecretSync.Vercel]: registerVercelSyncRouter,
[SecretSync.Windmill]: registerWindmillSyncRouter,
[SecretSync.HCVault]: registerHCVaultSyncRouter,
- [SecretSync.TeamCity]: registerTeamCitySyncRouter
+ [SecretSync.TeamCity]: registerTeamCitySyncRouter,
+ [SecretSync.OCIVault]: registerOCIVaultSyncRouter
};
diff --git a/backend/src/server/routes/v1/secret-sync-routers/oci-vault-sync-router.ts b/backend/src/server/routes/v1/secret-sync-routers/oci-vault-sync-router.ts
new file mode 100644
index 0000000000..b46f27a50b
--- /dev/null
+++ b/backend/src/server/routes/v1/secret-sync-routers/oci-vault-sync-router.ts
@@ -0,0 +1,17 @@
+import {
+ CreateOCIVaultSyncSchema,
+ OCIVaultSyncSchema,
+ UpdateOCIVaultSyncSchema
+} from "@app/services/secret-sync/oci-vault";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+
+import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints";
+
+export const registerOCIVaultSyncRouter = async (server: FastifyZodProvider) =>
+ registerSyncSecretsEndpoints({
+ destination: SecretSync.OCIVault,
+ server,
+ responseSchema: OCIVaultSyncSchema,
+ createSchema: CreateOCIVaultSyncSchema,
+ updateSchema: UpdateOCIVaultSyncSchema
+ });
diff --git a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
index 359040d7f9..a7a561738b 100644
--- a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
+++ b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
@@ -24,6 +24,7 @@ import { GcpSyncListItemSchema, GcpSyncSchema } from "@app/services/secret-sync/
import { GitHubSyncListItemSchema, GitHubSyncSchema } from "@app/services/secret-sync/github";
import { HCVaultSyncListItemSchema, HCVaultSyncSchema } from "@app/services/secret-sync/hc-vault";
import { HumanitecSyncListItemSchema, HumanitecSyncSchema } from "@app/services/secret-sync/humanitec";
+import { OCIVaultSyncListItemSchema, OCIVaultSyncSchema } from "@app/services/secret-sync/oci-vault";
import { TeamCitySyncListItemSchema, TeamCitySyncSchema } from "@app/services/secret-sync/teamcity";
import { TerraformCloudSyncListItemSchema, TerraformCloudSyncSchema } from "@app/services/secret-sync/terraform-cloud";
import { VercelSyncListItemSchema, VercelSyncSchema } from "@app/services/secret-sync/vercel";
@@ -43,7 +44,8 @@ const SecretSyncSchema = z.discriminatedUnion("destination", [
VercelSyncSchema,
WindmillSyncSchema,
HCVaultSyncSchema,
- TeamCitySyncSchema
+ TeamCitySyncSchema,
+ OCIVaultSyncSchema
]);
const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
@@ -60,7 +62,8 @@ const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
VercelSyncListItemSchema,
WindmillSyncListItemSchema,
HCVaultSyncListItemSchema,
- TeamCitySyncListItemSchema
+ TeamCitySyncListItemSchema,
+ OCIVaultSyncListItemSchema
]);
export const registerSecretSyncRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/server/routes/v2/project-router.ts b/backend/src/server/routes/v2/project-router.ts
index a223004a9a..3d92bfb1a7 100644
--- a/backend/src/server/routes/v2/project-router.ts
+++ b/backend/src/server/routes/v2/project-router.ts
@@ -24,6 +24,7 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
import { CaStatus } from "@app/services/certificate-authority/certificate-authority-types";
import { sanitizedCertificateTemplate } from "@app/services/certificate-template/certificate-template-schema";
+import { sanitizedPkiSubscriber } from "@app/services/pki-subscriber/pki-subscriber-schema";
import { ProjectFilterType } from "@app/services/project/project-types";
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
@@ -170,7 +171,8 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
.optional()
.default(InfisicalProjectTemplate.Default)
.describe(PROJECTS.CREATE.template),
- type: z.nativeEnum(ProjectType).default(ProjectType.SecretManager)
+ type: z.nativeEnum(ProjectType).default(ProjectType.SecretManager),
+ shouldCreateDefaultEnvs: z.boolean().optional().default(true)
}),
response: {
200: z.object({
@@ -190,7 +192,8 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
slug: req.body.slug,
kmsKeyId: req.body.kmsKeyId,
template: req.body.template,
- type: req.body.type
+ type: req.body.type,
+ createDefaultEnvs: req.body.shouldCreateDefaultEnvs
});
await server.services.telemetry.sendPostHogEvents({
@@ -272,7 +275,7 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
},
schema: {
params: z.object({
- slug: slugSchema({ min: 5, max: 36 }).describe("The slug of the project to get.")
+ slug: slugSchema({ max: 36 }).describe("The slug of the project to get.")
}),
response: {
200: projectWithEnv
@@ -488,6 +491,38 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
}
});
+ server.route({
+ method: "GET",
+ url: "/:projectId/pki-subscribers",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiSubscribers],
+ params: z.object({
+ projectId: z.string().trim().describe(PROJECTS.LIST_PKI_SUBSCRIBERS.projectId)
+ }),
+ response: {
+ 200: z.object({
+ subscribers: z.array(sanitizedPkiSubscriber)
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const subscribers = await server.services.project.listProjectPkiSubscribers({
+ actorId: req.permission.id,
+ actorOrgId: req.permission.orgId,
+ actorAuthMethod: req.permission.authMethod,
+ actor: req.permission.type,
+ projectId: req.params.projectId
+ });
+
+ return { subscribers };
+ }
+ });
+
server.route({
method: "GET",
url: "/:projectId/certificate-templates",
@@ -626,6 +661,8 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
rateLimit: readLimit
},
schema: {
+ hide: false,
+ tags: [ApiDocsTags.SshHosts],
params: z.object({
projectId: z.string().trim().describe(PROJECTS.LIST_SSH_HOSTS.projectId)
}),
@@ -664,6 +701,8 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
rateLimit: readLimit
},
schema: {
+ hide: false,
+ tags: [ApiDocsTags.SshHostGroups],
params: z.object({
projectId: z.string().trim().describe(PROJECTS.LIST_SSH_HOST_GROUPS.projectId)
}),
diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.ts
index c2912c2b64..6e09f12932 100644
--- a/backend/src/services/app-connection/app-connection-enums.ts
+++ b/backend/src/services/app-connection/app-connection-enums.ts
@@ -16,7 +16,8 @@ export enum AppConnection {
Auth0 = "auth0",
HCVault = "hashicorp-vault",
LDAP = "ldap",
- TeamCity = "teamcity"
+ TeamCity = "teamcity",
+ OCI = "oci"
}
export enum AWSRegion {
diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.ts
index 95afdcbd2b..f6fd894a64 100644
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@ -53,6 +53,7 @@ import {
} from "./humanitec";
import { getLdapConnectionListItem, LdapConnectionMethod, validateLdapConnectionCredentials } from "./ldap";
import { getMsSqlConnectionListItem, MsSqlConnectionMethod } from "./mssql";
+import { getOCIConnectionListItem, OCIConnectionMethod, validateOCIConnectionCredentials } from "./oci";
import { getPostgresConnectionListItem, PostgresConnectionMethod } from "./postgres";
import {
getTeamCityConnectionListItem,
@@ -91,7 +92,8 @@ export const listAppConnectionOptions = () => {
getAuth0ConnectionListItem(),
getHCVaultConnectionListItem(),
getLdapConnectionListItem(),
- getTeamCityConnectionListItem()
+ getTeamCityConnectionListItem(),
+ getOCIConnectionListItem()
].sort((a, b) => a.name.localeCompare(b.name));
};
@@ -160,7 +162,8 @@ export const validateAppConnectionCredentials = async (
[AppConnection.Windmill]: validateWindmillConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.HCVault]: validateHCVaultConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.LDAP]: validateLdapConnectionCredentials as TAppConnectionCredentialsValidator,
- [AppConnection.TeamCity]: validateTeamCityConnectionCredentials as TAppConnectionCredentialsValidator
+ [AppConnection.TeamCity]: validateTeamCityConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.OCI]: validateOCIConnectionCredentials as TAppConnectionCredentialsValidator
};
return VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection);
@@ -176,6 +179,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
case GitHubConnectionMethod.OAuth:
return "OAuth";
case AwsConnectionMethod.AccessKey:
+ case OCIConnectionMethod.AccessKey:
return "Access Key";
case AwsConnectionMethod.AssumeRole:
return "Assume Role";
@@ -250,5 +254,6 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
[AppConnection.Auth0]: platformManagedCredentialsNotSupported,
[AppConnection.HCVault]: platformManagedCredentialsNotSupported,
[AppConnection.LDAP]: platformManagedCredentialsNotSupported, // we could support this in the future
- [AppConnection.TeamCity]: platformManagedCredentialsNotSupported
+ [AppConnection.TeamCity]: platformManagedCredentialsNotSupported,
+ [AppConnection.OCI]: platformManagedCredentialsNotSupported
};
diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.ts
index 05e00446c2..c32336453c 100644
--- a/backend/src/services/app-connection/app-connection-maps.ts
+++ b/backend/src/services/app-connection/app-connection-maps.ts
@@ -18,5 +18,6 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
[AppConnection.Auth0]: "Auth0",
[AppConnection.HCVault]: "Hashicorp Vault",
[AppConnection.LDAP]: "LDAP",
- [AppConnection.TeamCity]: "TeamCity"
+ [AppConnection.TeamCity]: "TeamCity",
+ [AppConnection.OCI]: "OCI"
};
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index 7a8b1a09c1..85b63138a5 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -49,6 +49,8 @@ import { ValidateHumanitecConnectionCredentialsSchema } from "./humanitec";
import { humanitecConnectionService } from "./humanitec/humanitec-connection-service";
import { ValidateLdapConnectionCredentialsSchema } from "./ldap";
import { ValidateMsSqlConnectionCredentialsSchema } from "./mssql";
+import { ValidateOCIConnectionCredentialsSchema } from "./oci";
+import { ociConnectionService } from "./oci/oci-connection-service";
import { ValidatePostgresConnectionCredentialsSchema } from "./postgres";
import { ValidateTeamCityConnectionCredentialsSchema } from "./teamcity";
import { teamcityConnectionService } from "./teamcity/teamcity-connection-service";
@@ -85,7 +87,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
[AppConnection.Auth0]: ValidateAuth0ConnectionCredentialsSchema,
[AppConnection.HCVault]: ValidateHCVaultConnectionCredentialsSchema,
[AppConnection.LDAP]: ValidateLdapConnectionCredentialsSchema,
- [AppConnection.TeamCity]: ValidateTeamCityConnectionCredentialsSchema
+ [AppConnection.TeamCity]: ValidateTeamCityConnectionCredentialsSchema,
+ [AppConnection.OCI]: ValidateOCIConnectionCredentialsSchema
};
export const appConnectionServiceFactory = ({
@@ -464,6 +467,7 @@ export const appConnectionServiceFactory = ({
auth0: auth0ConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),
hcvault: hcVaultConnectionService(connectAppConnectionById),
windmill: windmillConnectionService(connectAppConnectionById),
- teamcity: teamcityConnectionService(connectAppConnectionById)
+ teamcity: teamcityConnectionService(connectAppConnectionById),
+ oci: ociConnectionService(connectAppConnectionById)
};
};
diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.ts
index 36eeca4b19..42ccfc84e5 100644
--- a/backend/src/services/app-connection/app-connection-types.ts
+++ b/backend/src/services/app-connection/app-connection-types.ts
@@ -76,6 +76,12 @@ import {
TValidateLdapConnectionCredentialsSchema
} from "./ldap";
import { TMsSqlConnection, TMsSqlConnectionInput, TValidateMsSqlConnectionCredentialsSchema } from "./mssql";
+import {
+ TOCIConnection,
+ TOCIConnectionConfig,
+ TOCIConnectionInput,
+ TValidateOCIConnectionCredentialsSchema
+} from "./oci";
import {
TPostgresConnection,
TPostgresConnectionInput,
@@ -125,6 +131,7 @@ export type TAppConnection = { id: string } & (
| THCVaultConnection
| TLdapConnection
| TTeamCityConnection
+ | TOCIConnection
);
export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;
@@ -150,6 +157,7 @@ export type TAppConnectionInput = { id: string } & (
| THCVaultConnectionInput
| TLdapConnectionInput
| TTeamCityConnectionInput
+ | TOCIConnectionInput
);
export type TSqlConnectionInput = TPostgresConnectionInput | TMsSqlConnectionInput;
@@ -180,7 +188,8 @@ export type TAppConnectionConfig =
| TAuth0ConnectionConfig
| THCVaultConnectionConfig
| TLdapConnectionConfig
- | TTeamCityConnectionConfig;
+ | TTeamCityConnectionConfig
+ | TOCIConnectionConfig;
export type TValidateAppConnectionCredentialsSchema =
| TValidateAwsConnectionCredentialsSchema
@@ -200,7 +209,8 @@ export type TValidateAppConnectionCredentialsSchema =
| TValidateAuth0ConnectionCredentialsSchema
| TValidateHCVaultConnectionCredentialsSchema
| TValidateLdapConnectionCredentialsSchema
- | TValidateTeamCityConnectionCredentialsSchema;
+ | TValidateTeamCityConnectionCredentialsSchema
+ | TValidateOCIConnectionCredentialsSchema;
export type TListAwsConnectionKmsKeys = {
connectionId: string;
diff --git a/backend/src/services/app-connection/oci/index.ts b/backend/src/services/app-connection/oci/index.ts
new file mode 100644
index 0000000000..eb2850d344
--- /dev/null
+++ b/backend/src/services/app-connection/oci/index.ts
@@ -0,0 +1,4 @@
+export * from "./oci-connection-enums";
+export * from "./oci-connection-fns";
+export * from "./oci-connection-schemas";
+export * from "./oci-connection-types";
diff --git a/backend/src/services/app-connection/oci/oci-connection-enums.ts b/backend/src/services/app-connection/oci/oci-connection-enums.ts
new file mode 100644
index 0000000000..1b43196511
--- /dev/null
+++ b/backend/src/services/app-connection/oci/oci-connection-enums.ts
@@ -0,0 +1,3 @@
+export enum OCIConnectionMethod {
+ AccessKey = "access-key"
+}
diff --git a/backend/src/services/app-connection/oci/oci-connection-fns.ts b/backend/src/services/app-connection/oci/oci-connection-fns.ts
new file mode 100644
index 0000000000..5dcf6ee7a6
--- /dev/null
+++ b/backend/src/services/app-connection/oci/oci-connection-fns.ts
@@ -0,0 +1,139 @@
+import { common, identity, keymanagement } from "oci-sdk";
+
+import { BadRequestError } from "@app/lib/errors";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+import { OCIConnectionMethod } from "./oci-connection-enums";
+import { TOCIConnection, TOCIConnectionConfig } from "./oci-connection-types";
+
+export const getOCIProvider = async (config: TOCIConnectionConfig) => {
+ const {
+ credentials: { fingerprint, privateKey, region, tenancyOcid, userOcid }
+ } = config;
+
+ const provider = new common.SimpleAuthenticationDetailsProvider(
+ tenancyOcid,
+ userOcid,
+ fingerprint,
+ privateKey,
+ null,
+ common.Region.fromRegionId(region)
+ );
+
+ return provider;
+};
+
+export const getOCIConnectionListItem = () => {
+ return {
+ name: "OCI" as const,
+ app: AppConnection.OCI as const,
+ methods: Object.values(OCIConnectionMethod) as [OCIConnectionMethod.AccessKey]
+ };
+};
+
+export const validateOCIConnectionCredentials = async (config: TOCIConnectionConfig) => {
+ const provider = await getOCIProvider(config);
+
+ try {
+ const identityClient = new identity.IdentityClient({
+ authenticationDetailsProvider: provider
+ });
+
+ // Get user details - a lightweight call that validates all credentials
+ await identityClient.getUser({ userId: config.credentials.userOcid });
+ } catch (error: unknown) {
+ if (error instanceof Error) {
+ throw new BadRequestError({
+ message: `Failed to validate credentials: ${error.message || "Unknown error"}`
+ });
+ }
+ throw new BadRequestError({
+ message: "Unable to validate connection: verify credentials"
+ });
+ }
+
+ return config.credentials;
+};
+
+export const listOCICompartments = async (appConnection: TOCIConnection) => {
+ const provider = await getOCIProvider(appConnection);
+
+ const identityClient = new identity.IdentityClient({ authenticationDetailsProvider: provider });
+ const keyManagementClient = new keymanagement.KmsVaultClient({
+ authenticationDetailsProvider: provider
+ });
+
+ const rootCompartment = await identityClient
+ .getTenancy({
+ tenancyId: appConnection.credentials.tenancyOcid
+ })
+ .then((response) => ({
+ ...response.tenancy,
+ id: appConnection.credentials.tenancyOcid,
+ name: response.tenancy.name ? `${response.tenancy.name} (root)` : "root"
+ }));
+
+ const compartments = await identityClient.listCompartments({
+ compartmentId: appConnection.credentials.tenancyOcid,
+ compartmentIdInSubtree: true,
+ accessLevel: identity.requests.ListCompartmentsRequest.AccessLevel.Any,
+ lifecycleState: identity.models.Compartment.LifecycleState.Active
+ });
+
+ const allCompartments = [rootCompartment, ...compartments.items];
+ const filteredCompartments = [];
+
+ for await (const compartment of allCompartments) {
+ try {
+ // Check if user can list vaults in this compartment
+ await keyManagementClient.listVaults({
+ compartmentId: compartment.id,
+ limit: 1
+ });
+
+ filteredCompartments.push(compartment);
+ } catch (error) {
+ // Do nothing
+ }
+ }
+
+ return filteredCompartments;
+};
+
+export const listOCIVaults = async (appConnection: TOCIConnection, compartmentOcid: string) => {
+ const provider = await getOCIProvider(appConnection);
+
+ const keyManagementClient = new keymanagement.KmsVaultClient({
+ authenticationDetailsProvider: provider
+ });
+
+ const vaults = await keyManagementClient.listVaults({
+ compartmentId: compartmentOcid
+ });
+
+ return vaults.items.filter((v) => v.lifecycleState === keymanagement.models.Vault.LifecycleState.Active);
+};
+
+export const listOCIVaultKeys = async (appConnection: TOCIConnection, compartmentOcid: string, vaultOcid: string) => {
+ const provider = await getOCIProvider(appConnection);
+
+ const kmsVaultClient = new keymanagement.KmsVaultClient({
+ authenticationDetailsProvider: provider
+ });
+
+ const vault = await kmsVaultClient.getVault({
+ vaultId: vaultOcid
+ });
+
+ const keyManagementClient = new keymanagement.KmsManagementClient({
+ authenticationDetailsProvider: provider
+ });
+
+ keyManagementClient.endpoint = vault.vault.managementEndpoint;
+
+ const keys = await keyManagementClient.listKeys({
+ compartmentId: compartmentOcid
+ });
+
+ return keys.items.filter((v) => v.lifecycleState === keymanagement.models.KeySummary.LifecycleState.Enabled);
+};
diff --git a/backend/src/services/app-connection/oci/oci-connection-schemas.ts b/backend/src/services/app-connection/oci/oci-connection-schemas.ts
new file mode 100644
index 0000000000..f09564455a
--- /dev/null
+++ b/backend/src/services/app-connection/oci/oci-connection-schemas.ts
@@ -0,0 +1,65 @@
+import z from "zod";
+
+import { AppConnections } from "@app/lib/api-docs";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ BaseAppConnectionSchema,
+ GenericCreateAppConnectionFieldsSchema,
+ GenericUpdateAppConnectionFieldsSchema
+} from "@app/services/app-connection/app-connection-schemas";
+
+import { OCIConnectionMethod } from "./oci-connection-enums";
+
+export const OCIConnectionAccessTokenCredentialsSchema = z.object({
+ userOcid: z.string().trim().min(1, "User OCID required").describe(AppConnections.CREDENTIALS.OCI.userOcid),
+ tenancyOcid: z.string().trim().min(1, "Tenancy OCID required").describe(AppConnections.CREDENTIALS.OCI.tenancyOcid),
+ region: z.string().trim().min(1, "Region required").describe(AppConnections.CREDENTIALS.OCI.region),
+ fingerprint: z.string().trim().min(1, "Fingerprint required").describe(AppConnections.CREDENTIALS.OCI.fingerprint),
+ privateKey: z.string().trim().min(1, "Private Key required").describe(AppConnections.CREDENTIALS.OCI.privateKey)
+});
+
+const BaseOCIConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.OCI) });
+
+export const OCIConnectionSchema = BaseOCIConnectionSchema.extend({
+ method: z.literal(OCIConnectionMethod.AccessKey),
+ credentials: OCIConnectionAccessTokenCredentialsSchema
+});
+
+export const SanitizedOCIConnectionSchema = z.discriminatedUnion("method", [
+ BaseOCIConnectionSchema.extend({
+ method: z.literal(OCIConnectionMethod.AccessKey),
+ credentials: OCIConnectionAccessTokenCredentialsSchema.pick({
+ userOcid: true,
+ tenancyOcid: true,
+ region: true,
+ fingerprint: true
+ })
+ })
+]);
+
+export const ValidateOCIConnectionCredentialsSchema = z.discriminatedUnion("method", [
+ z.object({
+ method: z.literal(OCIConnectionMethod.AccessKey).describe(AppConnections.CREATE(AppConnection.OCI).method),
+ credentials: OCIConnectionAccessTokenCredentialsSchema.describe(
+ AppConnections.CREATE(AppConnection.OCI).credentials
+ )
+ })
+]);
+
+export const CreateOCIConnectionSchema = ValidateOCIConnectionCredentialsSchema.and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.OCI)
+);
+
+export const UpdateOCIConnectionSchema = z
+ .object({
+ credentials: OCIConnectionAccessTokenCredentialsSchema.optional().describe(
+ AppConnections.UPDATE(AppConnection.OCI).credentials
+ )
+ })
+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.OCI));
+
+export const OCIConnectionListItemSchema = z.object({
+ name: z.literal("OCI"),
+ app: z.literal(AppConnection.OCI),
+ methods: z.nativeEnum(OCIConnectionMethod).array()
+});
diff --git a/backend/src/services/app-connection/oci/oci-connection-service.ts b/backend/src/services/app-connection/oci/oci-connection-service.ts
new file mode 100644
index 0000000000..2d72135e50
--- /dev/null
+++ b/backend/src/services/app-connection/oci/oci-connection-service.ts
@@ -0,0 +1,70 @@
+import { logger } from "@app/lib/logger";
+import { OrgServiceActor } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import { listOCICompartments, listOCIVaultKeys, listOCIVaults } from "./oci-connection-fns";
+import { TOCIConnection } from "./oci-connection-types";
+
+type TGetAppConnectionFunc = (
+ app: AppConnection,
+ connectionId: string,
+ actor: OrgServiceActor
+) => Promise<TOCIConnection>;
+
+type TListOCIVaultsDTO = {
+ connectionId: string;
+ compartmentOcid: string;
+};
+
+type TListOCIVaultKeysDTO = {
+ connectionId: string;
+ compartmentOcid: string;
+ vaultOcid: string;
+};
+
+export const ociConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
+ const listCompartments = async (connectionId: string, actor: OrgServiceActor) => {
+ const appConnection = await getAppConnection(AppConnection.OCI, connectionId, actor);
+
+ try {
+ const compartments = await listOCICompartments(appConnection);
+ return compartments;
+ } catch (error) {
+ logger.error(error, "Failed to establish connection with OCI");
+ return [];
+ }
+ };
+
+ const listVaults = async ({ connectionId, compartmentOcid }: TListOCIVaultsDTO, actor: OrgServiceActor) => {
+ const appConnection = await getAppConnection(AppConnection.OCI, connectionId, actor);
+
+ try {
+ const vaults = await listOCIVaults(appConnection, compartmentOcid);
+ return vaults;
+ } catch (error) {
+ logger.error(error, "Failed to establish connection with OCI");
+ return [];
+ }
+ };
+
+ const listVaultKeys = async (
+ { connectionId, compartmentOcid, vaultOcid }: TListOCIVaultKeysDTO,
+ actor: OrgServiceActor
+ ) => {
+ const appConnection = await getAppConnection(AppConnection.OCI, connectionId, actor);
+
+ try {
+ const keys = await listOCIVaultKeys(appConnection, compartmentOcid, vaultOcid);
+ return keys;
+ } catch (error) {
+ logger.error(error, "Failed to establish connection with OCI");
+ return [];
+ }
+ };
+
+ return {
+ listCompartments,
+ listVaults,
+ listVaultKeys
+ };
+};
diff --git a/backend/src/services/app-connection/oci/oci-connection-types.ts b/backend/src/services/app-connection/oci/oci-connection-types.ts
new file mode 100644
index 0000000000..74ddfe0c80
--- /dev/null
+++ b/backend/src/services/app-connection/oci/oci-connection-types.ts
@@ -0,0 +1,22 @@
+import z from "zod";
+
+import { DiscriminativePick } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import {
+ CreateOCIConnectionSchema,
+ OCIConnectionSchema,
+ ValidateOCIConnectionCredentialsSchema
+} from "./oci-connection-schemas";
+
+export type TOCIConnection = z.infer<typeof OCIConnectionSchema>;
+
+export type TOCIConnectionInput = z.infer<typeof CreateOCIConnectionSchema> & {
+ app: AppConnection.OCI;
+};
+
+export type TValidateOCIConnectionCredentialsSchema = typeof ValidateOCIConnectionCredentialsSchema;
+
+export type TOCIConnectionConfig = DiscriminativePick<TOCIConnectionInput, "method" | "app" | "credentials"> & {
+ orgId: string;
+};
diff --git a/backend/src/services/certificate-authority/certificate-authority-service.ts b/backend/src/services/certificate-authority/certificate-authority-service.ts
index 499a257417..d504e38edb 100644
--- a/backend/src/services/certificate-authority/certificate-authority-service.ts
+++ b/backend/src/services/certificate-authority/certificate-authority-service.ts
@@ -6,7 +6,11 @@ import { z } from "zod";
import { ActionProjectType, ProjectType, TCertificateAuthorities, TCertificateTemplates } from "@app/db/schemas";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
+import {
+ ProjectPermissionActions,
+ ProjectPermissionCertificateActions,
+ ProjectPermissionSub
+} from "@app/ee/services/permission/project-permission";
import { extractX509CertFromChain } from "@app/lib/certificates/extract-certificate";
import { getConfig } from "@app/lib/config/env";
import { BadRequestError, NotFoundError } from "@app/lib/errors";
@@ -21,6 +25,7 @@ import { TProjectDALFactory } from "@app/services/project/project-dal";
import { getProjectKmsCertificateKeyId } from "@app/services/project/project-fns";
import { TCertificateAuthorityCrlDALFactory } from "../../ee/services/certificate-authority-crl/certificate-authority-crl-dal";
+import { TCertificateSecretDALFactory } from "../certificate/certificate-secret-dal";
import {
CertExtendedKeyUsage,
CertExtendedKeyUsageOIDToName,
@@ -75,6 +80,7 @@ type TCertificateAuthorityServiceFactoryDep = {
certificateTemplateDAL: Pick<TCertificateTemplateDALFactory, "getById" | "find">;
certificateAuthorityQueue: TCertificateAuthorityQueueFactory; // TODO: Pick
certificateDAL: Pick<TCertificateDALFactory, "transaction" | "create" | "find">;
+ certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;
certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;
pkiCollectionDAL: Pick<TPkiCollectionDALFactory, "findById">;
pkiCollectionItemDAL: Pick<TPkiCollectionItemDALFactory, "create">;
@@ -96,6 +102,7 @@ export const certificateAuthorityServiceFactory = ({
certificateTemplateDAL,
certificateDAL,
certificateBodyDAL,
+ certificateSecretDAL,
pkiCollectionDAL,
pkiCollectionItemDAL,
projectDAL,
@@ -1157,9 +1164,12 @@ export const certificateAuthorityServiceFactory = ({
actionProjectType: ActionProjectType.CertificateManager
});
- ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Certificates);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Create,
+ ProjectPermissionSub.Certificates
+ );
- if (ca.status === CaStatus.DISABLED) throw new BadRequestError({ message: "CA is disabled" });
+ if (ca.status !== CaStatus.ACTIVE) throw new BadRequestError({ message: "CA is not active" });
if (!ca.activeCaCertId) throw new BadRequestError({ message: "CA does not have a certificate installed" });
if (ca.requireTemplateForIssuance && !certificateTemplate) {
throw new BadRequestError({ message: "Certificate template is required for issuance" });
@@ -1373,6 +1383,23 @@ export const certificateAuthorityServiceFactory = ({
const { cipherTextBlob: encryptedCertificate } = await kmsEncryptor({
plainText: Buffer.from(new Uint8Array(leafCert.rawData))
});
+ const { cipherTextBlob: encryptedPrivateKey } = await kmsEncryptor({
+ plainText: Buffer.from(skLeaf)
+ });
+
+ const { caCert: issuingCaCertificate, caCertChain } = await getCaCertChain({
+ caCertId: caCert.id,
+ certificateAuthorityDAL,
+ certificateAuthorityCertDAL,
+ projectDAL,
+ kmsService
+ });
+
+ const certificateChainPem = `${issuingCaCertificate}\n${caCertChain}`.trim();
+
+ const { cipherTextBlob: encryptedCertificateChain } = await kmsEncryptor({
+ plainText: Buffer.from(certificateChainPem)
+ });
await certificateDAL.transaction(async (tx) => {
const cert = await certificateDAL.create(
@@ -1396,7 +1423,16 @@ export const certificateAuthorityServiceFactory = ({
await certificateBodyDAL.create(
{
certId: cert.id,
- encryptedCertificate
+ encryptedCertificate,
+ encryptedCertificateChain
+ },
+ tx
+ );
+
+ await certificateSecretDAL.create(
+ {
+ certId: cert.id,
+ encryptedPrivateKey
},
tx
);
@@ -1414,17 +1450,9 @@ export const certificateAuthorityServiceFactory = ({
return cert;
});
- const { caCert: issuingCaCertificate, caCertChain } = await getCaCertChain({
- caCertId: caCert.id,
- certificateAuthorityDAL,
- certificateAuthorityCertDAL,
- projectDAL,
- kmsService
- });
-
return {
certificate: leafCert.toString("pem"),
- certificateChain: `${issuingCaCertificate}\n${caCertChain}`.trim(),
+ certificateChain: certificateChainPem,
issuingCaCertificate,
privateKey: skLeaf,
serialNumber,
@@ -1487,12 +1515,12 @@ export const certificateAuthorityServiceFactory = ({
});
ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionActions.Create,
+ ProjectPermissionCertificateActions.Create,
ProjectPermissionSub.Certificates
);
}
- if (ca.status === CaStatus.DISABLED) throw new BadRequestError({ message: "CA is disabled" });
+ if (ca.status !== CaStatus.ACTIVE) throw new BadRequestError({ message: "CA is not active" });
if (!ca.activeCaCertId) throw new BadRequestError({ message: "CA does not have a certificate installed" });
if (ca.requireTemplateForIssuance && !certificateTemplate) {
throw new BadRequestError({ message: "Certificate template is required for issuance" });
diff --git a/backend/src/services/certificate-authority/certificate-authority-validators.ts b/backend/src/services/certificate-authority/certificate-authority-validators.ts
index 979a3b9c52..4820cfe009 100644
--- a/backend/src/services/certificate-authority/certificate-authority-validators.ts
+++ b/backend/src/services/certificate-authority/certificate-authority-validators.ts
@@ -10,6 +10,18 @@ const isValidDate = (dateString: string) => {
export const validateCaDateField = z.string().trim().refine(isValidDate, { message: "Invalid date format" });
+export const validateAltNameField = z
+ .string()
+ .trim()
+ .refine(
+ (name) => {
+ return isFQDN(name) || z.string().email().safeParse(name).success || isValidIp(name);
+ },
+ {
+ message: "SAN must be a valid hostname, email address, or IP address"
+ }
+ );
+
export const validateAltNamesField = z
.string()
.trim()
diff --git a/backend/src/services/certificate/certificate-dal.ts b/backend/src/services/certificate/certificate-dal.ts
index 71c70838c8..aafbe56f4f 100644
--- a/backend/src/services/certificate/certificate-dal.ts
+++ b/backend/src/services/certificate/certificate-dal.ts
@@ -44,8 +44,27 @@ export const certificateDALFactory = (db: TDbClient) => {
}
};
+ const countCertificatesForPkiSubscriber = async (subscriberId: string) => {
+ try {
+ interface CountResult {
+ count: string;
+ }
+
+ const query = db
+ .replicaNode()(TableName.Certificate)
+ .where(`${TableName.Certificate}.pkiSubscriberId`, subscriberId);
+
+ const count = await query.count("*").first();
+
+ return parseInt((count as unknown as CountResult).count || "0", 10);
+ } catch (error) {
+ throw new DatabaseError({ error, name: "Count all subscriber certificates" });
+ }
+ };
+
return {
...certificateOrm,
- countCertificatesInProject
+ countCertificatesInProject,
+ countCertificatesForPkiSubscriber
};
};
diff --git a/backend/src/services/certificate/certificate-fns.ts b/backend/src/services/certificate/certificate-fns.ts
index 45ad5963c8..7eeb62d93c 100644
--- a/backend/src/services/certificate/certificate-fns.ts
+++ b/backend/src/services/certificate/certificate-fns.ts
@@ -1,6 +1,11 @@
+import crypto from "node:crypto";
+
import * as x509 from "@peculiar/x509";
-import { CrlReason } from "./certificate-types";
+import { BadRequestError, NotFoundError } from "@app/lib/errors";
+
+import { getProjectKmsCertificateKeyId } from "../project/project-fns";
+import { CrlReason, TBuildCertificateChainDTO, TGetCertificateCredentialsDTO } from "./certificate-types";
export const revocationReasonToCrlCode = (crlReason: CrlReason) => {
switch (crlReason) {
@@ -46,3 +51,73 @@ export const constructPemChainFromCerts = (certificates: x509.X509Certificate[])
.map((cert) => cert.toString("pem"))
.join("\n")
.trim();
+
+/**
+ * Return the public and private key of certificate
+ * Note: credentials are returned as PEM strings
+ */
+export const getCertificateCredentials = async ({
+ certId,
+ projectId,
+ certificateSecretDAL,
+ projectDAL,
+ kmsService
+}: TGetCertificateCredentialsDTO) => {
+ const certificateSecret = await certificateSecretDAL.findOne({ certId });
+ if (!certificateSecret)
+ throw new NotFoundError({ message: `Certificate secret for certificate with ID '${certId}' not found` });
+
+ const keyId = await getProjectKmsCertificateKeyId({
+ projectId,
+ projectDAL,
+ kmsService
+ });
+ const kmsDecryptor = await kmsService.decryptWithKmsKey({
+ kmsId: keyId
+ });
+ const decryptedPrivateKey = await kmsDecryptor({
+ cipherTextBlob: certificateSecret.encryptedPrivateKey
+ });
+
+ try {
+ const skObj = crypto.createPrivateKey({ key: decryptedPrivateKey, format: "pem", type: "pkcs8" });
+ const certPrivateKey = skObj.export({ format: "pem", type: "pkcs8" }).toString();
+
+ const pkObj = crypto.createPublicKey(skObj);
+ const certPublicKey = pkObj.export({ format: "pem", type: "spki" }).toString();
+
+ return {
+ certificateSecret,
+ certPrivateKey,
+ certPublicKey
+ };
+ } catch (error) {
+ throw new BadRequestError({ message: `Failed to process private key for certificate with ID '${certId}'` });
+ }
+};
+
+// If the certificate was generated after ~05/01/25 it will have a encryptedCertificateChain attached to it's body
+// Otherwise we'll fallback to manually building the chain
+export const buildCertificateChain = async ({
+ caCert,
+ caCertChain,
+ encryptedCertificateChain,
+ kmsService,
+ kmsId
+}: TBuildCertificateChainDTO) => {
+ if (!encryptedCertificateChain && !caCert) {
+ return null;
+ }
+
+ let certificateChain = `${caCert}\n${caCertChain}`.trim();
+
+ if (encryptedCertificateChain) {
+ const kmsDecryptor = await kmsService.decryptWithKmsKey({ kmsId });
+ const decryptedCertChain = await kmsDecryptor({
+ cipherTextBlob: encryptedCertificateChain
+ });
+ certificateChain = decryptedCertChain.toString();
+ }
+
+ return certificateChain;
+};
diff --git a/backend/src/services/certificate/certificate-secret-dal.ts b/backend/src/services/certificate/certificate-secret-dal.ts
new file mode 100644
index 0000000000..c1493eceb7
--- /dev/null
+++ b/backend/src/services/certificate/certificate-secret-dal.ts
@@ -0,0 +1,10 @@
+import { TDbClient } from "@app/db";
+import { TableName } from "@app/db/schemas";
+import { ormify } from "@app/lib/knex";
+
+export type TCertificateSecretDALFactory = ReturnType<typeof certificateSecretDALFactory>;
+
+export const certificateSecretDALFactory = (db: TDbClient) => {
+ const certSecretOrm = ormify(db, TableName.CertificateSecret);
+ return certSecretOrm;
+};
diff --git a/backend/src/services/certificate/certificate-service.ts b/backend/src/services/certificate/certificate-service.ts
index 0ca0d64c61..292b5f1098 100644
--- a/backend/src/services/certificate/certificate-service.ts
+++ b/backend/src/services/certificate/certificate-service.ts
@@ -4,7 +4,10 @@ import * as x509 from "@peculiar/x509";
import { ActionProjectType } from "@app/db/schemas";
import { TCertificateAuthorityCrlDALFactory } from "@app/ee/services/certificate-authority-crl/certificate-authority-crl-dal";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
-import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
+import {
+ ProjectPermissionCertificateActions,
+ ProjectPermissionSub
+} from "@app/ee/services/permission/project-permission";
import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";
import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";
import { TCertificateAuthorityCertDALFactory } from "@app/services/certificate-authority/certificate-authority-cert-dal";
@@ -15,11 +18,22 @@ import { TProjectDALFactory } from "@app/services/project/project-dal";
import { getProjectKmsCertificateKeyId } from "@app/services/project/project-fns";
import { getCaCertChain, rebuildCaCrl } from "../certificate-authority/certificate-authority-fns";
-import { revocationReasonToCrlCode } from "./certificate-fns";
-import { CertStatus, TDeleteCertDTO, TGetCertBodyDTO, TGetCertDTO, TRevokeCertDTO } from "./certificate-types";
+import { buildCertificateChain, getCertificateCredentials, revocationReasonToCrlCode } from "./certificate-fns";
+import { TCertificateSecretDALFactory } from "./certificate-secret-dal";
+import {
+ CertStatus,
+ TDeleteCertDTO,
+ TGetCertBodyDTO,
+ TGetCertBundleDTO,
+ TGetCertDTO,
+ TGetCertPrivateKeyDTO,
+ TRevokeCertDTO
+} from "./certificate-types";
+import { NotFoundError } from "@app/lib/errors";
type TCertificateServiceFactoryDep = {
certificateDAL: Pick<TCertificateDALFactory, "findOne" | "deleteById" | "update" | "find">;
+ certificateSecretDAL: Pick<TCertificateSecretDALFactory, "findOne">;
certificateBodyDAL: Pick<TCertificateBodyDALFactory, "findOne">;
certificateAuthorityDAL: Pick<TCertificateAuthorityDALFactory, "findById">;
certificateAuthorityCertDAL: Pick<TCertificateAuthorityCertDALFactory, "findById">;
@@ -34,6 +48,7 @@ export type TCertificateServiceFactory = ReturnType<typeof certificateServiceFac
export const certificateServiceFactory = ({
certificateDAL,
+ certificateSecretDAL,
certificateBodyDAL,
certificateAuthorityDAL,
certificateAuthorityCertDAL,
@@ -59,7 +74,10 @@ export const certificateServiceFactory = ({
actionProjectType: ActionProjectType.CertificateManager
});
- ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Read,
+ ProjectPermissionSub.Certificates
+ );
return {
cert,
@@ -67,6 +85,48 @@ export const certificateServiceFactory = ({
};
};
+ /**
+ * Get certificate private key.
+ */
+ const getCertPrivateKey = async ({
+ serialNumber,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TGetCertPrivateKeyDTO) => {
+ const cert = await certificateDAL.findOne({ serialNumber });
+ const ca = await certificateAuthorityDAL.findById(cert.caId);
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: ca.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.ReadPrivateKey,
+ ProjectPermissionSub.Certificates
+ );
+
+ const { certPrivateKey } = await getCertificateCredentials({
+ certId: cert.id,
+ projectId: ca.projectId,
+ certificateSecretDAL,
+ projectDAL,
+ kmsService
+ });
+
+ return {
+ ca,
+ cert,
+ certPrivateKey
+ };
+ };
+
/**
* Delete certificate with serial number [serialNumber]
*/
@@ -83,7 +143,10 @@ export const certificateServiceFactory = ({
actionProjectType: ActionProjectType.CertificateManager
});
- ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Certificates);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Delete,
+ ProjectPermissionSub.Certificates
+ );
const deletedCert = await certificateDAL.deleteById(cert.id);
@@ -118,7 +181,10 @@ export const certificateServiceFactory = ({
actionProjectType: ActionProjectType.CertificateManager
});
- ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Certificates);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Delete,
+ ProjectPermissionSub.Certificates
+ );
if (cert.status === CertStatus.REVOKED) throw new Error("Certificate already revoked");
@@ -165,7 +231,10 @@ export const certificateServiceFactory = ({
actionProjectType: ActionProjectType.CertificateManager
});
- ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Read,
+ ProjectPermissionSub.Certificates
+ );
const certBody = await certificateBodyDAL.findOne({ certId: cert.id });
@@ -192,19 +261,116 @@ export const certificateServiceFactory = ({
kmsService
});
+ const certificateChain = await buildCertificateChain({
+ caCert,
+ caCertChain,
+ kmsId: certificateManagerKeyId,
+ kmsService,
+ encryptedCertificateChain: certBody.encryptedCertificateChain || undefined
+ });
+
return {
certificate: certObj.toString("pem"),
- certificateChain: `${caCert}\n${caCertChain}`.trim(),
+ certificateChain,
serialNumber: certObj.serialNumber,
cert,
ca
};
};
+ /**
+ * Return certificate body and certificate chain for certificate with
+ * serial number [serialNumber]
+ */
+ const getCertBundle = async ({ serialNumber, actorId, actorAuthMethod, actor, actorOrgId }: TGetCertBundleDTO) => {
+ const cert = await certificateDAL.findOne({ serialNumber });
+ const ca = await certificateAuthorityDAL.findById(cert.caId);
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: ca.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Read,
+ ProjectPermissionSub.Certificates
+ );
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.ReadPrivateKey,
+ ProjectPermissionSub.Certificates
+ );
+
+ const certBody = await certificateBodyDAL.findOne({ certId: cert.id });
+
+ const certificateManagerKeyId = await getProjectKmsCertificateKeyId({
+ projectId: ca.projectId,
+ projectDAL,
+ kmsService
+ });
+
+ const kmsDecryptor = await kmsService.decryptWithKmsKey({
+ kmsId: certificateManagerKeyId
+ });
+ const decryptedCert = await kmsDecryptor({
+ cipherTextBlob: certBody.encryptedCertificate
+ });
+
+ const certObj = new x509.X509Certificate(decryptedCert);
+ const certificate = certObj.toString("pem");
+
+ const { caCert, caCertChain } = await getCaCertChain({
+ caCertId: cert.caCertId,
+ certificateAuthorityDAL,
+ certificateAuthorityCertDAL,
+ projectDAL,
+ kmsService
+ });
+
+ const certificateChain = await buildCertificateChain({
+ caCert,
+ caCertChain,
+ kmsId: certificateManagerKeyId,
+ kmsService,
+ encryptedCertificateChain: certBody.encryptedCertificateChain || undefined
+ });
+
+ let privateKey: string | null = null;
+ try {
+ const { certPrivateKey } = await getCertificateCredentials({
+ certId: cert.id,
+ projectId: ca.projectId,
+ certificateSecretDAL,
+ projectDAL,
+ kmsService
+ });
+ privateKey = certPrivateKey;
+ } catch (e) {
+ // Skip NotFound errors but throw all others
+ if (!(e instanceof NotFoundError)) {
+ throw e;
+ }
+ }
+
+ return {
+ certificate,
+ certificateChain,
+ privateKey,
+ serialNumber,
+ cert,
+ ca
+ };
+ };
+
return {
getCert,
+ getCertPrivateKey,
deleteCert,
revokeCert,
- getCertBody
+ getCertBody,
+ getCertBundle
};
};
diff --git a/backend/src/services/certificate/certificate-types.ts b/backend/src/services/certificate/certificate-types.ts
index ef63f142d3..ae04eae6b7 100644
--- a/backend/src/services/certificate/certificate-types.ts
+++ b/backend/src/services/certificate/certificate-types.ts
@@ -2,6 +2,10 @@ import * as x509 from "@peculiar/x509";
import { TProjectPermission } from "@app/lib/types";
+import { TKmsServiceFactory } from "../kms/kms-service";
+import { TProjectDALFactory } from "../project/project-dal";
+import { TCertificateSecretDALFactory } from "./certificate-secret-dal";
+
export enum CertStatus {
ACTIVE = "active",
REVOKED = "revoked"
@@ -73,3 +77,27 @@ export type TRevokeCertDTO = {
export type TGetCertBodyDTO = {
serialNumber: string;
} & Omit<TProjectPermission, "projectId">;
+
+export type TGetCertPrivateKeyDTO = {
+ serialNumber: string;
+} & Omit<TProjectPermission, "projectId">;
+
+export type TGetCertBundleDTO = {
+ serialNumber: string;
+} & Omit<TProjectPermission, "projectId">;
+
+export type TGetCertificateCredentialsDTO = {
+ certId: string;
+ projectId: string;
+ certificateSecretDAL: Pick<TCertificateSecretDALFactory, "findOne">;
+ projectDAL: Pick<TProjectDALFactory, "findOne" | "updateById" | "transaction">;
+ kmsService: Pick<TKmsServiceFactory, "decryptWithKmsKey" | "generateKmsKey">;
+};
+
+export type TBuildCertificateChainDTO = {
+ caCert?: string;
+ caCertChain?: string;
+ encryptedCertificateChain?: Buffer;
+ kmsService: Pick<TKmsServiceFactory, "decryptWithKmsKey">;
+ kmsId: string;
+};
diff --git a/backend/src/services/identity-access-token/identity-access-token-dal.ts b/backend/src/services/identity-access-token/identity-access-token-dal.ts
index 57517c7063..fea12d3ee2 100644
--- a/backend/src/services/identity-access-token/identity-access-token-dal.ts
+++ b/backend/src/services/identity-access-token/identity-access-token-dal.ts
@@ -30,11 +30,13 @@ export const identityAccessTokenDALFactory = (db: TDbClient) => {
.leftJoin(TableName.IdentityGcpAuth, `${TableName.Identity}.id`, `${TableName.IdentityGcpAuth}.identityId`)
.leftJoin(TableName.IdentityAwsAuth, `${TableName.Identity}.id`, `${TableName.IdentityAwsAuth}.identityId`)
.leftJoin(TableName.IdentityAzureAuth, `${TableName.Identity}.id`, `${TableName.IdentityAzureAuth}.identityId`)
+ .leftJoin(TableName.IdentityLdapAuth, `${TableName.Identity}.id`, `${TableName.IdentityLdapAuth}.identityId`)
.leftJoin(
TableName.IdentityKubernetesAuth,
`${TableName.Identity}.id`,
`${TableName.IdentityKubernetesAuth}.identityId`
)
+ .leftJoin(TableName.IdentityOciAuth, `${TableName.Identity}.id`, `${TableName.IdentityOciAuth}.identityId`)
.leftJoin(TableName.IdentityOidcAuth, `${TableName.Identity}.id`, `${TableName.IdentityOidcAuth}.identityId`)
.leftJoin(TableName.IdentityTokenAuth, `${TableName.Identity}.id`, `${TableName.IdentityTokenAuth}.identityId`)
.leftJoin(TableName.IdentityJwtAuth, `${TableName.Identity}.id`, `${TableName.IdentityJwtAuth}.identityId`)
@@ -45,9 +47,11 @@ export const identityAccessTokenDALFactory = (db: TDbClient) => {
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityAwsAuth).as("accessTokenTrustedIpsAws"),
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityAzureAuth).as("accessTokenTrustedIpsAzure"),
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityKubernetesAuth).as("accessTokenTrustedIpsK8s"),
+ db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityOciAuth).as("accessTokenTrustedIpsOci"),
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityOidcAuth).as("accessTokenTrustedIpsOidc"),
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityTokenAuth).as("accessTokenTrustedIpsToken"),
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityJwtAuth).as("accessTokenTrustedIpsJwt"),
+ db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityLdapAuth).as("accessTokenTrustedIpsLdap"),
db.ref("name").withSchema(TableName.Identity)
)
.first();
@@ -61,9 +65,11 @@ export const identityAccessTokenDALFactory = (db: TDbClient) => {
trustedIpsAwsAuth: doc.accessTokenTrustedIpsAws,
trustedIpsAzureAuth: doc.accessTokenTrustedIpsAzure,
trustedIpsKubernetesAuth: doc.accessTokenTrustedIpsK8s,
+ trustedIpsOciAuth: doc.accessTokenTrustedIpsOci,
trustedIpsOidcAuth: doc.accessTokenTrustedIpsOidc,
trustedIpsAccessTokenAuth: doc.accessTokenTrustedIpsToken,
- trustedIpsAccessJwtAuth: doc.accessTokenTrustedIpsJwt
+ trustedIpsAccessJwtAuth: doc.accessTokenTrustedIpsJwt,
+ trustedIpsAccessLdapAuth: doc.accessTokenTrustedIpsLdap
};
} catch (error) {
throw new DatabaseError({ error, name: "IdAccessTokenFindOne" });
diff --git a/backend/src/services/identity-access-token/identity-access-token-service.ts b/backend/src/services/identity-access-token/identity-access-token-service.ts
index a51d80e41e..6a082c432d 100644
--- a/backend/src/services/identity-access-token/identity-access-token-service.ts
+++ b/backend/src/services/identity-access-token/identity-access-token-service.ts
@@ -182,11 +182,13 @@ export const identityAccessTokenServiceFactory = ({
[IdentityAuthMethod.UNIVERSAL_AUTH]: identityAccessToken.trustedIpsUniversalAuth,
[IdentityAuthMethod.GCP_AUTH]: identityAccessToken.trustedIpsGcpAuth,
[IdentityAuthMethod.AWS_AUTH]: identityAccessToken.trustedIpsAwsAuth,
+ [IdentityAuthMethod.OCI_AUTH]: identityAccessToken.trustedIpsOciAuth,
[IdentityAuthMethod.AZURE_AUTH]: identityAccessToken.trustedIpsAzureAuth,
[IdentityAuthMethod.KUBERNETES_AUTH]: identityAccessToken.trustedIpsKubernetesAuth,
[IdentityAuthMethod.OIDC_AUTH]: identityAccessToken.trustedIpsOidcAuth,
[IdentityAuthMethod.TOKEN_AUTH]: identityAccessToken.trustedIpsAccessTokenAuth,
- [IdentityAuthMethod.JWT_AUTH]: identityAccessToken.trustedIpsAccessJwtAuth
+ [IdentityAuthMethod.JWT_AUTH]: identityAccessToken.trustedIpsAccessJwtAuth,
+ [IdentityAuthMethod.LDAP_AUTH]: identityAccessToken.trustedIpsAccessLdapAuth
};
const trustedIps = trustedIpsMap[identityAccessToken.authMethod as IdentityAuthMethod];
diff --git a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
index 9c0e8d2dd7..a3ec1bdeb8 100644
--- a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
+++ b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
@@ -4,8 +4,14 @@ import https from "https";
import jwt from "jsonwebtoken";
import { IdentityAuthMethod, TIdentityKubernetesAuthsUpdate } from "@app/db/schemas";
+import { TGatewayDALFactory } from "@app/ee/services/gateway/gateway-dal";
+import { TGatewayServiceFactory } from "@app/ee/services/gateway/gateway-service";
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
-import { OrgPermissionIdentityActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";
+import {
+ OrgPermissionGatewayActions,
+ OrgPermissionIdentityActions,
+ OrgPermissionSubjects
+} from "@app/ee/services/permission/org-permission";
import {
constructPermissionErrorMessage,
validatePrivilegeChangeOperation
@@ -13,6 +19,7 @@ import {
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
import { getConfig } from "@app/lib/config/env";
import { BadRequestError, NotFoundError, PermissionBoundaryError, UnauthorizedError } from "@app/lib/errors";
+import { withGatewayProxy } from "@app/lib/gateway";
import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip";
import { ActorType, AuthTokenType } from "../auth/auth-type";
@@ -43,6 +50,8 @@ type TIdentityKubernetesAuthServiceFactoryDep = {
permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;
licenseService: Pick<TLicenseServiceFactory, "getPlan">;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
+ gatewayService: TGatewayServiceFactory;
+ gatewayDAL: Pick<TGatewayDALFactory, "find">;
};
export type TIdentityKubernetesAuthServiceFactory = ReturnType<typeof identityKubernetesAuthServiceFactory>;
@@ -53,8 +62,45 @@ export const identityKubernetesAuthServiceFactory = ({
identityAccessTokenDAL,
permissionService,
licenseService,
+ gatewayService,
+ gatewayDAL,
kmsService
}: TIdentityKubernetesAuthServiceFactoryDep) => {
+ const $gatewayProxyWrapper = async <T>(
+ inputs: {
+ gatewayId: string;
+ targetHost: string;
+ targetPort: number;
+ },
+ gatewayCallback: (host: string, port: number) => Promise<T>
+ ): Promise<T> => {
+ const relayDetails = await gatewayService.fnGetGatewayClientTlsByGatewayId(inputs.gatewayId);
+ const [relayHost, relayPort] = relayDetails.relayAddress.split(":");
+
+ const callbackResult = await withGatewayProxy(
+ async (port) => {
+ // Needs to be https protocol or the kubernetes API server will fail with "Client sent an HTTP request to an HTTPS server"
+ const res = await gatewayCallback("https://localhost", port);
+ return res;
+ },
+ {
+ targetHost: inputs.targetHost,
+ targetPort: inputs.targetPort,
+ relayHost,
+ relayPort: Number(relayPort),
+ identityId: relayDetails.identityId,
+ orgId: relayDetails.orgId,
+ tlsOptions: {
+ ca: relayDetails.certChain,
+ cert: relayDetails.certificate,
+ key: relayDetails.privateKey.toString()
+ }
+ }
+ );
+
+ return callbackResult;
+ };
+
const login = async ({ identityId, jwt: serviceAccountJwt }: TLoginKubernetesAuthDTO) => {
const identityKubernetesAuth = await identityKubernetesAuthDAL.findOne({ identityId });
if (!identityKubernetesAuth) {
@@ -92,46 +138,65 @@ export const identityKubernetesAuthServiceFactory = ({
tokenReviewerJwt = serviceAccountJwt;
}
- const { data } = await axios
- .post<TCreateTokenReviewResponse>(
- `${identityKubernetesAuth.kubernetesHost}/apis/authentication.k8s.io/v1/tokenreviews`,
- {
- apiVersion: "authentication.k8s.io/v1",
- kind: "TokenReview",
- spec: {
- token: serviceAccountJwt,
- ...(identityKubernetesAuth.allowedAudience ? { audiences: [identityKubernetesAuth.allowedAudience] } : {})
- }
- },
- {
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${tokenReviewerJwt}`
+ const tokenReviewCallback = async (host: string = identityKubernetesAuth.kubernetesHost, port?: number) => {
+ const baseUrl = port ? `${host}:${port}` : host;
+
+ const res = await axios
+ .post<TCreateTokenReviewResponse>(
+ `${baseUrl}/apis/authentication.k8s.io/v1/tokenreviews`,
+ {
+ apiVersion: "authentication.k8s.io/v1",
+ kind: "TokenReview",
+ spec: {
+ token: serviceAccountJwt,
+ ...(identityKubernetesAuth.allowedAudience ? { audiences: [identityKubernetesAuth.allowedAudience] } : {})
+ }
},
- signal: AbortSignal.timeout(10000),
- timeout: 10000,
- // if ca cert, rejectUnauthorized: true
- httpsAgent: new https.Agent({
- ca: caCert,
- rejectUnauthorized: !!caCert
- })
- }
- )
- .catch((err) => {
- if (err instanceof AxiosError) {
- if (err.response) {
- const { message } = err?.response?.data as unknown as { message?: string };
-
- if (message) {
- throw new UnauthorizedError({
- message,
- name: "KubernetesTokenReviewRequestError"
- });
+ {
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${tokenReviewerJwt}`
+ },
+ signal: AbortSignal.timeout(10000),
+ timeout: 10000,
+ // if ca cert, rejectUnauthorized: true
+ httpsAgent: new https.Agent({
+ ca: caCert,
+ rejectUnauthorized: !!caCert
+ })
+ }
+ )
+ .catch((err) => {
+ if (err instanceof AxiosError) {
+ if (err.response) {
+ const { message } = err?.response?.data as unknown as { message?: string };
+
+ if (message) {
+ throw new UnauthorizedError({
+ message,
+ name: "KubernetesTokenReviewRequestError"
+ });
+ }
}
}
- }
- throw err;
- });
+ throw err;
+ });
+
+ return res.data;
+ };
+
+ const [k8sHost, k8sPort] = identityKubernetesAuth.kubernetesHost.split(":");
+
+ const data = identityKubernetesAuth.gatewayId
+ ? await $gatewayProxyWrapper(
+ {
+ gatewayId: identityKubernetesAuth.gatewayId,
+ targetHost: k8sHost,
+ targetPort: k8sPort ? Number(k8sPort) : 443
+ },
+ tokenReviewCallback
+ )
+ : await tokenReviewCallback();
if ("error" in data.status)
throw new UnauthorizedError({ message: data.status.error, name: "KubernetesTokenReviewError" });
@@ -222,6 +287,7 @@ export const identityKubernetesAuthServiceFactory = ({
const attachKubernetesAuth = async ({
identityId,
+ gatewayId,
kubernetesHost,
caCert,
tokenReviewerJwt,
@@ -280,6 +346,27 @@ export const identityKubernetesAuthServiceFactory = ({
return extractIPDetails(accessTokenTrustedIp.ipAddress);
});
+ if (gatewayId) {
+ const [gateway] = await gatewayDAL.find({ id: gatewayId, orgId: identityMembershipOrg.orgId });
+ if (!gateway) {
+ throw new NotFoundError({
+ message: `Gateway with ID ${gatewayId} not found`
+ });
+ }
+
+ const { permission: orgPermission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+ ForbiddenError.from(orgPermission).throwUnlessCan(
+ OrgPermissionGatewayActions.AttachGateways,
+ OrgPermissionSubjects.Gateway
+ );
+ }
+
const { encryptor } = await kmsService.createCipherPairWithDataKey({
type: KmsDataKey.Organization,
orgId: identityMembershipOrg.orgId
@@ -296,6 +383,7 @@ export const identityKubernetesAuthServiceFactory = ({
accessTokenMaxTTL,
accessTokenTTL,
accessTokenNumUsesLimit,
+ gatewayId,
accessTokenTrustedIps: JSON.stringify(reformattedAccessTokenTrustedIps),
encryptedKubernetesTokenReviewerJwt: tokenReviewerJwt
? encryptor({ plainText: Buffer.from(tokenReviewerJwt) }).cipherTextBlob
@@ -318,6 +406,7 @@ export const identityKubernetesAuthServiceFactory = ({
allowedNamespaces,
allowedNames,
allowedAudience,
+ gatewayId,
accessTokenTTL,
accessTokenMaxTTL,
accessTokenNumUsesLimit,
@@ -373,11 +462,33 @@ export const identityKubernetesAuthServiceFactory = ({
return extractIPDetails(accessTokenTrustedIp.ipAddress);
});
+ if (gatewayId) {
+ const [gateway] = await gatewayDAL.find({ id: gatewayId, orgId: identityMembershipOrg.orgId });
+ if (!gateway) {
+ throw new NotFoundError({
+ message: `Gateway with ID ${gatewayId} not found`
+ });
+ }
+
+ const { permission: orgPermission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+ ForbiddenError.from(orgPermission).throwUnlessCan(
+ OrgPermissionGatewayActions.AttachGateways,
+ OrgPermissionSubjects.Gateway
+ );
+ }
+
const updateQuery: TIdentityKubernetesAuthsUpdate = {
kubernetesHost,
allowedNamespaces,
allowedNames,
allowedAudience,
+ gatewayId,
accessTokenMaxTTL,
accessTokenTTL,
accessTokenNumUsesLimit,
diff --git a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-types.ts b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-types.ts
index b3bbcb49ea..7a9cb88b57 100644
--- a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-types.ts
+++ b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-types.ts
@@ -13,6 +13,7 @@ export type TAttachKubernetesAuthDTO = {
allowedNamespaces: string;
allowedNames: string;
allowedAudience: string;
+ gatewayId?: string | null;
accessTokenTTL: number;
accessTokenMaxTTL: number;
accessTokenNumUsesLimit: number;
@@ -28,6 +29,7 @@ export type TUpdateKubernetesAuthDTO = {
allowedNamespaces?: string;
allowedNames?: string;
allowedAudience?: string;
+ gatewayId?: string | null;
accessTokenTTL?: number;
accessTokenMaxTTL?: number;
accessTokenNumUsesLimit?: number;
diff --git a/backend/src/services/identity-ldap-auth/identity-ldap-auth-dal.ts b/backend/src/services/identity-ldap-auth/identity-ldap-auth-dal.ts
new file mode 100644
index 0000000000..0d998dbe93
--- /dev/null
+++ b/backend/src/services/identity-ldap-auth/identity-ldap-auth-dal.ts
@@ -0,0 +1,11 @@
+import { TDbClient } from "@app/db";
+import { TableName } from "@app/db/schemas";
+import { ormify } from "@app/lib/knex";
+
+export type TIdentityLdapAuthDALFactory = ReturnType<typeof identityLdapAuthDALFactory>;
+
+export const identityLdapAuthDALFactory = (db: TDbClient) => {
+ const ldapAuthOrm = ormify(db, TableName.IdentityLdapAuth);
+
+ return ldapAuthOrm;
+};
diff --git a/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts b/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts
new file mode 100644
index 0000000000..7462c92288
--- /dev/null
+++ b/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts
@@ -0,0 +1,543 @@
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+import { ForbiddenError } from "@casl/ability";
+import jwt from "jsonwebtoken";
+
+import { IdentityAuthMethod } from "@app/db/schemas";
+import { testLDAPConfig } from "@app/ee/services/ldap-config/ldap-fns";
+import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
+import { OrgPermissionIdentityActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";
+import {
+ constructPermissionErrorMessage,
+ validatePrivilegeChangeOperation
+} from "@app/ee/services/permission/permission-fns";
+import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
+import { getConfig } from "@app/lib/config/env";
+import { BadRequestError, NotFoundError, PermissionBoundaryError } from "@app/lib/errors";
+import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip";
+
+import { ActorType, AuthTokenType } from "../auth/auth-type";
+import { TIdentityDALFactory } from "../identity/identity-dal";
+import { TIdentityOrgDALFactory } from "../identity/identity-org-dal";
+import { TIdentityAccessTokenDALFactory } from "../identity-access-token/identity-access-token-dal";
+import { TIdentityAccessTokenJwtPayload } from "../identity-access-token/identity-access-token-types";
+import { TKmsServiceFactory } from "../kms/kms-service";
+import { KmsDataKey } from "../kms/kms-types";
+import { validateIdentityUpdateForSuperAdminPrivileges } from "../super-admin/super-admin-fns";
+import { TIdentityLdapAuthDALFactory } from "./identity-ldap-auth-dal";
+import {
+ AllowedFieldsSchema,
+ TAttachLdapAuthDTO,
+ TGetLdapAuthDTO,
+ TLoginLdapAuthDTO,
+ TRevokeLdapAuthDTO,
+ TUpdateLdapAuthDTO
+} from "./identity-ldap-auth-types";
+
+type TIdentityLdapAuthServiceFactoryDep = {
+ identityAccessTokenDAL: Pick<TIdentityAccessTokenDALFactory, "create" | "delete">;
+ identityLdapAuthDAL: Pick<
+ TIdentityLdapAuthDALFactory,
+ "findOne" | "transaction" | "create" | "updateById" | "delete"
+ >;
+ identityOrgMembershipDAL: Pick<TIdentityOrgDALFactory, "findOne">;
+ licenseService: Pick<TLicenseServiceFactory, "getPlan">;
+ permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;
+ kmsService: TKmsServiceFactory;
+ identityDAL: TIdentityDALFactory;
+};
+
+export type TIdentityLdapAuthServiceFactory = ReturnType<typeof identityLdapAuthServiceFactory>;
+
+export const identityLdapAuthServiceFactory = ({
+ identityAccessTokenDAL,
+ identityDAL,
+ identityLdapAuthDAL,
+ identityOrgMembershipDAL,
+ licenseService,
+ permissionService,
+ kmsService
+}: TIdentityLdapAuthServiceFactoryDep) => {
+ const getLdapConfig = async (identityId: string) => {
+ const identity = await identityDAL.findOne({ id: identityId });
+ if (!identity) throw new NotFoundError({ message: `Identity with ID '${identityId}' not found` });
+
+ const identityOrgMembership = await identityOrgMembershipDAL.findOne({ identityId: identity.id });
+ if (!identityOrgMembership) throw new NotFoundError({ message: `Identity with ID '${identityId}' not found` });
+
+ const ldapAuth = await identityLdapAuthDAL.findOne({ identityId: identity.id });
+ if (!ldapAuth) throw new NotFoundError({ message: `LDAP auth with ID '${identityId}' not found` });
+
+ const parsedAllowedFields = ldapAuth.allowedFields
+ ? AllowedFieldsSchema.array().parse(ldapAuth.allowedFields)
+ : undefined;
+
+ const { decryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.Organization,
+ orgId: identityOrgMembership.orgId
+ });
+
+ const bindDN = decryptor({ cipherTextBlob: ldapAuth.encryptedBindDN }).toString();
+ const bindPass = decryptor({ cipherTextBlob: ldapAuth.encryptedBindPass }).toString();
+ const ldapCaCertificate = ldapAuth.encryptedLdapCaCertificate
+ ? decryptor({ cipherTextBlob: ldapAuth.encryptedLdapCaCertificate }).toString()
+ : undefined;
+
+ const ldapConfig = {
+ id: ldapAuth.id,
+ organization: identityOrgMembership.orgId,
+ url: ldapAuth.url,
+ bindDN,
+ bindPass,
+ searchBase: ldapAuth.searchBase,
+ searchFilter: ldapAuth.searchFilter,
+ caCert: ldapCaCertificate || "",
+ allowedFields: parsedAllowedFields
+ };
+
+ const opts = {
+ server: {
+ url: ldapAuth.url,
+ bindDN,
+ bindCredentials: bindPass,
+ searchBase: ldapAuth.searchBase,
+ searchFilter: ldapAuth.searchFilter,
+ ...(ldapCaCertificate
+ ? {
+ tlsOptions: {
+ ca: [ldapCaCertificate]
+ }
+ }
+ : {})
+ },
+ passReqToCallback: true
+ };
+
+ return { opts, ldapConfig };
+ };
+
+ const login = async ({ identityId }: TLoginLdapAuthDTO) => {
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId });
+
+ if (!identityMembershipOrg) {
+ throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+ }
+
+ const identityLdapAuth = await identityLdapAuthDAL.findOne({ identityId });
+
+ if (!identityLdapAuth) {
+ throw new NotFoundError({ message: `Failed to find LDAP auth for identity with ID ${identityId}` });
+ }
+
+ const plan = await licenseService.getPlan(identityMembershipOrg.orgId);
+ if (!plan.ldap) {
+ throw new BadRequestError({
+ message:
+ "Failed to login to identity due to plan restriction. Upgrade plan to login to use LDAP authentication."
+ });
+ }
+
+ const identityAccessToken = await identityLdapAuthDAL.transaction(async (tx) => {
+ const newToken = await identityAccessTokenDAL.create(
+ {
+ identityId: identityLdapAuth.identityId,
+ isAccessTokenRevoked: false,
+ accessTokenTTL: identityLdapAuth.accessTokenTTL,
+ accessTokenMaxTTL: identityLdapAuth.accessTokenMaxTTL,
+ accessTokenNumUses: 0,
+ accessTokenNumUsesLimit: identityLdapAuth.accessTokenNumUsesLimit,
+ authMethod: IdentityAuthMethod.LDAP_AUTH
+ },
+ tx
+ );
+ return newToken;
+ });
+
+ const appCfg = getConfig();
+ const accessToken = jwt.sign(
+ {
+ identityId: identityLdapAuth.identityId,
+ identityAccessTokenId: identityAccessToken.id,
+ authTokenType: AuthTokenType.IDENTITY_ACCESS_TOKEN
+ } as TIdentityAccessTokenJwtPayload,
+ appCfg.AUTH_SECRET,
+ // akhilmhdh: for non-expiry tokens you should not even set the value, including undefined. Even for undefined jsonwebtoken throws error
+ Number(identityAccessToken.accessTokenTTL) === 0
+ ? undefined
+ : {
+ expiresIn: Number(identityAccessToken.accessTokenTTL)
+ }
+ );
+
+ return { accessToken, identityLdapAuth, identityAccessToken, identityMembershipOrg };
+ };
+
+ const attachLdapAuth = async ({
+ identityId,
+ url,
+ searchBase,
+ searchFilter,
+ bindDN,
+ bindPass,
+ ldapCaCertificate,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId,
+ isActorSuperAdmin,
+ allowedFields
+ }: TAttachLdapAuthDTO) => {
+ await validateIdentityUpdateForSuperAdminPrivileges(identityId, isActorSuperAdmin);
+
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId });
+ if (!identityMembershipOrg) throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+
+ if (identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.LDAP_AUTH)) {
+ throw new BadRequestError({
+ message: "Failed to add LDAP Auth to already configured identity"
+ });
+ }
+
+ if (accessTokenMaxTTL > 0 && accessTokenTTL > accessTokenMaxTTL) {
+ throw new BadRequestError({ message: "Access token TTL cannot be greater than max TTL" });
+ }
+
+ const { permission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Create, OrgPermissionSubjects.Identity);
+ const plan = await licenseService.getPlan(identityMembershipOrg.orgId);
+
+ if (!plan.ldap) {
+ throw new BadRequestError({
+ message: "Failed to add LDAP Auth to identity due to plan restriction. Upgrade plan to add LDAP Auth."
+ });
+ }
+
+ const reformattedAccessTokenTrustedIps = accessTokenTrustedIps.map((accessTokenTrustedIp) => {
+ if (
+ !plan.ipAllowlisting &&
+ accessTokenTrustedIp.ipAddress !== "0.0.0.0/0" &&
+ accessTokenTrustedIp.ipAddress !== "::/0"
+ )
+ throw new BadRequestError({
+ message:
+ "Failed to add IP access range to access token due to plan restriction. Upgrade plan to add IP access range."
+ });
+ if (!isValidIpOrCidr(accessTokenTrustedIp.ipAddress))
+ throw new BadRequestError({
+ message: "The IP is not a valid IPv4, IPv6, or CIDR block"
+ });
+ return extractIPDetails(accessTokenTrustedIp.ipAddress);
+ });
+
+ if (allowedFields) AllowedFieldsSchema.array().parse(allowedFields);
+
+ const identityLdapAuth = await identityLdapAuthDAL.transaction(async (tx) => {
+ const { encryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.Organization,
+ orgId: identityMembershipOrg.orgId
+ });
+
+ const { cipherTextBlob: encryptedBindPass } = encryptor({
+ plainText: Buffer.from(bindPass)
+ });
+
+ let encryptedLdapCaCertificate: Buffer | undefined;
+ if (ldapCaCertificate) {
+ const { cipherTextBlob: encryptedCertificate } = encryptor({
+ plainText: Buffer.from(ldapCaCertificate)
+ });
+
+ encryptedLdapCaCertificate = encryptedCertificate;
+ }
+
+ const { cipherTextBlob: encryptedBindDN } = encryptor({
+ plainText: Buffer.from(bindDN)
+ });
+
+ const isConnected = await testLDAPConfig({
+ bindDN,
+ bindPass,
+ caCert: ldapCaCertificate || "",
+ url
+ });
+
+ if (!isConnected) {
+ throw new BadRequestError({
+ message:
+ "Failed to connect to LDAP server. Please ensure that the LDAP server is running and your credentials are correct."
+ });
+ }
+
+ const doc = await identityLdapAuthDAL.create(
+ {
+ identityId: identityMembershipOrg.identityId,
+ encryptedBindDN,
+ encryptedBindPass,
+ searchBase,
+ searchFilter,
+ url,
+ encryptedLdapCaCertificate,
+ accessTokenMaxTTL,
+ accessTokenTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps: JSON.stringify(reformattedAccessTokenTrustedIps),
+ allowedFields: allowedFields ? JSON.stringify(allowedFields) : undefined
+ },
+ tx
+ );
+ return doc;
+ });
+ return { ...identityLdapAuth, orgId: identityMembershipOrg.orgId };
+ };
+
+ const updateLdapAuth = async ({
+ identityId,
+ url,
+ searchBase,
+ searchFilter,
+ bindDN,
+ bindPass,
+ ldapCaCertificate,
+ allowedFields,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TUpdateLdapAuthDTO) => {
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId });
+ if (!identityMembershipOrg) throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+
+ if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.LDAP_AUTH)) {
+ throw new NotFoundError({
+ message: "The identity does not have LDAP Auth attached"
+ });
+ }
+
+ const identityLdapAuth = await identityLdapAuthDAL.findOne({ identityId });
+
+ if (
+ (accessTokenMaxTTL || identityLdapAuth.accessTokenMaxTTL) > 0 &&
+ (accessTokenTTL || identityLdapAuth.accessTokenTTL) > (accessTokenMaxTTL || identityLdapAuth.accessTokenMaxTTL)
+ ) {
+ throw new BadRequestError({ message: "Access token TTL cannot be greater than max TTL" });
+ }
+
+ const { permission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Edit, OrgPermissionSubjects.Identity);
+
+ const plan = await licenseService.getPlan(identityMembershipOrg.orgId);
+
+ if (!plan.ldap) {
+ throw new BadRequestError({
+ message: "Failed to update LDAP Auth due to plan restriction. Upgrade plan to update LDAP Auth."
+ });
+ }
+
+ const reformattedAccessTokenTrustedIps = accessTokenTrustedIps?.map((accessTokenTrustedIp) => {
+ if (
+ !plan.ipAllowlisting &&
+ accessTokenTrustedIp.ipAddress !== "0.0.0.0/0" &&
+ accessTokenTrustedIp.ipAddress !== "::/0"
+ )
+ throw new BadRequestError({
+ message:
+ "Failed to add IP access range to access token due to plan restriction. Upgrade plan to add IP access range."
+ });
+ if (!isValidIpOrCidr(accessTokenTrustedIp.ipAddress))
+ throw new BadRequestError({
+ message: "The IP is not a valid IPv4, IPv6, or CIDR block"
+ });
+ return extractIPDetails(accessTokenTrustedIp.ipAddress);
+ });
+
+ if (allowedFields) AllowedFieldsSchema.array().parse(allowedFields);
+
+ const { encryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.Organization,
+ orgId: identityMembershipOrg.orgId
+ });
+
+ let encryptedBindPass: Buffer | undefined;
+ if (bindPass) {
+ const { cipherTextBlob: bindPassCiphertext } = encryptor({
+ plainText: Buffer.from(bindPass)
+ });
+
+ encryptedBindPass = bindPassCiphertext;
+ }
+
+ let encryptedLdapCaCertificate: Buffer | undefined;
+ if (ldapCaCertificate) {
+ const { cipherTextBlob: ldapCaCertificateCiphertext } = encryptor({
+ plainText: Buffer.from(ldapCaCertificate)
+ });
+
+ encryptedLdapCaCertificate = ldapCaCertificateCiphertext;
+ }
+
+ let encryptedBindDN: Buffer | undefined;
+ if (bindDN) {
+ const { cipherTextBlob: bindDNCiphertext } = encryptor({
+ plainText: Buffer.from(bindDN)
+ });
+
+ encryptedBindDN = bindDNCiphertext;
+ }
+
+ const { ldapConfig } = await getLdapConfig(identityId);
+
+ const isConnected = await testLDAPConfig({
+ bindDN: bindDN || ldapConfig.bindDN,
+ bindPass: bindPass || ldapConfig.bindPass,
+ caCert: ldapCaCertificate || ldapConfig.caCert,
+ url: url || ldapConfig.url
+ });
+
+ if (!isConnected) {
+ throw new BadRequestError({
+ message:
+ "Failed to connect to LDAP server. Please ensure that the LDAP server is running and your credentials are correct."
+ });
+ }
+
+ const updatedLdapAuth = await identityLdapAuthDAL.updateById(identityLdapAuth.id, {
+ url,
+ searchBase,
+ searchFilter,
+ encryptedBindDN,
+ encryptedBindPass,
+ encryptedLdapCaCertificate,
+ allowedFields: allowedFields ? JSON.stringify(allowedFields) : undefined,
+ accessTokenMaxTTL,
+ accessTokenTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps: reformattedAccessTokenTrustedIps
+ ? JSON.stringify(reformattedAccessTokenTrustedIps)
+ : undefined
+ });
+
+ return { ...updatedLdapAuth, orgId: identityMembershipOrg.orgId };
+ };
+
+ const getLdapAuth = async ({ identityId, actorId, actor, actorAuthMethod, actorOrgId }: TGetLdapAuthDTO) => {
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId });
+ if (!identityMembershipOrg) throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+
+ if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.LDAP_AUTH)) {
+ throw new BadRequestError({
+ message: "The identity does not have LDAP Auth attached"
+ });
+ }
+
+ const ldapIdentityAuth = await identityLdapAuthDAL.findOne({ identityId });
+
+ const { permission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
+ const { decryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.Organization,
+ orgId: identityMembershipOrg.orgId
+ });
+
+ const bindDN = decryptor({ cipherTextBlob: ldapIdentityAuth.encryptedBindDN }).toString();
+ const bindPass = decryptor({ cipherTextBlob: ldapIdentityAuth.encryptedBindPass }).toString();
+ const ldapCaCertificate = ldapIdentityAuth.encryptedLdapCaCertificate
+ ? decryptor({ cipherTextBlob: ldapIdentityAuth.encryptedLdapCaCertificate }).toString()
+ : undefined;
+
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Read, OrgPermissionSubjects.Identity);
+ return { ...ldapIdentityAuth, orgId: identityMembershipOrg.orgId, bindDN, bindPass, ldapCaCertificate };
+ };
+
+ const revokeIdentityLdapAuth = async ({
+ identityId,
+ actorId,
+ actor,
+ actorAuthMethod,
+ actorOrgId
+ }: TRevokeLdapAuthDTO) => {
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId });
+ if (!identityMembershipOrg) throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+ if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.LDAP_AUTH)) {
+ throw new BadRequestError({
+ message: "The identity does not have LDAP Auth attached"
+ });
+ }
+ const { permission, membership } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Edit, OrgPermissionSubjects.Identity);
+
+ const { permission: rolePermission } = await permissionService.getOrgPermission(
+ ActorType.IDENTITY,
+ identityMembershipOrg.identityId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
+ const permissionBoundary = validatePrivilegeChangeOperation(
+ membership.shouldUseNewPrivilegeSystem,
+ OrgPermissionIdentityActions.RevokeAuth,
+ OrgPermissionSubjects.Identity,
+ permission,
+ rolePermission
+ );
+
+ if (!permissionBoundary.isValid)
+ throw new PermissionBoundaryError({
+ message: constructPermissionErrorMessage(
+ "Failed to revoke LDAP auth of identity with more privileged role",
+ membership.shouldUseNewPrivilegeSystem,
+ OrgPermissionIdentityActions.RevokeAuth,
+ OrgPermissionSubjects.Identity
+ ),
+ details: { missingPermissions: permissionBoundary.missingPermissions }
+ });
+
+ const revokedIdentityLdapAuth = await identityLdapAuthDAL.transaction(async (tx) => {
+ const [deletedLdapAuth] = await identityLdapAuthDAL.delete({ identityId }, tx);
+ await identityAccessTokenDAL.delete({ identityId, authMethod: IdentityAuthMethod.LDAP_AUTH }, tx);
+
+ return { ...deletedLdapAuth, orgId: identityMembershipOrg.orgId };
+ });
+ return revokedIdentityLdapAuth;
+ };
+
+ return {
+ attachLdapAuth,
+ getLdapConfig,
+ updateLdapAuth,
+ login,
+ revokeIdentityLdapAuth,
+ getLdapAuth
+ };
+};
diff --git a/backend/src/services/identity-ldap-auth/identity-ldap-auth-types.ts b/backend/src/services/identity-ldap-auth/identity-ldap-auth-types.ts
new file mode 100644
index 0000000000..0e6feb5fb5
--- /dev/null
+++ b/backend/src/services/identity-ldap-auth/identity-ldap-auth-types.ts
@@ -0,0 +1,56 @@
+import { z } from "zod";
+
+import { TProjectPermission } from "@app/lib/types";
+
+export const AllowedFieldsSchema = z.object({
+ key: z.string().trim(),
+ value: z
+ .string()
+ .trim()
+ .transform((val) => val.replace(/\s/g, ""))
+});
+
+export type TAllowedFields = z.infer<typeof AllowedFieldsSchema>;
+
+export type TAttachLdapAuthDTO = {
+ identityId: string;
+ url: string;
+ searchBase: string;
+ searchFilter: string;
+ bindDN: string;
+ bindPass: string;
+ ldapCaCertificate?: string;
+ allowedFields?: TAllowedFields[];
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: { ipAddress: string }[];
+ isActorSuperAdmin?: boolean;
+} & Omit<TProjectPermission, "projectId">;
+
+export type TUpdateLdapAuthDTO = {
+ identityId: string;
+ url?: string;
+ searchBase?: string;
+ searchFilter?: string;
+ bindDN?: string;
+ bindPass?: string;
+ allowedFields?: TAllowedFields[];
+ ldapCaCertificate?: string;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: { ipAddress: string }[];
+} & Omit<TProjectPermission, "projectId">;
+
+export type TGetLdapAuthDTO = {
+ identityId: string;
+} & Omit<TProjectPermission, "projectId">;
+
+export type TLoginLdapAuthDTO = {
+ identityId: string;
+};
+
+export type TRevokeLdapAuthDTO = {
+ identityId: string;
+} & Omit<TProjectPermission, "projectId">;
diff --git a/backend/src/services/identity-oci-auth/identity-oci-auth-dal.ts b/backend/src/services/identity-oci-auth/identity-oci-auth-dal.ts
new file mode 100644
index 0000000000..95278c75a1
--- /dev/null
+++ b/backend/src/services/identity-oci-auth/identity-oci-auth-dal.ts
@@ -0,0 +1,9 @@
+import { TDbClient } from "@app/db";
+import { TableName } from "@app/db/schemas";
+import { ormify } from "@app/lib/knex";
+
+export type TIdentityOciAuthDALFactory = ReturnType<typeof identityOciAuthDALFactory>;
+
+export const identityOciAuthDALFactory = (db: TDbClient) => {
+ return ormify(db, TableName.IdentityOciAuth);
+};
diff --git a/backend/src/services/identity-oci-auth/identity-oci-auth-service.ts b/backend/src/services/identity-oci-auth/identity-oci-auth-service.ts
new file mode 100644
index 0000000000..00e3884bdb
--- /dev/null
+++ b/backend/src/services/identity-oci-auth/identity-oci-auth-service.ts
@@ -0,0 +1,368 @@
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+import { ForbiddenError } from "@casl/ability";
+import { AxiosError } from "axios";
+import jwt from "jsonwebtoken";
+import RE2 from "re2";
+
+import { IdentityAuthMethod } from "@app/db/schemas";
+import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
+import { OrgPermissionIdentityActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";
+import {
+ constructPermissionErrorMessage,
+ validatePrivilegeChangeOperation
+} from "@app/ee/services/permission/permission-fns";
+import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
+import { getConfig } from "@app/lib/config/env";
+import { request } from "@app/lib/config/request";
+import { BadRequestError, NotFoundError, PermissionBoundaryError, UnauthorizedError } from "@app/lib/errors";
+import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip";
+import { logger } from "@app/lib/logger";
+
+import { ActorType, AuthTokenType } from "../auth/auth-type";
+import { TIdentityOrgDALFactory } from "../identity/identity-org-dal";
+import { TIdentityAccessTokenDALFactory } from "../identity-access-token/identity-access-token-dal";
+import { TIdentityAccessTokenJwtPayload } from "../identity-access-token/identity-access-token-types";
+import { validateIdentityUpdateForSuperAdminPrivileges } from "../super-admin/super-admin-fns";
+import { TIdentityOciAuthDALFactory } from "./identity-oci-auth-dal";
+import {
+ TAttachOciAuthDTO,
+ TGetOciAuthDTO,
+ TLoginOciAuthDTO,
+ TOciGetUserResponse,
+ TRevokeOciAuthDTO,
+ TUpdateOciAuthDTO
+} from "./identity-oci-auth-types";
+
+type TIdentityOciAuthServiceFactoryDep = {
+ identityAccessTokenDAL: Pick<TIdentityAccessTokenDALFactory, "create" | "delete">;
+ identityOciAuthDAL: Pick<TIdentityOciAuthDALFactory, "findOne" | "transaction" | "create" | "updateById" | "delete">;
+ identityOrgMembershipDAL: Pick<TIdentityOrgDALFactory, "findOne">;
+ licenseService: Pick<TLicenseServiceFactory, "getPlan">;
+ permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;
+};
+
+export type TIdentityOciAuthServiceFactory = ReturnType<typeof identityOciAuthServiceFactory>;
+
+export const identityOciAuthServiceFactory = ({
+ identityAccessTokenDAL,
+ identityOciAuthDAL,
+ identityOrgMembershipDAL,
+ licenseService,
+ permissionService
+}: TIdentityOciAuthServiceFactoryDep) => {
+ const login = async ({ identityId, headers, userOcid }: TLoginOciAuthDTO) => {
+ const identityOciAuth = await identityOciAuthDAL.findOne({ identityId });
+ if (!identityOciAuth) {
+ throw new NotFoundError({ message: "OCI auth method not found for identity, did you configure OCI auth?" });
+ }
+
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId: identityOciAuth.identityId });
+
+ // Validate OCI host format. Ensures that the host is in "identity.<region>.oraclecloud.com" format.
+ if (!headers.host || !new RE2("^identity\\.([a-z]{2}-[a-z]+-[1-9])\\.oraclecloud\\.com$").test(headers.host)) {
+ throw new BadRequestError({
+ message: "Invalid OCI host format. Expected format: identity.<region>.oraclecloud.com"
+ });
+ }
+
+ const { data } = await request
+ .get<TOciGetUserResponse>(`https://${headers.host}/20160918/users/${userOcid}`, {
+ headers
+ })
+ .catch((err: AxiosError) => {
+ logger.error(err.response, "OciIdentityLogin: Failed to authenticate with Oracle Cloud");
+ throw err;
+ });
+
+ if (data.compartmentId !== identityOciAuth.tenancyOcid) {
+ throw new UnauthorizedError({
+ message: "Access denied: OCI account isn't part of tenancy."
+ });
+ }
+
+ if (identityOciAuth.allowedUsernames) {
+ const isAccountAllowed = identityOciAuth.allowedUsernames.split(",").some((name) => name.trim() === data.name);
+
+ if (!isAccountAllowed)
+ throw new UnauthorizedError({
+ message: "Access denied: OCI account username not allowed."
+ });
+ }
+
+ // Generate the token
+ const identityAccessToken = await identityOciAuthDAL.transaction(async (tx) => {
+ const newToken = await identityAccessTokenDAL.create(
+ {
+ identityId: identityOciAuth.identityId,
+ isAccessTokenRevoked: false,
+ accessTokenTTL: identityOciAuth.accessTokenTTL,
+ accessTokenMaxTTL: identityOciAuth.accessTokenMaxTTL,
+ accessTokenNumUses: 0,
+ accessTokenNumUsesLimit: identityOciAuth.accessTokenNumUsesLimit,
+ authMethod: IdentityAuthMethod.OCI_AUTH
+ },
+ tx
+ );
+ return newToken;
+ });
+
+ const appCfg = getConfig();
+ const accessToken = jwt.sign(
+ {
+ identityId: identityOciAuth.identityId,
+ identityAccessTokenId: identityAccessToken.id,
+ authTokenType: AuthTokenType.IDENTITY_ACCESS_TOKEN
+ } as TIdentityAccessTokenJwtPayload,
+ appCfg.AUTH_SECRET,
+ Number(identityAccessToken.accessTokenTTL) === 0
+ ? undefined
+ : {
+ expiresIn: Number(identityAccessToken.accessTokenTTL)
+ }
+ );
+
+ return {
+ identityOciAuth,
+ accessToken,
+ identityAccessToken,
+ identityMembershipOrg
+ };
+ };
+
+ const attachOciAuth = async ({
+ identityId,
+ tenancyOcid,
+ allowedUsernames,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId,
+ isActorSuperAdmin
+ }: TAttachOciAuthDTO) => {
+ await validateIdentityUpdateForSuperAdminPrivileges(identityId, isActorSuperAdmin);
+
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId });
+ if (!identityMembershipOrg) throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+
+ if (identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.OCI_AUTH)) {
+ throw new BadRequestError({
+ message: "Failed to add OCI Auth to already configured identity"
+ });
+ }
+
+ if (accessTokenMaxTTL > 0 && accessTokenTTL > accessTokenMaxTTL) {
+ throw new BadRequestError({ message: "Access token TTL cannot be greater than max TTL" });
+ }
+
+ const { permission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Create, OrgPermissionSubjects.Identity);
+
+ const plan = await licenseService.getPlan(identityMembershipOrg.orgId);
+ const reformattedAccessTokenTrustedIps = accessTokenTrustedIps.map((accessTokenTrustedIp) => {
+ if (
+ !plan.ipAllowlisting &&
+ accessTokenTrustedIp.ipAddress !== "0.0.0.0/0" &&
+ accessTokenTrustedIp.ipAddress !== "::/0"
+ )
+ throw new BadRequestError({
+ message:
+ "Failed to add IP access range to access token due to plan restriction. Upgrade plan to add IP access range."
+ });
+ if (!isValidIpOrCidr(accessTokenTrustedIp.ipAddress))
+ throw new BadRequestError({
+ message: "The IP is not a valid IPv4, IPv6, or CIDR block"
+ });
+ return extractIPDetails(accessTokenTrustedIp.ipAddress);
+ });
+
+ const identityOciAuth = await identityOciAuthDAL.transaction(async (tx) => {
+ const doc = await identityOciAuthDAL.create(
+ {
+ identityId: identityMembershipOrg.identityId,
+ type: "iam",
+ tenancyOcid,
+ allowedUsernames,
+ accessTokenMaxTTL,
+ accessTokenTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps: JSON.stringify(reformattedAccessTokenTrustedIps)
+ },
+ tx
+ );
+ return doc;
+ });
+ return { ...identityOciAuth, orgId: identityMembershipOrg.orgId };
+ };
+
+ const updateOciAuth = async ({
+ identityId,
+ tenancyOcid,
+ allowedUsernames,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TUpdateOciAuthDTO) => {
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId });
+ if (!identityMembershipOrg) throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+
+ if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.OCI_AUTH)) {
+ throw new NotFoundError({
+ message: "The identity does not have OCI Auth attached"
+ });
+ }
+
+ const identityOciAuth = await identityOciAuthDAL.findOne({ identityId });
+
+ if (
+ (accessTokenMaxTTL || identityOciAuth.accessTokenMaxTTL) > 0 &&
+ (accessTokenTTL || identityOciAuth.accessTokenTTL) > (accessTokenMaxTTL || identityOciAuth.accessTokenMaxTTL)
+ ) {
+ throw new BadRequestError({ message: "Access token TTL cannot be greater than max TTL" });
+ }
+
+ const { permission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Edit, OrgPermissionSubjects.Identity);
+
+ const plan = await licenseService.getPlan(identityMembershipOrg.orgId);
+ const reformattedAccessTokenTrustedIps = accessTokenTrustedIps?.map((accessTokenTrustedIp) => {
+ if (
+ !plan.ipAllowlisting &&
+ accessTokenTrustedIp.ipAddress !== "0.0.0.0/0" &&
+ accessTokenTrustedIp.ipAddress !== "::/0"
+ )
+ throw new BadRequestError({
+ message:
+ "Failed to add IP access range to access token due to plan restriction. Upgrade plan to add IP access range."
+ });
+ if (!isValidIpOrCidr(accessTokenTrustedIp.ipAddress))
+ throw new BadRequestError({
+ message: "The IP is not a valid IPv4, IPv6, or CIDR block"
+ });
+ return extractIPDetails(accessTokenTrustedIp.ipAddress);
+ });
+
+ const updatedOciAuth = await identityOciAuthDAL.updateById(identityOciAuth.id, {
+ tenancyOcid,
+ allowedUsernames,
+ accessTokenMaxTTL,
+ accessTokenTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps: reformattedAccessTokenTrustedIps
+ ? JSON.stringify(reformattedAccessTokenTrustedIps)
+ : undefined
+ });
+
+ return { ...updatedOciAuth, orgId: identityMembershipOrg.orgId };
+ };
+
+ const getOciAuth = async ({ identityId, actorId, actor, actorAuthMethod, actorOrgId }: TGetOciAuthDTO) => {
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId });
+ if (!identityMembershipOrg) throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+
+ if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.OCI_AUTH)) {
+ throw new BadRequestError({
+ message: "The identity does not have OCI Auth attached"
+ });
+ }
+
+ const ociIdentityAuth = await identityOciAuthDAL.findOne({ identityId });
+
+ const { permission } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Read, OrgPermissionSubjects.Identity);
+ return { ...ociIdentityAuth, orgId: identityMembershipOrg.orgId };
+ };
+
+ const revokeIdentityOciAuth = async ({
+ identityId,
+ actorId,
+ actor,
+ actorAuthMethod,
+ actorOrgId
+ }: TRevokeOciAuthDTO) => {
+ const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId });
+ if (!identityMembershipOrg) throw new NotFoundError({ message: `Failed to find identity with ID ${identityId}` });
+ if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.OCI_AUTH)) {
+ throw new BadRequestError({
+ message: "The identity does not have OCI auth"
+ });
+ }
+ const { permission, membership } = await permissionService.getOrgPermission(
+ actor,
+ actorId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Edit, OrgPermissionSubjects.Identity);
+
+ const { permission: rolePermission } = await permissionService.getOrgPermission(
+ ActorType.IDENTITY,
+ identityMembershipOrg.identityId,
+ identityMembershipOrg.orgId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
+ const permissionBoundary = validatePrivilegeChangeOperation(
+ membership.shouldUseNewPrivilegeSystem,
+ OrgPermissionIdentityActions.RevokeAuth,
+ OrgPermissionSubjects.Identity,
+ permission,
+ rolePermission
+ );
+
+ if (!permissionBoundary.isValid)
+ throw new PermissionBoundaryError({
+ message: constructPermissionErrorMessage(
+ "Failed to revoke OCI auth of identity with more privileged role",
+ membership.shouldUseNewPrivilegeSystem,
+ OrgPermissionIdentityActions.RevokeAuth,
+ OrgPermissionSubjects.Identity
+ ),
+ details: { missingPermissions: permissionBoundary.missingPermissions }
+ });
+
+ const revokedIdentityOciAuth = await identityOciAuthDAL.transaction(async (tx) => {
+ const deletedOciAuth = await identityOciAuthDAL.delete({ identityId }, tx);
+ await identityAccessTokenDAL.delete({ identityId, authMethod: IdentityAuthMethod.OCI_AUTH }, tx);
+
+ return { ...deletedOciAuth?.[0], orgId: identityMembershipOrg.orgId };
+ });
+ return revokedIdentityOciAuth;
+ };
+
+ return {
+ login,
+ attachOciAuth,
+ updateOciAuth,
+ getOciAuth,
+ revokeIdentityOciAuth
+ };
+};
diff --git a/backend/src/services/identity-oci-auth/identity-oci-auth-types.ts b/backend/src/services/identity-oci-auth/identity-oci-auth-types.ts
new file mode 100644
index 0000000000..c7a131bde5
--- /dev/null
+++ b/backend/src/services/identity-oci-auth/identity-oci-auth-types.ts
@@ -0,0 +1,53 @@
+import { TProjectPermission } from "@app/lib/types";
+
+export type TLoginOciAuthDTO = {
+ identityId: string;
+ userOcid: string;
+ headers: {
+ authorization: string;
+ host: string;
+ "x-date": string;
+ };
+};
+
+export type TAttachOciAuthDTO = {
+ identityId: string;
+ tenancyOcid: string;
+ allowedUsernames: string | null;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: { ipAddress: string }[];
+ isActorSuperAdmin?: boolean;
+} & Omit<TProjectPermission, "projectId">;
+
+export type TUpdateOciAuthDTO = {
+ identityId: string;
+ tenancyOcid: string;
+ allowedUsernames: string | null;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: { ipAddress: string }[];
+} & Omit<TProjectPermission, "projectId">;
+
+export type TGetOciAuthDTO = {
+ identityId: string;
+} & Omit<TProjectPermission, "projectId">;
+
+export type TRevokeOciAuthDTO = {
+ identityId: string;
+} & Omit<TProjectPermission, "projectId">;
+
+export type TOciGetUserResponse = {
+ email: string;
+ emailVerified: boolean;
+ timeModified: string;
+ isMfaActivated: boolean;
+ id: string;
+ compartmentId: string;
+ name: string;
+ timeCreated: string;
+ freeformTags: { [key: string]: string };
+ lifecycleState: string;
+};
diff --git a/backend/src/services/identity-oci-auth/identity-oci-auth-validators.ts b/backend/src/services/identity-oci-auth/identity-oci-auth-validators.ts
new file mode 100644
index 0000000000..49100b46c8
--- /dev/null
+++ b/backend/src/services/identity-oci-auth/identity-oci-auth-validators.ts
@@ -0,0 +1,32 @@
+import RE2 from "re2";
+import { z } from "zod";
+
+const usernameSchema = z
+ .string()
+ .min(1, "Username cannot be empty")
+ .refine((val) => new RE2("^[a-zA-Z0-9._@-]+$").test(val), "Invalid OCI username format");
+export const validateUsernames = z
+ .string()
+ .trim()
+ .max(500, "Input exceeds the maximum limit of 500 characters")
+ .nullish()
+ .transform((val) => {
+ if (!val) return [];
+ return val
+ .split(",")
+ .map((s) => s.trim())
+ .filter(Boolean);
+ })
+ .refine((arr) => arr.every((name) => usernameSchema.safeParse(name).success), {
+ message: "One or more usernames are invalid"
+ })
+ .transform((arr) => (arr.length > 0 ? arr.join(", ") : null));
+
+export const validateTenancy = z
+ .string()
+ .trim()
+ .min(1, "Tenancy OCID cannot be empty.")
+ .refine(
+ (val) => new RE2("^ocid1\\.tenancy\\.oc1\\..+$").test(val),
+ "Invalid Tenancy OCID format. Must start with ocid1.tenancy.oc1."
+ );
diff --git a/backend/src/services/identity-project/identity-project-dal.ts b/backend/src/services/identity-project/identity-project-dal.ts
index bc4f4a303e..3c8bc5d370 100644
--- a/backend/src/services/identity-project/identity-project-dal.ts
+++ b/backend/src/services/identity-project/identity-project-dal.ts
@@ -8,6 +8,7 @@ import {
TIdentityAzureAuths,
TIdentityGcpAuths,
TIdentityKubernetesAuths,
+ TIdentityOciAuths,
TIdentityOidcAuths,
TIdentityTokenAuths,
TIdentityUniversalAuths
@@ -66,6 +67,11 @@ export const identityProjectDALFactory = (db: TDbClient) => {
`${TableName.IdentityProjectMembership}.identityId`,
`${TableName.IdentityKubernetesAuth}.identityId`
)
+ .leftJoin(
+ TableName.IdentityOciAuth,
+ `${TableName.IdentityProjectMembership}.identityId`,
+ `${TableName.IdentityOciAuth}.identityId`
+ )
.leftJoin(
TableName.IdentityOidcAuth,
`${TableName.IdentityProjectMembership}.identityId`,
@@ -107,6 +113,7 @@ export const identityProjectDALFactory = (db: TDbClient) => {
db.ref("id").as("gcpId").withSchema(TableName.IdentityGcpAuth),
db.ref("id").as("awsId").withSchema(TableName.IdentityAwsAuth),
db.ref("id").as("kubernetesId").withSchema(TableName.IdentityKubernetesAuth),
+ db.ref("id").as("ociId").withSchema(TableName.IdentityOciAuth),
db.ref("id").as("oidcId").withSchema(TableName.IdentityOidcAuth),
db.ref("id").as("azureId").withSchema(TableName.IdentityAzureAuth),
db.ref("id").as("tokenId").withSchema(TableName.IdentityTokenAuth)
@@ -270,6 +277,11 @@ export const identityProjectDALFactory = (db: TDbClient) => {
`${TableName.Identity}.id`,
`${TableName.IdentityKubernetesAuth}.identityId`
)
+ .leftJoin<TIdentityOciAuths>(
+ TableName.IdentityOciAuth,
+ `${TableName.Identity}.id`,
+ `${TableName.IdentityOciAuth}.identityId`
+ )
.leftJoin<TIdentityOidcAuths>(
TableName.IdentityOidcAuth,
`${TableName.Identity}.id`,
@@ -309,6 +321,7 @@ export const identityProjectDALFactory = (db: TDbClient) => {
db.ref("id").as("gcpId").withSchema(TableName.IdentityGcpAuth),
db.ref("id").as("awsId").withSchema(TableName.IdentityAwsAuth),
db.ref("id").as("kubernetesId").withSchema(TableName.IdentityKubernetesAuth),
+ db.ref("id").as("ociId").withSchema(TableName.IdentityOciAuth),
db.ref("id").as("oidcId").withSchema(TableName.IdentityOidcAuth),
db.ref("id").as("azureId").withSchema(TableName.IdentityAzureAuth),
db.ref("id").as("tokenId").withSchema(TableName.IdentityTokenAuth)
@@ -336,6 +349,7 @@ export const identityProjectDALFactory = (db: TDbClient) => {
awsId,
gcpId,
kubernetesId,
+ ociId,
oidcId,
azureId,
tokenId,
@@ -356,6 +370,7 @@ export const identityProjectDALFactory = (db: TDbClient) => {
awsId,
gcpId,
kubernetesId,
+ ociId,
oidcId,
azureId,
tokenId
diff --git a/backend/src/services/identity/identity-fns.ts b/backend/src/services/identity/identity-fns.ts
index 2d77e65445..3fa2482aa1 100644
--- a/backend/src/services/identity/identity-fns.ts
+++ b/backend/src/services/identity/identity-fns.ts
@@ -5,28 +5,34 @@ export const buildAuthMethods = ({
gcpId,
awsId,
kubernetesId,
+ ociId,
oidcId,
azureId,
tokenId,
- jwtId
+ jwtId,
+ ldapId
}: {
uaId?: string;
gcpId?: string;
awsId?: string;
kubernetesId?: string;
+ ociId?: string;
oidcId?: string;
azureId?: string;
tokenId?: string;
jwtId?: string;
+ ldapId?: string;
}) => {
return [
...[uaId ? IdentityAuthMethod.UNIVERSAL_AUTH : null],
...[gcpId ? IdentityAuthMethod.GCP_AUTH : null],
...[awsId ? IdentityAuthMethod.AWS_AUTH : null],
...[kubernetesId ? IdentityAuthMethod.KUBERNETES_AUTH : null],
+ ...[ociId ? IdentityAuthMethod.OCI_AUTH : null],
...[oidcId ? IdentityAuthMethod.OIDC_AUTH : null],
...[azureId ? IdentityAuthMethod.AZURE_AUTH : null],
...[tokenId ? IdentityAuthMethod.TOKEN_AUTH : null],
- ...[jwtId ? IdentityAuthMethod.JWT_AUTH : null]
+ ...[jwtId ? IdentityAuthMethod.JWT_AUTH : null],
+ ...[ldapId ? IdentityAuthMethod.LDAP_AUTH : null]
].filter((authMethod) => authMethod) as IdentityAuthMethod[];
};
diff --git a/backend/src/services/identity/identity-org-dal.ts b/backend/src/services/identity/identity-org-dal.ts
index dbae59bbe2..af5537249d 100644
--- a/backend/src/services/identity/identity-org-dal.ts
+++ b/backend/src/services/identity/identity-org-dal.ts
@@ -8,12 +8,14 @@ import {
TIdentityGcpAuths,
TIdentityJwtAuths,
TIdentityKubernetesAuths,
+ TIdentityOciAuths,
TIdentityOidcAuths,
TIdentityOrgMemberships,
TIdentityTokenAuths,
TIdentityUniversalAuths,
TOrgRoles
} from "@app/db/schemas";
+import { TIdentityLdapAuths } from "@app/db/schemas/identity-ldap-auths";
import { BadRequestError, DatabaseError } from "@app/lib/errors";
import { ormify, selectAllTableCols, sqlNestRelationships } from "@app/lib/knex";
import { buildKnexFilterForSearchResource } from "@app/lib/search-resource/db";
@@ -61,6 +63,11 @@ export const identityOrgDALFactory = (db: TDbClient) => {
`${TableName.IdentityOrgMembership}.identityId`,
`${TableName.IdentityKubernetesAuth}.identityId`
)
+ .leftJoin<TIdentityOciAuths>(
+ TableName.IdentityOciAuth,
+ `${TableName.IdentityOrgMembership}.identityId`,
+ `${TableName.IdentityOciAuth}.identityId`
+ )
.leftJoin<TIdentityOidcAuths>(
TableName.IdentityOidcAuth,
`${TableName.IdentityOrgMembership}.identityId`,
@@ -81,6 +88,11 @@ export const identityOrgDALFactory = (db: TDbClient) => {
`${TableName.IdentityOrgMembership}.identityId`,
`${TableName.IdentityJwtAuth}.identityId`
)
+ .leftJoin<TIdentityLdapAuths>(
+ TableName.IdentityLdapAuth,
+ `${TableName.IdentityOrgMembership}.identityId`,
+ `${TableName.IdentityLdapAuth}.identityId`
+ )
.select(
selectAllTableCols(TableName.IdentityOrgMembership),
@@ -89,11 +101,12 @@ export const identityOrgDALFactory = (db: TDbClient) => {
db.ref("id").as("gcpId").withSchema(TableName.IdentityGcpAuth),
db.ref("id").as("awsId").withSchema(TableName.IdentityAwsAuth),
db.ref("id").as("kubernetesId").withSchema(TableName.IdentityKubernetesAuth),
+ db.ref("id").as("ociId").withSchema(TableName.IdentityOciAuth),
db.ref("id").as("oidcId").withSchema(TableName.IdentityOidcAuth),
db.ref("id").as("azureId").withSchema(TableName.IdentityAzureAuth),
db.ref("id").as("tokenId").withSchema(TableName.IdentityTokenAuth),
db.ref("id").as("jwtId").withSchema(TableName.IdentityJwtAuth),
-
+ db.ref("id").as("ldapId").withSchema(TableName.IdentityLdapAuth),
db.ref("name").withSchema(TableName.Identity)
);
@@ -180,6 +193,11 @@ export const identityOrgDALFactory = (db: TDbClient) => {
"paginatedIdentity.identityId",
`${TableName.IdentityKubernetesAuth}.identityId`
)
+ .leftJoin<TIdentityOciAuths>(
+ TableName.IdentityOciAuth,
+ "paginatedIdentity.identityId",
+ `${TableName.IdentityOciAuth}.identityId`
+ )
.leftJoin<TIdentityOidcAuths>(
TableName.IdentityOidcAuth,
"paginatedIdentity.identityId",
@@ -200,6 +218,12 @@ export const identityOrgDALFactory = (db: TDbClient) => {
"paginatedIdentity.identityId",
`${TableName.IdentityJwtAuth}.identityId`
)
+ .leftJoin<TIdentityLdapAuths>(
+ TableName.IdentityLdapAuth,
+ "paginatedIdentity.identityId",
+ `${TableName.IdentityLdapAuth}.identityId`
+ )
+
.select(
db.ref("id").withSchema("paginatedIdentity"),
db.ref("role").withSchema("paginatedIdentity"),
@@ -214,10 +238,12 @@ export const identityOrgDALFactory = (db: TDbClient) => {
db.ref("id").as("gcpId").withSchema(TableName.IdentityGcpAuth),
db.ref("id").as("awsId").withSchema(TableName.IdentityAwsAuth),
db.ref("id").as("kubernetesId").withSchema(TableName.IdentityKubernetesAuth),
+ db.ref("id").as("ociId").withSchema(TableName.IdentityOciAuth),
db.ref("id").as("oidcId").withSchema(TableName.IdentityOidcAuth),
db.ref("id").as("azureId").withSchema(TableName.IdentityAzureAuth),
db.ref("id").as("tokenId").withSchema(TableName.IdentityTokenAuth),
- db.ref("id").as("jwtId").withSchema(TableName.IdentityJwtAuth)
+ db.ref("id").as("jwtId").withSchema(TableName.IdentityJwtAuth),
+ db.ref("id").as("ldapId").withSchema(TableName.IdentityLdapAuth)
)
// cr stands for custom role
.select(db.ref("id").as("crId").withSchema(TableName.OrgRoles))
@@ -256,9 +282,11 @@ export const identityOrgDALFactory = (db: TDbClient) => {
gcpId,
jwtId,
kubernetesId,
+ ociId,
oidcId,
azureId,
tokenId,
+ ldapId,
createdAt,
updatedAt
}) => ({
@@ -287,10 +315,12 @@ export const identityOrgDALFactory = (db: TDbClient) => {
awsId,
gcpId,
kubernetesId,
+ ociId,
oidcId,
azureId,
tokenId,
- jwtId
+ jwtId,
+ ldapId
})
}
}),
@@ -386,6 +416,11 @@ export const identityOrgDALFactory = (db: TDbClient) => {
`${TableName.IdentityOrgMembership}.identityId`,
`${TableName.IdentityKubernetesAuth}.identityId`
)
+ .leftJoin(
+ TableName.IdentityOciAuth,
+ `${TableName.IdentityOrgMembership}.identityId`,
+ `${TableName.IdentityOciAuth}.identityId`
+ )
.leftJoin(
TableName.IdentityOidcAuth,
`${TableName.IdentityOrgMembership}.identityId`,
@@ -406,6 +441,11 @@ export const identityOrgDALFactory = (db: TDbClient) => {
`${TableName.IdentityOrgMembership}.identityId`,
`${TableName.IdentityJwtAuth}.identityId`
)
+ .leftJoin(
+ TableName.IdentityLdapAuth,
+ `${TableName.IdentityOrgMembership}.identityId`,
+ `${TableName.IdentityLdapAuth}.identityId`
+ )
.select(
db.ref("id").withSchema(TableName.IdentityOrgMembership),
db.ref("total_count").withSchema("searchedIdentities"),
@@ -421,10 +461,12 @@ export const identityOrgDALFactory = (db: TDbClient) => {
db.ref("id").as("gcpId").withSchema(TableName.IdentityGcpAuth),
db.ref("id").as("awsId").withSchema(TableName.IdentityAwsAuth),
db.ref("id").as("kubernetesId").withSchema(TableName.IdentityKubernetesAuth),
+ db.ref("id").as("ociId").withSchema(TableName.IdentityOciAuth),
db.ref("id").as("oidcId").withSchema(TableName.IdentityOidcAuth),
db.ref("id").as("azureId").withSchema(TableName.IdentityAzureAuth),
db.ref("id").as("tokenId").withSchema(TableName.IdentityTokenAuth),
- db.ref("id").as("jwtId").withSchema(TableName.IdentityJwtAuth)
+ db.ref("id").as("jwtId").withSchema(TableName.IdentityJwtAuth),
+ db.ref("id").as("ldapId").withSchema(TableName.IdentityLdapAuth)
)
// cr stands for custom role
.select(db.ref("id").as("crId").withSchema(TableName.OrgRoles))
@@ -464,9 +506,11 @@ export const identityOrgDALFactory = (db: TDbClient) => {
gcpId,
jwtId,
kubernetesId,
+ ociId,
oidcId,
azureId,
tokenId,
+ ldapId,
createdAt,
updatedAt
}) => ({
@@ -495,10 +539,12 @@ export const identityOrgDALFactory = (db: TDbClient) => {
awsId,
gcpId,
kubernetesId,
+ ociId,
oidcId,
azureId,
tokenId,
- jwtId
+ jwtId,
+ ldapId
})
}
}),
diff --git a/backend/src/services/identity/identity-service.ts b/backend/src/services/identity/identity-service.ts
index 6f72b3c6e4..fd893713e0 100644
--- a/backend/src/services/identity/identity-service.ts
+++ b/backend/src/services/identity/identity-service.ts
@@ -106,18 +106,29 @@ export const identityServiceFactory = ({
},
tx
);
+
+ let insertedMetadata: Array<{
+ id: string;
+ key: string;
+ value: string;
+ }> = [];
+
if (metadata && metadata.length) {
- await identityMetadataDAL.insertMany(
- metadata.map(({ key, value }) => ({
- identityId: newIdentity.id,
- orgId,
- key,
- value
- })),
- tx
- );
+ const rowsToInsert = metadata.map(({ key, value }) => ({
+ identityId: newIdentity.id,
+ orgId,
+ key,
+ value
+ }));
+
+ insertedMetadata = await identityMetadataDAL.insertMany(rowsToInsert, tx);
}
- return { ...newIdentity, authMethods: [] };
+
+ return {
+ ...newIdentity,
+ authMethods: [],
+ metadata: insertedMetadata
+ };
});
await licenseService.updateSubscriptionOrgMemberCount(orgId);
@@ -189,21 +200,31 @@ export const identityServiceFactory = ({
tx
);
}
+ let insertedMetadata: Array<{
+ id: string;
+ key: string;
+ value: string;
+ }> = [];
+
if (metadata) {
await identityMetadataDAL.delete({ orgId: identityOrgMembership.orgId, identityId: id }, tx);
+
if (metadata.length) {
- await identityMetadataDAL.insertMany(
- metadata.map(({ key, value }) => ({
- identityId: newIdentity.id,
- orgId: identityOrgMembership.orgId,
- key,
- value
- })),
- tx
- );
+ const rowsToInsert = metadata.map(({ key, value }) => ({
+ identityId: newIdentity.id,
+ orgId: identityOrgMembership.orgId,
+ key,
+ value
+ }));
+
+ insertedMetadata = await identityMetadataDAL.insertMany(rowsToInsert, tx);
}
}
- return newIdentity;
+
+ return {
+ ...newIdentity,
+ metadata: insertedMetadata
+ };
});
return { ...identity, orgId: identityOrgMembership.orgId };
@@ -224,6 +245,7 @@ export const identityServiceFactory = ({
actorOrgId
);
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Read, OrgPermissionSubjects.Identity);
+
return identity;
};
diff --git a/backend/src/services/integration-auth/integration-delete-secret.ts b/backend/src/services/integration-auth/integration-delete-secret.ts
index 46c5ed2bd9..f77becb020 100644
--- a/backend/src/services/integration-auth/integration-delete-secret.ts
+++ b/backend/src/services/integration-auth/integration-delete-secret.ts
@@ -177,7 +177,6 @@ export const deleteGithubSecrets = async ({
selected_repositories_url?: string | undefined;
}
- // @ts-expect-error just octokit ts compatiability issue
const OctokitWithRetry = Octokit.plugin(retry);
let octokit: Octokit;
const appCfg = getConfig();
diff --git a/backend/src/services/microsoft-teams/microsoft-teams-service.ts b/backend/src/services/microsoft-teams/microsoft-teams-service.ts
index 3712a0793e..1413a3199b 100644
--- a/backend/src/services/microsoft-teams/microsoft-teams-service.ts
+++ b/backend/src/services/microsoft-teams/microsoft-teams-service.ts
@@ -6,6 +6,7 @@ import {
Request,
Response
} from "botbuilder";
+import { CronJob } from "cron";
import { FastifyReply, FastifyRequest } from "fastify";
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";
@@ -86,8 +87,17 @@ export const microsoftTeamsServiceFactory = ({
}: TMicrosoftTeamsServiceFactoryDep) => {
let teamsBot: TeamsBot | null = null;
let adapter: CloudAdapter | null = null;
-
- const initializeTeamsBot = async ({ botAppId, botAppPassword }: { botAppId: string; botAppPassword: string }) => {
+ let lastKnownUpdatedAt = new Date();
+
+ const initializeTeamsBot = async ({
+ botAppId,
+ botAppPassword,
+ lastUpdatedAt
+ }: {
+ botAppId: string;
+ botAppPassword: string;
+ lastUpdatedAt?: Date;
+ }) => {
logger.info("Initializing Microsoft Teams bot");
teamsBot = new TeamsBot({
botAppId,
@@ -106,6 +116,57 @@ export const microsoftTeamsServiceFactory = ({
})
)
);
+
+ if (lastUpdatedAt) {
+ lastKnownUpdatedAt = lastUpdatedAt;
+ }
+ };
+
+ const $syncMicrosoftTeamsIntegrationConfiguration = async () => {
+ try {
+ const serverCfg = await serverCfgDAL.findById(ADMIN_CONFIG_DB_UUID);
+ if (!serverCfg) {
+ throw new BadRequestError({
+ message: "Failed to get server configuration."
+ });
+ }
+
+ if (lastKnownUpdatedAt.getTime() === serverCfg.updatedAt.getTime()) {
+ logger.info("No changes to Microsoft Teams integration configuration, skipping sync");
+ return;
+ }
+
+ lastKnownUpdatedAt = serverCfg.updatedAt;
+
+ if (
+ serverCfg.encryptedMicrosoftTeamsAppId &&
+ serverCfg.encryptedMicrosoftTeamsClientSecret &&
+ serverCfg.encryptedMicrosoftTeamsBotId
+ ) {
+ const decryptWithRoot = kmsService.decryptWithRootKey();
+ const decryptedAppId = decryptWithRoot(serverCfg.encryptedMicrosoftTeamsAppId);
+ const decryptedAppPassword = decryptWithRoot(serverCfg.encryptedMicrosoftTeamsClientSecret);
+
+ await initializeTeamsBot({
+ botAppId: decryptedAppId.toString(),
+ botAppPassword: decryptedAppPassword.toString()
+ });
+ }
+ } catch (err) {
+ logger.error(err, "Error syncing Microsoft Teams integration configuration");
+ }
+ };
+
+ const initializeBackgroundSync = async () => {
+ logger.info("Setting up background sync process for Microsoft Teams workflow integration configuration");
+ // initial sync upon startup
+ await $syncMicrosoftTeamsIntegrationConfiguration();
+
+ // sync rate limits configuration every 5 minutes
+ const job = new CronJob("*/5 * * * *", $syncMicrosoftTeamsIntegrationConfiguration);
+ job.start();
+
+ return job;
};
const start = async () => {
@@ -703,6 +764,7 @@ export const microsoftTeamsServiceFactory = ({
getTeams,
handleMessageEndpoint,
start,
+ initializeBackgroundSync,
sendNotification,
checkInstallationStatus,
getClientId
diff --git a/backend/src/services/org/org-schema.ts b/backend/src/services/org/org-schema.ts
index 5a1a4c3334..ae82cd1bc1 100644
--- a/backend/src/services/org/org-schema.ts
+++ b/backend/src/services/org/org-schema.ts
@@ -18,5 +18,13 @@ export const sanitizedOrganizationSchema = OrganizationsSchema.pick({
privilegeUpgradeInitiatedByUsername: true,
privilegeUpgradeInitiatedAt: true,
bypassOrgAuthEnabled: true,
- userTokenExpiration: true
+ userTokenExpiration: true,
+ secretsProductEnabled: true,
+ pkiProductEnabled: true,
+ kmsProductEnabled: true,
+ sshProductEnabled: true,
+ scannerProductEnabled: true,
+ shareSecretsProductEnabled: true,
+ maxSharedSecretLifetime: true,
+ maxSharedSecretViewLimit: true
});
diff --git a/backend/src/services/org/org-service.ts b/backend/src/services/org/org-service.ts
index d794391c16..c966d5ef9e 100644
--- a/backend/src/services/org/org-service.ts
+++ b/backend/src/services/org/org-service.ts
@@ -355,7 +355,15 @@ export const orgServiceFactory = ({
selectedMfaMethod,
allowSecretSharingOutsideOrganization,
bypassOrgAuthEnabled,
- userTokenExpiration
+ userTokenExpiration,
+ secretsProductEnabled,
+ pkiProductEnabled,
+ kmsProductEnabled,
+ sshProductEnabled,
+ scannerProductEnabled,
+ shareSecretsProductEnabled,
+ maxSharedSecretLifetime,
+ maxSharedSecretViewLimit
}
}: TUpdateOrgDTO) => {
const appCfg = getConfig();
@@ -457,7 +465,15 @@ export const orgServiceFactory = ({
selectedMfaMethod,
allowSecretSharingOutsideOrganization,
bypassOrgAuthEnabled,
- userTokenExpiration
+ userTokenExpiration,
+ secretsProductEnabled,
+ pkiProductEnabled,
+ kmsProductEnabled,
+ sshProductEnabled,
+ scannerProductEnabled,
+ shareSecretsProductEnabled,
+ maxSharedSecretLifetime,
+ maxSharedSecretViewLimit
});
if (!org) throw new NotFoundError({ message: `Organization with ID '${orgId}' not found` });
return org;
diff --git a/backend/src/services/org/org-types.ts b/backend/src/services/org/org-types.ts
index 702cd25bf9..8b2485ac44 100644
--- a/backend/src/services/org/org-types.ts
+++ b/backend/src/services/org/org-types.ts
@@ -75,6 +75,14 @@ export type TUpdateOrgDTO = {
allowSecretSharingOutsideOrganization: boolean;
bypassOrgAuthEnabled: boolean;
userTokenExpiration: string;
+ secretsProductEnabled: boolean;
+ pkiProductEnabled: boolean;
+ kmsProductEnabled: boolean;
+ sshProductEnabled: boolean;
+ scannerProductEnabled: boolean;
+ shareSecretsProductEnabled: boolean;
+ maxSharedSecretLifetime: number;
+ maxSharedSecretViewLimit: number | null;
}>;
} & TOrgPermission;
diff --git a/backend/src/services/pki-subscriber/pki-subscriber-dal.ts b/backend/src/services/pki-subscriber/pki-subscriber-dal.ts
new file mode 100644
index 0000000000..1899c63a6f
--- /dev/null
+++ b/backend/src/services/pki-subscriber/pki-subscriber-dal.ts
@@ -0,0 +1,10 @@
+import { TDbClient } from "@app/db";
+import { TableName } from "@app/db/schemas";
+import { ormify } from "@app/lib/knex";
+
+export type TPkiSubscriberDALFactory = ReturnType<typeof pkiSubscriberDALFactory>;
+
+export const pkiSubscriberDALFactory = (db: TDbClient) => {
+ const pkiSubscriberOrm = ormify(db, TableName.PkiSubscriber);
+ return pkiSubscriberOrm;
+};
diff --git a/backend/src/services/pki-subscriber/pki-subscriber-schema.ts b/backend/src/services/pki-subscriber/pki-subscriber-schema.ts
new file mode 100644
index 0000000000..7ffeea3fa4
--- /dev/null
+++ b/backend/src/services/pki-subscriber/pki-subscriber-schema.ts
@@ -0,0 +1,14 @@
+import { PkiSubscribersSchema } from "@app/db/schemas";
+
+export const sanitizedPkiSubscriber = PkiSubscribersSchema.pick({
+ id: true,
+ projectId: true,
+ caId: true,
+ name: true,
+ commonName: true,
+ status: true,
+ subjectAlternativeNames: true,
+ ttl: true,
+ keyUsages: true,
+ extendedKeyUsages: true
+});
diff --git a/backend/src/services/pki-subscriber/pki-subscriber-service.ts b/backend/src/services/pki-subscriber/pki-subscriber-service.ts
new file mode 100644
index 0000000000..5b15786b18
--- /dev/null
+++ b/backend/src/services/pki-subscriber/pki-subscriber-service.ts
@@ -0,0 +1,805 @@
+/* eslint-disable no-bitwise */
+import { ForbiddenError, subject } from "@casl/ability";
+import * as x509 from "@peculiar/x509";
+import crypto, { KeyObject } from "crypto";
+import { z } from "zod";
+
+import { ActionProjectType } from "@app/db/schemas";
+import { TCertificateAuthorityCrlDALFactory } from "@app/ee/services/certificate-authority-crl/certificate-authority-crl-dal";
+import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
+import {
+ ProjectPermissionPkiSubscriberActions,
+ ProjectPermissionSub
+} from "@app/ee/services/permission/project-permission";
+import { getConfig } from "@app/lib/config/env";
+import { BadRequestError, NotFoundError } from "@app/lib/errors";
+import { ms } from "@app/lib/ms";
+import { isFQDN } from "@app/lib/validator/validate-url";
+import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";
+import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";
+import { TCertificateSecretDALFactory } from "@app/services/certificate/certificate-secret-dal";
+import {
+ CertExtendedKeyUsage,
+ CertExtendedKeyUsageOIDToName,
+ CertKeyAlgorithm,
+ CertKeyUsage,
+ CertStatus
+} from "@app/services/certificate/certificate-types";
+import { TCertificateAuthorityCertDALFactory } from "@app/services/certificate-authority/certificate-authority-cert-dal";
+import { TCertificateAuthorityDALFactory } from "@app/services/certificate-authority/certificate-authority-dal";
+import {
+ createSerialNumber,
+ getCaCertChain,
+ getCaCredentials,
+ keyAlgorithmToAlgCfg,
+ parseDistinguishedName
+} from "@app/services/certificate-authority/certificate-authority-fns";
+import { TCertificateAuthoritySecretDALFactory } from "@app/services/certificate-authority/certificate-authority-secret-dal";
+import { CaStatus } from "@app/services/certificate-authority/certificate-authority-types";
+import { TKmsServiceFactory } from "@app/services/kms/kms-service";
+import { TPkiSubscriberDALFactory } from "@app/services/pki-subscriber/pki-subscriber-dal";
+import { TProjectDALFactory } from "@app/services/project/project-dal";
+import { getProjectKmsCertificateKeyId } from "@app/services/project/project-fns";
+
+import {
+ PkiSubscriberStatus,
+ TCreatePkiSubscriberDTO,
+ TDeletePkiSubscriberDTO,
+ TGetPkiSubscriberDTO,
+ TIssuePkiSubscriberCertDTO,
+ TListPkiSubscriberCertsDTO,
+ TSignPkiSubscriberCertDTO,
+ TUpdatePkiSubscriberDTO
+} from "./pki-subscriber-types";
+
+type TPkiSubscriberServiceFactoryDep = {
+ pkiSubscriberDAL: Pick<
+ TPkiSubscriberDALFactory,
+ "create" | "findById" | "updateById" | "deleteById" | "transaction" | "find" | "findOne"
+ >;
+ certificateAuthorityDAL: Pick<TCertificateAuthorityDALFactory, "findById">;
+ certificateAuthorityCertDAL: Pick<TCertificateAuthorityCertDALFactory, "findById">;
+ certificateAuthoritySecretDAL: Pick<TCertificateAuthoritySecretDALFactory, "findOne">;
+ certificateAuthorityCrlDAL: Pick<TCertificateAuthorityCrlDALFactory, "findOne">;
+ certificateDAL: Pick<TCertificateDALFactory, "create" | "transaction" | "countCertificatesForPkiSubscriber" | "find">;
+ certificateBodyDAL: Pick<TCertificateBodyDALFactory, "create">;
+ certificateSecretDAL: Pick<TCertificateSecretDALFactory, "create">;
+ projectDAL: Pick<TProjectDALFactory, "findOne" | "updateById" | "transaction" | "findById" | "find">;
+ kmsService: Pick<TKmsServiceFactory, "generateKmsKey" | "decryptWithKmsKey" | "encryptWithKmsKey">;
+ permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
+};
+
+export type TPkiSubscriberServiceFactory = ReturnType<typeof pkiSubscriberServiceFactory>;
+
+export const pkiSubscriberServiceFactory = ({
+ pkiSubscriberDAL,
+ certificateAuthorityDAL,
+ certificateAuthorityCertDAL,
+ certificateAuthoritySecretDAL,
+ certificateAuthorityCrlDAL,
+ certificateDAL,
+ certificateBodyDAL,
+ certificateSecretDAL,
+ projectDAL,
+ kmsService,
+ permissionService
+}: TPkiSubscriberServiceFactoryDep) => {
+ const createSubscriber = async ({
+ name,
+ commonName,
+ status,
+ caId,
+ ttl,
+ subjectAlternativeNames,
+ keyUsages,
+ extendedKeyUsages,
+ projectId,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TCreatePkiSubscriberDTO) => {
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionPkiSubscriberActions.Create,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name
+ })
+ );
+
+ const newSubscriber = await pkiSubscriberDAL.create({
+ caId,
+ projectId,
+ name,
+ commonName,
+ status,
+ ttl,
+ subjectAlternativeNames,
+ keyUsages,
+ extendedKeyUsages
+ });
+
+ return newSubscriber;
+ };
+
+ const getSubscriber = async ({
+ subscriberName,
+ projectId,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TGetPkiSubscriberDTO) => {
+ const subscriber = await pkiSubscriberDAL.findOne({
+ name: subscriberName,
+ projectId
+ });
+
+ if (!subscriber) throw new NotFoundError({ message: `PKI subscriber named '${subscriberName}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: subscriber.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionPkiSubscriberActions.Read,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name: subscriber.name
+ })
+ );
+
+ return subscriber;
+ };
+
+ const updateSubscriber = async ({
+ subscriberName,
+ projectId,
+ name,
+ commonName,
+ status,
+ caId,
+ ttl,
+ subjectAlternativeNames,
+ keyUsages,
+ extendedKeyUsages,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TUpdatePkiSubscriberDTO) => {
+ const subscriber = await pkiSubscriberDAL.findOne({
+ name: subscriberName,
+ projectId
+ });
+ if (!subscriber) throw new NotFoundError({ message: `PKI subscriber named '${subscriberName}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: subscriber.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionPkiSubscriberActions.Edit,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name: subscriber.name
+ })
+ );
+
+ const updatedSubscriber = await pkiSubscriberDAL.updateById(subscriber.id, {
+ caId,
+ name,
+ commonName,
+ status,
+ ttl,
+ subjectAlternativeNames,
+ keyUsages,
+ extendedKeyUsages
+ });
+
+ return updatedSubscriber;
+ };
+
+ const deleteSubscriber = async ({
+ subscriberName,
+ projectId,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TDeletePkiSubscriberDTO) => {
+ const subscriber = await pkiSubscriberDAL.findOne({
+ name: subscriberName,
+ projectId
+ });
+ if (!subscriber) throw new NotFoundError({ message: `PKI subscriber named '${subscriberName}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: subscriber.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionPkiSubscriberActions.Delete,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name: subscriber.name
+ })
+ );
+
+ await pkiSubscriberDAL.deleteById(subscriber.id);
+
+ return subscriber;
+ };
+
+ const issueSubscriberCert = async ({
+ subscriberName,
+ projectId,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TIssuePkiSubscriberCertDTO) => {
+ const subscriber = await pkiSubscriberDAL.findOne({
+ name: subscriberName,
+ projectId
+ });
+ if (!subscriber) throw new NotFoundError({ message: `PKI subscriber named '${subscriberName}' not found` });
+ if (!subscriber.caId) throw new BadRequestError({ message: "Subscriber does not have an assigned issuing CA" });
+
+ const ca = await certificateAuthorityDAL.findById(subscriber.caId);
+ if (!ca) throw new NotFoundError({ message: `CA with ID '${subscriber.caId}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: ca.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionPkiSubscriberActions.IssueCert,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name: subscriber.name
+ })
+ );
+
+ if (subscriber.status !== PkiSubscriberStatus.ACTIVE)
+ throw new BadRequestError({ message: "Subscriber is not active" });
+ if (ca.status !== CaStatus.ACTIVE) throw new BadRequestError({ message: "CA is not active" });
+ if (!ca.activeCaCertId) throw new BadRequestError({ message: "CA does not have a certificate installed" });
+ if (ca.requireTemplateForIssuance) {
+ throw new BadRequestError({ message: "Certificate template is required for issuance" });
+ }
+ const caCert = await certificateAuthorityCertDAL.findById(ca.activeCaCertId);
+
+ const certificateManagerKmsId = await getProjectKmsCertificateKeyId({
+ projectId: ca.projectId,
+ projectDAL,
+ kmsService
+ });
+ const kmsDecryptor = await kmsService.decryptWithKmsKey({
+ kmsId: certificateManagerKmsId
+ });
+
+ const decryptedCaCert = await kmsDecryptor({
+ cipherTextBlob: caCert.encryptedCertificate
+ });
+
+ const caCertObj = new x509.X509Certificate(decryptedCaCert);
+ const notBeforeDate = new Date();
+ const notAfterDate = new Date(new Date().getTime() + ms(subscriber.ttl));
+ const caCertNotBeforeDate = new Date(caCertObj.notBefore);
+ const caCertNotAfterDate = new Date(caCertObj.notAfter);
+
+ // check not before constraint
+ if (notBeforeDate < caCertNotBeforeDate) {
+ throw new BadRequestError({ message: "notBefore date is before CA certificate's notBefore date" });
+ }
+
+ // check not after constraint
+ if (notAfterDate > caCertNotAfterDate) {
+ throw new BadRequestError({ message: "notAfter date is after CA certificate's notAfter date" });
+ }
+
+ const alg = keyAlgorithmToAlgCfg(ca.keyAlgorithm as CertKeyAlgorithm);
+ const leafKeys = await crypto.subtle.generateKey(alg, true, ["sign", "verify"]);
+
+ const csrObj = await x509.Pkcs10CertificateRequestGenerator.create({
+ name: `CN=${subscriber.commonName}`,
+ keys: leafKeys,
+ signingAlgorithm: alg,
+ extensions: [
+ // eslint-disable-next-line no-bitwise
+ new x509.KeyUsagesExtension(x509.KeyUsageFlags.digitalSignature | x509.KeyUsageFlags.keyEncipherment)
+ ],
+ attributes: [new x509.ChallengePasswordAttribute("password")]
+ });
+
+ const { caPrivateKey, caSecret } = await getCaCredentials({
+ caId: ca.id,
+ certificateAuthorityDAL,
+ certificateAuthoritySecretDAL,
+ projectDAL,
+ kmsService
+ });
+
+ const caCrl = await certificateAuthorityCrlDAL.findOne({ caSecretId: caSecret.id });
+ const appCfg = getConfig();
+
+ const distributionPointUrl = `${appCfg.SITE_URL}/api/v1/pki/crl/${caCrl.id}/der`;
+ const caIssuerUrl = `${appCfg.SITE_URL}/api/v1/pki/ca/${ca.id}/certificates/${caCert.id}/der`;
+
+ const extensions: x509.Extension[] = [
+ new x509.BasicConstraintsExtension(false),
+ new x509.CRLDistributionPointsExtension([distributionPointUrl]),
+ await x509.AuthorityKeyIdentifierExtension.create(caCertObj, false),
+ await x509.SubjectKeyIdentifierExtension.create(csrObj.publicKey),
+ new x509.AuthorityInfoAccessExtension({
+ caIssuers: new x509.GeneralName("url", caIssuerUrl)
+ }),
+ new x509.CertificatePolicyExtension(["2.5.29.32.0"]) // anyPolicy
+ ];
+
+ const selectedKeyUsages = subscriber.keyUsages as CertKeyUsage[];
+ const keyUsagesBitValue = selectedKeyUsages.reduce((accum, keyUsage) => accum | x509.KeyUsageFlags[keyUsage], 0);
+ if (keyUsagesBitValue) {
+ extensions.push(new x509.KeyUsagesExtension(keyUsagesBitValue, true));
+ }
+
+ if (subscriber.extendedKeyUsages.length) {
+ const extendedKeyUsagesExtension = new x509.ExtendedKeyUsageExtension(
+ subscriber.extendedKeyUsages.map((eku) => x509.ExtendedKeyUsage[eku as CertExtendedKeyUsage]),
+ true
+ );
+ extensions.push(extendedKeyUsagesExtension);
+ }
+
+ let altNamesArray: { type: "email" | "dns"; value: string }[] = [];
+
+ if (subscriber.subjectAlternativeNames?.length) {
+ altNamesArray = subscriber.subjectAlternativeNames.map((altName) => {
+ if (z.string().email().safeParse(altName).success) {
+ return { type: "email", value: altName };
+ }
+
+ if (isFQDN(altName, { allow_wildcard: true })) {
+ return { type: "dns", value: altName };
+ }
+
+ throw new BadRequestError({ message: `Invalid SAN entry: ${altName}` });
+ });
+
+ const altNamesExtension = new x509.SubjectAlternativeNameExtension(altNamesArray, false);
+ extensions.push(altNamesExtension);
+ }
+
+ const serialNumber = createSerialNumber();
+ const leafCert = await x509.X509CertificateGenerator.create({
+ serialNumber,
+ subject: csrObj.subject,
+ issuer: caCertObj.subject,
+ notBefore: notBeforeDate,
+ notAfter: notAfterDate,
+ signingKey: caPrivateKey,
+ publicKey: csrObj.publicKey,
+ signingAlgorithm: alg,
+ extensions
+ });
+
+ const skLeafObj = KeyObject.from(leafKeys.privateKey);
+ const skLeaf = skLeafObj.export({ format: "pem", type: "pkcs8" }) as string;
+
+ const kmsEncryptor = await kmsService.encryptWithKmsKey({
+ kmsId: certificateManagerKmsId
+ });
+ const { cipherTextBlob: encryptedCertificate } = await kmsEncryptor({
+ plainText: Buffer.from(new Uint8Array(leafCert.rawData))
+ });
+ const { cipherTextBlob: encryptedPrivateKey } = await kmsEncryptor({
+ plainText: Buffer.from(skLeaf)
+ });
+
+ const { caCert: issuingCaCertificate, caCertChain } = await getCaCertChain({
+ caCertId: caCert.id,
+ certificateAuthorityDAL,
+ certificateAuthorityCertDAL,
+ projectDAL,
+ kmsService
+ });
+
+ const certificateChainPem = `${issuingCaCertificate}\n${caCertChain}`.trim();
+
+ const { cipherTextBlob: encryptedCertificateChain } = await kmsEncryptor({
+ plainText: Buffer.from(certificateChainPem)
+ });
+
+ await certificateDAL.transaction(async (tx) => {
+ const cert = await certificateDAL.create(
+ {
+ caId: ca.id,
+ caCertId: caCert.id,
+ pkiSubscriberId: subscriber.id,
+ status: CertStatus.ACTIVE,
+ friendlyName: subscriber.commonName,
+ commonName: subscriber.commonName,
+ altNames: subscriber.subjectAlternativeNames.join(","),
+ serialNumber,
+ notBefore: notBeforeDate,
+ notAfter: notAfterDate,
+ keyUsages: selectedKeyUsages,
+ extendedKeyUsages: subscriber.extendedKeyUsages as CertExtendedKeyUsage[]
+ },
+ tx
+ );
+
+ await certificateBodyDAL.create(
+ {
+ certId: cert.id,
+ encryptedCertificate,
+ encryptedCertificateChain
+ },
+ tx
+ );
+
+ await certificateSecretDAL.create(
+ {
+ certId: cert.id,
+ encryptedPrivateKey
+ },
+ tx
+ );
+ });
+
+ return {
+ certificate: leafCert.toString("pem"),
+ certificateChain: certificateChainPem,
+ issuingCaCertificate,
+ privateKey: skLeaf,
+ serialNumber,
+ ca,
+ subscriber
+ };
+ };
+
+ const signSubscriberCert = async ({
+ subscriberName,
+ projectId,
+ csr,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TSignPkiSubscriberCertDTO) => {
+ const appCfg = getConfig();
+ const subscriber = await pkiSubscriberDAL.findOne({
+ name: subscriberName,
+ projectId
+ });
+ if (!subscriber) throw new NotFoundError({ message: `PKI subscriber named '${subscriberName}' not found` });
+ if (!subscriber.caId) throw new BadRequestError({ message: "Subscriber does not have an assigned issuing CA" });
+
+ const ca = await certificateAuthorityDAL.findById(subscriber.caId);
+ if (!ca) throw new NotFoundError({ message: `CA with ID '${subscriber.caId}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: ca.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionPkiSubscriberActions.IssueCert,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name: subscriber.name
+ })
+ );
+
+ if (subscriber.status !== PkiSubscriberStatus.ACTIVE)
+ throw new BadRequestError({ message: "Subscriber is not active" });
+ if (ca.status !== CaStatus.ACTIVE) throw new BadRequestError({ message: "CA is not active" });
+ if (!ca.activeCaCertId) throw new BadRequestError({ message: "CA does not have a certificate installed" });
+ if (ca.requireTemplateForIssuance) {
+ throw new BadRequestError({ message: "Certificate template is required for issuance" });
+ }
+ const caCert = await certificateAuthorityCertDAL.findById(ca.activeCaCertId);
+
+ const certificateManagerKmsId = await getProjectKmsCertificateKeyId({
+ projectId: ca.projectId,
+ projectDAL,
+ kmsService
+ });
+ const kmsDecryptor = await kmsService.decryptWithKmsKey({
+ kmsId: certificateManagerKmsId
+ });
+
+ const decryptedCaCert = await kmsDecryptor({
+ cipherTextBlob: caCert.encryptedCertificate
+ });
+
+ const caCertObj = new x509.X509Certificate(decryptedCaCert);
+ const notBeforeDate = new Date();
+ const notAfterDate = new Date(new Date().getTime() + ms(subscriber.ttl));
+ const caCertNotBeforeDate = new Date(caCertObj.notBefore);
+ const caCertNotAfterDate = new Date(caCertObj.notAfter);
+
+ // check not before constraint
+ if (notBeforeDate < caCertNotBeforeDate) {
+ throw new BadRequestError({ message: "notBefore date is before CA certificate's notBefore date" });
+ }
+
+ // check not after constraint
+ if (notAfterDate > caCertNotAfterDate) {
+ throw new BadRequestError({ message: "notAfter date is after CA certificate's notAfter date" });
+ }
+
+ const alg = keyAlgorithmToAlgCfg(ca.keyAlgorithm as CertKeyAlgorithm);
+
+ const csrObj = new x509.Pkcs10CertificateRequest(csr);
+
+ const dn = parseDistinguishedName(csrObj.subject);
+ const cn = dn.commonName;
+ if (cn !== subscriber.commonName) {
+ throw new BadRequestError({ message: "Common name (CN) in the CSR does not match the subscriber's common name" });
+ }
+
+ const { caPrivateKey, caSecret } = await getCaCredentials({
+ caId: ca.id,
+ certificateAuthorityDAL,
+ certificateAuthoritySecretDAL,
+ projectDAL,
+ kmsService
+ });
+
+ const caCrl = await certificateAuthorityCrlDAL.findOne({ caSecretId: caSecret.id });
+ const distributionPointUrl = `${appCfg.SITE_URL}/api/v1/pki/crl/${caCrl.id}/der`;
+ const caIssuerUrl = `${appCfg.SITE_URL}/api/v1/pki/ca/${ca.id}/certificates/${caCert.id}/der`;
+
+ const extensions: x509.Extension[] = [
+ new x509.BasicConstraintsExtension(false),
+ await x509.AuthorityKeyIdentifierExtension.create(caCertObj, false),
+ await x509.SubjectKeyIdentifierExtension.create(csrObj.publicKey),
+ new x509.CRLDistributionPointsExtension([distributionPointUrl]),
+ new x509.AuthorityInfoAccessExtension({
+ caIssuers: new x509.GeneralName("url", caIssuerUrl)
+ }),
+ new x509.CertificatePolicyExtension(["2.5.29.32.0"]) // anyPolicy
+ ];
+
+ // handle key usages
+ const csrKeyUsageExtension = csrObj.getExtension("2.5.29.15") as x509.KeyUsagesExtension;
+ let csrKeyUsages: CertKeyUsage[] = [];
+ if (csrKeyUsageExtension) {
+ csrKeyUsages = Object.values(CertKeyUsage).filter(
+ (keyUsage) => (x509.KeyUsageFlags[keyUsage] & csrKeyUsageExtension.usages) !== 0
+ );
+ }
+
+ const selectedKeyUsages = subscriber.keyUsages as CertKeyUsage[];
+
+ if (csrKeyUsages.some((keyUsage) => !selectedKeyUsages.includes(keyUsage))) {
+ throw new BadRequestError({
+ message: "Invalid key usage value based on subscriber's specified key usages"
+ });
+ }
+
+ const keyUsagesBitValue = selectedKeyUsages.reduce((accum, keyUsage) => accum | x509.KeyUsageFlags[keyUsage], 0);
+ if (keyUsagesBitValue) {
+ extensions.push(new x509.KeyUsagesExtension(keyUsagesBitValue, true));
+ }
+
+ // handle extended key usages
+ const csrExtendedKeyUsageExtension = csrObj.getExtension("2.5.29.37") as x509.ExtendedKeyUsageExtension;
+ let csrExtendedKeyUsages: CertExtendedKeyUsage[] = [];
+ if (csrExtendedKeyUsageExtension) {
+ csrExtendedKeyUsages = csrExtendedKeyUsageExtension.usages.map(
+ (ekuOid) => CertExtendedKeyUsageOIDToName[ekuOid as string]
+ );
+ }
+
+ const selectedExtendedKeyUsages = subscriber.extendedKeyUsages as CertExtendedKeyUsage[];
+ if (csrExtendedKeyUsages.some((eku) => !selectedExtendedKeyUsages.includes(eku))) {
+ throw new BadRequestError({
+ message: "Invalid extended key usage value based on subscriber's specified extended key usages"
+ });
+ }
+
+ if (selectedExtendedKeyUsages.length) {
+ extensions.push(
+ new x509.ExtendedKeyUsageExtension(
+ selectedExtendedKeyUsages.map((eku) => x509.ExtendedKeyUsage[eku]),
+ true
+ )
+ );
+ }
+
+ // attempt to read from CSR if altNames is not explicitly provided
+ let altNamesArray: {
+ type: "email" | "dns";
+ value: string;
+ }[] = [];
+
+ const sanExtension = csrObj.extensions.find((ext) => ext.type === "2.5.29.17");
+ if (sanExtension) {
+ const sanNames = new x509.GeneralNames(sanExtension.value);
+
+ altNamesArray = sanNames.items
+ .filter((value) => value.type === "email" || value.type === "dns")
+ .map((name) => ({
+ type: name.type as "email" | "dns",
+ value: name.value
+ }));
+ }
+
+ if (
+ altNamesArray
+ .map((altName) => altName.value)
+ .some((altName) => !subscriber.subjectAlternativeNames.includes(altName))
+ ) {
+ throw new BadRequestError({
+ message: "Invalid subject alternative name based on subscriber's specified subject alternative names"
+ });
+ }
+
+ if (altNamesArray.length) {
+ const altNamesExtension = new x509.SubjectAlternativeNameExtension(altNamesArray, false);
+ extensions.push(altNamesExtension);
+ }
+
+ const serialNumber = createSerialNumber();
+ const leafCert = await x509.X509CertificateGenerator.create({
+ serialNumber,
+ subject: csrObj.subject,
+ issuer: caCertObj.subject,
+ notBefore: notBeforeDate,
+ notAfter: notAfterDate,
+ signingKey: caPrivateKey,
+ publicKey: csrObj.publicKey,
+ signingAlgorithm: alg,
+ extensions
+ });
+
+ const kmsEncryptor = await kmsService.encryptWithKmsKey({
+ kmsId: certificateManagerKmsId
+ });
+ const { cipherTextBlob: encryptedCertificate } = await kmsEncryptor({
+ plainText: Buffer.from(new Uint8Array(leafCert.rawData))
+ });
+
+ const { caCert: issuingCaCertificate, caCertChain } = await getCaCertChain({
+ caCertId: ca.activeCaCertId,
+ certificateAuthorityDAL,
+ certificateAuthorityCertDAL,
+ projectDAL,
+ kmsService
+ });
+
+ const certificateChainPem = `${issuingCaCertificate}\n${caCertChain}`.trim();
+
+ const { cipherTextBlob: encryptedCertificateChain } = await kmsEncryptor({
+ plainText: Buffer.from(certificateChainPem)
+ });
+
+ await certificateDAL.transaction(async (tx) => {
+ const cert = await certificateDAL.create(
+ {
+ caId: ca.id,
+ caCertId: caCert.id,
+ pkiSubscriberId: subscriber.id,
+ status: CertStatus.ACTIVE,
+ friendlyName: subscriber.commonName,
+ commonName: subscriber.commonName,
+ altNames: subscriber.subjectAlternativeNames.join(","),
+ serialNumber,
+ notBefore: notBeforeDate,
+ notAfter: notAfterDate,
+ keyUsages: selectedKeyUsages,
+ extendedKeyUsages: selectedExtendedKeyUsages
+ },
+ tx
+ );
+
+ await certificateBodyDAL.create(
+ {
+ certId: cert.id,
+ encryptedCertificate,
+ encryptedCertificateChain
+ },
+ tx
+ );
+
+ return cert;
+ });
+
+ return {
+ certificate: leafCert.toString("pem"),
+ certificateChain: `${issuingCaCertificate}\n${caCertChain}`.trim(),
+ issuingCaCertificate,
+ serialNumber,
+ ca,
+ commonName: subscriber.commonName,
+ subscriber
+ };
+ };
+
+ const listSubscriberCerts = async ({
+ subscriberName,
+ projectId,
+ offset,
+ limit,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TListPkiSubscriberCertsDTO) => {
+ const subscriber = await pkiSubscriberDAL.findOne({
+ name: subscriberName,
+ projectId
+ });
+ if (!subscriber) throw new NotFoundError({ message: `PKI subscriber named '${subscriberName}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: subscriber.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionPkiSubscriberActions.ListCerts,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name: subscriber.name
+ })
+ );
+
+ const certificates = await certificateDAL.find(
+ {
+ pkiSubscriberId: subscriber.id
+ },
+ { offset, limit, sort: [["updatedAt", "desc"]] }
+ );
+
+ const count = await certificateDAL.countCertificatesForPkiSubscriber(subscriber.id);
+
+ return {
+ certificates,
+ totalCount: count
+ };
+ };
+
+ return {
+ createSubscriber,
+ getSubscriber,
+ updateSubscriber,
+ deleteSubscriber,
+ issueSubscriberCert,
+ signSubscriberCert,
+ listSubscriberCerts
+ };
+};
diff --git a/backend/src/services/pki-subscriber/pki-subscriber-types.ts b/backend/src/services/pki-subscriber/pki-subscriber-types.ts
new file mode 100644
index 0000000000..690148f161
--- /dev/null
+++ b/backend/src/services/pki-subscriber/pki-subscriber-types.ts
@@ -0,0 +1,54 @@
+import { TProjectPermission } from "@app/lib/types";
+
+import { CertExtendedKeyUsage, CertKeyUsage } from "../certificate/certificate-types";
+
+export enum PkiSubscriberStatus {
+ ACTIVE = "active",
+ DISABLED = "disabled"
+}
+
+export type TCreatePkiSubscriberDTO = {
+ caId: string;
+ name: string;
+ commonName: string;
+ status: PkiSubscriberStatus;
+ ttl: string;
+ subjectAlternativeNames: string[];
+ keyUsages: CertKeyUsage[];
+ extendedKeyUsages: CertExtendedKeyUsage[];
+} & TProjectPermission;
+
+export type TGetPkiSubscriberDTO = {
+ subscriberName: string;
+} & TProjectPermission;
+
+export type TUpdatePkiSubscriberDTO = {
+ subscriberName: string;
+ caId?: string;
+ name?: string;
+ commonName?: string;
+ status?: PkiSubscriberStatus;
+ ttl?: string;
+ subjectAlternativeNames?: string[];
+ keyUsages?: CertKeyUsage[];
+ extendedKeyUsages?: CertExtendedKeyUsage[];
+} & TProjectPermission;
+
+export type TDeletePkiSubscriberDTO = {
+ subscriberName: string;
+} & TProjectPermission;
+
+export type TIssuePkiSubscriberCertDTO = {
+ subscriberName: string;
+} & TProjectPermission;
+
+export type TSignPkiSubscriberCertDTO = {
+ subscriberName: string;
+ csr: string;
+} & TProjectPermission;
+
+export type TListPkiSubscriberCertsDTO = {
+ subscriberName: string;
+ offset: number;
+ limit: number;
+} & TProjectPermission;
diff --git a/backend/src/services/project-role/project-role-fns.ts b/backend/src/services/project-role/project-role-fns.ts
index c465715a77..4dfcf960b7 100644
--- a/backend/src/services/project-role/project-role-fns.ts
+++ b/backend/src/services/project-role/project-role-fns.ts
@@ -1,15 +1,20 @@
-import { ProjectMembershipRole } from "@app/db/schemas";
+import { v4 as uuidv4 } from "uuid";
+
+import { ProjectMembershipRole, ProjectType } from "@app/db/schemas";
import {
+ cryptographicOperatorPermissions,
projectAdminPermissions,
projectMemberPermissions,
projectNoAccessPermissions,
- projectViewerPermission
-} from "@app/ee/services/permission/project-permission";
+ projectViewerPermission,
+ sshHostBootstrapPermissions
+} from "@app/ee/services/permission/default-roles";
+import { TGetPredefinedRolesDTO } from "@app/services/project-role/project-role-types";
-export const getPredefinedRoles = (projectId: string, roleFilter?: ProjectMembershipRole) => {
+export const getPredefinedRoles = ({ projectId, projectType, roleFilter }: TGetPredefinedRolesDTO) => {
return [
{
- id: "b11b49a9-09a9-4443-916a-4246f9ff2c69", // dummy userid
+ id: uuidv4(),
projectId,
name: "Admin",
slug: ProjectMembershipRole.Admin,
@@ -19,7 +24,7 @@ export const getPredefinedRoles = (projectId: string, roleFilter?: ProjectMember
updatedAt: new Date()
},
{
- id: "b11b49a9-09a9-4443-916a-4246f9ff2c70", // dummy user for zod validation in response
+ id: uuidv4(),
projectId,
name: "Developer",
slug: ProjectMembershipRole.Member,
@@ -29,7 +34,29 @@ export const getPredefinedRoles = (projectId: string, roleFilter?: ProjectMember
updatedAt: new Date()
},
{
- id: "b11b49a9-09a9-4443-916a-4246f9ff2c71", // dummy user for zod validation in response
+ id: uuidv4(),
+ projectId,
+ name: "SSH Host Bootstrapper",
+ slug: ProjectMembershipRole.SshHostBootstrapper,
+ permissions: sshHostBootstrapPermissions,
+ description: "Create and issue SSH Hosts in a project",
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ type: ProjectType.SSH
+ },
+ {
+ id: uuidv4(),
+ projectId,
+ name: "Cryptographic Operator",
+ slug: ProjectMembershipRole.KmsCryptographicOperator,
+ permissions: cryptographicOperatorPermissions,
+ description: "Perform cryptographic operations, such as encryption and signing, in a project",
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ type: ProjectType.KMS
+ },
+ {
+ id: uuidv4(),
projectId,
name: "Viewer",
slug: ProjectMembershipRole.Viewer,
@@ -39,7 +66,7 @@ export const getPredefinedRoles = (projectId: string, roleFilter?: ProjectMember
updatedAt: new Date()
},
{
- id: "b11b49a9-09a9-4443-916a-4246f9ff2c72", // dummy user for zod validation in response
+ id: uuidv4(),
projectId,
name: "No Access",
slug: ProjectMembershipRole.NoAccess,
@@ -48,5 +75,5 @@ export const getPredefinedRoles = (projectId: string, roleFilter?: ProjectMember
createdAt: new Date(),
updatedAt: new Date()
}
- ].filter(({ slug }) => !roleFilter || roleFilter.includes(slug));
+ ].filter(({ slug, type }) => (type ? type === projectType : true) && (!roleFilter || roleFilter === slug));
};
diff --git a/backend/src/services/project-role/project-role-service.ts b/backend/src/services/project-role/project-role-service.ts
index 211dcff4fc..babcf7d9c7 100644
--- a/backend/src/services/project-role/project-role-service.ts
+++ b/backend/src/services/project-role/project-role-service.ts
@@ -2,7 +2,7 @@ import { ForbiddenError, MongoAbility, RawRuleOf } from "@casl/ability";
import { PackRule, packRules, unpackRules } from "@casl/ability/extra";
import { requestContext } from "@fastify/request-context";
-import { ActionProjectType, ProjectMembershipRole, TableName } from "@app/db/schemas";
+import { ActionProjectType, ProjectMembershipRole, ProjectType, TableName, TProjects } from "@app/db/schemas";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
import {
ProjectPermissionActions,
@@ -34,7 +34,7 @@ type TProjectRoleServiceFactoryDep = {
projectRoleDAL: TProjectRoleDALFactory;
identityDAL: Pick<TIdentityDALFactory, "findById">;
userDAL: Pick<TUserDALFactory, "findById">;
- projectDAL: Pick<TProjectDALFactory, "findProjectBySlug">;
+ projectDAL: Pick<TProjectDALFactory, "findProjectBySlug" | "findProjectById">;
permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getUserProjectPermission">;
identityProjectMembershipRoleDAL: TIdentityProjectMembershipRoleDALFactory;
projectUserMembershipRoleDAL: TProjectUserMembershipRoleDALFactory;
@@ -98,30 +98,37 @@ export const projectRoleServiceFactory = ({
roleSlug,
filter
}: TGetRoleDetailsDTO) => {
- let projectId = "";
+ let project: TProjects;
if (filter.type === ProjectRoleServiceIdentifierType.SLUG) {
- const project = await projectDAL.findProjectBySlug(filter.projectSlug, actorOrgId);
- if (!project) throw new NotFoundError({ message: "Project not found" });
- projectId = project.id;
+ project = await projectDAL.findProjectBySlug(filter.projectSlug, actorOrgId);
} else {
- projectId = filter.projectId;
+ project = await projectDAL.findProjectById(filter.projectId);
}
+ if (!project) throw new NotFoundError({ message: "Project not found" });
+
const { permission } = await permissionService.getProjectPermission({
actor,
actorId,
- projectId,
+ projectId: project.id,
actorAuthMethod,
actorOrgId,
actionProjectType: ActionProjectType.Any
});
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Role);
if (roleSlug !== "custom" && Object.values(ProjectMembershipRole).includes(roleSlug as ProjectMembershipRole)) {
- const predefinedRole = getPredefinedRoles(projectId, roleSlug as ProjectMembershipRole)[0];
+ const [predefinedRole] = getPredefinedRoles({
+ projectId: project.id,
+ projectType: project.type as ProjectType,
+ roleFilter: roleSlug as ProjectMembershipRole
+ });
+
+ if (!predefinedRole) throw new NotFoundError({ message: `Default role with slug '${roleSlug}' not found` });
+
return { ...predefinedRole, permissions: UnpackedPermissionSchema.array().parse(predefinedRole.permissions) };
}
- const customRole = await projectRoleDAL.findOne({ slug: roleSlug, projectId });
+ const customRole = await projectRoleDAL.findOne({ slug: roleSlug, projectId: project.id });
if (!customRole) throw new NotFoundError({ message: `Project role with slug '${roleSlug}' not found` });
return { ...customRole, permissions: unpackPermissions(customRole.permissions) };
};
@@ -194,29 +201,32 @@ export const projectRoleServiceFactory = ({
};
const listRoles = async ({ actorOrgId, actorAuthMethod, actorId, actor, filter }: TListRolesDTO) => {
- let projectId = "";
+ let project: TProjects;
if (filter.type === ProjectRoleServiceIdentifierType.SLUG) {
- const project = await projectDAL.findProjectBySlug(filter.projectSlug, actorOrgId);
- if (!project) throw new BadRequestError({ message: "Project not found" });
- projectId = project.id;
+ project = await projectDAL.findProjectBySlug(filter.projectSlug, actorOrgId);
} else {
- projectId = filter.projectId;
+ project = await projectDAL.findProjectById(filter.projectId);
}
+ if (!project) throw new BadRequestError({ message: "Project not found" });
+
const { permission } = await permissionService.getProjectPermission({
actor,
actorId,
- projectId,
+ projectId: project.id,
actorAuthMethod,
actorOrgId,
actionProjectType: ActionProjectType.Any
});
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Role);
const customRoles = await projectRoleDAL.find(
- { projectId },
+ { projectId: project.id },
{ sort: [[`${TableName.ProjectRoles}.slug` as "slug", "asc"]] }
);
- const roles = [...getPredefinedRoles(projectId), ...(customRoles || [])];
+ const roles = [
+ ...getPredefinedRoles({ projectId: project.id, projectType: project.type as ProjectType }),
+ ...(customRoles || [])
+ ];
return roles;
};
diff --git a/backend/src/services/project-role/project-role-types.ts b/backend/src/services/project-role/project-role-types.ts
index a71c731136..508623a0cf 100644
--- a/backend/src/services/project-role/project-role-types.ts
+++ b/backend/src/services/project-role/project-role-types.ts
@@ -1,4 +1,4 @@
-import { TOrgRolesUpdate, TProjectRolesInsert } from "@app/db/schemas";
+import { ProjectMembershipRole, ProjectType, TOrgRolesUpdate, TProjectRolesInsert } from "@app/db/schemas";
import { TProjectPermission } from "@app/lib/types";
export enum ProjectRoleServiceIdentifierType {
@@ -34,3 +34,9 @@ export type TListRolesDTO = {
| { type: ProjectRoleServiceIdentifierType.SLUG; projectSlug: string }
| { type: ProjectRoleServiceIdentifierType.ID; projectId: string };
} & Omit<TProjectPermission, "projectId">;
+
+export type TGetPredefinedRolesDTO = {
+ projectId: string;
+ projectType: ProjectType;
+ roleFilter?: ProjectMembershipRole;
+};
diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.ts
index 8e60252bab..38631a8fa7 100644
--- a/backend/src/services/project/project-service.ts
+++ b/backend/src/services/project/project-service.ts
@@ -14,6 +14,8 @@ import { throwIfMissingSecretReadValueOrDescribePermission } from "@app/ee/servi
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
import {
ProjectPermissionActions,
+ ProjectPermissionCertificateActions,
+ ProjectPermissionPkiSubscriberActions,
ProjectPermissionSecretActions,
ProjectPermissionSshHostActions,
ProjectPermissionSub
@@ -34,6 +36,7 @@ import { groupBy } from "@app/lib/fn";
import { alphaNumericNanoId } from "@app/lib/nanoid";
import { TProjectPermission } from "@app/lib/types";
import { TQueueServiceFactory } from "@app/queue";
+import { TPkiSubscriberDALFactory } from "@app/services/pki-subscriber/pki-subscriber-dal";
import { ActorType } from "../auth/auth-type";
import { TCertificateDALFactory } from "../certificate/certificate-dal";
@@ -85,6 +88,7 @@ import {
TListProjectCasDTO,
TListProjectCertificateTemplatesDTO,
TListProjectCertsDTO,
+ TListProjectPkiSubscribersDTO,
TListProjectsDTO,
TListProjectSshCasDTO,
TListProjectSshCertificatesDTO,
@@ -144,6 +148,7 @@ type TProjectServiceFactoryDep = {
"findById" | "findByIdWithWorkflowIntegrationDetails"
>;
projectUserMembershipRoleDAL: Pick<TProjectUserMembershipRoleDALFactory, "create">;
+ pkiSubscriberDAL: Pick<TPkiSubscriberDALFactory, "find">;
certificateAuthorityDAL: Pick<TCertificateAuthorityDALFactory, "find">;
certificateDAL: Pick<TCertificateDALFactory, "find" | "countCertificatesInProject">;
certificateTemplateDAL: Pick<TCertificateTemplateDALFactory, "getCertTemplatesByProjectId">;
@@ -206,6 +211,7 @@ export const projectServiceFactory = ({
certificateTemplateDAL,
pkiCollectionDAL,
pkiAlertDAL,
+ pkiSubscriberDAL,
sshCertificateAuthorityDAL,
sshCertificateAuthoritySecretDAL,
sshCertificateDAL,
@@ -328,14 +334,16 @@ export const projectServiceFactory = ({
// set default environments and root folder for provided environments
let envs: TProjectEnvironments[] = [];
if (projectTemplate) {
- envs = await projectEnvDAL.insertMany(
- projectTemplate.environments.map((env) => ({ ...env, projectId: project.id })),
- tx
- );
- await folderDAL.insertMany(
- envs.map(({ id }) => ({ name: ROOT_FOLDER_NAME, envId: id, version: 1 })),
- tx
- );
+ if (projectTemplate.environments) {
+ envs = await projectEnvDAL.insertMany(
+ projectTemplate.environments.map((env) => ({ ...env, projectId: project.id })),
+ tx
+ );
+ await folderDAL.insertMany(
+ envs.map(({ id }) => ({ name: ROOT_FOLDER_NAME, envId: id, version: 1 })),
+ tx
+ );
+ }
await projectRoleDAL.insertMany(
projectTemplate.packedRoles.map((role) => ({
...role,
@@ -591,7 +599,10 @@ export const projectServiceFactory = ({
workspaces.map(async (workspace) => {
return {
...workspace,
- roles: [...(workspaceMappedToRoles[workspace.id] || []), ...getPredefinedRoles(workspace.id)]
+ roles: [
+ ...(workspaceMappedToRoles[workspace.id] || []),
+ ...getPredefinedRoles({ projectId: workspace.id, projectType: workspace.type as ProjectType })
+ ]
};
})
);
@@ -647,7 +658,8 @@ export const projectServiceFactory = ({
autoCapitalization: update.autoCapitalization,
enforceCapitalization: update.autoCapitalization,
hasDeleteProtection: update.hasDeleteProtection,
- slug: update.slug
+ slug: update.slug,
+ secretSharing: update.secretSharing
});
return updatedProject;
@@ -948,7 +960,10 @@ export const projectServiceFactory = ({
actionProjectType: ActionProjectType.CertificateManager
});
- ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionCertificateActions.Read,
+ ProjectPermissionSub.Certificates
+ );
const cas = await certificateAuthorityDAL.find({ projectId });
@@ -1048,6 +1063,45 @@ export const projectServiceFactory = ({
};
};
+ /**
+ * Return list of PKI subscribers for project
+ */
+ const listProjectPkiSubscribers = async ({
+ actorId,
+ actorOrgId,
+ actorAuthMethod,
+ actor,
+ projectId
+ }: TListProjectPkiSubscribersDTO) => {
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.CertificateManager
+ });
+
+ const allowedSubscribers = [];
+
+ // (dangtony98): room to optimize
+ const subscribers = await pkiSubscriberDAL.find({ projectId });
+
+ for (const subscriber of subscribers) {
+ const canRead = permission.can(
+ ProjectPermissionPkiSubscriberActions.Read,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name: subscriber.name
+ })
+ );
+ if (canRead) {
+ allowedSubscribers.push(subscriber);
+ }
+ }
+
+ return allowedSubscribers;
+ };
+
/**
* Return list of certificate templates for project
*/
@@ -1147,17 +1201,15 @@ export const projectServiceFactory = ({
const hosts = await sshHostDAL.findSshHostsWithLoginMappings(projectId);
for (const host of hosts) {
- try {
- ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionSshHostActions.Read,
- subject(ProjectPermissionSub.SshHosts, {
- hostname: host.hostname
- })
- );
+ const canRead = permission.can(
+ ProjectPermissionSshHostActions.Read,
+ subject(ProjectPermissionSub.SshHosts, {
+ hostname: host.hostname
+ })
+ );
+ if (canRead) {
allowedHosts.push(host);
- } catch {
- // intentionally ignore projects where user lacks access
}
}
@@ -1921,6 +1973,7 @@ export const projectServiceFactory = ({
listProjectSshCas,
listProjectSshHosts,
listProjectSshHostGroups,
+ listProjectPkiSubscribers,
listProjectSshCertificates,
listProjectSshCertificateTemplates,
updateVersionLimit,
diff --git a/backend/src/services/project/project-types.ts b/backend/src/services/project/project-types.ts
index dc26d23577..be052f1cbe 100644
--- a/backend/src/services/project/project-types.ts
+++ b/backend/src/services/project/project-types.ts
@@ -93,6 +93,7 @@ export type TUpdateProjectDTO = {
autoCapitalization?: boolean;
hasDeleteProtection?: boolean;
slug?: string;
+ secretSharing?: boolean;
};
} & Omit<TProjectPermission, "projectId">;
@@ -155,6 +156,7 @@ export type TListProjectCertificateTemplatesDTO = TProjectPermission;
export type TListProjectSshCasDTO = TProjectPermission;
export type TListProjectSshHostsDTO = TProjectPermission;
export type TListProjectSshCertificateTemplatesDTO = TProjectPermission;
+export type TListProjectPkiSubscribersDTO = TProjectPermission;
export type TListProjectSshCertificatesDTO = {
offset: number;
limit: number;
diff --git a/backend/src/services/secret-sharing/secret-sharing-service.ts b/backend/src/services/secret-sharing/secret-sharing-service.ts
index 9649be7228..7020783644 100644
--- a/backend/src/services/secret-sharing/secret-sharing-service.ts
+++ b/backend/src/services/secret-sharing/secret-sharing-service.ts
@@ -6,6 +6,7 @@ import { TSecretSharing } from "@app/db/schemas";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
import { getConfig } from "@app/lib/config/env";
import { BadRequestError, ForbiddenRequestError, NotFoundError, UnauthorizedError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
import { SecretSharingAccessType } from "@app/lib/types";
import { isUuidV4 } from "@app/lib/validator";
@@ -60,7 +61,9 @@ export const secretSharingServiceFactory = ({
}
const fiveMins = 5 * 60 * 1000;
- if (expiryTime - currentTime < fiveMins) {
+
+ // 1 second buffer
+ if (expiryTime - currentTime + 1000 < fiveMins) {
throw new BadRequestError({ message: "Expiration time cannot be less than 5 mins" });
}
};
@@ -76,8 +79,11 @@ export const secretSharingServiceFactory = ({
password,
accessType,
expiresAt,
- expiresAfterViews
+ expiresAfterViews,
+ emails
}: TCreateSharedSecretDTO) => {
+ const appCfg = getConfig();
+
const { permission } = await permissionService.getOrgPermission(actor, actorId, orgId, actorAuthMethod, actorOrgId);
if (!permission) throw new ForbiddenRequestError({ name: "User is not a part of the specified organization" });
$validateSharedSecretExpiry(expiresAt);
@@ -93,7 +99,46 @@ export const secretSharingServiceFactory = ({
throw new BadRequestError({ message: "Shared secret value too long" });
}
+ // Check lifetime is within org allowance
+ const expiresAtTimestamp = new Date(expiresAt).getTime();
+ const lifetime = expiresAtTimestamp - new Date().getTime();
+
+ // org.maxSharedSecretLifetime is in seconds
+ if (org.maxSharedSecretLifetime && lifetime / 1000 > org.maxSharedSecretLifetime) {
+ throw new BadRequestError({ message: "Secret lifetime exceeds organization limit" });
+ }
+
+ // Check max view count is within org allowance
+ if (org.maxSharedSecretViewLimit && (!expiresAfterViews || expiresAfterViews > org.maxSharedSecretViewLimit)) {
+ throw new BadRequestError({ message: "Secret max views parameter exceeds organization limit" });
+ }
+
const encryptWithRoot = kmsService.encryptWithRootKey();
+
+ let salt: string | undefined;
+ let encryptedSalt: Buffer | undefined;
+ const orgEmails = [];
+
+ if (emails && emails.length > 0) {
+ const allOrgMembers = await orgDAL.findAllOrgMembers(orgId);
+
+ // Check to see that all emails are a part of the organization (if enforced) while also collecting a list of emails which are in the org
+ for (const email of emails) {
+ if (allOrgMembers.some((v) => v.user.email === email)) {
+ orgEmails.push(email);
+ // If the email is not part of the org, but access type / org settings require it
+ } else if (!org.allowSecretSharingOutsideOrganization || accessType === SecretSharingAccessType.Organization) {
+ throw new BadRequestError({
+ message: "Organization does not allow sharing secrets to members outside of this organization"
+ });
+ }
+ }
+
+ // Generate salt for signing email hashes (if emails are provided)
+ salt = crypto.randomBytes(32).toString("hex");
+ encryptedSalt = encryptWithRoot(Buffer.from(salt));
+ }
+
const encryptedSecret = encryptWithRoot(Buffer.from(secretValue));
const id = crypto.randomBytes(32).toString("hex");
@@ -112,11 +157,45 @@ export const secretSharingServiceFactory = ({
expiresAfterViews,
userId: actorId,
orgId,
- accessType
+ accessType,
+ authorizedEmails: emails && emails.length > 0 ? JSON.stringify(emails) : undefined,
+ encryptedSalt
});
const idToReturn = `${Buffer.from(newSharedSecret.identifier!, "hex").toString("base64url")}`;
+ // Loop through recipients and send out emails with unique access links
+ if (emails && salt) {
+ const user = await userDAL.findById(actorId);
+
+ if (!user) {
+ throw new NotFoundError({ message: `User with ID '${actorId}' not found` });
+ }
+
+ for await (const email of emails) {
+ try {
+ const hmac = crypto.createHmac("sha256", salt).update(email);
+ const hash = hmac.digest("hex");
+
+ // Only show the username to emails which are part of the organization
+ const respondentUsername = orgEmails.includes(email) ? user.username : undefined;
+
+ await smtpService.sendMail({
+ recipients: [email],
+ subjectLine: "A secret has been shared with you",
+ substitutions: {
+ name,
+ respondentUsername,
+ secretRequestUrl: `${appCfg.SITE_URL}/shared/secret/${idToReturn}?email=${encodeURIComponent(email)}&hash=${hash}`
+ },
+ template: SmtpTemplates.SecretRequestCompleted
+ });
+ } catch (e) {
+ logger.error(e, "Failed to send shared secret URL to a recipient's email.");
+ }
+ }
+ }
+
return { id: idToReturn };
};
@@ -390,8 +469,15 @@ export const secretSharingServiceFactory = ({
});
};
- /** Get's password-less secret. validates all secret's requested (must be fresh). */
- const getSharedSecretById = async ({ sharedSecretId, hashedHex, orgId, password }: TGetActiveSharedSecretByIdDTO) => {
+ /** Gets password-less secret. validates all secret's requested (must be fresh). */
+ const getSharedSecretById = async ({
+ sharedSecretId,
+ hashedHex,
+ orgId,
+ password,
+ email,
+ hash
+ }: TGetActiveSharedSecretByIdDTO) => {
const sharedSecret = isUuidV4(sharedSecretId)
? await secretSharingDAL.findOne({
id: sharedSecretId,
@@ -438,6 +524,32 @@ export const secretSharingServiceFactory = ({
});
}
+ const decryptWithRoot = kmsService.decryptWithRootKey();
+
+ if (sharedSecret.authorizedEmails && sharedSecret.encryptedSalt) {
+ // Verify both params were passed
+ if (!email || !hash) {
+ throw new BadRequestError({
+ message: "This secret is email protected. Parameters must include email and hash."
+ });
+
+ // Verify that email is authorized to view shared secret
+ } else if (!(sharedSecret.authorizedEmails as string[]).includes(email)) {
+ throw new UnauthorizedError({ message: "Email not authorized to view secret" });
+
+ // Verify that hash matches
+ } else {
+ const salt = decryptWithRoot(sharedSecret.encryptedSalt).toString();
+ const hmac = crypto.createHmac("sha256", salt).update(email);
+ const rebuiltHash = hmac.digest("hex");
+
+ if (rebuiltHash !== hash) {
+ throw new UnauthorizedError({ message: "Email not authorized to view secret" });
+ }
+ }
+ }
+
+ // Password checks
const isPasswordProtected = Boolean(sharedSecret.password);
const hasProvidedPassword = Boolean(password);
if (isPasswordProtected) {
@@ -452,7 +564,6 @@ export const secretSharingServiceFactory = ({
// If encryptedSecret is set, we know that this secret has been encrypted using KMS, and we can therefore do server-side decryption.
let decryptedSecretValue: Buffer | undefined;
if (sharedSecret.encryptedSecret) {
- const decryptWithRoot = kmsService.decryptWithRootKey();
decryptedSecretValue = decryptWithRoot(sharedSecret.encryptedSecret);
}
diff --git a/backend/src/services/secret-sharing/secret-sharing-types.ts b/backend/src/services/secret-sharing/secret-sharing-types.ts
index 835d70eff0..049dbb9138 100644
--- a/backend/src/services/secret-sharing/secret-sharing-types.ts
+++ b/backend/src/services/secret-sharing/secret-sharing-types.ts
@@ -22,6 +22,7 @@ export type TSharedSecretPermission = {
accessType?: SecretSharingAccessType;
name?: string;
password?: string;
+ emails?: string[];
};
export type TCreatePublicSharedSecretDTO = {
@@ -37,6 +38,10 @@ export type TGetActiveSharedSecretByIdDTO = {
hashedHex?: string;
orgId?: string;
password?: string;
+
+ // For secrets shared with specific emails
+ email?: string;
+ hash?: string;
};
export type TValidateActiveSharedSecretDTO = TGetActiveSharedSecretByIdDTO & {
diff --git a/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-fns.ts b/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-fns.ts
index 7e77bd2564..a73bc81c9f 100644
--- a/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-fns.ts
+++ b/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-fns.ts
@@ -2,6 +2,7 @@ import AWS, { AWSError } from "aws-sdk";
import { getAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-fns";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import { TAwsParameterStoreSyncWithCredentials } from "./aws-parameter-store-sync-types";
@@ -169,7 +170,7 @@ const getParameterStoreTagsRecord = async (
throw new SecretSyncError({
message:
- "IAM role has inadequate permissions to manage resource tags. Ensure the following polices are present: ssm:ListTagsForResource, ssm:AddTagsToResource, and ssm:RemoveTagsFromResource",
+ "IAM role has inadequate permissions to manage resource tags. Ensure the following policies are present: ssm:ListTagsForResource, ssm:AddTagsToResource, and ssm:RemoveTagsFromResource",
shouldRetry: false
});
}
@@ -389,6 +390,9 @@ export const AwsParameterStoreSyncFns = {
for (const entry of Object.entries(awsParameterStoreSecretsRecord)) {
const [key, parameter] = entry;
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(key, syncOptions.keySchema)) continue;
+
if (!(key in secretMap) || !secretMap[key].value) {
parametersToDelete.push(parameter);
}
diff --git a/backend/src/services/secret-sync/aws-secrets-manager/aws-secrets-manager-sync-fns.ts b/backend/src/services/secret-sync/aws-secrets-manager/aws-secrets-manager-sync-fns.ts
index 7cea12d1b8..cef1bee155 100644
--- a/backend/src/services/secret-sync/aws-secrets-manager/aws-secrets-manager-sync-fns.ts
+++ b/backend/src/services/secret-sync/aws-secrets-manager/aws-secrets-manager-sync-fns.ts
@@ -27,6 +27,7 @@ import {
import { getAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-fns";
import { AwsSecretsManagerSyncMappingBehavior } from "@app/services/secret-sync/aws-secrets-manager/aws-secrets-manager-sync-enums";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import { TAwsSecretsManagerSyncWithCredentials } from "./aws-secrets-manager-sync-types";
@@ -399,6 +400,9 @@ export const AwsSecretsManagerSyncFns = {
if (syncOptions.disableSecretDeletion) return;
for await (const secretKey of Object.keys(awsSecretsRecord)) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(secretKey, syncOptions.keySchema)) continue;
+
if (!(secretKey in secretMap) || !secretMap[secretKey].value) {
try {
await deleteSecret(client, secretKey);
diff --git a/backend/src/services/secret-sync/azure-app-configuration/azure-app-configuration-sync-fns.ts b/backend/src/services/secret-sync/azure-app-configuration/azure-app-configuration-sync-fns.ts
index 64d82c125e..dce509face 100644
--- a/backend/src/services/secret-sync/azure-app-configuration/azure-app-configuration-sync-fns.ts
+++ b/backend/src/services/secret-sync/azure-app-configuration/azure-app-configuration-sync-fns.ts
@@ -7,6 +7,7 @@ import { TAppConnectionDALFactory } from "@app/services/app-connection/app-conne
import { getAzureConnectionAccessToken } from "@app/services/app-connection/azure-key-vault";
import { isAzureKeyVaultReference } from "@app/services/integration-auth/integration-sync-secret-fns";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import { TAzureAppConfigurationSyncWithCredentials } from "./azure-app-configuration-sync-types";
@@ -139,6 +140,9 @@ export const azureAppConfigurationSyncFactory = ({
if (secretSync.syncOptions.disableSecretDeletion) return;
for await (const key of Object.keys(azureAppConfigSecrets)) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(key, secretSync.syncOptions.keySchema)) continue;
+
const azureSecret = azureAppConfigSecrets[key];
if (
!(key in secretMap) ||
diff --git a/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts b/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts
index 12f1f2aff9..fd1e2bd782 100644
--- a/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts
+++ b/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts
@@ -5,6 +5,7 @@ import { request } from "@app/lib/config/request";
import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";
import { getAzureConnectionAccessToken } from "@app/services/app-connection/azure-key-vault";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import { SecretSyncError } from "../secret-sync-errors";
@@ -192,7 +193,9 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzur
if (secretSync.syncOptions.disableSecretDeletion) return;
for await (const deleteSecretKey of deleteSecrets.filter(
- (secret) => !setSecrets.find((setSecret) => setSecret.key === secret)
+ (secret) =>
+ matchesSchema(secret, secretSync.syncOptions.keySchema) &&
+ !setSecrets.find((setSecret) => setSecret.key === secret)
)) {
await request.delete(`${secretSync.destinationConfig.vaultBaseUrl}/secrets/${deleteSecretKey}?api-version=7.3`, {
headers: {
diff --git a/backend/src/services/secret-sync/camunda/camunda-sync-fns.ts b/backend/src/services/secret-sync/camunda/camunda-sync-fns.ts
index 3a52a49390..256ae4644f 100644
--- a/backend/src/services/secret-sync/camunda/camunda-sync-fns.ts
+++ b/backend/src/services/secret-sync/camunda/camunda-sync-fns.ts
@@ -12,6 +12,7 @@ import {
TCamundaSyncWithCredentials
} from "@app/services/secret-sync/camunda/camunda-sync-types";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { TSecretMap } from "../secret-sync-types";
@@ -116,6 +117,9 @@ export const camundaSyncFactory = ({ kmsService, appConnectionDAL }: TCamundaSec
if (secretSync.syncOptions.disableSecretDeletion) return;
for await (const secret of Object.keys(camundaSecrets)) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(secret, secretSync.syncOptions.keySchema)) continue;
+
if (!(secret in secretMap) || !secretMap[secret].value) {
try {
await deleteCamundaSecret({
diff --git a/backend/src/services/secret-sync/databricks/databricks-sync-fns.ts b/backend/src/services/secret-sync/databricks/databricks-sync-fns.ts
index 2ee7977a47..11143e24df 100644
--- a/backend/src/services/secret-sync/databricks/databricks-sync-fns.ts
+++ b/backend/src/services/secret-sync/databricks/databricks-sync-fns.ts
@@ -11,6 +11,7 @@ import {
TDatabricksSyncWithCredentials
} from "@app/services/secret-sync/databricks/databricks-sync-types";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { SECRET_SYNC_NAME_MAP } from "@app/services/secret-sync/secret-sync-maps";
import { TSecretMap } from "../secret-sync-types";
@@ -115,6 +116,9 @@ export const databricksSyncFactory = ({ kmsService, appConnectionDAL }: TDatabri
if (secretSync.syncOptions.disableSecretDeletion) return;
for await (const secret of databricksSecretKeys) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(secret.key, secretSync.syncOptions.keySchema)) continue;
+
if (!(secret.key in secretMap)) {
await deleteDatabricksSecrets({
key: secret.key,
diff --git a/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts b/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts
index a71e29ae4e..97da66a484 100644
--- a/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts
+++ b/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts
@@ -4,6 +4,7 @@ import { request } from "@app/lib/config/request";
import { logger } from "@app/lib/logger";
import { getGcpConnectionAuthToken } from "@app/services/app-connection/gcp";
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { SecretSyncError } from "../secret-sync-errors";
import { TSecretMap } from "../secret-sync-types";
@@ -153,6 +154,9 @@ export const GcpSyncFns = {
}
for await (const key of Object.keys(gcpSecrets)) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(key, secretSync.syncOptions.keySchema)) continue;
+
try {
if (!(key in secretMap) || !secretMap[key].value) {
// eslint-disable-next-line no-continue
diff --git a/backend/src/services/secret-sync/github/github-sync-fns.ts b/backend/src/services/secret-sync/github/github-sync-fns.ts
index 1fe922de5f..952f4b5126 100644
--- a/backend/src/services/secret-sync/github/github-sync-fns.ts
+++ b/backend/src/services/secret-sync/github/github-sync-fns.ts
@@ -4,6 +4,7 @@ import sodium from "libsodium-wrappers";
import { getGitHubClient } from "@app/services/app-connection/github";
import { GitHubSyncScope, GitHubSyncVisibility } from "@app/services/secret-sync/github/github-sync-enums";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { SECRET_SYNC_NAME_MAP } from "@app/services/secret-sync/secret-sync-maps";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
@@ -222,6 +223,9 @@ export const GithubSyncFns = {
if (secretSync.syncOptions.disableSecretDeletion) return;
for await (const encryptedSecret of encryptedSecrets) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(encryptedSecret.name, secretSync.syncOptions.keySchema)) continue;
+
if (!(encryptedSecret.name in secretMap)) {
await deleteSecret(client, secretSync, encryptedSecret);
}
diff --git a/backend/src/services/secret-sync/hc-vault/hc-vault-sync-fns.ts b/backend/src/services/secret-sync/hc-vault/hc-vault-sync-fns.ts
index db35df2920..6331cd91f2 100644
--- a/backend/src/services/secret-sync/hc-vault/hc-vault-sync-fns.ts
+++ b/backend/src/services/secret-sync/hc-vault/hc-vault-sync-fns.ts
@@ -11,6 +11,7 @@ import {
TPostHCVaultVariable
} from "@app/services/secret-sync/hc-vault/hc-vault-sync-types";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
const listHCVaultVariables = async ({ instanceUrl, namespace, mount, accessToken, path }: THCVaultListVariables) => {
@@ -68,7 +69,7 @@ export const HCVaultSyncFns = {
const {
connection,
destinationConfig: { mount, path },
- syncOptions: { disableSecretDeletion }
+ syncOptions: { disableSecretDeletion, keySchema }
} = secretSync;
const { namespace } = connection.credentials;
@@ -95,6 +96,9 @@ export const HCVaultSyncFns = {
if (disableSecretDeletion) return;
for await (const [key] of Object.entries(variables)) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(key, keySchema)) continue;
+
if (!(key in secretMap)) {
delete variables[key];
tainted = true;
diff --git a/backend/src/services/secret-sync/humanitec/humanitec-sync-fns.ts b/backend/src/services/secret-sync/humanitec/humanitec-sync-fns.ts
index 5fa0a3d633..2fcf488aa2 100644
--- a/backend/src/services/secret-sync/humanitec/humanitec-sync-fns.ts
+++ b/backend/src/services/secret-sync/humanitec/humanitec-sync-fns.ts
@@ -2,6 +2,7 @@ import { request } from "@app/lib/config/request";
import { logger } from "@app/lib/logger";
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { SECRET_SYNC_NAME_MAP } from "@app/services/secret-sync/secret-sync-maps";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
@@ -199,6 +200,9 @@ export const HumanitecSyncFns = {
if (secretSync.syncOptions.disableSecretDeletion) return;
for await (const humanitecSecret of humanitecSecrets) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(humanitecSecret.key, secretSync.syncOptions.keySchema)) continue;
+
if (!secretMap[humanitecSecret.key]) {
await deleteSecret(secretSync, humanitecSecret);
}
diff --git a/backend/src/services/secret-sync/oci-vault/index.ts b/backend/src/services/secret-sync/oci-vault/index.ts
new file mode 100644
index 0000000000..cee990de40
--- /dev/null
+++ b/backend/src/services/secret-sync/oci-vault/index.ts
@@ -0,0 +1,4 @@
+export * from "./oci-vault-sync-constants";
+export * from "./oci-vault-sync-fns";
+export * from "./oci-vault-sync-schemas";
+export * from "./oci-vault-sync-types";
diff --git a/backend/src/services/secret-sync/oci-vault/oci-vault-sync-constants.ts b/backend/src/services/secret-sync/oci-vault/oci-vault-sync-constants.ts
new file mode 100644
index 0000000000..9e2aad0568
--- /dev/null
+++ b/backend/src/services/secret-sync/oci-vault/oci-vault-sync-constants.ts
@@ -0,0 +1,10 @@
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+import { TSecretSyncListItem } from "@app/services/secret-sync/secret-sync-types";
+
+export const OCI_VAULT_SYNC_LIST_OPTION: TSecretSyncListItem = {
+ name: "OCI Vault",
+ destination: SecretSync.OCIVault,
+ connection: AppConnection.OCI,
+ canImportSecrets: true
+};
diff --git a/backend/src/services/secret-sync/oci-vault/oci-vault-sync-fns.ts b/backend/src/services/secret-sync/oci-vault/oci-vault-sync-fns.ts
new file mode 100644
index 0000000000..e270f2e025
--- /dev/null
+++ b/backend/src/services/secret-sync/oci-vault/oci-vault-sync-fns.ts
@@ -0,0 +1,296 @@
+import { secrets, vault } from "oci-sdk";
+
+import { delay } from "@app/lib/delay";
+import { getOCIProvider } from "@app/services/app-connection/oci";
+import {
+ TCreateOCIVaultVariable,
+ TDeleteOCIVaultVariable,
+ TOCIVaultListVariables,
+ TOCIVaultSyncWithCredentials,
+ TUnmarkOCIVaultVariableFromDeletion,
+ TUpdateOCIVaultVariable
+} from "@app/services/secret-sync/oci-vault/oci-vault-sync-types";
+import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
+import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
+
+const listOCIVaultVariables = async ({ provider, compartmentId, vaultId, onlyActive }: TOCIVaultListVariables) => {
+ const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
+ const secretsClient = new secrets.SecretsClient({ authenticationDetailsProvider: provider });
+
+ const secretsRes = await vaultsClient.listSecrets({
+ compartmentId,
+ vaultId,
+ lifecycleState: onlyActive ? vault.models.SecretSummary.LifecycleState.Active : undefined
+ });
+
+ const result: Record<string, vault.models.SecretSummary & { name: string; value: string }> = {};
+
+ for await (const s of secretsRes.items) {
+ let secretValue = "";
+
+ if (s.lifecycleState === vault.models.SecretSummary.LifecycleState.Active) {
+ const secretBundle = await secretsClient.getSecretBundle({
+ secretId: s.id
+ });
+
+ secretValue = Buffer.from(secretBundle.secretBundle.secretBundleContent?.content || "", "base64").toString(
+ "utf-8"
+ );
+ }
+
+ result[s.secretName] = {
+ ...s,
+ name: s.secretName,
+ value: secretValue
+ };
+ }
+
+ return result;
+};
+
+const createOCIVaultVariable = async ({
+ provider,
+ compartmentId,
+ vaultId,
+ keyId,
+ name,
+ value
+}: TCreateOCIVaultVariable) => {
+ if (!value) return;
+
+ const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
+
+ return vaultsClient.createSecret({
+ createSecretDetails: {
+ compartmentId,
+ vaultId,
+ keyId,
+ secretName: name,
+ enableAutoGeneration: false,
+ secretContent: {
+ content: Buffer.from(value).toString("base64"),
+ contentType: "BASE64"
+ }
+ }
+ });
+};
+
+const updateOCIVaultVariable = async ({ provider, secretId, value }: TUpdateOCIVaultVariable) => {
+ if (!value) return;
+
+ const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
+
+ return vaultsClient.updateSecret({
+ secretId,
+ updateSecretDetails: {
+ enableAutoGeneration: false,
+ secretContent: {
+ content: Buffer.from(value).toString("base64"),
+ contentType: "BASE64"
+ }
+ }
+ });
+};
+
+const deleteOCIVaultVariable = async ({ provider, secretId }: TDeleteOCIVaultVariable) => {
+ const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
+
+ // Schedule a secret deletion 7 days from now. OCI Vault requires a MINIMUM buffer period of 7 days
+ return vaultsClient.scheduleSecretDeletion({
+ secretId,
+ scheduleSecretDeletionDetails: {
+ timeOfDeletion: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000)
+ }
+ });
+};
+
+const unmarkOCIVaultVariableFromDeletion = async ({ provider, secretId }: TUnmarkOCIVaultVariableFromDeletion) => {
+ const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
+
+ return vaultsClient.cancelSecretDeletion({
+ secretId
+ });
+};
+
+export const OCIVaultSyncFns = {
+ syncSecrets: async (secretSync: TOCIVaultSyncWithCredentials, secretMap: TSecretMap) => {
+ const {
+ connection,
+ destinationConfig: { compartmentOcid, vaultOcid, keyOcid }
+ } = secretSync;
+
+ const provider = await getOCIProvider(connection);
+ const variables = await listOCIVaultVariables({ provider, compartmentId: compartmentOcid, vaultId: vaultOcid });
+
+ // Throw an error if any keys are updating in OCI vault to prevent skipped updates
+ if (
+ Object.entries(variables).some(
+ ([, secret]) =>
+ secret.lifecycleState === vault.models.SecretSummary.LifecycleState.Updating ||
+ secret.lifecycleState === vault.models.SecretSummary.LifecycleState.CancellingDeletion ||
+ secret.lifecycleState === vault.models.SecretSummary.LifecycleState.Creating ||
+ secret.lifecycleState === vault.models.SecretSummary.LifecycleState.Deleting ||
+ secret.lifecycleState === vault.models.SecretSummary.LifecycleState.SchedulingDeletion
+ )
+ ) {
+ throw new SecretSyncError({
+ error: "Cannot sync while keys are updating in OCI Vault."
+ });
+ }
+
+ // Create secrets
+ for await (const entry of Object.entries(secretMap)) {
+ const [key, { value }] = entry;
+
+ // skip secrets that don't have a value set
+ if (!value) {
+ // eslint-disable-next-line no-continue
+ continue;
+ }
+
+ const existingVariable = Object.values(variables).find((v) => v.secretName === key);
+
+ if (!existingVariable) {
+ try {
+ await createOCIVaultVariable({
+ compartmentId: compartmentOcid,
+ vaultId: vaultOcid,
+ provider,
+ keyId: keyOcid,
+ name: key,
+ value
+ });
+ } catch (error) {
+ throw new SecretSyncError({
+ error,
+ secretKey: key
+ });
+ }
+ } else if (existingVariable.lifecycleState === vault.models.SecretSummary.LifecycleState.PendingDeletion) {
+ // If a secret exists but is pending deletion, cancel the deletion and update the secret
+ await unmarkOCIVaultVariableFromDeletion({
+ provider,
+ compartmentId: compartmentOcid,
+ vaultId: vaultOcid,
+ secretId: existingVariable.id
+ });
+
+ const vaultsClient = new vault.VaultsClient({ authenticationDetailsProvider: provider });
+ const MAX_RETRIES = 10;
+
+ for (let i = 0; i < MAX_RETRIES; i += 1) {
+ // eslint-disable-next-line no-await-in-loop
+ await delay(5000);
+
+ // eslint-disable-next-line no-await-in-loop
+ const secret = await vaultsClient.getSecret({
+ secretId: existingVariable.id
+ });
+
+ if (secret.secret.lifecycleState === vault.models.SecretSummary.LifecycleState.Active) {
+ // eslint-disable-next-line no-await-in-loop
+ await updateOCIVaultVariable({
+ provider,
+ compartmentId: compartmentOcid,
+ vaultId: vaultOcid,
+ secretId: existingVariable.id,
+ value
+ });
+ break;
+ }
+
+ if (i === MAX_RETRIES - 1) {
+ throw new SecretSyncError({
+ error: "Failed to update secret after cancelling deletion.",
+ secretKey: key
+ });
+ }
+ }
+ }
+ }
+
+ // Update and delete secrets
+ for await (const [key, variable] of Object.entries(variables)) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(key, secretSync.syncOptions.keySchema)) continue;
+
+ // Only update / delete active secrets
+ if (variable.lifecycleState === vault.models.SecretSummary.LifecycleState.Active) {
+ if (key in secretMap && secretMap[key].value.length > 0) {
+ if (variable.value !== secretMap[key].value) {
+ try {
+ await updateOCIVaultVariable({
+ compartmentId: compartmentOcid,
+ vaultId: vaultOcid,
+ provider,
+ secretId: variable.id,
+ value: secretMap[key].value
+ });
+ } catch (error) {
+ throw new SecretSyncError({
+ error,
+ secretKey: key
+ });
+ }
+ }
+ } else if (!secretSync.syncOptions.disableSecretDeletion) {
+ try {
+ await deleteOCIVaultVariable({
+ compartmentId: compartmentOcid,
+ vaultId: vaultOcid,
+ provider,
+ secretId: variable.id
+ });
+ } catch (error) {
+ throw new SecretSyncError({
+ error,
+ secretKey: key
+ });
+ }
+ }
+ }
+ }
+ },
+ removeSecrets: async (secretSync: TOCIVaultSyncWithCredentials, secretMap: TSecretMap) => {
+ const {
+ connection,
+ destinationConfig: { compartmentOcid, vaultOcid }
+ } = secretSync;
+
+ const provider = await getOCIProvider(connection);
+ const variables = await listOCIVaultVariables({
+ provider,
+ compartmentId: compartmentOcid,
+ vaultId: vaultOcid,
+ onlyActive: true
+ });
+
+ for await (const [key, variable] of Object.entries(variables)) {
+ if (key in secretMap) {
+ try {
+ await deleteOCIVaultVariable({
+ compartmentId: compartmentOcid,
+ vaultId: vaultOcid,
+ provider,
+ secretId: variable.id
+ });
+ } catch (error) {
+ throw new SecretSyncError({
+ error,
+ secretKey: key
+ });
+ }
+ }
+ }
+ },
+ getSecrets: async (secretSync: TOCIVaultSyncWithCredentials) => {
+ const {
+ connection,
+ destinationConfig: { compartmentOcid, vaultOcid }
+ } = secretSync;
+
+ const provider = await getOCIProvider(connection);
+ return listOCIVaultVariables({ provider, compartmentId: compartmentOcid, vaultId: vaultOcid, onlyActive: true });
+ }
+};
diff --git a/backend/src/services/secret-sync/oci-vault/oci-vault-sync-schemas.ts b/backend/src/services/secret-sync/oci-vault/oci-vault-sync-schemas.ts
new file mode 100644
index 0000000000..84a58bc8a0
--- /dev/null
+++ b/backend/src/services/secret-sync/oci-vault/oci-vault-sync-schemas.ts
@@ -0,0 +1,70 @@
+import RE2 from "re2";
+import { z } from "zod";
+
+import { SecretSyncs } from "@app/lib/api-docs";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+import {
+ BaseSecretSyncSchema,
+ GenericCreateSecretSyncFieldsSchema,
+ GenericUpdateSecretSyncFieldsSchema
+} from "@app/services/secret-sync/secret-sync-schemas";
+import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types";
+
+const OCIVaultSyncDestinationConfigSchema = z.object({
+ compartmentOcid: z
+ .string()
+ .trim()
+ .min(1, "Compartment OCID required")
+ .refine(
+ (val) => new RE2("^ocid1\\.(tenancy|compartment)\\.oc1\\..+$").test(val),
+ "Invalid Compartment OCID format. Must start with ocid1.tenancy.oc1. or ocid1.compartment.oc1."
+ )
+ .describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.compartmentOcid),
+ vaultOcid: z
+ .string()
+ .trim()
+ .min(1, "Vault OCID required")
+ .refine(
+ (val) => new RE2("^ocid1\\.vault\\.oc1\\..+$").test(val),
+ "Invalid Vault OCID format. Must start with ocid1.vault.oc1."
+ )
+ .describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.vaultOcid),
+ keyOcid: z
+ .string()
+ .trim()
+ .min(1, "Key OCID required")
+ .refine(
+ (val) => new RE2("^ocid1\\.key\\.oc1\\..+$").test(val),
+ "Invalid Key OCID format. Must start with ocid1.key.oc1."
+ )
+ .describe(SecretSyncs.DESTINATION_CONFIG.OCI_VAULT.keyOcid)
+});
+
+const OCIVaultSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: true };
+
+export const OCIVaultSyncSchema = BaseSecretSyncSchema(SecretSync.OCIVault, OCIVaultSyncOptionsConfig).extend({
+ destination: z.literal(SecretSync.OCIVault),
+ destinationConfig: OCIVaultSyncDestinationConfigSchema
+});
+
+export const CreateOCIVaultSyncSchema = GenericCreateSecretSyncFieldsSchema(
+ SecretSync.OCIVault,
+ OCIVaultSyncOptionsConfig
+).extend({
+ destinationConfig: OCIVaultSyncDestinationConfigSchema
+});
+
+export const UpdateOCIVaultSyncSchema = GenericUpdateSecretSyncFieldsSchema(
+ SecretSync.OCIVault,
+ OCIVaultSyncOptionsConfig
+).extend({
+ destinationConfig: OCIVaultSyncDestinationConfigSchema.optional()
+});
+
+export const OCIVaultSyncListItemSchema = z.object({
+ name: z.literal("OCI Vault"),
+ connection: z.literal(AppConnection.OCI),
+ destination: z.literal(SecretSync.OCIVault),
+ canImportSecrets: z.literal(true)
+});
diff --git a/backend/src/services/secret-sync/oci-vault/oci-vault-sync-types.ts b/backend/src/services/secret-sync/oci-vault/oci-vault-sync-types.ts
new file mode 100644
index 0000000000..c040cd0c0b
--- /dev/null
+++ b/backend/src/services/secret-sync/oci-vault/oci-vault-sync-types.ts
@@ -0,0 +1,48 @@
+import { SimpleAuthenticationDetailsProvider } from "oci-sdk";
+import { z } from "zod";
+
+import { TOCIConnection } from "@app/services/app-connection/oci";
+
+import { CreateOCIVaultSyncSchema, OCIVaultSyncListItemSchema, OCIVaultSyncSchema } from "./oci-vault-sync-schemas";
+
+export type TOCIVaultSync = z.infer<typeof OCIVaultSyncSchema>;
+
+export type TOCIVaultSyncInput = z.infer<typeof CreateOCIVaultSyncSchema>;
+
+export type TOCIVaultSyncListItem = z.infer<typeof OCIVaultSyncListItemSchema>;
+
+export type TOCIVaultSyncWithCredentials = TOCIVaultSync & {
+ connection: TOCIConnection;
+};
+
+export type TOCIVaultVariable = {
+ id: string;
+ name: string;
+ value: string;
+};
+
+export type TOCIVaultListVariables = {
+ provider: SimpleAuthenticationDetailsProvider;
+ compartmentId: string;
+ vaultId: string;
+ onlyActive?: boolean; // Whether to filter for only active secrets. Removes deleted / scheduled for deletion secrets
+};
+
+export type TCreateOCIVaultVariable = TOCIVaultListVariables & {
+ keyId: string;
+ name: string;
+ value: string;
+};
+
+export type TUpdateOCIVaultVariable = TOCIVaultListVariables & {
+ secretId: string;
+ value: string;
+};
+
+export type TDeleteOCIVaultVariable = TOCIVaultListVariables & {
+ secretId: string;
+};
+
+export type TUnmarkOCIVaultVariableFromDeletion = TOCIVaultListVariables & {
+ secretId: string;
+};
diff --git a/backend/src/services/secret-sync/secret-sync-enums.ts b/backend/src/services/secret-sync/secret-sync-enums.ts
index 9d59ebb76c..a0982c5b65 100644
--- a/backend/src/services/secret-sync/secret-sync-enums.ts
+++ b/backend/src/services/secret-sync/secret-sync-enums.ts
@@ -12,7 +12,8 @@ export enum SecretSync {
Vercel = "vercel",
Windmill = "windmill",
HCVault = "hashicorp-vault",
- TeamCity = "teamcity"
+ TeamCity = "teamcity",
+ OCIVault = "oci-vault"
}
export enum SecretSyncInitialSyncBehavior {
diff --git a/backend/src/services/secret-sync/secret-sync-fns.ts b/backend/src/services/secret-sync/secret-sync-fns.ts
index 5749852d71..1bb4da9db9 100644
--- a/backend/src/services/secret-sync/secret-sync-fns.ts
+++ b/backend/src/services/secret-sync/secret-sync-fns.ts
@@ -1,4 +1,5 @@
import { AxiosError } from "axios";
+import RE2 from "re2";
import {
AWS_PARAMETER_STORE_SYNC_LIST_OPTION,
@@ -28,6 +29,7 @@ import { GcpSyncFns } from "./gcp/gcp-sync-fns";
import { HC_VAULT_SYNC_LIST_OPTION, HCVaultSyncFns } from "./hc-vault";
import { HUMANITEC_SYNC_LIST_OPTION } from "./humanitec";
import { HumanitecSyncFns } from "./humanitec/humanitec-sync-fns";
+import { OCI_VAULT_SYNC_LIST_OPTION, OCIVaultSyncFns } from "./oci-vault";
import { TEAMCITY_SYNC_LIST_OPTION, TeamCitySyncFns } from "./teamcity";
import { TERRAFORM_CLOUD_SYNC_LIST_OPTION, TerraformCloudSyncFns } from "./terraform-cloud";
import { VERCEL_SYNC_LIST_OPTION, VercelSyncFns } from "./vercel";
@@ -47,7 +49,8 @@ const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
[SecretSync.Vercel]: VERCEL_SYNC_LIST_OPTION,
[SecretSync.Windmill]: WINDMILL_SYNC_LIST_OPTION,
[SecretSync.HCVault]: HC_VAULT_SYNC_LIST_OPTION,
- [SecretSync.TeamCity]: TEAMCITY_SYNC_LIST_OPTION
+ [SecretSync.TeamCity]: TEAMCITY_SYNC_LIST_OPTION,
+ [SecretSync.OCIVault]: OCI_VAULT_SYNC_LIST_OPTION
};
export const listSecretSyncOptions = () => {
@@ -59,45 +62,63 @@ type TSyncSecretDeps = {
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
};
-// const addAffixes = (secretSync: TSecretSyncWithCredentials, unprocessedSecretMap: TSecretMap) => {
-// let secretMap = { ...unprocessedSecretMap };
-//
-// const { appendSuffix, prependPrefix } = secretSync.syncOptions;
-//
-// if (appendSuffix || prependPrefix) {
-// secretMap = {};
-// Object.entries(unprocessedSecretMap).forEach(([key, value]) => {
-// secretMap[`${prependPrefix || ""}${key}${appendSuffix || ""}`] = value;
-// });
-// }
-//
-// return secretMap;
-// };
-//
-// const stripAffixes = (secretSync: TSecretSyncWithCredentials, unprocessedSecretMap: TSecretMap) => {
-// let secretMap = { ...unprocessedSecretMap };
-//
-// const { appendSuffix, prependPrefix } = secretSync.syncOptions;
-//
-// if (appendSuffix || prependPrefix) {
-// secretMap = {};
-// Object.entries(unprocessedSecretMap).forEach(([key, value]) => {
-// let processedKey = key;
-//
-// if (prependPrefix && processedKey.startsWith(prependPrefix)) {
-// processedKey = processedKey.slice(prependPrefix.length);
-// }
-//
-// if (appendSuffix && processedKey.endsWith(appendSuffix)) {
-// processedKey = processedKey.slice(0, -appendSuffix.length);
-// }
-//
-// secretMap[processedKey] = value;
-// });
-// }
-//
-// return secretMap;
-// };
+// Add schema to secret keys
+const addSchema = (unprocessedSecretMap: TSecretMap, schema?: string): TSecretMap => {
+ if (!schema) return unprocessedSecretMap;
+
+ const processedSecretMap: TSecretMap = {};
+
+ for (const [key, value] of Object.entries(unprocessedSecretMap)) {
+ const newKey = new RE2("{{secretKey}}").replace(schema, key);
+ processedSecretMap[newKey] = value;
+ }
+
+ return processedSecretMap;
+};
+
+// Strip schema from secret keys
+const stripSchema = (unprocessedSecretMap: TSecretMap, schema?: string): TSecretMap => {
+ if (!schema) return unprocessedSecretMap;
+
+ const [prefix, suffix] = schema.split("{{secretKey}}");
+
+ const strippedMap: TSecretMap = {};
+
+ for (const [key, value] of Object.entries(unprocessedSecretMap)) {
+ if (!key.startsWith(prefix) || !key.endsWith(suffix)) {
+ // eslint-disable-next-line no-continue
+ continue;
+ }
+
+ const strippedKey = key.slice(prefix.length, key.length - suffix.length);
+ strippedMap[strippedKey] = value;
+ }
+
+ return strippedMap;
+};
+
+// Checks if a key matches a schema
+export const matchesSchema = (key: string, schema?: string): boolean => {
+ if (!schema) return true;
+
+ const [prefix, suffix] = schema.split("{{secretKey}}");
+ if (prefix === undefined || suffix === undefined) return true;
+
+ return key.startsWith(prefix) && key.endsWith(suffix);
+};
+
+// Filter only for secrets with keys that match the schema
+const filterForSchema = (secretMap: TSecretMap, schema?: string): TSecretMap => {
+ const filteredMap: TSecretMap = {};
+
+ for (const [key, value] of Object.entries(secretMap)) {
+ if (matchesSchema(key, schema)) {
+ filteredMap[key] = value;
+ }
+ }
+
+ return filteredMap;
+};
export const SecretSyncFns = {
syncSecrets: (
@@ -105,49 +126,51 @@ export const SecretSyncFns = {
secretMap: TSecretMap,
{ kmsService, appConnectionDAL }: TSyncSecretDeps
): Promise<void> => {
- // const affixedSecretMap = addAffixes(secretSync, secretMap);
+ const schemaSecretMap = addSchema(secretMap, secretSync.syncOptions.keySchema);
switch (secretSync.destination) {
case SecretSync.AWSParameterStore:
- return AwsParameterStoreSyncFns.syncSecrets(secretSync, secretMap);
+ return AwsParameterStoreSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.AWSSecretsManager:
- return AwsSecretsManagerSyncFns.syncSecrets(secretSync, secretMap);
+ return AwsSecretsManagerSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.GitHub:
- return GithubSyncFns.syncSecrets(secretSync, secretMap);
+ return GithubSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.GCPSecretManager:
- return GcpSyncFns.syncSecrets(secretSync, secretMap);
+ return GcpSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.AzureKeyVault:
return azureKeyVaultSyncFactory({
appConnectionDAL,
kmsService
- }).syncSecrets(secretSync, secretMap);
+ }).syncSecrets(secretSync, schemaSecretMap);
case SecretSync.AzureAppConfiguration:
return azureAppConfigurationSyncFactory({
appConnectionDAL,
kmsService
- }).syncSecrets(secretSync, secretMap);
+ }).syncSecrets(secretSync, schemaSecretMap);
case SecretSync.Databricks:
return databricksSyncFactory({
appConnectionDAL,
kmsService
- }).syncSecrets(secretSync, secretMap);
+ }).syncSecrets(secretSync, schemaSecretMap);
case SecretSync.Humanitec:
- return HumanitecSyncFns.syncSecrets(secretSync, secretMap);
+ return HumanitecSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.TerraformCloud:
- return TerraformCloudSyncFns.syncSecrets(secretSync, secretMap);
+ return TerraformCloudSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.Camunda:
return camundaSyncFactory({
appConnectionDAL,
kmsService
- }).syncSecrets(secretSync, secretMap);
+ }).syncSecrets(secretSync, schemaSecretMap);
case SecretSync.Vercel:
- return VercelSyncFns.syncSecrets(secretSync, secretMap);
+ return VercelSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.Windmill:
- return WindmillSyncFns.syncSecrets(secretSync, secretMap);
+ return WindmillSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.HCVault:
- return HCVaultSyncFns.syncSecrets(secretSync, secretMap);
+ return HCVaultSyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.TeamCity:
- return TeamCitySyncFns.syncSecrets(secretSync, secretMap);
+ return TeamCitySyncFns.syncSecrets(secretSync, schemaSecretMap);
+ case SecretSync.OCIVault:
+ return OCIVaultSyncFns.syncSecrets(secretSync, schemaSecretMap);
default:
throw new Error(
`Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
@@ -213,63 +236,67 @@ export const SecretSyncFns = {
case SecretSync.TeamCity:
secretMap = await TeamCitySyncFns.getSecrets(secretSync);
break;
+ case SecretSync.OCIVault:
+ secretMap = await OCIVaultSyncFns.getSecrets(secretSync);
+ break;
default:
throw new Error(
`Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
);
}
- return secretMap;
- // return stripAffixes(secretSync, secretMap);
+ return stripSchema(filterForSchema(secretMap), secretSync.syncOptions.keySchema);
},
removeSecrets: (
secretSync: TSecretSyncWithCredentials,
secretMap: TSecretMap,
{ kmsService, appConnectionDAL }: TSyncSecretDeps
): Promise<void> => {
- // const affixedSecretMap = addAffixes(secretSync, secretMap);
+ const schemaSecretMap = addSchema(secretMap, secretSync.syncOptions.keySchema);
switch (secretSync.destination) {
case SecretSync.AWSParameterStore:
- return AwsParameterStoreSyncFns.removeSecrets(secretSync, secretMap);
+ return AwsParameterStoreSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.AWSSecretsManager:
- return AwsSecretsManagerSyncFns.removeSecrets(secretSync, secretMap);
+ return AwsSecretsManagerSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.GitHub:
- return GithubSyncFns.removeSecrets(secretSync, secretMap);
+ return GithubSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.GCPSecretManager:
- return GcpSyncFns.removeSecrets(secretSync, secretMap);
+ return GcpSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.AzureKeyVault:
return azureKeyVaultSyncFactory({
appConnectionDAL,
kmsService
- }).removeSecrets(secretSync, secretMap);
+ }).removeSecrets(secretSync, schemaSecretMap);
case SecretSync.AzureAppConfiguration:
return azureAppConfigurationSyncFactory({
appConnectionDAL,
kmsService
- }).removeSecrets(secretSync, secretMap);
+ }).removeSecrets(secretSync, schemaSecretMap);
case SecretSync.Databricks:
return databricksSyncFactory({
appConnectionDAL,
kmsService
- }).removeSecrets(secretSync, secretMap);
+ }).removeSecrets(secretSync, schemaSecretMap);
case SecretSync.Humanitec:
- return HumanitecSyncFns.removeSecrets(secretSync, secretMap);
+ return HumanitecSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.TerraformCloud:
- return TerraformCloudSyncFns.removeSecrets(secretSync, secretMap);
+ return TerraformCloudSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.Camunda:
return camundaSyncFactory({
appConnectionDAL,
kmsService
- }).removeSecrets(secretSync, secretMap);
+ }).removeSecrets(secretSync, schemaSecretMap);
case SecretSync.Vercel:
- return VercelSyncFns.removeSecrets(secretSync, secretMap);
+ return VercelSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.Windmill:
- return WindmillSyncFns.removeSecrets(secretSync, secretMap);
+ return WindmillSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.HCVault:
- return HCVaultSyncFns.removeSecrets(secretSync, secretMap);
+ return HCVaultSyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.TeamCity:
- return TeamCitySyncFns.removeSecrets(secretSync, secretMap);
+ return TeamCitySyncFns.removeSecrets(secretSync, schemaSecretMap);
+ case SecretSync.OCIVault:
+ return OCIVaultSyncFns.removeSecrets(secretSync, schemaSecretMap);
default:
throw new Error(
`Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
diff --git a/backend/src/services/secret-sync/secret-sync-maps.ts b/backend/src/services/secret-sync/secret-sync-maps.ts
index c6d7adc8c0..21cb912b4c 100644
--- a/backend/src/services/secret-sync/secret-sync-maps.ts
+++ b/backend/src/services/secret-sync/secret-sync-maps.ts
@@ -15,7 +15,8 @@ export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {
[SecretSync.Vercel]: "Vercel",
[SecretSync.Windmill]: "Windmill",
[SecretSync.HCVault]: "Hashicorp Vault",
- [SecretSync.TeamCity]: "TeamCity"
+ [SecretSync.TeamCity]: "TeamCity",
+ [SecretSync.OCIVault]: "OCI Vault"
};
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
@@ -32,5 +33,6 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
[SecretSync.Vercel]: AppConnection.Vercel,
[SecretSync.Windmill]: AppConnection.Windmill,
[SecretSync.HCVault]: AppConnection.HCVault,
- [SecretSync.TeamCity]: AppConnection.TeamCity
+ [SecretSync.TeamCity]: AppConnection.TeamCity,
+ [SecretSync.OCIVault]: AppConnection.OCI
};
diff --git a/backend/src/services/secret-sync/secret-sync-schemas.ts b/backend/src/services/secret-sync/secret-sync-schemas.ts
index 50ff3f3077..80e96bf8b3 100644
--- a/backend/src/services/secret-sync/secret-sync-schemas.ts
+++ b/backend/src/services/secret-sync/secret-sync-schemas.ts
@@ -1,3 +1,4 @@
+import RE2 from "re2";
import { AnyZodObject, z } from "zod";
import { SecretSyncsSchema } from "@app/db/schemas/secret-syncs";
@@ -24,6 +25,14 @@ const BaseSyncOptionsSchema = <T extends AnyZodObject | undefined = undefined>({
? z.nativeEnum(SecretSyncInitialSyncBehavior)
: z.literal(SecretSyncInitialSyncBehavior.OverwriteDestination)
).describe(SecretSyncs.SYNC_OPTIONS(destination).initialSyncBehavior),
+ keySchema: z
+ .string()
+ .optional()
+ .refine((val) => !val || new RE2(/^(?:[a-zA-Z0-9_\-/]*)(?:\{\{secretKey\}\})(?:[a-zA-Z0-9_\-/]*)$/).test(val), {
+ message:
+ "Key schema must include one {{secretKey}} and only contain letters, numbers, dashes, underscores, slashes, and the {{secretKey}} placeholder."
+ })
+ .describe(SecretSyncs.SYNC_OPTIONS(destination).keySchema),
disableSecretDeletion: z.boolean().optional().describe(SecretSyncs.SYNC_OPTIONS(destination).disableSecretDeletion)
});
diff --git a/backend/src/services/secret-sync/secret-sync-types.ts b/backend/src/services/secret-sync/secret-sync-types.ts
index e88174cc6b..64d027e189 100644
--- a/backend/src/services/secret-sync/secret-sync-types.ts
+++ b/backend/src/services/secret-sync/secret-sync-types.ts
@@ -67,6 +67,7 @@ import {
THumanitecSyncListItem,
THumanitecSyncWithCredentials
} from "./humanitec";
+import { TOCIVaultSync, TOCIVaultSyncInput, TOCIVaultSyncListItem, TOCIVaultSyncWithCredentials } from "./oci-vault";
import {
TTeamCitySync,
TTeamCitySyncInput,
@@ -95,7 +96,8 @@ export type TSecretSync =
| TVercelSync
| TWindmillSync
| THCVaultSync
- | TTeamCitySync;
+ | TTeamCitySync
+ | TOCIVaultSync;
export type TSecretSyncWithCredentials =
| TAwsParameterStoreSyncWithCredentials
@@ -111,7 +113,8 @@ export type TSecretSyncWithCredentials =
| TVercelSyncWithCredentials
| TWindmillSyncWithCredentials
| THCVaultSyncWithCredentials
- | TTeamCitySyncWithCredentials;
+ | TTeamCitySyncWithCredentials
+ | TOCIVaultSyncWithCredentials;
export type TSecretSyncInput =
| TAwsParameterStoreSyncInput
@@ -127,7 +130,8 @@ export type TSecretSyncInput =
| TVercelSyncInput
| TWindmillSyncInput
| THCVaultSyncInput
- | TTeamCitySyncInput;
+ | TTeamCitySyncInput
+ | TOCIVaultSyncInput;
export type TSecretSyncListItem =
| TAwsParameterStoreSyncListItem
@@ -143,7 +147,8 @@ export type TSecretSyncListItem =
| TVercelSyncListItem
| TWindmillSyncListItem
| THCVaultSyncListItem
- | TTeamCitySyncListItem;
+ | TTeamCitySyncListItem
+ | TOCIVaultSyncListItem;
export type TSyncOptionsConfig = {
canImportSecrets: boolean;
diff --git a/backend/src/services/secret-sync/teamcity/teamcity-sync-fns.ts b/backend/src/services/secret-sync/teamcity/teamcity-sync-fns.ts
index 6dbd9bdd7a..0afe29beba 100644
--- a/backend/src/services/secret-sync/teamcity/teamcity-sync-fns.ts
+++ b/backend/src/services/secret-sync/teamcity/teamcity-sync-fns.ts
@@ -1,6 +1,7 @@
import { request } from "@app/lib/config/request";
import { getTeamCityInstanceUrl } from "@app/services/app-connection/teamcity";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import {
TDeleteTeamCityVariable,
@@ -125,6 +126,9 @@ export const TeamCitySyncFns = {
const variables = await listTeamCityVariables({ instanceUrl, accessToken, project, buildConfig });
for await (const [key, variable] of Object.entries(variables)) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(key, secretSync.syncOptions.keySchema)) continue;
+
if (!(key in secretMap)) {
try {
await deleteTeamCityVariable({
diff --git a/backend/src/services/secret-sync/terraform-cloud/terraform-cloud-sync-fns.ts b/backend/src/services/secret-sync/terraform-cloud/terraform-cloud-sync-fns.ts
index 4cfd7ec057..a58ec213c9 100644
--- a/backend/src/services/secret-sync/terraform-cloud/terraform-cloud-sync-fns.ts
+++ b/backend/src/services/secret-sync/terraform-cloud/terraform-cloud-sync-fns.ts
@@ -4,6 +4,7 @@ import { AxiosResponse } from "axios";
import { request } from "@app/lib/config/request";
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
@@ -231,6 +232,9 @@ export const TerraformCloudSyncFns = {
if (secretSync.syncOptions.disableSecretDeletion) return;
for (const terraformCloudVariable of terraformCloudVariables) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(terraformCloudVariable.key, secretSync.syncOptions.keySchema)) continue;
+
if (!Object.prototype.hasOwnProperty.call(secretMap, terraformCloudVariable.key)) {
await deleteVariable(secretSync, terraformCloudVariable);
}
diff --git a/backend/src/services/secret-sync/vercel/vercel-sync-fns.ts b/backend/src/services/secret-sync/vercel/vercel-sync-fns.ts
index 7139712833..90e9327e59 100644
--- a/backend/src/services/secret-sync/vercel/vercel-sync-fns.ts
+++ b/backend/src/services/secret-sync/vercel/vercel-sync-fns.ts
@@ -2,6 +2,7 @@
import { request } from "@app/lib/config/request";
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import { VercelEnvironmentType } from "./vercel-sync-enums";
@@ -290,6 +291,9 @@ export const VercelSyncFns = {
if (secretSync.syncOptions.disableSecretDeletion) return;
for await (const vercelSecret of vercelSecrets) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(vercelSecret.key, secretSync.syncOptions.keySchema)) continue;
+
if (!secretMap[vercelSecret.key]) {
await deleteSecret(secretSync, vercelSecret);
}
diff --git a/backend/src/services/secret-sync/windmill/windmill-sync-fns.ts b/backend/src/services/secret-sync/windmill/windmill-sync-fns.ts
index 2e2c367406..a097065815 100644
--- a/backend/src/services/secret-sync/windmill/windmill-sync-fns.ts
+++ b/backend/src/services/secret-sync/windmill/windmill-sync-fns.ts
@@ -1,6 +1,7 @@
import { request } from "@app/lib/config/request";
import { getWindmillInstanceUrl } from "@app/services/app-connection/windmill";
import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
import {
TDeleteWindmillVariable,
TPostWindmillVariable,
@@ -128,7 +129,7 @@ export const WindmillSyncFns = {
const {
connection,
destinationConfig: { path },
- syncOptions: { disableSecretDeletion }
+ syncOptions: { disableSecretDeletion, keySchema }
} = secretSync;
// url needs to be lowercase
@@ -169,6 +170,9 @@ export const WindmillSyncFns = {
if (disableSecretDeletion) return;
for await (const [key, variable] of Object.entries(variables)) {
+ // eslint-disable-next-line no-continue
+ if (!matchesSchema(key, keySchema)) continue;
+
if (!(key in secretMap)) {
try {
await deleteWindmillVariable({
diff --git a/backend/src/services/super-admin/invalidate-cache-queue.ts b/backend/src/services/super-admin/invalidate-cache-queue.ts
new file mode 100644
index 0000000000..c2a12f5d5c
--- /dev/null
+++ b/backend/src/services/super-admin/invalidate-cache-queue.ts
@@ -0,0 +1,49 @@
+import { TKeyStoreFactory } from "@app/keystore/keystore";
+import { logger } from "@app/lib/logger";
+import { QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue";
+
+import { CacheType } from "./super-admin-types";
+
+export type TInvalidateCacheQueueFactoryDep = {
+ queueService: TQueueServiceFactory;
+
+ keyStore: Pick<TKeyStoreFactory, "deleteItems" | "setItemWithExpiry" | "deleteItem">;
+};
+
+export type TInvalidateCacheQueueFactory = ReturnType<typeof invalidateCacheQueueFactory>;
+
+export const invalidateCacheQueueFactory = ({ queueService, keyStore }: TInvalidateCacheQueueFactoryDep) => {
+ const startInvalidate = async (dto: {
+ data: {
+ type: CacheType;
+ };
+ }) => {
+ await queueService.queue(QueueName.InvalidateCache, QueueJobs.InvalidateCache, dto, {
+ removeOnComplete: true,
+ removeOnFail: true,
+ jobId: `invalidate-cache-${dto.data.type}`
+ });
+ };
+
+ queueService.start(QueueName.InvalidateCache, async (job) => {
+ try {
+ const {
+ data: { type }
+ } = job.data;
+
+ await keyStore.setItemWithExpiry("invalidating-cache", 1800, "true"); // 30 minutes max (in case the job somehow silently fails)
+
+ if (type === CacheType.ALL || type === CacheType.SECRETS)
+ await keyStore.deleteItems({ pattern: "secret-manager:*" });
+
+ await keyStore.deleteItem("invalidating-cache");
+ } catch (err) {
+ logger.error(err, "Failed to invalidate cache");
+ await keyStore.deleteItem("invalidating-cache");
+ }
+ });
+
+ return {
+ startInvalidate
+ };
+};
diff --git a/backend/src/services/super-admin/super-admin-service.ts b/backend/src/services/super-admin/super-admin-service.ts
index 8687826c8d..22fc51d1a1 100644
--- a/backend/src/services/super-admin/super-admin-service.ts
+++ b/backend/src/services/super-admin/super-admin-service.ts
@@ -25,8 +25,10 @@ import { TOrgServiceFactory } from "../org/org-service";
import { TUserDALFactory } from "../user/user-dal";
import { TUserAliasDALFactory } from "../user-alias/user-alias-dal";
import { UserAliasType } from "../user-alias/user-alias-types";
+import { TInvalidateCacheQueueFactory } from "./invalidate-cache-queue";
import { TSuperAdminDALFactory } from "./super-admin-dal";
import {
+ CacheType,
LoginMethod,
TAdminBootstrapInstanceDTO,
TAdminGetIdentitiesDTO,
@@ -46,9 +48,10 @@ type TSuperAdminServiceFactoryDep = {
kmsService: Pick<TKmsServiceFactory, "encryptWithRootKey" | "decryptWithRootKey" | "updateEncryptionStrategy">;
kmsRootConfigDAL: TKmsRootConfigDALFactory;
orgService: Pick<TOrgServiceFactory, "createOrganization">;
- keyStore: Pick<TKeyStoreFactory, "getItem" | "setItemWithExpiry" | "deleteItem">;
+ keyStore: Pick<TKeyStoreFactory, "getItem" | "setItemWithExpiry" | "deleteItem" | "deleteItems">;
licenseService: Pick<TLicenseServiceFactory, "onPremFeatures">;
microsoftTeamsService: Pick<TMicrosoftTeamsServiceFactory, "initializeTeamsBot">;
+ invalidateCacheQueue: TInvalidateCacheQueueFactory;
};
export type TSuperAdminServiceFactory = ReturnType<typeof superAdminServiceFactory>;
@@ -64,7 +67,7 @@ export let getServerCfg: () => Promise<
const ADMIN_CONFIG_KEY = "infisical-admin-cfg";
const ADMIN_CONFIG_KEY_EXP = 60; // 60s
-const ADMIN_CONFIG_DB_UUID = "00000000-0000-0000-0000-000000000000";
+export const ADMIN_CONFIG_DB_UUID = "00000000-0000-0000-0000-000000000000";
export const superAdminServiceFactory = ({
serverCfgDAL,
@@ -80,7 +83,8 @@ export const superAdminServiceFactory = ({
identityAccessTokenDAL,
identityTokenAuthDAL,
identityOrgMembershipDAL,
- microsoftTeamsService
+ microsoftTeamsService,
+ invalidateCacheQueue
}: TSuperAdminServiceFactoryDep) => {
const initServerCfg = async () => {
// TODO(akhilmhdh): bad pattern time less change this later to me itself
@@ -242,7 +246,8 @@ export const superAdminServiceFactory = ({
await microsoftTeamsService.initializeTeamsBot({
botAppId: decryptedAppId.toString(),
- botAppPassword: decryptedAppPassword.toString()
+ botAppPassword: decryptedAppPassword.toString(),
+ lastUpdatedAt: updatedServerCfg.updatedAt
});
}
@@ -631,6 +636,16 @@ export const superAdminServiceFactory = ({
await kmsService.updateEncryptionStrategy(strategy);
};
+ const invalidateCache = async (type: CacheType) => {
+ await invalidateCacheQueue.startInvalidate({
+ data: { type }
+ });
+ };
+
+ const checkIfInvalidatingCache = async () => {
+ return (await keyStore.getItem("invalidating-cache")) !== null;
+ };
+
return {
initServerCfg,
updateServerCfg,
@@ -644,6 +659,8 @@ export const superAdminServiceFactory = ({
getConfiguredEncryptionStrategies,
grantServerAdminAccessToUser,
deleteIdentitySuperAdminAccess,
- deleteUserSuperAdminAccess
+ deleteUserSuperAdminAccess,
+ invalidateCache,
+ checkIfInvalidatingCache
};
};
diff --git a/backend/src/services/super-admin/super-admin-types.ts b/backend/src/services/super-admin/super-admin-types.ts
index 64ec926326..c804bed743 100644
--- a/backend/src/services/super-admin/super-admin-types.ts
+++ b/backend/src/services/super-admin/super-admin-types.ts
@@ -44,3 +44,8 @@ export enum LoginMethod {
LDAP = "ldap",
OIDC = "oidc"
}
+
+export enum CacheType {
+ ALL = "all",
+ SECRETS = "secrets"
+}
diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.ts
index ab90a71d47..a370d03322 100644
--- a/backend/src/services/telemetry/telemetry-types.ts
+++ b/backend/src/services/telemetry/telemetry-types.ts
@@ -21,7 +21,8 @@ export enum PostHogEventTypes {
IssueSshHostUserCert = "Issue SSH Host User Certificate",
IssueSshHostHostCert = "Issue SSH Host Host Certificate",
SignCert = "Sign PKI Certificate",
- IssueCert = "Issue PKI Certificate"
+ IssueCert = "Issue PKI Certificate",
+ InvalidateCache = "Invalidate Cache"
}
export type TSecretModifiedEvent = {
@@ -188,6 +189,7 @@ export type TSignCertificateEvent = {
properties: {
caId?: string;
certificateTemplateId?: string;
+ subscriberId?: string;
commonName: string;
userAgent?: string;
};
@@ -198,11 +200,19 @@ export type TIssueCertificateEvent = {
properties: {
caId?: string;
certificateTemplateId?: string;
+ subscriberId?: string;
commonName: string;
userAgent?: string;
};
};
+export type TInvalidateCacheEvent = {
+ event: PostHogEventTypes.InvalidateCache;
+ properties: {
+ userAgent?: string;
+ };
+};
+
export type TPostHogEvent = { distinctId: string } & (
| TSecretModifiedEvent
| TAdminInitEvent
@@ -221,4 +231,5 @@ export type TPostHogEvent = { distinctId: string } & (
| TIssueSshHostHostCertEvent
| TSignCertificateEvent
| TIssueCertificateEvent
+ | TInvalidateCacheEvent
);
diff --git a/cli/config/allowlist_test.go b/cli/config/allowlist_test.go
deleted file mode 100644
index 52766e3cde..0000000000
--- a/cli/config/allowlist_test.go
+++ /dev/null
@@ -1,115 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package config
-
-import (
- "regexp"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestCommitAllowed(t *testing.T) {
- tests := []struct {
- allowlist Allowlist
- commit string
- commitAllowed bool
- }{
- {
- allowlist: Allowlist{
- Commits: []string{"commitA"},
- },
- commit: "commitA",
- commitAllowed: true,
- },
- {
- allowlist: Allowlist{
- Commits: []string{"commitB"},
- },
- commit: "commitA",
- commitAllowed: false,
- },
- {
- allowlist: Allowlist{
- Commits: []string{"commitB"},
- },
- commit: "",
- commitAllowed: false,
- },
- }
- for _, tt := range tests {
- assert.Equal(t, tt.commitAllowed, tt.allowlist.CommitAllowed(tt.commit))
- }
-}
-
-func TestRegexAllowed(t *testing.T) {
- tests := []struct {
- allowlist Allowlist
- secret string
- regexAllowed bool
- }{
- {
- allowlist: Allowlist{
- Regexes: []*regexp.Regexp{regexp.MustCompile("matchthis")},
- },
- secret: "a secret: matchthis, done",
- regexAllowed: true,
- },
- {
- allowlist: Allowlist{
- Regexes: []*regexp.Regexp{regexp.MustCompile("matchthis")},
- },
- secret: "a secret",
- regexAllowed: false,
- },
- }
- for _, tt := range tests {
- assert.Equal(t, tt.regexAllowed, tt.allowlist.RegexAllowed(tt.secret))
- }
-}
-
-func TestPathAllowed(t *testing.T) {
- tests := []struct {
- allowlist Allowlist
- path string
- pathAllowed bool
- }{
- {
- allowlist: Allowlist{
- Paths: []*regexp.Regexp{regexp.MustCompile("path")},
- },
- path: "a path",
- pathAllowed: true,
- },
- {
- allowlist: Allowlist{
- Paths: []*regexp.Regexp{regexp.MustCompile("path")},
- },
- path: "a ???",
- pathAllowed: false,
- },
- }
- for _, tt := range tests {
- assert.Equal(t, tt.pathAllowed, tt.allowlist.PathAllowed(tt.path))
- }
-}
diff --git a/cli/config/config.go b/cli/config/config.go
deleted file mode 100644
index b1ce08e2b3..0000000000
--- a/cli/config/config.go
+++ /dev/null
@@ -1,279 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package config
-
-import (
- _ "embed"
- "fmt"
- "regexp"
- "strings"
-
- "github.com/rs/zerolog/log"
- "github.com/spf13/viper"
-)
-
-//go:embed infisical-scan.toml
-var DefaultConfig string
-
-// use to keep track of how many configs we can extend
-// yea I know, globals bad
-var extendDepth int
-
-const maxExtendDepth = 2
-
-const DefaultScanConfigFileName = ".infisical-scan.toml"
-const DefaultScanConfigEnvName = "INFISICAL_SCAN_CONFIG"
-const DefaultInfisicalIgnoreFineName = ".infisicalignore"
-
-// ViperConfig is the config struct used by the Viper config package
-// to parse the config file. This struct does not include regular expressions.
-// It is used as an intermediary to convert the Viper config to the Config struct.
-type ViperConfig struct {
- Description string
- Extend Extend
- Rules []struct {
- ID string
- Description string
- Entropy float64
- SecretGroup int
- Regex string
- Keywords []string
- Path string
- Tags []string
-
- Allowlist struct {
- RegexTarget string
- Regexes []string
- Paths []string
- Commits []string
- StopWords []string
- }
- }
- Allowlist struct {
- RegexTarget string
- Regexes []string
- Paths []string
- Commits []string
- StopWords []string
- }
-}
-
-// Config is a configuration struct that contains rules and an allowlist if present.
-type Config struct {
- Extend Extend
- Path string
- Description string
- Rules map[string]Rule
- Allowlist Allowlist
- Keywords []string
-
- // used to keep sarif results consistent
- orderedRules []string
-}
-
-// Extend is a struct that allows users to define how they want their
-// configuration extended by other configuration files.
-type Extend struct {
- Path string
- URL string
- UseDefault bool
-}
-
-func (vc *ViperConfig) Translate() (Config, error) {
- var (
- keywords []string
- orderedRules []string
- )
- rulesMap := make(map[string]Rule)
-
- for _, r := range vc.Rules {
- var allowlistRegexes []*regexp.Regexp
- for _, a := range r.Allowlist.Regexes {
- allowlistRegexes = append(allowlistRegexes, regexp.MustCompile(a))
- }
- var allowlistPaths []*regexp.Regexp
- for _, a := range r.Allowlist.Paths {
- allowlistPaths = append(allowlistPaths, regexp.MustCompile(a))
- }
-
- if r.Keywords == nil {
- r.Keywords = []string{}
- } else {
- for _, k := range r.Keywords {
- keywords = append(keywords, strings.ToLower(k))
- }
- }
-
- if r.Tags == nil {
- r.Tags = []string{}
- }
-
- var configRegex *regexp.Regexp
- var configPathRegex *regexp.Regexp
- if r.Regex == "" {
- configRegex = nil
- } else {
- configRegex = regexp.MustCompile(r.Regex)
- }
- if r.Path == "" {
- configPathRegex = nil
- } else {
- configPathRegex = regexp.MustCompile(r.Path)
- }
- r := Rule{
- Description: r.Description,
- RuleID: r.ID,
- Regex: configRegex,
- Path: configPathRegex,
- SecretGroup: r.SecretGroup,
- Entropy: r.Entropy,
- Tags: r.Tags,
- Keywords: r.Keywords,
- Allowlist: Allowlist{
- RegexTarget: r.Allowlist.RegexTarget,
- Regexes: allowlistRegexes,
- Paths: allowlistPaths,
- Commits: r.Allowlist.Commits,
- StopWords: r.Allowlist.StopWords,
- },
- }
- orderedRules = append(orderedRules, r.RuleID)
-
- if r.Regex != nil && r.SecretGroup > r.Regex.NumSubexp() {
- return Config{}, fmt.Errorf("%s invalid regex secret group %d, max regex secret group %d", r.Description, r.SecretGroup, r.Regex.NumSubexp())
- }
- rulesMap[r.RuleID] = r
- }
- var allowlistRegexes []*regexp.Regexp
- for _, a := range vc.Allowlist.Regexes {
- allowlistRegexes = append(allowlistRegexes, regexp.MustCompile(a))
- }
- var allowlistPaths []*regexp.Regexp
- for _, a := range vc.Allowlist.Paths {
- allowlistPaths = append(allowlistPaths, regexp.MustCompile(a))
- }
- c := Config{
- Description: vc.Description,
- Extend: vc.Extend,
- Rules: rulesMap,
- Allowlist: Allowlist{
- RegexTarget: vc.Allowlist.RegexTarget,
- Regexes: allowlistRegexes,
- Paths: allowlistPaths,
- Commits: vc.Allowlist.Commits,
- StopWords: vc.Allowlist.StopWords,
- },
- Keywords: keywords,
- orderedRules: orderedRules,
- }
-
- if maxExtendDepth != extendDepth {
- // disallow both usedefault and path from being set
- if c.Extend.Path != "" && c.Extend.UseDefault {
- log.Fatal().Msg("unable to load config due to extend.path and extend.useDefault being set")
- }
- if c.Extend.UseDefault {
- c.extendDefault()
- } else if c.Extend.Path != "" {
- c.extendPath()
- }
-
- }
-
- return c, nil
-}
-
-func (c *Config) OrderedRules() []Rule {
- var orderedRules []Rule
- for _, id := range c.orderedRules {
- if _, ok := c.Rules[id]; ok {
- orderedRules = append(orderedRules, c.Rules[id])
- }
- }
- return orderedRules
-}
-
-func (c *Config) extendDefault() {
- extendDepth++
- viper.SetConfigType("toml")
- if err := viper.ReadConfig(strings.NewReader(DefaultConfig)); err != nil {
- log.Fatal().Msgf("failed to load extended config, err: %s", err)
- return
- }
- defaultViperConfig := ViperConfig{}
- if err := viper.Unmarshal(&defaultViperConfig); err != nil {
- log.Fatal().Msgf("failed to load extended config, err: %s", err)
- return
- }
- cfg, err := defaultViperConfig.Translate()
- if err != nil {
- log.Fatal().Msgf("failed to load extended config, err: %s", err)
- return
- }
- log.Debug().Msg("extending config with default config")
- c.extend(cfg)
-
-}
-
-func (c *Config) extendPath() {
- extendDepth++
- viper.SetConfigFile(c.Extend.Path)
- if err := viper.ReadInConfig(); err != nil {
- log.Fatal().Msgf("failed to load extended config, err: %s", err)
- return
- }
- extensionViperConfig := ViperConfig{}
- if err := viper.Unmarshal(&extensionViperConfig); err != nil {
- log.Fatal().Msgf("failed to load extended config, err: %s", err)
- return
- }
- cfg, err := extensionViperConfig.Translate()
- if err != nil {
- log.Fatal().Msgf("failed to load extended config, err: %s", err)
- return
- }
- log.Debug().Msgf("extending config with %s", c.Extend.Path)
- c.extend(cfg)
-}
-
-func (c *Config) extendURL() {
- // TODO
-}
-
-func (c *Config) extend(extensionConfig Config) {
- for ruleID, rule := range extensionConfig.Rules {
- if _, ok := c.Rules[ruleID]; !ok {
- log.Trace().Msgf("adding %s to base config", ruleID)
- c.Rules[ruleID] = rule
- c.Keywords = append(c.Keywords, rule.Keywords...)
- }
- }
-
- // append allowlists, not attempting to merge
- c.Allowlist.Commits = append(c.Allowlist.Commits,
- extensionConfig.Allowlist.Commits...)
- c.Allowlist.Paths = append(c.Allowlist.Paths,
- extensionConfig.Allowlist.Paths...)
- c.Allowlist.Regexes = append(c.Allowlist.Regexes,
- extensionConfig.Allowlist.Regexes...)
-}
diff --git a/cli/config/config_test.go b/cli/config/config_test.go
deleted file mode 100644
index e8f4d47b13..0000000000
--- a/cli/config/config_test.go
+++ /dev/null
@@ -1,170 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package config
-
-import (
- "fmt"
- "regexp"
- "testing"
-
- "github.com/spf13/viper"
- "github.com/stretchr/testify/assert"
-)
-
-const configPath = "../testdata/config/"
-
-func TestTranslate(t *testing.T) {
- tests := []struct {
- cfgName string
- cfg Config
- wantError error
- }{
- {
- cfgName: "allow_aws_re",
- cfg: Config{
- Rules: map[string]Rule{"aws-access-key": {
- Description: "AWS Access Key",
- Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
- Tags: []string{"key", "AWS"},
- Keywords: []string{},
- RuleID: "aws-access-key",
- Allowlist: Allowlist{
- Regexes: []*regexp.Regexp{
- regexp.MustCompile("AKIALALEMEL33243OLIA"),
- },
- },
- },
- },
- },
- },
- {
- cfgName: "allow_commit",
- cfg: Config{
- Rules: map[string]Rule{"aws-access-key": {
- Description: "AWS Access Key",
- Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
- Tags: []string{"key", "AWS"},
- Keywords: []string{},
- RuleID: "aws-access-key",
- Allowlist: Allowlist{
- Commits: []string{"allowthiscommit"},
- },
- },
- },
- },
- },
- {
- cfgName: "allow_path",
- cfg: Config{
- Rules: map[string]Rule{"aws-access-key": {
- Description: "AWS Access Key",
- Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
- Tags: []string{"key", "AWS"},
- Keywords: []string{},
- RuleID: "aws-access-key",
- Allowlist: Allowlist{
- Paths: []*regexp.Regexp{
- regexp.MustCompile(".go"),
- },
- },
- },
- },
- },
- },
- {
- cfgName: "entropy_group",
- cfg: Config{
- Rules: map[string]Rule{"discord-api-key": {
- Description: "Discord API key",
- Regex: regexp.MustCompile(`(?i)(discord[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([a-h0-9]{64})['\"]`),
- RuleID: "discord-api-key",
- Allowlist: Allowlist{},
- Entropy: 3.5,
- SecretGroup: 3,
- Tags: []string{},
- Keywords: []string{},
- },
- },
- },
- },
- {
- cfgName: "bad_entropy_group",
- cfg: Config{},
- wantError: fmt.Errorf("Discord API key invalid regex secret group 5, max regex secret group 3"),
- },
- {
- cfgName: "base",
- cfg: Config{
- Rules: map[string]Rule{
- "aws-access-key": {
- Description: "AWS Access Key",
- Regex: regexp.MustCompile("(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"),
- Tags: []string{"key", "AWS"},
- Keywords: []string{},
- RuleID: "aws-access-key",
- },
- "aws-secret-key": {
- Description: "AWS Secret Key",
- Regex: regexp.MustCompile(`(?i)aws_(.{0,20})?=?.[\'\"0-9a-zA-Z\/+]{40}`),
- Tags: []string{"key", "AWS"},
- Keywords: []string{},
- RuleID: "aws-secret-key",
- },
- "aws-secret-key-again": {
- Description: "AWS Secret Key",
- Regex: regexp.MustCompile(`(?i)aws_(.{0,20})?=?.[\'\"0-9a-zA-Z\/+]{40}`),
- Tags: []string{"key", "AWS"},
- Keywords: []string{},
- RuleID: "aws-secret-key-again",
- },
- },
- },
- },
- }
-
- for _, tt := range tests {
- viper.Reset()
- viper.AddConfigPath(configPath)
- viper.SetConfigName(tt.cfgName)
- viper.SetConfigType("toml")
- err := viper.ReadInConfig()
- if err != nil {
- t.Error(err)
- }
-
- var vc ViperConfig
- err = viper.Unmarshal(&vc)
- if err != nil {
- t.Error(err)
- }
- cfg, err := vc.Translate()
- if tt.wantError != nil {
- if err == nil {
- t.Errorf("expected error")
- }
- assert.Equal(t, tt.wantError, err)
- }
-
- assert.Equal(t, cfg.Rules, tt.cfg.Rules)
- }
-}
diff --git a/cli/config/example-infisical-relay.yaml b/cli/config/example-infisical-relay.yaml
deleted file mode 100644
index c913ed757c..0000000000
--- a/cli/config/example-infisical-relay.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-public_ip: 127.0.0.1
-auth_secret: example-auth-secret
-realm: infisical.org
-# set port 5349 for tls
-# port: 5349
-# tls_private_key_path: /full-path
-# tls_ca_path: /full-path
-# tls_cert_path: /full-path
diff --git a/cli/config/infisical-relay.yaml b/cli/config/infisical-relay.yaml
deleted file mode 100644
index 89c6b5e452..0000000000
--- a/cli/config/infisical-relay.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-public_ip: 127.0.0.1
-auth_secret: changeThisOnProduction
-realm: infisical.org
-# set port 5349 for tls
-# port: 5349
-# tls_private_key_path: /full-path
-# tls_ca_path: /full-path
-# tls_cert_path: /full-path
diff --git a/cli/config/infisical-scan.toml b/cli/config/infisical-scan.toml
deleted file mode 100644
index 193883444f..0000000000
--- a/cli/config/infisical-scan.toml
+++ /dev/null
@@ -1,2803 +0,0 @@
-
-# This file has been auto-generated. Do not edit manually.
-# If you would like to contribute new rules, please use
-# cmd/generate/config/main.go and follow the contributing guidelines
-# at https://github.com/zricethezav/gitleaks/blob/master/CONTRIBUTING.md
-
-# This is the default gitleaks configuration file.
-# Rules and allowlists are defined within this file.
-# Rules instruct gitleaks on what should be considered a secret.
-# Allowlists instruct gitleaks on what is allowed, i.e. not a secret.
-
-title = "gitleaks config"
-
-[allowlist]
-description = "global allow lists"
-paths = [
- '''infisical-scan.toml''',
- '''(.*?)(jpg|gif|doc|docx|zip|xls|pdf|bin|svg|socket)$''',
- '''(go.mod|go.sum)$''',
- '''gradle.lockfile''',
- '''node_modules''',
- '''package-lock.json''',
- '''pnpm-lock.yaml''',
- '''Database.refactorlog''',
- '''vendor''',
-]
-
-[[rules]]
-description = "Adafruit API Key"
-id = "adafruit-api-key"
-regex = '''(?i)(?:adafruit)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9_-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "adafruit",
-]
-
-[[rules]]
-description = "Adobe Client ID (OAuth Web)"
-id = "adobe-client-id"
-regex = '''(?i)(?:adobe)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "adobe",
-]
-
-[[rules]]
-description = "Adobe Client Secret"
-id = "adobe-client-secret"
-regex = '''(?i)\b((p8e-)(?i)[a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "p8e-",
-]
-
-[[rules]]
-description = "Age secret key"
-id = "age secret key"
-regex = '''AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}'''
-keywords = [
- "age-secret-key-1",
-]
-
-[[rules]]
-description = "Airtable API Key"
-id = "airtable-api-key"
-regex = '''(?i)(?:airtable)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{17})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "airtable",
-]
-
-[[rules]]
-description = "Algolia API Key"
-id = "algolia-api-key"
-regex = '''(?i)(?:algolia)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "algolia",
-]
-
-[[rules]]
-description = "Alibaba AccessKey ID"
-id = "alibaba-access-key-id"
-regex = '''(?i)\b((LTAI)(?i)[a-z0-9]{20})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "ltai",
-]
-
-[[rules]]
-description = "Alibaba Secret Key"
-id = "alibaba-secret-key"
-regex = '''(?i)(?:alibaba)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{30})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "alibaba",
-]
-
-[[rules]]
-description = "Asana Client ID"
-id = "asana-client-id"
-regex = '''(?i)(?:asana)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9]{16})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "asana",
-]
-
-[[rules]]
-description = "Asana Client Secret"
-id = "asana-client-secret"
-regex = '''(?i)(?:asana)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "asana",
-]
-
-[[rules]]
-description = "Atlassian API token"
-id = "atlassian-api-token"
-regex = '''(?i)(?:atlassian|confluence|jira)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{24})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "atlassian","confluence","jira",
-]
-
-[[rules]]
-description = "Authress Service Client Access Key"
-id = "authress-service-client-access-key"
-regex = '''(?i)\b((?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.acc_[a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "sc_","ext_","scauth_","authress_",
-]
-
-[[rules]]
-description = "AWS"
-id = "aws-access-token"
-regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
-keywords = [
- "akia","agpa","aida","aroa","aipa","anpa","anva","asia",
-]
-
-[[rules]]
-description = "Beamer API token"
-id = "beamer-api-token"
-regex = '''(?i)(?:beamer)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(b_[a-z0-9=_\-]{44})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "beamer",
-]
-
-[[rules]]
-description = "Bitbucket Client ID"
-id = "bitbucket-client-id"
-regex = '''(?i)(?:bitbucket)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "bitbucket",
-]
-
-[[rules]]
-description = "Bitbucket Client Secret"
-id = "bitbucket-client-secret"
-regex = '''(?i)(?:bitbucket)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9=_\-]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "bitbucket",
-]
-
-[[rules]]
-description = "Bittrex Access Key"
-id = "bittrex-access-key"
-regex = '''(?i)(?:bittrex)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "bittrex",
-]
-
-[[rules]]
-description = "Bittrex Secret Key"
-id = "bittrex-secret-key"
-regex = '''(?i)(?:bittrex)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "bittrex",
-]
-
-[[rules]]
-description = "Clojars API token"
-id = "clojars-api-token"
-regex = '''(?i)(CLOJARS_)[a-z0-9]{60}'''
-keywords = [
- "clojars",
-]
-
-[[rules]]
-description = "Codecov Access Token"
-id = "codecov-access-token"
-regex = '''(?i)(?:codecov)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "codecov",
-]
-
-[[rules]]
-description = "Coinbase Access Token"
-id = "coinbase-access-token"
-regex = '''(?i)(?:coinbase)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9_-]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "coinbase",
-]
-
-[[rules]]
-description = "Confluent Access Token"
-id = "confluent-access-token"
-regex = '''(?i)(?:confluent)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{16})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "confluent",
-]
-
-[[rules]]
-description = "Confluent Secret Key"
-id = "confluent-secret-key"
-regex = '''(?i)(?:confluent)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "confluent",
-]
-
-[[rules]]
-description = "Contentful delivery API token"
-id = "contentful-delivery-api-token"
-regex = '''(?i)(?:contentful)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9=_\-]{43})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "contentful",
-]
-
-[[rules]]
-description = "Databricks API token"
-id = "databricks-api-token"
-regex = '''(?i)\b(dapi[a-h0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "dapi",
-]
-
-[[rules]]
-description = "Datadog Access Token"
-id = "datadog-access-token"
-regex = '''(?i)(?:datadog)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "datadog",
-]
-
-[[rules]]
-description = "Defined Networking API token"
-id = "defined-networking-api-token"
-regex = '''(?i)(?:dnkey)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(dnkey-[a-z0-9=_\-]{26}-[a-z0-9=_\-]{52})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "dnkey",
-]
-
-[[rules]]
-description = "DigitalOcean OAuth Access Token"
-id = "digitalocean-access-token"
-regex = '''(?i)\b(doo_v1_[a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "doo_v1_",
-]
-
-[[rules]]
-description = "DigitalOcean Personal Access Token"
-id = "digitalocean-pat"
-regex = '''(?i)\b(dop_v1_[a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "dop_v1_",
-]
-
-[[rules]]
-description = "DigitalOcean OAuth Refresh Token"
-id = "digitalocean-refresh-token"
-regex = '''(?i)\b(dor_v1_[a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "dor_v1_",
-]
-
-[[rules]]
-description = "Discord API key"
-id = "discord-api-token"
-regex = '''(?i)(?:discord)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "discord",
-]
-
-[[rules]]
-description = "Discord client ID"
-id = "discord-client-id"
-regex = '''(?i)(?:discord)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9]{18})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "discord",
-]
-
-[[rules]]
-description = "Discord client secret"
-id = "discord-client-secret"
-regex = '''(?i)(?:discord)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9=_\-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "discord",
-]
-
-[[rules]]
-description = "Doppler API token"
-id = "doppler-api-token"
-regex = '''(dp\.pt\.)(?i)[a-z0-9]{43}'''
-keywords = [
- "doppler",
-]
-
-[[rules]]
-description = "Droneci Access Token"
-id = "droneci-access-token"
-regex = '''(?i)(?:droneci)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "droneci",
-]
-
-[[rules]]
-description = "Dropbox API secret"
-id = "dropbox-api-token"
-regex = '''(?i)(?:dropbox)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{15})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "dropbox",
-]
-
-[[rules]]
-description = "Dropbox long lived API token"
-id = "dropbox-long-lived-api-token"
-regex = '''(?i)(?:dropbox)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "dropbox",
-]
-
-[[rules]]
-description = "Dropbox short lived API token"
-id = "dropbox-short-lived-api-token"
-regex = '''(?i)(?:dropbox)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(sl\.[a-z0-9\-=_]{135})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "dropbox",
-]
-
-[[rules]]
-description = "Duffel API token"
-id = "duffel-api-token"
-regex = '''duffel_(test|live)_(?i)[a-z0-9_\-=]{43}'''
-keywords = [
- "duffel",
-]
-
-[[rules]]
-description = "Dynatrace API token"
-id = "dynatrace-api-token"
-regex = '''dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}'''
-keywords = [
- "dynatrace",
-]
-
-[[rules]]
-description = "EasyPost API token"
-id = "easypost-api-token"
-regex = '''\bEZAK(?i)[a-z0-9]{54}'''
-keywords = [
- "ezak",
-]
-
-[[rules]]
-description = "EasyPost test API token"
-id = "easypost-test-api-token"
-regex = '''\bEZTK(?i)[a-z0-9]{54}'''
-keywords = [
- "eztk",
-]
-
-[[rules]]
-description = "Etsy Access Token"
-id = "etsy-access-token"
-regex = '''(?i)(?:etsy)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{24})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "etsy",
-]
-
-[[rules]]
-description = "Facebook Access Token"
-id = "facebook"
-regex = '''(?i)(?:facebook)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "facebook",
-]
-
-[[rules]]
-description = "Fastly API key"
-id = "fastly-api-token"
-regex = '''(?i)(?:fastly)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9=_\-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "fastly",
-]
-
-[[rules]]
-description = "Finicity API token"
-id = "finicity-api-token"
-regex = '''(?i)(?:finicity)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "finicity",
-]
-
-[[rules]]
-description = "Finicity Client Secret"
-id = "finicity-client-secret"
-regex = '''(?i)(?:finicity)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{20})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "finicity",
-]
-
-[[rules]]
-description = "Finnhub Access Token"
-id = "finnhub-access-token"
-regex = '''(?i)(?:finnhub)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{20})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "finnhub",
-]
-
-[[rules]]
-description = "Flickr Access Token"
-id = "flickr-access-token"
-regex = '''(?i)(?:flickr)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "flickr",
-]
-
-[[rules]]
-description = "Flutterwave Encryption Key"
-id = "flutterwave-encryption-key"
-regex = '''FLWSECK_TEST-(?i)[a-h0-9]{12}'''
-keywords = [
- "flwseck_test",
-]
-
-[[rules]]
-description = "Finicity Public Key"
-id = "flutterwave-public-key"
-regex = '''FLWPUBK_TEST-(?i)[a-h0-9]{32}-X'''
-keywords = [
- "flwpubk_test",
-]
-
-[[rules]]
-description = "Flutterwave Secret Key"
-id = "flutterwave-secret-key"
-regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
-keywords = [
- "flwseck_test",
-]
-
-[[rules]]
-description = "Frame.io API token"
-id = "frameio-api-token"
-regex = '''fio-u-(?i)[a-z0-9\-_=]{64}'''
-keywords = [
- "fio-u-",
-]
-
-[[rules]]
-description = "Freshbooks Access Token"
-id = "freshbooks-access-token"
-regex = '''(?i)(?:freshbooks)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "freshbooks",
-]
-
-[[rules]]
-description = "GCP API key"
-id = "gcp-api-key"
-regex = '''(?i)\b(AIza[0-9A-Za-z\\-_]{35})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "aiza",
-]
-
-[[rules]]
-description = "Generic API Key"
-id = "generic-api-key"
-regex = '''(?i)(?:key|api|token|secret|client|passwd|password|auth|access)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9a-z\-_.=]{10,150})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-entropy = 3.5
-keywords = [
- "key","api","token","secret","client","passwd","password","auth","access",
-]
-[rules.allowlist]
-stopwords= [
- "client",
- "endpoint",
- "vpn",
- "_ec2_",
- "aws_",
- "authorize",
- "author",
- "define",
- "config",
- "credential",
- "setting",
- "sample",
- "xxxxxx",
- "000000",
- "buffer",
- "delete",
- "aaaaaa",
- "fewfwef",
- "getenv",
- "env_",
- "system",
- "example",
- "ecdsa",
- "sha256",
- "sha1",
- "sha2",
- "md5",
- "alert",
- "wizard",
- "target",
- "onboard",
- "welcome",
- "page",
- "exploit",
- "experiment",
- "expire",
- "rabbitmq",
- "scraper",
- "widget",
- "music",
- "dns_",
- "dns-",
- "yahoo",
- "want",
- "json",
- "action",
- "script",
- "fix_",
- "fix-",
- "develop",
- "compas",
- "stripe",
- "service",
- "master",
- "metric",
- "tech",
- "gitignore",
- "rich",
- "open",
- "stack",
- "irc_",
- "irc-",
- "sublime",
- "kohana",
- "has_",
- "has-",
- "fabric",
- "wordpres",
- "role",
- "osx_",
- "osx-",
- "boost",
- "addres",
- "queue",
- "working",
- "sandbox",
- "internet",
- "print",
- "vision",
- "tracking",
- "being",
- "generator",
- "traffic",
- "world",
- "pull",
- "rust",
- "watcher",
- "small",
- "auth",
- "full",
- "hash",
- "more",
- "install",
- "auto",
- "complete",
- "learn",
- "paper",
- "installer",
- "research",
- "acces",
- "last",
- "binding",
- "spine",
- "into",
- "chat",
- "algorithm",
- "resource",
- "uploader",
- "video",
- "maker",
- "next",
- "proc",
- "lock",
- "robot",
- "snake",
- "patch",
- "matrix",
- "drill",
- "terminal",
- "term",
- "stuff",
- "genetic",
- "generic",
- "identity",
- "audit",
- "pattern",
- "audio",
- "web_",
- "web-",
- "crud",
- "problem",
- "statu",
- "cms-",
- "cms_",
- "arch",
- "coffee",
- "workflow",
- "changelog",
- "another",
- "uiview",
- "content",
- "kitchen",
- "gnu_",
- "gnu-",
- "gnu.",
- "conf",
- "couchdb",
- "client",
- "opencv",
- "rendering",
- "update",
- "concept",
- "varnish",
- "gui_",
- "gui-",
- "gui.",
- "version",
- "shared",
- "extra",
- "product",
- "still",
- "not_",
- "not-",
- "not.",
- "drop",
- "ring",
- "png_",
- "png-",
- "png.",
- "actively",
- "import",
- "output",
- "backup",
- "start",
- "embedded",
- "registry",
- "pool",
- "semantic",
- "instagram",
- "bash",
- "system",
- "ninja",
- "drupal",
- "jquery",
- "polyfill",
- "physic",
- "league",
- "guide",
- "pack",
- "synopsi",
- "sketch",
- "injection",
- "svg_",
- "svg-",
- "svg.",
- "friendly",
- "wave",
- "convert",
- "manage",
- "camera",
- "link",
- "slide",
- "timer",
- "wrapper",
- "gallery",
- "url_",
- "url-",
- "url.",
- "todomvc",
- "requirej",
- "party",
- "http",
- "payment",
- "async",
- "library",
- "home",
- "coco",
- "gaia",
- "display",
- "universal",
- "func",
- "metadata",
- "hipchat",
- "under",
- "room",
- "config",
- "personal",
- "realtime",
- "resume",
- "database",
- "testing",
- "tiny",
- "basic",
- "forum",
- "meetup",
- "yet_",
- "yet-",
- "yet.",
- "cento",
- "dead",
- "fluentd",
- "editor",
- "utilitie",
- "run_",
- "run-",
- "run.",
- "box_",
- "box-",
- "box.",
- "bot_",
- "bot-",
- "bot.",
- "making",
- "sample",
- "group",
- "monitor",
- "ajax",
- "parallel",
- "cassandra",
- "ultimate",
- "site",
- "get_",
- "get-",
- "get.",
- "gen_",
- "gen-",
- "gen.",
- "gem_",
- "gem-",
- "gem.",
- "extended",
- "image",
- "knife",
- "asset",
- "nested",
- "zero",
- "plugin",
- "bracket",
- "mule",
- "mozilla",
- "number",
- "act_",
- "act-",
- "act.",
- "map_",
- "map-",
- "map.",
- "micro",
- "debug",
- "openshift",
- "chart",
- "expres",
- "backend",
- "task",
- "source",
- "translate",
- "jbos",
- "composer",
- "sqlite",
- "profile",
- "mustache",
- "mqtt",
- "yeoman",
- "have",
- "builder",
- "smart",
- "like",
- "oauth",
- "school",
- "guideline",
- "captcha",
- "filter",
- "bitcoin",
- "bridge",
- "color",
- "toolbox",
- "discovery",
- "new_",
- "new-",
- "new.",
- "dashboard",
- "when",
- "setting",
- "level",
- "post",
- "standard",
- "port",
- "platform",
- "yui_",
- "yui-",
- "yui.",
- "grunt",
- "animation",
- "haskell",
- "icon",
- "latex",
- "cheat",
- "lua_",
- "lua-",
- "lua.",
- "gulp",
- "case",
- "author",
- "without",
- "simulator",
- "wifi",
- "directory",
- "lisp",
- "list",
- "flat",
- "adventure",
- "story",
- "storm",
- "gpu_",
- "gpu-",
- "gpu.",
- "store",
- "caching",
- "attention",
- "solr",
- "logger",
- "demo",
- "shortener",
- "hadoop",
- "finder",
- "phone",
- "pipeline",
- "range",
- "textmate",
- "showcase",
- "app_",
- "app-",
- "app.",
- "idiomatic",
- "edit",
- "our_",
- "our-",
- "our.",
- "out_",
- "out-",
- "out.",
- "sentiment",
- "linked",
- "why_",
- "why-",
- "why.",
- "local",
- "cube",
- "gmail",
- "job_",
- "job-",
- "job.",
- "rpc_",
- "rpc-",
- "rpc.",
- "contest",
- "tcp_",
- "tcp-",
- "tcp.",
- "usage",
- "buildout",
- "weather",
- "transfer",
- "automated",
- "sphinx",
- "issue",
- "sas_",
- "sas-",
- "sas.",
- "parallax",
- "jasmine",
- "addon",
- "machine",
- "solution",
- "dsl_",
- "dsl-",
- "dsl.",
- "episode",
- "menu",
- "theme",
- "best",
- "adapter",
- "debugger",
- "chrome",
- "tutorial",
- "life",
- "step",
- "people",
- "joomla",
- "paypal",
- "developer",
- "solver",
- "team",
- "current",
- "love",
- "visual",
- "date",
- "data",
- "canva",
- "container",
- "future",
- "xml_",
- "xml-",
- "xml.",
- "twig",
- "nagio",
- "spatial",
- "original",
- "sync",
- "archived",
- "refinery",
- "science",
- "mapping",
- "gitlab",
- "play",
- "ext_",
- "ext-",
- "ext.",
- "session",
- "impact",
- "set_",
- "set-",
- "set.",
- "see_",
- "see-",
- "see.",
- "migration",
- "commit",
- "community",
- "shopify",
- "what'",
- "cucumber",
- "statamic",
- "mysql",
- "location",
- "tower",
- "line",
- "code",
- "amqp",
- "hello",
- "send",
- "index",
- "high",
- "notebook",
- "alloy",
- "python",
- "field",
- "document",
- "soap",
- "edition",
- "email",
- "php_",
- "php-",
- "php.",
- "command",
- "transport",
- "official",
- "upload",
- "study",
- "secure",
- "angularj",
- "akka",
- "scalable",
- "package",
- "request",
- "con_",
- "con-",
- "con.",
- "flexible",
- "security",
- "comment",
- "module",
- "flask",
- "graph",
- "flash",
- "apache",
- "change",
- "window",
- "space",
- "lambda",
- "sheet",
- "bookmark",
- "carousel",
- "friend",
- "objective",
- "jekyll",
- "bootstrap",
- "first",
- "article",
- "gwt_",
- "gwt-",
- "gwt.",
- "classic",
- "media",
- "websocket",
- "touch",
- "desktop",
- "real",
- "read",
- "recorder",
- "moved",
- "storage",
- "validator",
- "add-on",
- "pusher",
- "scs_",
- "scs-",
- "scs.",
- "inline",
- "asp_",
- "asp-",
- "asp.",
- "timeline",
- "base",
- "encoding",
- "ffmpeg",
- "kindle",
- "tinymce",
- "pretty",
- "jpa_",
- "jpa-",
- "jpa.",
- "used",
- "user",
- "required",
- "webhook",
- "download",
- "resque",
- "espresso",
- "cloud",
- "mongo",
- "benchmark",
- "pure",
- "cakephp",
- "modx",
- "mode",
- "reactive",
- "fuel",
- "written",
- "flickr",
- "mail",
- "brunch",
- "meteor",
- "dynamic",
- "neo_",
- "neo-",
- "neo.",
- "new_",
- "new-",
- "new.",
- "net_",
- "net-",
- "net.",
- "typo",
- "type",
- "keyboard",
- "erlang",
- "adobe",
- "logging",
- "ckeditor",
- "message",
- "iso_",
- "iso-",
- "iso.",
- "hook",
- "ldap",
- "folder",
- "reference",
- "railscast",
- "www_",
- "www-",
- "www.",
- "tracker",
- "azure",
- "fork",
- "form",
- "digital",
- "exporter",
- "skin",
- "string",
- "template",
- "designer",
- "gollum",
- "fluent",
- "entity",
- "language",
- "alfred",
- "summary",
- "wiki",
- "kernel",
- "calendar",
- "plupload",
- "symfony",
- "foundry",
- "remote",
- "talk",
- "search",
- "dev_",
- "dev-",
- "dev.",
- "del_",
- "del-",
- "del.",
- "token",
- "idea",
- "sencha",
- "selector",
- "interface",
- "create",
- "fun_",
- "fun-",
- "fun.",
- "groovy",
- "query",
- "grail",
- "red_",
- "red-",
- "red.",
- "laravel",
- "monkey",
- "slack",
- "supported",
- "instant",
- "value",
- "center",
- "latest",
- "work",
- "but_",
- "but-",
- "but.",
- "bug_",
- "bug-",
- "bug.",
- "virtual",
- "tweet",
- "statsd",
- "studio",
- "path",
- "real-time",
- "frontend",
- "notifier",
- "coding",
- "tool",
- "firmware",
- "flow",
- "random",
- "mediawiki",
- "bosh",
- "been",
- "beer",
- "lightbox",
- "theory",
- "origin",
- "redmine",
- "hub_",
- "hub-",
- "hub.",
- "require",
- "pro_",
- "pro-",
- "pro.",
- "ant_",
- "ant-",
- "ant.",
- "any_",
- "any-",
- "any.",
- "recipe",
- "closure",
- "mapper",
- "event",
- "todo",
- "model",
- "redi",
- "provider",
- "rvm_",
- "rvm-",
- "rvm.",
- "program",
- "memcached",
- "rail",
- "silex",
- "foreman",
- "activity",
- "license",
- "strategy",
- "batch",
- "streaming",
- "fast",
- "use_",
- "use-",
- "use.",
- "usb_",
- "usb-",
- "usb.",
- "impres",
- "academy",
- "slider",
- "please",
- "layer",
- "cros",
- "now_",
- "now-",
- "now.",
- "miner",
- "extension",
- "own_",
- "own-",
- "own.",
- "app_",
- "app-",
- "app.",
- "debian",
- "symphony",
- "example",
- "feature",
- "serie",
- "tree",
- "project",
- "runner",
- "entry",
- "leetcode",
- "layout",
- "webrtc",
- "logic",
- "login",
- "worker",
- "toolkit",
- "mocha",
- "support",
- "back",
- "inside",
- "device",
- "jenkin",
- "contact",
- "fake",
- "awesome",
- "ocaml",
- "bit_",
- "bit-",
- "bit.",
- "drive",
- "screen",
- "prototype",
- "gist",
- "binary",
- "nosql",
- "rest",
- "overview",
- "dart",
- "dark",
- "emac",
- "mongoid",
- "solarized",
- "homepage",
- "emulator",
- "commander",
- "django",
- "yandex",
- "gradle",
- "xcode",
- "writer",
- "crm_",
- "crm-",
- "crm.",
- "jade",
- "startup",
- "error",
- "using",
- "format",
- "name",
- "spring",
- "parser",
- "scratch",
- "magic",
- "try_",
- "try-",
- "try.",
- "rack",
- "directive",
- "challenge",
- "slim",
- "counter",
- "element",
- "chosen",
- "doc_",
- "doc-",
- "doc.",
- "meta",
- "should",
- "button",
- "packet",
- "stream",
- "hardware",
- "android",
- "infinite",
- "password",
- "software",
- "ghost",
- "xamarin",
- "spec",
- "chef",
- "interview",
- "hubot",
- "mvc_",
- "mvc-",
- "mvc.",
- "exercise",
- "leaflet",
- "launcher",
- "air_",
- "air-",
- "air.",
- "photo",
- "board",
- "boxen",
- "way_",
- "way-",
- "way.",
- "computing",
- "welcome",
- "notepad",
- "portfolio",
- "cat_",
- "cat-",
- "cat.",
- "can_",
- "can-",
- "can.",
- "magento",
- "yaml",
- "domain",
- "card",
- "yii_",
- "yii-",
- "yii.",
- "checker",
- "browser",
- "upgrade",
- "only",
- "progres",
- "aura",
- "ruby_",
- "ruby-",
- "ruby.",
- "polymer",
- "util",
- "lite",
- "hackathon",
- "rule",
- "log_",
- "log-",
- "log.",
- "opengl",
- "stanford",
- "skeleton",
- "history",
- "inspector",
- "help",
- "soon",
- "selenium",
- "lab_",
- "lab-",
- "lab.",
- "scheme",
- "schema",
- "look",
- "ready",
- "leveldb",
- "docker",
- "game",
- "minimal",
- "logstash",
- "messaging",
- "within",
- "heroku",
- "mongodb",
- "kata",
- "suite",
- "picker",
- "win_",
- "win-",
- "win.",
- "wip_",
- "wip-",
- "wip.",
- "panel",
- "started",
- "starter",
- "front-end",
- "detector",
- "deploy",
- "editing",
- "based",
- "admin",
- "capture",
- "spree",
- "page",
- "bundle",
- "goal",
- "rpg_",
- "rpg-",
- "rpg.",
- "setup",
- "side",
- "mean",
- "reader",
- "cookbook",
- "mini",
- "modern",
- "seed",
- "dom_",
- "dom-",
- "dom.",
- "doc_",
- "doc-",
- "doc.",
- "dot_",
- "dot-",
- "dot.",
- "syntax",
- "sugar",
- "loader",
- "website",
- "make",
- "kit_",
- "kit-",
- "kit.",
- "protocol",
- "human",
- "daemon",
- "golang",
- "manager",
- "countdown",
- "connector",
- "swagger",
- "map_",
- "map-",
- "map.",
- "mac_",
- "mac-",
- "mac.",
- "man_",
- "man-",
- "man.",
- "orm_",
- "orm-",
- "orm.",
- "org_",
- "org-",
- "org.",
- "little",
- "zsh_",
- "zsh-",
- "zsh.",
- "shop",
- "show",
- "workshop",
- "money",
- "grid",
- "server",
- "octopres",
- "svn_",
- "svn-",
- "svn.",
- "ember",
- "embed",
- "general",
- "file",
- "important",
- "dropbox",
- "portable",
- "public",
- "docpad",
- "fish",
- "sbt_",
- "sbt-",
- "sbt.",
- "done",
- "para",
- "network",
- "common",
- "readme",
- "popup",
- "simple",
- "purpose",
- "mirror",
- "single",
- "cordova",
- "exchange",
- "object",
- "design",
- "gateway",
- "account",
- "lamp",
- "intellij",
- "math",
- "mit_",
- "mit-",
- "mit.",
- "control",
- "enhanced",
- "emitter",
- "multi",
- "add_",
- "add-",
- "add.",
- "about",
- "socket",
- "preview",
- "vagrant",
- "cli_",
- "cli-",
- "cli.",
- "powerful",
- "top_",
- "top-",
- "top.",
- "radio",
- "watch",
- "fluid",
- "amazon",
- "report",
- "couchbase",
- "automatic",
- "detection",
- "sprite",
- "pyramid",
- "portal",
- "advanced",
- "plu_",
- "plu-",
- "plu.",
- "runtime",
- "git_",
- "git-",
- "git.",
- "uri_",
- "uri-",
- "uri.",
- "haml",
- "node",
- "sql_",
- "sql-",
- "sql.",
- "cool",
- "core",
- "obsolete",
- "handler",
- "iphone",
- "extractor",
- "array",
- "copy",
- "nlp_",
- "nlp-",
- "nlp.",
- "reveal",
- "pop_",
- "pop-",
- "pop.",
- "engine",
- "parse",
- "check",
- "html",
- "nest",
- "all_",
- "all-",
- "all.",
- "chinese",
- "buildpack",
- "what",
- "tag_",
- "tag-",
- "tag.",
- "proxy",
- "style",
- "cookie",
- "feed",
- "restful",
- "compiler",
- "creating",
- "prelude",
- "context",
- "java",
- "rspec",
- "mock",
- "backbone",
- "light",
- "spotify",
- "flex",
- "related",
- "shell",
- "which",
- "clas",
- "webapp",
- "swift",
- "ansible",
- "unity",
- "console",
- "tumblr",
- "export",
- "campfire",
- "conway'",
- "made",
- "riak",
- "hero",
- "here",
- "unix",
- "unit",
- "glas",
- "smtp",
- "how_",
- "how-",
- "how.",
- "hot_",
- "hot-",
- "hot.",
- "debug",
- "release",
- "diff",
- "player",
- "easy",
- "right",
- "old_",
- "old-",
- "old.",
- "animate",
- "time",
- "push",
- "explorer",
- "course",
- "training",
- "nette",
- "router",
- "draft",
- "structure",
- "note",
- "salt",
- "where",
- "spark",
- "trello",
- "power",
- "method",
- "social",
- "via_",
- "via-",
- "via.",
- "vim_",
- "vim-",
- "vim.",
- "select",
- "webkit",
- "github",
- "ftp_",
- "ftp-",
- "ftp.",
- "creator",
- "mongoose",
- "led_",
- "led-",
- "led.",
- "movie",
- "currently",
- "pdf_",
- "pdf-",
- "pdf.",
- "load",
- "markdown",
- "phalcon",
- "input",
- "custom",
- "atom",
- "oracle",
- "phonegap",
- "ubuntu",
- "great",
- "rdf_",
- "rdf-",
- "rdf.",
- "popcorn",
- "firefox",
- "zip_",
- "zip-",
- "zip.",
- "cuda",
- "dotfile",
- "static",
- "openwrt",
- "viewer",
- "powered",
- "graphic",
- "les_",
- "les-",
- "les.",
- "doe_",
- "doe-",
- "doe.",
- "maven",
- "word",
- "eclipse",
- "lab_",
- "lab-",
- "lab.",
- "hacking",
- "steam",
- "analytic",
- "option",
- "abstract",
- "archive",
- "reality",
- "switcher",
- "club",
- "write",
- "kafka",
- "arduino",
- "angular",
- "online",
- "title",
- "don't",
- "contao",
- "notice",
- "analyzer",
- "learning",
- "zend",
- "external",
- "staging",
- "busines",
- "tdd_",
- "tdd-",
- "tdd.",
- "scanner",
- "building",
- "snippet",
- "modular",
- "bower",
- "stm_",
- "stm-",
- "stm.",
- "lib_",
- "lib-",
- "lib.",
- "alpha",
- "mobile",
- "clean",
- "linux",
- "nginx",
- "manifest",
- "some",
- "raspberry",
- "gnome",
- "ide_",
- "ide-",
- "ide.",
- "block",
- "statistic",
- "info",
- "drag",
- "youtube",
- "koan",
- "facebook",
- "paperclip",
- "art_",
- "art-",
- "art.",
- "quality",
- "tab_",
- "tab-",
- "tab.",
- "need",
- "dojo",
- "shield",
- "computer",
- "stat",
- "state",
- "twitter",
- "utility",
- "converter",
- "hosting",
- "devise",
- "liferay",
- "updated",
- "force",
- "tip_",
- "tip-",
- "tip.",
- "behavior",
- "active",
- "call",
- "answer",
- "deck",
- "better",
- "principle",
- "ches",
- "bar_",
- "bar-",
- "bar.",
- "reddit",
- "three",
- "haxe",
- "just",
- "plug-in",
- "agile",
- "manual",
- "tetri",
- "super",
- "beta",
- "parsing",
- "doctrine",
- "minecraft",
- "useful",
- "perl",
- "sharing",
- "agent",
- "switch",
- "view",
- "dash",
- "channel",
- "repo",
- "pebble",
- "profiler",
- "warning",
- "cluster",
- "running",
- "markup",
- "evented",
- "mod_",
- "mod-",
- "mod.",
- "share",
- "csv_",
- "csv-",
- "csv.",
- "response",
- "good",
- "house",
- "connect",
- "built",
- "build",
- "find",
- "ipython",
- "webgl",
- "big_",
- "big-",
- "big.",
- "google",
- "scala",
- "sdl_",
- "sdl-",
- "sdl.",
- "sdk_",
- "sdk-",
- "sdk.",
- "native",
- "day_",
- "day-",
- "day.",
- "puppet",
- "text",
- "routing",
- "helper",
- "linkedin",
- "crawler",
- "host",
- "guard",
- "merchant",
- "poker",
- "over",
- "writing",
- "free",
- "classe",
- "component",
- "craft",
- "nodej",
- "phoenix",
- "longer",
- "quick",
- "lazy",
- "memory",
- "clone",
- "hacker",
- "middleman",
- "factory",
- "motion",
- "multiple",
- "tornado",
- "hack",
- "ssh_",
- "ssh-",
- "ssh.",
- "review",
- "vimrc",
- "driver",
- "driven",
- "blog",
- "particle",
- "table",
- "intro",
- "importer",
- "thrift",
- "xmpp",
- "framework",
- "refresh",
- "react",
- "font",
- "librarie",
- "variou",
- "formatter",
- "analysi",
- "karma",
- "scroll",
- "tut_",
- "tut-",
- "tut.",
- "apple",
- "tag_",
- "tag-",
- "tag.",
- "tab_",
- "tab-",
- "tab.",
- "category",
- "ionic",
- "cache",
- "homebrew",
- "reverse",
- "english",
- "getting",
- "shipping",
- "clojure",
- "boot",
- "book",
- "branch",
- "combination",
- "combo",
-]
-[[rules]]
-description = "GitHub App Token"
-id = "github-app-token"
-regex = '''(ghu|ghs)_[0-9a-zA-Z]{36}'''
-keywords = [
- "ghu_","ghs_",
-]
-
-[[rules]]
-description = "GitHub Fine-Grained Personal Access Token"
-id = "github-fine-grained-pat"
-regex = '''github_pat_[0-9a-zA-Z_]{82}'''
-keywords = [
- "github_pat_",
-]
-
-[[rules]]
-description = "GitHub OAuth Access Token"
-id = "github-oauth"
-regex = '''gho_[0-9a-zA-Z]{36}'''
-keywords = [
- "gho_",
-]
-
-[[rules]]
-description = "GitHub Personal Access Token"
-id = "github-pat"
-regex = '''ghp_[0-9a-zA-Z]{36}'''
-keywords = [
- "ghp_",
-]
-
-[[rules]]
-description = "GitHub Refresh Token"
-id = "github-refresh-token"
-regex = '''ghr_[0-9a-zA-Z]{36}'''
-keywords = [
- "ghr_",
-]
-
-[[rules]]
-description = "GitLab Personal Access Token"
-id = "gitlab-pat"
-regex = '''glpat-[0-9a-zA-Z\-\_]{20}'''
-keywords = [
- "glpat-",
-]
-
-[[rules]]
-description = "GitLab Pipeline Trigger Token"
-id = "gitlab-ptt"
-regex = '''glptt-[0-9a-f]{40}'''
-keywords = [
- "glptt-",
-]
-
-[[rules]]
-description = "GitLab Runner Registration Token"
-id = "gitlab-rrt"
-regex = '''GR1348941[0-9a-zA-Z\-\_]{20}'''
-keywords = [
- "gr1348941",
-]
-
-[[rules]]
-description = "Gitter Access Token"
-id = "gitter-access-token"
-regex = '''(?i)(?:gitter)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9_-]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "gitter",
-]
-
-[[rules]]
-description = "GoCardless API token"
-id = "gocardless-api-token"
-regex = '''(?i)(?:gocardless)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(live_(?i)[a-z0-9\-_=]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "live_","gocardless",
-]
-
-[[rules]]
-description = "Grafana api key (or Grafana cloud api key)"
-id = "grafana-api-key"
-regex = '''(?i)\b(eyJrIjoi[A-Za-z0-9]{70,400}={0,2})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "eyjrijoi",
-]
-
-[[rules]]
-description = "Grafana cloud api token"
-id = "grafana-cloud-api-token"
-regex = '''(?i)\b(glc_[A-Za-z0-9+/]{32,400}={0,2})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "glc_",
-]
-
-[[rules]]
-description = "Grafana service account token"
-id = "grafana-service-account-token"
-regex = '''(?i)\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "glsa_",
-]
-
-[[rules]]
-description = "HashiCorp Terraform user/org API token"
-id = "hashicorp-tf-api-token"
-regex = '''(?i)[a-z0-9]{14}\.atlasv1\.[a-z0-9\-_=]{60,70}'''
-keywords = [
- "atlasv1",
-]
-
-[[rules]]
-description = "Heroku API Key"
-id = "heroku-api-key"
-regex = '''(?i)(?:heroku)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "heroku",
-]
-
-[[rules]]
-description = "HubSpot API Token"
-id = "hubspot-api-key"
-regex = '''(?i)(?:hubspot)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "hubspot",
-]
-
-[[rules]]
-description = "Intercom API Token"
-id = "intercom-api-key"
-regex = '''(?i)(?:intercom)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9=_\-]{60})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "intercom",
-]
-
-[[rules]]
-description = "JSON Web Token"
-id = "jwt"
-regex = '''(?i)\b(ey[0-9a-z]{30,34}\.ey[0-9a-z-\/_]{30,500}\.[0-9a-zA-Z-\/_]{10,200}={0,2})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "ey",
-]
-
-[[rules]]
-description = "Kraken Access Token"
-id = "kraken-access-token"
-regex = '''(?i)(?:kraken)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9\/=_\+\-]{80,90})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "kraken",
-]
-
-[[rules]]
-description = "Kucoin Access Token"
-id = "kucoin-access-token"
-regex = '''(?i)(?:kucoin)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{24})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "kucoin",
-]
-
-[[rules]]
-description = "Kucoin Secret Key"
-id = "kucoin-secret-key"
-regex = '''(?i)(?:kucoin)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "kucoin",
-]
-
-[[rules]]
-description = "Launchdarkly Access Token"
-id = "launchdarkly-access-token"
-regex = '''(?i)(?:launchdarkly)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9=_\-]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "launchdarkly",
-]
-
-[[rules]]
-description = "Linear API Token"
-id = "linear-api-key"
-regex = '''lin_api_(?i)[a-z0-9]{40}'''
-keywords = [
- "lin_api_",
-]
-
-[[rules]]
-description = "Linear Client Secret"
-id = "linear-client-secret"
-regex = '''(?i)(?:linear)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "linear",
-]
-
-[[rules]]
-description = "LinkedIn Client ID"
-id = "linkedin-client-id"
-regex = '''(?i)(?:linkedin|linked-in)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{14})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "linkedin","linked-in",
-]
-
-[[rules]]
-description = "LinkedIn Client secret"
-id = "linkedin-client-secret"
-regex = '''(?i)(?:linkedin|linked-in)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{16})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "linkedin","linked-in",
-]
-
-[[rules]]
-description = "Lob API Key"
-id = "lob-api-key"
-regex = '''(?i)(?:lob)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}((live|test)_[a-f0-9]{35})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "test_","live_",
-]
-
-[[rules]]
-description = "Lob Publishable API Key"
-id = "lob-pub-api-key"
-regex = '''(?i)(?:lob)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}((test|live)_pub_[a-f0-9]{31})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "test_pub","live_pub","_pub",
-]
-
-[[rules]]
-description = "Mailchimp API key"
-id = "mailchimp-api-key"
-regex = '''(?i)(?:mailchimp)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{32}-us20)(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "mailchimp",
-]
-
-[[rules]]
-description = "Mailgun private API token"
-id = "mailgun-private-api-token"
-regex = '''(?i)(?:mailgun)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(key-[a-f0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "mailgun",
-]
-
-[[rules]]
-description = "Mailgun public validation key"
-id = "mailgun-pub-key"
-regex = '''(?i)(?:mailgun)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(pubkey-[a-f0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "mailgun",
-]
-
-[[rules]]
-description = "Mailgun webhook signing key"
-id = "mailgun-signing-key"
-regex = '''(?i)(?:mailgun)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "mailgun",
-]
-
-[[rules]]
-description = "MapBox API token"
-id = "mapbox-api-token"
-regex = '''(?i)(?:mapbox)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(pk\.[a-z0-9]{60}\.[a-z0-9]{22})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "mapbox",
-]
-
-[[rules]]
-description = "Mattermost Access Token"
-id = "mattermost-access-token"
-regex = '''(?i)(?:mattermost)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{26})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "mattermost",
-]
-
-[[rules]]
-description = "MessageBird API token"
-id = "messagebird-api-token"
-regex = '''(?i)(?:messagebird|message-bird|message_bird)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{25})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "messagebird","message-bird","message_bird",
-]
-
-[[rules]]
-description = "MessageBird client ID"
-id = "messagebird-client-id"
-regex = '''(?i)(?:messagebird|message-bird|message_bird)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "messagebird","message-bird","message_bird",
-]
-
-[[rules]]
-description = "Microsoft Teams Webhook"
-id = "microsoft-teams-webhook"
-regex = '''https:\/\/[a-z0-9]+\.webhook\.office\.com\/webhookb2\/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}\/IncomingWebhook\/[a-z0-9]{32}\/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}'''
-keywords = [
- "webhook.office.com","webhookb2","incomingwebhook",
-]
-
-[[rules]]
-description = "Netlify Access Token"
-id = "netlify-access-token"
-regex = '''(?i)(?:netlify)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9=_\-]{40,46})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "netlify",
-]
-
-[[rules]]
-description = "New Relic ingest browser API token"
-id = "new-relic-browser-api-token"
-regex = '''(?i)(?:new-relic|newrelic|new_relic)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(NRJS-[a-f0-9]{19})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "nrjs-",
-]
-
-[[rules]]
-description = "New Relic user API ID"
-id = "new-relic-user-api-id"
-regex = '''(?i)(?:new-relic|newrelic|new_relic)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "new-relic","newrelic","new_relic",
-]
-
-[[rules]]
-description = "New Relic user API Key"
-id = "new-relic-user-api-key"
-regex = '''(?i)(?:new-relic|newrelic|new_relic)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(NRAK-[a-z0-9]{27})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "nrak",
-]
-
-[[rules]]
-description = "npm access token"
-id = "npm-access-token"
-regex = '''(?i)\b(npm_[a-z0-9]{36})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "npm_",
-]
-
-[[rules]]
-description = "Nytimes Access Token"
-id = "nytimes-access-token"
-regex = '''(?i)(?:nytimes|new-york-times,|newyorktimes)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9=_\-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "nytimes","new-york-times","newyorktimes",
-]
-
-[[rules]]
-description = "Okta Access Token"
-id = "okta-access-token"
-regex = '''(?i)(?:okta)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9=_\-]{42})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "okta",
-]
-
-[[rules]]
-description = "Plaid API Token"
-id = "plaid-api-token"
-regex = '''(?i)(?:plaid)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(access-(?:sandbox|development|production)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "plaid",
-]
-
-[[rules]]
-description = "Plaid Client ID"
-id = "plaid-client-id"
-regex = '''(?i)(?:plaid)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{24})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "plaid",
-]
-
-[[rules]]
-description = "Plaid Secret key"
-id = "plaid-secret-key"
-regex = '''(?i)(?:plaid)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{30})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "plaid",
-]
-
-[[rules]]
-description = "PlanetScale API token"
-id = "planetscale-api-token"
-regex = '''(?i)\b(pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "pscale_tkn_",
-]
-
-[[rules]]
-description = "PlanetScale OAuth token"
-id = "planetscale-oauth-token"
-regex = '''(?i)\b(pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "pscale_oauth_",
-]
-
-[[rules]]
-description = "PlanetScale password"
-id = "planetscale-password"
-regex = '''(?i)\b(pscale_pw_(?i)[a-z0-9=\-_\.]{32,64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "pscale_pw_",
-]
-
-[[rules]]
-description = "Postman API token"
-id = "postman-api-token"
-regex = '''(?i)\b(PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "pmak-",
-]
-
-[[rules]]
-description = "Prefect API token"
-id = "prefect-api-token"
-regex = '''(?i)\b(pnu_[a-z0-9]{36})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "pnu_",
-]
-
-[[rules]]
-description = "Private Key"
-id = "private-key"
-regex = '''(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY( BLOCK)?-----[\s\S-]*KEY( BLOCK)?----'''
-keywords = [
- "-----begin",
-]
-
-[[rules]]
-description = "Pulumi API token"
-id = "pulumi-api-token"
-regex = '''(?i)\b(pul-[a-f0-9]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "pul-",
-]
-
-[[rules]]
-description = "PyPI upload token"
-id = "pypi-upload-token"
-regex = '''pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}'''
-keywords = [
- "pypi-ageichlwas5vcmc",
-]
-
-[[rules]]
-description = "RapidAPI Access Token"
-id = "rapidapi-access-token"
-regex = '''(?i)(?:rapidapi)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9_-]{50})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "rapidapi",
-]
-
-[[rules]]
-description = "Readme API token"
-id = "readme-api-token"
-regex = '''(?i)\b(rdme_[a-z0-9]{70})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "rdme_",
-]
-
-[[rules]]
-description = "Rubygem API token"
-id = "rubygems-api-token"
-regex = '''(?i)\b(rubygems_[a-f0-9]{48})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "rubygems_",
-]
-
-[[rules]]
-description = "Sendbird Access ID"
-id = "sendbird-access-id"
-regex = '''(?i)(?:sendbird)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "sendbird",
-]
-
-[[rules]]
-description = "Sendbird Access Token"
-id = "sendbird-access-token"
-regex = '''(?i)(?:sendbird)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "sendbird",
-]
-
-[[rules]]
-description = "SendGrid API token"
-id = "sendgrid-api-token"
-regex = '''(?i)\b(SG\.(?i)[a-z0-9=_\-\.]{66})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "sg.",
-]
-
-[[rules]]
-description = "Sendinblue API token"
-id = "sendinblue-api-token"
-regex = '''(?i)\b(xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "xkeysib-",
-]
-
-[[rules]]
-description = "Sentry Access Token"
-id = "sentry-access-token"
-regex = '''(?i)(?:sentry)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "sentry",
-]
-
-[[rules]]
-description = "Shippo API token"
-id = "shippo-api-token"
-regex = '''(?i)\b(shippo_(live|test)_[a-f0-9]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "shippo_",
-]
-
-[[rules]]
-description = "Shopify access token"
-id = "shopify-access-token"
-regex = '''shpat_[a-fA-F0-9]{32}'''
-keywords = [
- "shpat_",
-]
-
-[[rules]]
-description = "Shopify custom access token"
-id = "shopify-custom-access-token"
-regex = '''shpca_[a-fA-F0-9]{32}'''
-keywords = [
- "shpca_",
-]
-
-[[rules]]
-description = "Shopify private app access token"
-id = "shopify-private-app-access-token"
-regex = '''shppa_[a-fA-F0-9]{32}'''
-keywords = [
- "shppa_",
-]
-
-[[rules]]
-description = "Shopify shared secret"
-id = "shopify-shared-secret"
-regex = '''shpss_[a-fA-F0-9]{32}'''
-keywords = [
- "shpss_",
-]
-
-[[rules]]
-description = "Sidekiq Secret"
-id = "sidekiq-secret"
-regex = '''(?i)(?:BUNDLE_ENTERPRISE__CONTRIBSYS__COM|BUNDLE_GEMS__CONTRIBSYS__COM)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{8}:[a-f0-9]{8})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "bundle_enterprise__contribsys__com","bundle_gems__contribsys__com",
-]
-
-[[rules]]
-description = "Sidekiq Sensitive URL"
-id = "sidekiq-sensitive-url"
-regex = '''(?i)\b(http(?:s??):\/\/)([a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\/|\#|\?|:]|$)'''
-secretGroup = 2
-keywords = [
- "gems.contribsys.com","enterprise.contribsys.com",
-]
-
-[[rules]]
-description = "Slack token"
-id = "slack-access-token"
-regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})'''
-keywords = [
- "xoxb","xoxa","xoxp","xoxr","xoxs",
-]
-
-[[rules]]
-description = "Slack Webhook"
-id = "slack-web-hook"
-regex = '''https:\/\/hooks.slack.com\/(services|workflows)\/[A-Za-z0-9+\/]{44,46}'''
-keywords = [
- "hooks.slack.com",
-]
-
-[[rules]]
-description = "Square Access Token"
-id = "square-access-token"
-regex = '''(?i)\b(sq0atp-[0-9A-Za-z\-_]{22})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "sq0atp-",
-]
-
-[[rules]]
-description = "Squarespace Access Token"
-id = "squarespace-access-token"
-regex = '''(?i)(?:squarespace)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "squarespace",
-]
-
-[[rules]]
-description = "Stripe Access Token"
-id = "stripe-access-token"
-regex = '''(?i)(sk|pk)_(test|live)_[0-9a-z]{10,32}'''
-keywords = [
- "sk_test","pk_test","sk_live","pk_live",
-]
-
-[[rules]]
-description = "SumoLogic Access ID"
-id = "sumologic-access-id"
-regex = '''(?i)(?:sumo)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{14})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "sumo",
-]
-
-[[rules]]
-description = "SumoLogic Access Token"
-id = "sumologic-access-token"
-regex = '''(?i)(?:sumo)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "sumo",
-]
-
-[[rules]]
-description = "Telegram Bot API Token"
-id = "telegram-bot-api-token"
-regex = '''(?i)(?:^|[^0-9])([0-9]{5,16}:A[a-zA-Z0-9_\-]{34})(?:$|[^a-zA-Z0-9_\-])'''
-secretGroup = 1
-keywords = [
- "telegram","api","bot","token","url",
-]
-
-[[rules]]
-description = "Travis CI Access Token"
-id = "travisci-access-token"
-regex = '''(?i)(?:travis)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{22})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "travis",
-]
-
-[[rules]]
-description = "Twilio API Key"
-id = "twilio-api-key"
-regex = '''SK[0-9a-fA-F]{32}'''
-keywords = [
- "twilio",
-]
-
-[[rules]]
-description = "Twitch API token"
-id = "twitch-api-token"
-regex = '''(?i)(?:twitch)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{30})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "twitch",
-]
-
-[[rules]]
-description = "Twitter Access Secret"
-id = "twitter-access-secret"
-regex = '''(?i)(?:twitter)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{45})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "twitter",
-]
-
-[[rules]]
-description = "Twitter Access Token"
-id = "twitter-access-token"
-regex = '''(?i)(?:twitter)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([0-9]{15,25}-[a-zA-Z0-9]{20,40})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "twitter",
-]
-
-[[rules]]
-description = "Twitter API Key"
-id = "twitter-api-key"
-regex = '''(?i)(?:twitter)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{25})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "twitter",
-]
-
-[[rules]]
-description = "Twitter API Secret"
-id = "twitter-api-secret"
-regex = '''(?i)(?:twitter)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{50})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "twitter",
-]
-
-[[rules]]
-description = "Twitter Bearer Token"
-id = "twitter-bearer-token"
-regex = '''(?i)(?:twitter)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(A{22}[a-zA-Z0-9%]{80,100})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "twitter",
-]
-
-[[rules]]
-description = "Typeform API token"
-id = "typeform-api-token"
-regex = '''(?i)(?:typeform)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(tfp_[a-z0-9\-_\.=]{59})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "tfp_",
-]
-
-[[rules]]
-description = "Vault Batch Token"
-id = "vault-batch-token"
-regex = '''(?i)\b(hvb\.[a-z0-9_-]{138,212})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "hvb",
-]
-
-[[rules]]
-description = "Vault Service Token"
-id = "vault-service-token"
-regex = '''(?i)\b(hvs\.[a-z0-9_-]{90,100})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-keywords = [
- "hvs",
-]
-
-[[rules]]
-description = "Yandex Access Token"
-id = "yandex-access-token"
-regex = '''(?i)(?:yandex)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "yandex",
-]
-
-[[rules]]
-description = "Yandex API Key"
-id = "yandex-api-key"
-regex = '''(?i)(?:yandex)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(AQVN[A-Za-z0-9_\-]{35,38})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "yandex",
-]
-
-[[rules]]
-description = "Yandex AWS Access Token"
-id = "yandex-aws-access-token"
-regex = '''(?i)(?:yandex)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}(YC[a-zA-Z0-9_\-]{38})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "yandex",
-]
-
-[[rules]]
-description = "Zendesk Secret Key"
-id = "zendesk-secret-key"
-regex = '''(?i)(?:zendesk)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:=|\|\|:|<=|=>|:)(?:'|\"|\s|=|\x60){0,5}([a-z0-9]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
-secretGroup = 1
-keywords = [
- "zendesk",
-]
-
-
diff --git a/cli/config/rule.go b/cli/config/rule.go
deleted file mode 100644
index b7c8c15185..0000000000
--- a/cli/config/rule.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package config
-
-import (
- "regexp"
-)
-
-// Rules contain information that define details on how to detect secrets
-type Rule struct {
- // Description is the description of the rule.
- Description string
-
- // RuleID is a unique identifier for this rule
- RuleID string
-
- // Entropy is a float representing the minimum shannon
- // entropy a regex group must have to be considered a secret.
- Entropy float64
-
- // SecretGroup is an int used to extract secret from regex
- // match and used as the group that will have its entropy
- // checked if `entropy` is set.
- SecretGroup int
-
- // Regex is a golang regular expression used to detect secrets.
- Regex *regexp.Regexp
-
- // Path is a golang regular expression used to
- // filter secrets by path
- Path *regexp.Regexp
-
- // Tags is an array of strings used for metadata
- // and reporting purposes.
- Tags []string
-
- // Keywords are used for pre-regex check filtering. Rules that contain
- // keywords will perform a quick string compare check to make sure the
- // keyword(s) are in the content being scanned.
- Keywords []string
-
- // Allowlist allows a rule to be ignored for specific
- // regexes, paths, and/or commits
- Allowlist Allowlist
-}
diff --git a/cli/config/utils.go b/cli/config/utils.go
deleted file mode 100644
index ada6ff0fe2..0000000000
--- a/cli/config/utils.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package config
-
-import (
- "regexp"
-)
-
-func anyRegexMatch(f string, res []*regexp.Regexp) bool {
- for _, re := range res {
- if regexMatched(f, re) {
- return true
- }
- }
- return false
-}
-
-func regexMatched(f string, re *regexp.Regexp) bool {
- if re == nil {
- return false
- }
- if re.FindString(f) != "" {
- return true
- }
- return false
-}
diff --git a/cli/detect/baseline.go b/cli/detect/baseline.go
index bd4c256657..eeaa2a73a7 100644
--- a/cli/detect/baseline.go
+++ b/cli/detect/baseline.go
@@ -25,35 +25,31 @@ package detect
import (
"encoding/json"
"fmt"
- "io"
"os"
+ "path/filepath"
- "github.com/rs/zerolog/log"
-
- "github.com/Infisical/infisical-merge/report"
+ "github.com/Infisical/infisical-merge/detect/report"
)
-func IsNew(finding report.Finding, baseline []report.Finding) bool {
+func IsNew(finding report.Finding, redact uint, baseline []report.Finding) bool {
// Explicitly testing each property as it gives significantly better performance in comparison to cmp.Equal(). Drawback is that
- // the code requires maintanance if/when the Finding struct changes
+ // the code requires maintenance if/when the Finding struct changes
for _, b := range baseline {
-
- if finding.Author == b.Author &&
- finding.Commit == b.Commit &&
- finding.Date == b.Date &&
+ if finding.RuleID == b.RuleID &&
finding.Description == b.Description &&
- finding.Email == b.Email &&
- finding.EndColumn == b.EndColumn &&
+ finding.StartLine == b.StartLine &&
finding.EndLine == b.EndLine &&
- finding.Entropy == b.Entropy &&
+ finding.StartColumn == b.StartColumn &&
+ finding.EndColumn == b.EndColumn &&
+ (redact > 0 || (finding.Match == b.Match && finding.Secret == b.Secret)) &&
finding.File == b.File &&
- // Omit checking finding.Fingerprint - if the format of the fingerprint changes, the users will see unexpected behaviour
- finding.Match == b.Match &&
+ finding.Commit == b.Commit &&
+ finding.Author == b.Author &&
+ finding.Email == b.Email &&
+ finding.Date == b.Date &&
finding.Message == b.Message &&
- finding.RuleID == b.RuleID &&
- finding.Secret == b.Secret &&
- finding.StartColumn == b.StartColumn &&
- finding.StartLine == b.StartLine {
+ // Omit checking finding.Fingerprint - if the format of the fingerprint changes, the users will see unexpected behaviour
+ finding.Entropy == b.Entropy {
return false
}
}
@@ -61,23 +57,12 @@ func IsNew(finding report.Finding, baseline []report.Finding) bool {
}
func LoadBaseline(baselinePath string) ([]report.Finding, error) {
- var previousFindings []report.Finding
- jsonFile, err := os.Open(baselinePath)
+ bytes, err := os.ReadFile(baselinePath)
if err != nil {
return nil, fmt.Errorf("could not open %s", baselinePath)
}
- defer func() {
- if cerr := jsonFile.Close(); cerr != nil {
- log.Warn().Err(cerr).Msg("problem closing jsonFile handle")
- }
- }()
-
- bytes, err := io.ReadAll(jsonFile)
- if err != nil {
- return nil, fmt.Errorf("could not read data from the file %s", baselinePath)
- }
-
+ var previousFindings []report.Finding
err = json.Unmarshal(bytes, &previousFindings)
if err != nil {
return nil, fmt.Errorf("the format of the file %s is not supported", baselinePath)
@@ -85,3 +70,34 @@ func LoadBaseline(baselinePath string) ([]report.Finding, error) {
return previousFindings, nil
}
+
+func (d *Detector) AddBaseline(baselinePath string, source string) error {
+ if baselinePath != "" {
+ absoluteSource, err := filepath.Abs(source)
+ if err != nil {
+ return err
+ }
+
+ absoluteBaseline, err := filepath.Abs(baselinePath)
+ if err != nil {
+ return err
+ }
+
+ relativeBaseline, err := filepath.Rel(absoluteSource, absoluteBaseline)
+ if err != nil {
+ return err
+ }
+
+ baseline, err := LoadBaseline(baselinePath)
+ if err != nil {
+ return err
+ }
+
+ d.baseline = baseline
+ baselinePath = relativeBaseline
+
+ }
+
+ d.baselinePath = baselinePath
+ return nil
+}
diff --git a/cli/detect/baseline_test.go b/cli/detect/baseline_test.go
deleted file mode 100644
index 91d2eb72ee..0000000000
--- a/cli/detect/baseline_test.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package detect
-
-import (
- "errors"
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/Infisical/infisical-merge/report"
-)
-
-func TestIsNew(t *testing.T) {
- tests := []struct {
- findings report.Finding
- baseline []report.Finding
- expect bool
- }{
- {
- findings: report.Finding{
- Author: "a",
- Commit: "0000",
- },
- baseline: []report.Finding{
- {
- Author: "a",
- Commit: "0000",
- },
- },
- expect: false,
- },
- {
- findings: report.Finding{
- Author: "a",
- Commit: "0000",
- },
- baseline: []report.Finding{
- {
- Author: "a",
- Commit: "0002",
- },
- },
- expect: true,
- },
- {
- findings: report.Finding{
- Author: "a",
- Commit: "0000",
- Tags: []string{"a", "b"},
- },
- baseline: []report.Finding{
- {
- Author: "a",
- Commit: "0000",
- Tags: []string{"a", "c"},
- },
- },
- expect: false, // Updated tags doesn't make it a new finding
- },
- }
- for _, test := range tests {
- assert.Equal(t, test.expect, IsNew(test.findings, test.baseline))
- }
-}
-
-func TestFileLoadBaseline(t *testing.T) {
- tests := []struct {
- Filename string
- ExpectedError error
- }{
- {
- Filename: "../testdata/baseline/baseline.csv",
- ExpectedError: errors.New("the format of the file ../testdata/baseline/baseline.csv is not supported"),
- },
- {
- Filename: "../testdata/baseline/baseline.sarif",
- ExpectedError: errors.New("the format of the file ../testdata/baseline/baseline.sarif is not supported"),
- },
- {
- Filename: "../testdata/baseline/notfound.json",
- ExpectedError: errors.New("could not open ../testdata/baseline/notfound.json"),
- },
- }
-
- for _, test := range tests {
- _, err := LoadBaseline(test.Filename)
- assert.Equal(t, test.ExpectedError.Error(), err.Error())
- }
-}
-
-func TestIgnoreIssuesInBaseline(t *testing.T) {
- tests := []struct {
- findings []report.Finding
- baseline []report.Finding
- expectCount int
- }{
- {
- findings: []report.Finding{
- {
- Author: "a",
- Commit: "5",
- },
- },
- baseline: []report.Finding{
- {
- Author: "a",
- Commit: "5",
- },
- },
- expectCount: 0,
- },
- {
- findings: []report.Finding{
- {
- Author: "a",
- Commit: "5",
- Fingerprint: "a",
- },
- },
- baseline: []report.Finding{
- {
- Author: "a",
- Commit: "5",
- Fingerprint: "b",
- },
- },
- expectCount: 0,
- },
- }
-
- for _, test := range tests {
- d, _ := NewDetectorDefaultConfig()
- d.baseline = test.baseline
- for _, finding := range test.findings {
- d.addFinding(finding)
- }
- assert.Equal(t, test.expectCount, len(d.findings))
- }
-}
diff --git a/cli/detect/cmd/scm/scm.go b/cli/detect/cmd/scm/scm.go
new file mode 100644
index 0000000000..66868aadcb
--- /dev/null
+++ b/cli/detect/cmd/scm/scm.go
@@ -0,0 +1,66 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package scm
+
+import (
+ "fmt"
+ "strings"
+)
+
+type Platform int
+
+const (
+ UnknownPlatform Platform = iota
+ NoPlatform // Explicitly disable the feature
+ GitHubPlatform
+ GitLabPlatform
+ AzureDevOpsPlatform
+ // TODO: Add others.
+)
+
+func (p Platform) String() string {
+ return [...]string{
+ "unknown",
+ "none",
+ "github",
+ "gitlab",
+ "azuredevops",
+ }[p]
+}
+
+func PlatformFromString(s string) (Platform, error) {
+ switch strings.ToLower(s) {
+ case "", "unknown":
+ return UnknownPlatform, nil
+ case "none":
+ return NoPlatform, nil
+ case "github":
+ return GitHubPlatform, nil
+ case "gitlab":
+ return GitLabPlatform, nil
+ case "azuredevops":
+ return AzureDevOpsPlatform, nil
+ default:
+ return UnknownPlatform, fmt.Errorf("invalid scm platform value: %s", s)
+ }
+}
diff --git a/cli/config/allowlist.go b/cli/detect/config/allowlist.go
similarity index 53%
rename from cli/config/allowlist.go
rename to cli/detect/config/allowlist.go
index 3733257588..d91188f68d 100644
--- a/cli/config/allowlist.go
+++ b/cli/detect/config/allowlist.go
@@ -23,63 +23,137 @@
package config
import (
- "regexp"
+ "fmt"
"strings"
+
+ "golang.org/x/exp/maps"
+
+ "github.com/Infisical/infisical-merge/detect/regexp"
+)
+
+type AllowlistMatchCondition int
+
+const (
+ AllowlistMatchOr AllowlistMatchCondition = iota
+ AllowlistMatchAnd
)
+func (a AllowlistMatchCondition) String() string {
+ return [...]string{
+ "OR",
+ "AND",
+ }[a]
+}
+
// Allowlist allows a rule to be ignored for specific
// regexes, paths, and/or commits
type Allowlist struct {
// Short human readable description of the allowlist.
Description string
- // Regexes is slice of content regular expressions that are allowed to be ignored.
- Regexes []*regexp.Regexp
+ // MatchCondition determines whether all criteria must match.
+ MatchCondition AllowlistMatchCondition
- // RegexTarget
- RegexTarget string
+ // Commits is a slice of commit SHAs that are allowed to be ignored. Defaults to "OR".
+ Commits []string
// Paths is a slice of path regular expressions that are allowed to be ignored.
Paths []*regexp.Regexp
- // Commits is a slice of commit SHAs that are allowed to be ignored.
- Commits []string
+ // Can be `match` or `line`.
+ //
+ // If `match` the _Regexes_ will be tested against the match of the _Rule.Regex_.
+ //
+ // If `line` the _Regexes_ will be tested against the entire line.
+ //
+ // If RegexTarget is empty, it will be tested against the found secret.
+ RegexTarget string
+
+ // Regexes is slice of content regular expressions that are allowed to be ignored.
+ Regexes []*regexp.Regexp
// StopWords is a slice of stop words that are allowed to be ignored.
// This targets the _secret_, not the content of the regex match like the
// Regexes slice.
StopWords []string
+
+ // validated is an internal flag to track whether `Validate()` has been called.
+ validated bool
+}
+
+func (a *Allowlist) Validate() error {
+ if a.validated {
+ return nil
+ }
+
+ // Disallow empty allowlists.
+ if len(a.Commits) == 0 &&
+ len(a.Paths) == 0 &&
+ len(a.Regexes) == 0 &&
+ len(a.StopWords) == 0 {
+ return fmt.Errorf("must contain at least one check for: commits, paths, regexes, or stopwords")
+ }
+
+ // Deduplicate commits and stopwords.
+ if len(a.Commits) > 0 {
+ uniqueCommits := make(map[string]struct{})
+ for _, commit := range a.Commits {
+ uniqueCommits[commit] = struct{}{}
+ }
+ a.Commits = maps.Keys(uniqueCommits)
+ }
+ if len(a.StopWords) > 0 {
+ uniqueStopwords := make(map[string]struct{})
+ for _, stopWord := range a.StopWords {
+ uniqueStopwords[stopWord] = struct{}{}
+ }
+ a.StopWords = maps.Keys(uniqueStopwords)
+ }
+
+ a.validated = true
+ return nil
}
// CommitAllowed returns true if the commit is allowed to be ignored.
-func (a *Allowlist) CommitAllowed(c string) bool {
- if c == "" {
- return false
+func (a *Allowlist) CommitAllowed(c string) (bool, string) {
+ if a == nil || c == "" {
+ return false, ""
}
+
for _, commit := range a.Commits {
if commit == c {
- return true
+ return true, c
}
}
- return false
+ return false, ""
}
// PathAllowed returns true if the path is allowed to be ignored.
func (a *Allowlist) PathAllowed(path string) bool {
+ if a == nil || path == "" {
+ return false
+ }
return anyRegexMatch(path, a.Paths)
}
// RegexAllowed returns true if the regex is allowed to be ignored.
-func (a *Allowlist) RegexAllowed(s string) bool {
- return anyRegexMatch(s, a.Regexes)
+func (a *Allowlist) RegexAllowed(secret string) bool {
+ if a == nil || secret == "" {
+ return false
+ }
+ return anyRegexMatch(secret, a.Regexes)
}
-func (a *Allowlist) ContainsStopWord(s string) bool {
+func (a *Allowlist) ContainsStopWord(s string) (bool, string) {
+ if a == nil || s == "" {
+ return false, ""
+ }
+
s = strings.ToLower(s)
for _, stopWord := range a.StopWords {
if strings.Contains(s, strings.ToLower(stopWord)) {
- return true
+ return true, stopWord
}
}
- return false
+ return false, ""
}
diff --git a/cli/detect/config/config.go b/cli/detect/config/config.go
new file mode 100644
index 0000000000..10c6db7e0e
--- /dev/null
+++ b/cli/detect/config/config.go
@@ -0,0 +1,426 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package config
+
+import (
+ _ "embed"
+ "errors"
+ "fmt"
+ "sort"
+ "strings"
+
+ "github.com/spf13/viper"
+
+ "github.com/Infisical/infisical-merge/detect/logging"
+ "github.com/Infisical/infisical-merge/detect/regexp"
+)
+
+const DefaultScanConfigFileName = ".infisical-scan.toml"
+const DefaultScanConfigEnvName = "INFISICAL_SCAN_CONFIG"
+const DefaultInfisicalIgnoreFineName = ".infisicalignore"
+
+var (
+ //go:embed gitleaks.toml
+ DefaultConfig string
+
+ // use to keep track of how many configs we can extend
+ // yea I know, globals bad
+ extendDepth int
+)
+
+const maxExtendDepth = 2
+
+// ViperConfig is the config struct used by the Viper config package
+// to parse the config file. This struct does not include regular expressions.
+// It is used as an intermediary to convert the Viper config to the Config struct.
+type ViperConfig struct {
+ Title string
+ Description string
+ Extend Extend
+ Rules []struct {
+ ID string
+ Description string
+ Path string
+ Regex string
+ SecretGroup int
+ Entropy float64
+ Keywords []string
+ Tags []string
+
+ // Deprecated: this is a shim for backwards-compatibility.
+ // TODO: Remove this in 9.x.
+ AllowList *viperRuleAllowlist
+ Allowlists []*viperRuleAllowlist
+ }
+ // Deprecated: this is a shim for backwards-compatibility.
+ // TODO: Remove this in 9.x.
+ AllowList *viperGlobalAllowlist
+ Allowlists []*viperGlobalAllowlist
+}
+
+type viperRuleAllowlist struct {
+ Description string
+ Condition string
+ Commits []string
+ Paths []string
+ RegexTarget string
+ Regexes []string
+ StopWords []string
+}
+
+type viperGlobalAllowlist struct {
+ TargetRules []string
+ viperRuleAllowlist `mapstructure:",squash"`
+}
+
+// Config is a configuration struct that contains rules and an allowlist if present.
+type Config struct {
+ Title string
+ Extend Extend
+ Path string
+ Description string
+ Rules map[string]Rule
+ Keywords map[string]struct{}
+ // used to keep sarif results consistent
+ OrderedRules []string
+ Allowlists []*Allowlist
+}
+
+// Extend is a struct that allows users to define how they want their
+// configuration extended by other configuration files.
+type Extend struct {
+ Path string
+ URL string
+ UseDefault bool
+ DisabledRules []string
+}
+
+func (vc *ViperConfig) Translate() (Config, error) {
+ var (
+ keywords = make(map[string]struct{})
+ orderedRules []string
+ rulesMap = make(map[string]Rule)
+ ruleAllowlists = make(map[string][]*Allowlist)
+ )
+
+ // Validate individual rules.
+ for _, vr := range vc.Rules {
+ var (
+ pathPat *regexp.Regexp
+ regexPat *regexp.Regexp
+ )
+ if vr.Path != "" {
+ pathPat = regexp.MustCompile(vr.Path)
+ }
+ if vr.Regex != "" {
+ regexPat = regexp.MustCompile(vr.Regex)
+ }
+ if vr.Keywords == nil {
+ vr.Keywords = []string{}
+ } else {
+ for i, k := range vr.Keywords {
+ keyword := strings.ToLower(k)
+ keywords[keyword] = struct{}{}
+ vr.Keywords[i] = keyword
+ }
+ }
+ if vr.Tags == nil {
+ vr.Tags = []string{}
+ }
+ cr := Rule{
+ RuleID: vr.ID,
+ Description: vr.Description,
+ Regex: regexPat,
+ SecretGroup: vr.SecretGroup,
+ Entropy: vr.Entropy,
+ Path: pathPat,
+ Keywords: vr.Keywords,
+ Tags: vr.Tags,
+ }
+
+ // Parse the rule allowlists, including the older format for backwards compatibility.
+ if vr.AllowList != nil {
+ // TODO: Remove this in v9.
+ if len(vr.Allowlists) > 0 {
+ return Config{}, fmt.Errorf("%s: [rules.allowlist] is deprecated, it cannot be used alongside [[rules.allowlist]]", cr.RuleID)
+ }
+ vr.Allowlists = append(vr.Allowlists, vr.AllowList)
+ }
+ for _, a := range vr.Allowlists {
+ allowlist, err := parseAllowlist(a)
+ if err != nil {
+ return Config{}, fmt.Errorf("%s: [[rules.allowlists]] %w", cr.RuleID, err)
+ }
+ cr.Allowlists = append(cr.Allowlists, allowlist)
+ }
+ orderedRules = append(orderedRules, cr.RuleID)
+ rulesMap[cr.RuleID] = cr
+ }
+
+ // Assemble the config.
+ c := Config{
+ Title: vc.Title,
+ Description: vc.Description,
+ Extend: vc.Extend,
+ Rules: rulesMap,
+ Keywords: keywords,
+ OrderedRules: orderedRules,
+ }
+ // Parse the config allowlists, including the older format for backwards compatibility.
+ if vc.AllowList != nil {
+ // TODO: Remove this in v9.
+ if len(vc.Allowlists) > 0 {
+ return Config{}, errors.New("[allowlist] is deprecated, it cannot be used alongside [[allowlists]]")
+ }
+ vc.Allowlists = append(vc.Allowlists, vc.AllowList)
+ }
+ for _, a := range vc.Allowlists {
+ allowlist, err := parseAllowlist(&a.viperRuleAllowlist)
+ if err != nil {
+ return Config{}, fmt.Errorf("[[allowlists]] %w", err)
+ }
+ // Allowlists with |targetRules| aren't added to the global list.
+ if len(a.TargetRules) > 0 {
+ for _, ruleID := range a.TargetRules {
+ // It's not possible to validate |ruleID| until after extend.
+ ruleAllowlists[ruleID] = append(ruleAllowlists[ruleID], allowlist)
+ }
+ } else {
+ c.Allowlists = append(c.Allowlists, allowlist)
+ }
+ }
+
+ if maxExtendDepth != extendDepth {
+ // disallow both usedefault and path from being set
+ if c.Extend.Path != "" && c.Extend.UseDefault {
+ return Config{}, errors.New("unable to load config due to extend.path and extend.useDefault being set")
+ }
+ if c.Extend.UseDefault {
+ if err := c.extendDefault(); err != nil {
+ return Config{}, err
+ }
+ } else if c.Extend.Path != "" {
+ if err := c.extendPath(); err != nil {
+ return Config{}, err
+ }
+ }
+ }
+
+ // Validate the rules after everything has been assembled (including extended configs).
+ if extendDepth == 0 {
+ for _, rule := range c.Rules {
+ if err := rule.Validate(); err != nil {
+ return Config{}, err
+ }
+ }
+
+ // Populate targeted configs.
+ for ruleID, allowlists := range ruleAllowlists {
+ rule, ok := c.Rules[ruleID]
+ if !ok {
+ return Config{}, fmt.Errorf("[[allowlists]] target rule ID '%s' does not exist", ruleID)
+ }
+ rule.Allowlists = append(rule.Allowlists, allowlists...)
+ c.Rules[ruleID] = rule
+ }
+ }
+
+ return c, nil
+}
+
+func parseAllowlist(a *viperRuleAllowlist) (*Allowlist, error) {
+ var matchCondition AllowlistMatchCondition
+ switch strings.ToUpper(a.Condition) {
+ case "AND", "&&":
+ matchCondition = AllowlistMatchAnd
+ case "", "OR", "||":
+ matchCondition = AllowlistMatchOr
+ default:
+ return nil, fmt.Errorf("unknown allowlist |condition| '%s' (expected 'and', 'or')", a.Condition)
+ }
+
+ // Validate the target.
+ regexTarget := a.RegexTarget
+ if regexTarget != "" {
+ switch regexTarget {
+ case "secret":
+ regexTarget = ""
+ case "match", "line":
+ // do nothing
+ default:
+ return nil, fmt.Errorf("unknown allowlist |regexTarget| '%s' (expected 'match', 'line')", regexTarget)
+ }
+ }
+ var allowlistRegexes []*regexp.Regexp
+ for _, a := range a.Regexes {
+ allowlistRegexes = append(allowlistRegexes, regexp.MustCompile(a))
+ }
+ var allowlistPaths []*regexp.Regexp
+ for _, a := range a.Paths {
+ allowlistPaths = append(allowlistPaths, regexp.MustCompile(a))
+ }
+
+ allowlist := &Allowlist{
+ Description: a.Description,
+ MatchCondition: matchCondition,
+ Commits: a.Commits,
+ Paths: allowlistPaths,
+ RegexTarget: regexTarget,
+ Regexes: allowlistRegexes,
+ StopWords: a.StopWords,
+ }
+ if err := allowlist.Validate(); err != nil {
+ return nil, err
+ }
+ return allowlist, nil
+}
+
+func (c *Config) GetOrderedRules() []Rule {
+ var orderedRules []Rule
+ for _, id := range c.OrderedRules {
+ if _, ok := c.Rules[id]; ok {
+ orderedRules = append(orderedRules, c.Rules[id])
+ }
+ }
+ return orderedRules
+}
+
+func (c *Config) extendDefault() error {
+ extendDepth++
+ viper.SetConfigType("toml")
+ if err := viper.ReadConfig(strings.NewReader(DefaultConfig)); err != nil {
+ return fmt.Errorf("failed to load extended default config, err: %w", err)
+ }
+ defaultViperConfig := ViperConfig{}
+ if err := viper.Unmarshal(&defaultViperConfig); err != nil {
+ return fmt.Errorf("failed to load extended default config, err: %w", err)
+ }
+ cfg, err := defaultViperConfig.Translate()
+ if err != nil {
+ return fmt.Errorf("failed to load extended default config, err: %w", err)
+
+ }
+ logging.Debug().Msg("extending config with default config")
+ c.extend(cfg)
+ return nil
+}
+
+func (c *Config) extendPath() error {
+ extendDepth++
+ viper.SetConfigFile(c.Extend.Path)
+ if err := viper.ReadInConfig(); err != nil {
+ return fmt.Errorf("failed to load extended config, err: %w", err)
+ }
+ extensionViperConfig := ViperConfig{}
+ if err := viper.Unmarshal(&extensionViperConfig); err != nil {
+ return fmt.Errorf("failed to load extended config, err: %w", err)
+ }
+ cfg, err := extensionViperConfig.Translate()
+ if err != nil {
+ return fmt.Errorf("failed to load extended config, err: %w", err)
+ }
+ logging.Debug().Msgf("extending config with %s", c.Extend.Path)
+ c.extend(cfg)
+ return nil
+}
+
+func (c *Config) extendURL() {
+ // TODO
+}
+
+func (c *Config) extend(extensionConfig Config) {
+ // Get config name for helpful log messages.
+ var configName string
+ if c.Extend.Path != "" {
+ configName = c.Extend.Path
+ } else {
+ configName = "default"
+ }
+ // Convert |Config.DisabledRules| into a map for ease of access.
+ disabledRuleIDs := map[string]struct{}{}
+ for _, id := range c.Extend.DisabledRules {
+ if _, ok := extensionConfig.Rules[id]; !ok {
+ logging.Warn().
+ Str("rule-id", id).
+ Str("config", configName).
+ Msg("Disabled rule doesn't exist in extended config.")
+ }
+ disabledRuleIDs[id] = struct{}{}
+ }
+
+ for ruleID, baseRule := range extensionConfig.Rules {
+ // Skip the rule.
+ if _, ok := disabledRuleIDs[ruleID]; ok {
+ logging.Debug().
+ Str("rule-id", ruleID).
+ Str("config", configName).
+ Msg("Ignoring rule from extended config.")
+ continue
+ }
+
+ currentRule, ok := c.Rules[ruleID]
+ if !ok {
+ // Rule doesn't exist, add it to the config.
+ c.Rules[ruleID] = baseRule
+ for _, k := range baseRule.Keywords {
+ c.Keywords[k] = struct{}{}
+ }
+ c.OrderedRules = append(c.OrderedRules, ruleID)
+ } else {
+ // Rule exists, merge our changes into the base.
+ if currentRule.Description != "" {
+ baseRule.Description = currentRule.Description
+ }
+ if currentRule.Entropy != 0 {
+ baseRule.Entropy = currentRule.Entropy
+ }
+ if currentRule.SecretGroup != 0 {
+ baseRule.SecretGroup = currentRule.SecretGroup
+ }
+ if currentRule.Regex != nil {
+ baseRule.Regex = currentRule.Regex
+ }
+ if currentRule.Path != nil {
+ baseRule.Path = currentRule.Path
+ }
+ baseRule.Tags = append(baseRule.Tags, currentRule.Tags...)
+ baseRule.Keywords = append(baseRule.Keywords, currentRule.Keywords...)
+ for _, a := range currentRule.Allowlists {
+ baseRule.Allowlists = append(baseRule.Allowlists, a)
+ }
+ // The keywords from the base rule and the extended rule must be merged into the global keywords list
+ for _, k := range baseRule.Keywords {
+ c.Keywords[k] = struct{}{}
+ }
+ c.Rules[ruleID] = baseRule
+ }
+ }
+
+ // append allowlists, not attempting to merge
+ for _, a := range extensionConfig.Allowlists {
+ c.Allowlists = append(c.Allowlists, a)
+ }
+
+ // sort to keep extended rules in order
+ sort.Strings(c.OrderedRules)
+}
diff --git a/cli/detect/config/gitleaks.toml b/cli/detect/config/gitleaks.toml
new file mode 100644
index 0000000000..92a06a3191
--- /dev/null
+++ b/cli/detect/config/gitleaks.toml
@@ -0,0 +1,3130 @@
+# This file has been auto-generated. Do not edit manually.
+# If you would like to contribute new rules, please use
+# cmd/generate/config/main.go and follow the contributing guidelines
+# at https://github.com/gitleaks/gitleaks/blob/master/CONTRIBUTING.md
+#
+# How the hell does secret scanning work? Read this:
+# https://lookingatcomputer.substack.com/p/regex-is-almost-all-you-need
+#
+# This is the default gitleaks configuration file.
+# Rules and allowlists are defined within this file.
+# Rules instruct gitleaks on what should be considered a secret.
+# Allowlists instruct gitleaks on what is allowed, i.e. not a secret.
+
+title = "gitleaks config"
+
+# TODO: change to [[allowlists]]
+[allowlist]
+description = "global allow lists"
+paths = [
+ '''gitleaks\.toml''',
+ '''(?i)\.(?:bmp|gif|jpe?g|png|svg|tiff?)$''',
+ '''(?i)\.(?:eot|[ot]tf|woff2?)$''',
+ '''(?i)\.(?:docx?|xlsx?|pdf|bin|socket|vsidx|v2|suo|wsuo|.dll|pdb|exe|gltf|zip)$''',
+ '''go\.(?:mod|sum|work(?:\.sum)?)$''',
+ '''(?:^|/)vendor/modules\.txt$''',
+ '''(?:^|/)vendor/(?:github\.com|golang\.org/x|google\.golang\.org|gopkg\.in|istio\.io|k8s\.io|sigs\.k8s\.io)(?:/.*)?$''',
+ '''(?:^|/)gradlew(?:\.bat)?$''',
+ '''(?:^|/)gradle\.lockfile$''',
+ '''(?:^|/)mvnw(?:\.cmd)?$''',
+ '''(?:^|/)\.mvn/wrapper/MavenWrapperDownloader\.java$''',
+ '''(?:^|/)node_modules(?:/.*)?$''',
+ '''(?:^|/)(?:deno\.lock|npm-shrinkwrap\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$''',
+ '''(?:^|/)bower_components(?:/.*)?$''',
+ '''(?:^|/)(?:angular|bootstrap|jquery(?:-?ui)?|plotly|swagger-?ui)[a-zA-Z0-9.-]*(?:\.min)?\.js(?:\.map)?$''',
+ '''(?:^|/)javascript\.json$''',
+ '''(?:^|/)(?:Pipfile|poetry)\.lock$''',
+ '''(?i)(?:^|/)(?:v?env|virtualenv)/lib(?:64)?(?:/.*)?$''',
+ '''(?i)(?:^|/)(?:lib(?:64)?/python[23](?:\.\d{1,2})+|python/[23](?:\.\d{1,2})+/lib(?:64)?)(?:/.*)?$''',
+ '''(?i)(?:^|/)[a-z0-9_.]+-[0-9.]+\.dist-info(?:/.+)?$''',
+ '''(?:^|/)vendor/(?:bundle|ruby)(?:/.*?)?$''',
+ '''\.gem$''',
+ '''verification-metadata\.xml''',
+ '''Database.refactorlog''',
+]
+regexes = [
+ '''(?i)^true|false|null$''',
+ '''^(?i:a+|b+|c+|d+|e+|f+|g+|h+|i+|j+|k+|l+|m+|n+|o+|p+|q+|r+|s+|t+|u+|v+|w+|x+|y+|z+|\*+|\.+)$''',
+ '''^\$(?:\d+|{\d+})$''',
+ '''^\$(?:[A-Z_]+|[a-z_]+)$''',
+ '''^\${(?:[A-Z_]+|[a-z_]+)}$''',
+ '''^\{\{[ \t]*[\w ().|]+[ \t]*}}$''',
+ '''^\$\{\{[ \t]*(?:(?:env|github|secrets|vars)(?:\.[A-Za-z]\w+)+[\w "'&./=|]*)[ \t]*}}$''',
+ '''^%(?:[A-Z_]+|[a-z_]+)%$''',
+ '''^%[+\-# 0]?[bcdeEfFgGoOpqstTUvxX]$''',
+ '''^\{\d{0,2}}$''',
+ '''^@(?:[A-Z_]+|[a-z_]+)@$''',
+ '''^/Users/(?i)[a-z0-9]+/[\w .-/]+$''',
+ '''^/(?:bin|etc|home|opt|tmp|usr|var)/[\w ./-]+$''',
+]
+stopwords = [
+ "abcdefghijklmnopqrstuvwxyz",
+ "014df517-39d1-4453-b7b3-9930c563627c",
+]
+
+[[rules]]
+id = "1password-secret-key"
+description = "Uncovered a possible 1Password secret key, potentially compromising access to secrets in vaults."
+regex = '''\bA3-[A-Z0-9]{6}-(?:(?:[A-Z0-9]{11})|(?:[A-Z0-9]{6}-[A-Z0-9]{5}))-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}\b'''
+entropy = 3.8
+keywords = ["a3-"]
+
+[[rules]]
+id = "1password-service-account-token"
+description = "Uncovered a possible 1Password service account token, potentially compromising access to secrets in vaults."
+regex = '''ops_eyJ[a-zA-Z0-9+/]{250,}={0,3}'''
+entropy = 4
+keywords = ["ops_"]
+
+[[rules]]
+id = "adafruit-api-key"
+description = "Identified a potential Adafruit API Key, which could lead to unauthorized access to Adafruit services and sensitive data exposure."
+regex = '''(?i)[\w.-]{0,50}?(?:adafruit)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9_-]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["adafruit"]
+
+[[rules]]
+id = "adobe-client-id"
+description = "Detected a pattern that resembles an Adobe OAuth Web Client ID, posing a risk of compromised Adobe integrations and data breaches."
+regex = '''(?i)[\w.-]{0,50}?(?:adobe)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["adobe"]
+
+[[rules]]
+id = "adobe-client-secret"
+description = "Discovered a potential Adobe Client Secret, which, if exposed, could allow unauthorized Adobe service access and data manipulation."
+regex = '''\b(p8e-(?i)[a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["p8e-"]
+
+[[rules]]
+id = "age-secret-key"
+description = "Discovered a potential Age encryption tool secret key, risking data decryption and unauthorized access to sensitive information."
+regex = '''AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}'''
+keywords = ["age-secret-key-1"]
+
+[[rules]]
+id = "airtable-api-key"
+description = "Uncovered a possible Airtable API Key, potentially compromising database access and leading to data leakage or alteration."
+regex = '''(?i)[\w.-]{0,50}?(?:airtable)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{17})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["airtable"]
+
+[[rules]]
+id = "algolia-api-key"
+description = "Identified an Algolia API Key, which could result in unauthorized search operations and data exposure on Algolia-managed platforms."
+regex = '''(?i)[\w.-]{0,50}?(?:algolia)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["algolia"]
+
+[[rules]]
+id = "alibaba-access-key-id"
+description = "Detected an Alibaba Cloud AccessKey ID, posing a risk of unauthorized cloud resource access and potential data compromise."
+regex = '''\b(LTAI(?i)[a-z0-9]{20})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["ltai"]
+
+[[rules]]
+id = "alibaba-secret-key"
+description = "Discovered a potential Alibaba Cloud Secret Key, potentially allowing unauthorized operations and data access within Alibaba Cloud."
+regex = '''(?i)[\w.-]{0,50}?(?:alibaba)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{30})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["alibaba"]
+
+[[rules]]
+id = "asana-client-id"
+description = "Discovered a potential Asana Client ID, risking unauthorized access to Asana projects and sensitive task information."
+regex = '''(?i)[\w.-]{0,50}?(?:asana)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9]{16})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["asana"]
+
+[[rules]]
+id = "asana-client-secret"
+description = "Identified an Asana Client Secret, which could lead to compromised project management integrity and unauthorized access."
+regex = '''(?i)[\w.-]{0,50}?(?:asana)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["asana"]
+
+[[rules]]
+id = "atlassian-api-token"
+description = "Detected an Atlassian API token, posing a threat to project management and collaboration tool security and data confidentiality."
+regex = '''[\w.-]{0,50}?(?i:[\w.-]{0,50}?(?:atlassian|confluence|jira)(?:[ \t\w.-]{0,20})[\s'"]{0,3})(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-zA-Z0-9]{24})(?:[\x60'"\s;]|\\[nr]|$)|\b(ATATT3[A-Za-z0-9_\-=]{186})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3.5
+keywords = [
+ "atlassian",
+ "confluence",
+ "jira",
+ "atatt3",
+]
+
+[[rules]]
+id = "authress-service-client-access-key"
+description = "Uncovered a possible Authress Service Client Access Key, which may compromise access control services and sensitive data."
+regex = '''\b((?:sc|ext|scauth|authress)_(?i)[a-z0-9]{5,30}\.[a-z0-9]{4,6}\.(?-i:acc)[_-][a-z0-9-]{10,32}\.[a-z0-9+/_=-]{30,120})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = [
+ "sc_",
+ "ext_",
+ "scauth_",
+ "authress_",
+]
+
+[[rules]]
+id = "aws-access-token"
+description = "Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms."
+regex = '''\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16})\b'''
+entropy = 3
+keywords = [
+ "a3t",
+ "akia",
+ "asia",
+ "abia",
+ "acca",
+]
+[[rules.allowlists]]
+regexes = [
+ '''.+EXAMPLE$''',
+]
+
+[[rules]]
+id = "azure-ad-client-secret"
+description = "Azure AD Client Secret"
+regex = '''(?:^|[\\'"\x60\s>=:(,)])([a-zA-Z0-9_~.]{3}\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\'"\x60\s<),])'''
+entropy = 3
+keywords = ["q~"]
+
+[[rules]]
+id = "beamer-api-token"
+description = "Detected a Beamer API token, potentially compromising content management and exposing sensitive notifications and updates."
+regex = '''(?i)[\w.-]{0,50}?(?:beamer)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(b_[a-z0-9=_\-]{44})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["beamer"]
+
+[[rules]]
+id = "bitbucket-client-id"
+description = "Discovered a potential Bitbucket Client ID, risking unauthorized repository access and potential codebase exposure."
+regex = '''(?i)[\w.-]{0,50}?(?:bitbucket)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["bitbucket"]
+
+[[rules]]
+id = "bitbucket-client-secret"
+description = "Discovered a potential Bitbucket Client Secret, posing a risk of compromised code repositories and unauthorized access."
+regex = '''(?i)[\w.-]{0,50}?(?:bitbucket)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9=_\-]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["bitbucket"]
+
+[[rules]]
+id = "bittrex-access-key"
+description = "Identified a Bittrex Access Key, which could lead to unauthorized access to cryptocurrency trading accounts and financial loss."
+regex = '''(?i)[\w.-]{0,50}?(?:bittrex)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["bittrex"]
+
+[[rules]]
+id = "bittrex-secret-key"
+description = "Detected a Bittrex Secret Key, potentially compromising cryptocurrency transactions and financial security."
+regex = '''(?i)[\w.-]{0,50}?(?:bittrex)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["bittrex"]
+
+[[rules]]
+id = "cisco-meraki-api-key"
+description = "Cisco Meraki is a cloud-managed IT solution that provides networking, security, and device management through an easy-to-use interface."
+regex = '''[\w.-]{0,50}?(?i:[\w.-]{0,50}?(?:(?-i:[Mm]eraki|MERAKI))(?:[ \t\w.-]{0,20})[\s'"]{0,3})(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9a-f]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["meraki"]
+
+[[rules]]
+id = "clickhouse-cloud-api-secret-key"
+description = "Identified a pattern that may indicate clickhouse cloud API secret key, risking unauthorized clickhouse cloud api access and data breaches on ClickHouse Cloud platforms."
+regex = '''\b(4b1d[A-Za-z0-9]{38})\b'''
+entropy = 3
+keywords = ["4b1d"]
+
+[[rules]]
+id = "clojars-api-token"
+description = "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation."
+regex = '''(?i)CLOJARS_[a-z0-9]{60}'''
+entropy = 2
+keywords = ["clojars_"]
+
+[[rules]]
+id = "cloudflare-api-key"
+description = "Detected a Cloudflare API Key, potentially compromising cloud application deployments and operational security."
+regex = '''(?i)[\w.-]{0,50}?(?:cloudflare)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9_-]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["cloudflare"]
+
+[[rules]]
+id = "cloudflare-global-api-key"
+description = "Detected a Cloudflare Global API Key, potentially compromising cloud application deployments and operational security."
+regex = '''(?i)[\w.-]{0,50}?(?:cloudflare)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{37})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["cloudflare"]
+
+[[rules]]
+id = "cloudflare-origin-ca-key"
+description = "Detected a Cloudflare Origin CA Key, potentially compromising cloud application deployments and operational security."
+regex = '''\b(v1\.0-[a-f0-9]{24}-[a-f0-9]{146})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = [
+ "cloudflare",
+ "v1.0-",
+]
+
+[[rules]]
+id = "codecov-access-token"
+description = "Found a pattern resembling a Codecov Access Token, posing a risk of unauthorized access to code coverage reports and sensitive data."
+regex = '''(?i)[\w.-]{0,50}?(?:codecov)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["codecov"]
+
+[[rules]]
+id = "cohere-api-token"
+description = "Identified a Cohere Token, posing a risk of unauthorized access to AI services and data manipulation."
+regex = '''[\w.-]{0,50}?(?i:[\w.-]{0,50}?(?:cohere|CO_API_KEY)(?:[ \t\w.-]{0,20})[\s'"]{0,3})(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-zA-Z0-9]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 4
+keywords = [
+ "cohere",
+ "co_api_key",
+]
+
+[[rules]]
+id = "coinbase-access-token"
+description = "Detected a Coinbase Access Token, posing a risk of unauthorized access to cryptocurrency accounts and financial transactions."
+regex = '''(?i)[\w.-]{0,50}?(?:coinbase)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9_-]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["coinbase"]
+
+[[rules]]
+id = "confluent-access-token"
+description = "Identified a Confluent Access Token, which could compromise access to streaming data platforms and sensitive data flow."
+regex = '''(?i)[\w.-]{0,50}?(?:confluent)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{16})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["confluent"]
+
+[[rules]]
+id = "confluent-secret-key"
+description = "Found a Confluent Secret Key, potentially risking unauthorized operations and data access within Confluent services."
+regex = '''(?i)[\w.-]{0,50}?(?:confluent)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["confluent"]
+
+[[rules]]
+id = "contentful-delivery-api-token"
+description = "Discovered a Contentful delivery API token, posing a risk to content management systems and data integrity."
+regex = '''(?i)[\w.-]{0,50}?(?:contentful)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9=_\-]{43})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["contentful"]
+
+[[rules]]
+id = "curl-auth-header"
+description = "Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource."
+regex = '''\bcurl\b(?:.*?|.*?(?:[\r\n]{1,2}.*?){1,5})[ \t\n\r](?:-H|--header)(?:=|[ \t]{0,5})(?:"(?i)(?:Authorization:[ \t]{0,5}(?:Basic[ \t]([a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \t]([\w=~@.+/-]{8,})|([\w=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \t]{0,5}([\w=~@.+/-]{8,}))"|'(?i)(?:Authorization:[ \t]{0,5}(?:Basic[ \t]([a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \t]([\w=~@.+/-]{8,})|([\w=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \t]{0,5}([\w=~@.+/-]{8,}))')(?:\B|\s|\z)'''
+entropy = 2.75
+keywords = ["curl"]
+
+[[rules]]
+id = "curl-auth-user"
+description = "Discovered a potential basic authorization token provided in a curl command, which could compromise the curl accessed resource."
+regex = '''\bcurl\b(?:.*|.*(?:[\r\n]{1,2}.*){1,5})[ \t\n\r](?:-u|--user)(?:=|[ \t]{0,5})("(:[^"]{3,}|[^:"]{3,}:|[^:"]{3,}:[^"]{3,})"|'([^:']{3,}:[^']{3,})'|((?:"[^"]{3,}"|'[^']{3,}'|[\[email protected]]+):(?:"[^"]{3,}"|'[^']{3,}'|[\w${}@.-]+)))(?:\s|\z)'''
+entropy = 2
+keywords = ["curl"]
+[[rules.allowlists]]
+regexes = [
+ '''[^:]+:(?:change(?:it|me)|pass(?:word)?|pwd|test|token|\*+|x+)''',
+ '''['"]?<[^>]+>['"]?:['"]?<[^>]+>|<[^:]+:[^>]+>['"]?''',
+ '''[^:]+:\[[^]]+]''',
+ '''['"]?[^:]+['"]?:['"]?\$(?:\d|\w+|\{(?:\d|\w+)})['"]?''',
+ '''\$\([^)]+\):\$\([^)]+\)''',
+ '''['"]?\$?{{[^}]+}}['"]?:['"]?\$?{{[^}]+}}['"]?''',
+]
+
+[[rules]]
+id = "databricks-api-token"
+description = "Uncovered a Databricks API token, which may compromise big data analytics platforms and sensitive data processing."
+regex = '''\b(dapi[a-f0-9]{32}(?:-\d)?)(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["dapi"]
+
+[[rules]]
+id = "datadog-access-token"
+description = "Detected a Datadog Access Token, potentially risking monitoring and analytics data exposure and manipulation."
+regex = '''(?i)[\w.-]{0,50}?(?:datadog)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["datadog"]
+
+[[rules]]
+id = "defined-networking-api-token"
+description = "Identified a Defined Networking API token, which could lead to unauthorized network operations and data breaches."
+regex = '''(?i)[\w.-]{0,50}?(?:dnkey)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(dnkey-[a-z0-9=_\-]{26}-[a-z0-9=_\-]{52})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["dnkey"]
+
+[[rules]]
+id = "digitalocean-access-token"
+description = "Found a DigitalOcean OAuth Access Token, risking unauthorized cloud resource access and data compromise."
+regex = '''\b(doo_v1_[a-f0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["doo_v1_"]
+
+[[rules]]
+id = "digitalocean-pat"
+description = "Discovered a DigitalOcean Personal Access Token, posing a threat to cloud infrastructure security and data privacy."
+regex = '''\b(dop_v1_[a-f0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["dop_v1_"]
+
+[[rules]]
+id = "digitalocean-refresh-token"
+description = "Uncovered a DigitalOcean OAuth Refresh Token, which could allow prolonged unauthorized access and resource manipulation."
+regex = '''(?i)\b(dor_v1_[a-f0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["dor_v1_"]
+
+[[rules]]
+id = "discord-api-token"
+description = "Detected a Discord API key, potentially compromising communication channels and user data privacy on Discord."
+regex = '''(?i)[\w.-]{0,50}?(?:discord)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["discord"]
+
+[[rules]]
+id = "discord-client-id"
+description = "Identified a Discord client ID, which may lead to unauthorized integrations and data exposure in Discord applications."
+regex = '''(?i)[\w.-]{0,50}?(?:discord)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9]{18})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["discord"]
+
+[[rules]]
+id = "discord-client-secret"
+description = "Discovered a potential Discord client secret, risking compromised Discord bot integrations and data leaks."
+regex = '''(?i)[\w.-]{0,50}?(?:discord)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9=_\-]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["discord"]
+
+[[rules]]
+id = "doppler-api-token"
+description = "Discovered a Doppler API token, posing a risk to environment and secrets management security."
+regex = '''dp\.pt\.(?i)[a-z0-9]{43}'''
+entropy = 2
+keywords = ["dp.pt."]
+
+[[rules]]
+id = "droneci-access-token"
+description = "Detected a Droneci Access Token, potentially compromising continuous integration and deployment workflows."
+regex = '''(?i)[\w.-]{0,50}?(?:droneci)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["droneci"]
+
+[[rules]]
+id = "dropbox-api-token"
+description = "Identified a Dropbox API secret, which could lead to unauthorized file access and data breaches in Dropbox storage."
+regex = '''(?i)[\w.-]{0,50}?(?:dropbox)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{15})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["dropbox"]
+
+[[rules]]
+id = "dropbox-long-lived-api-token"
+description = "Found a Dropbox long-lived API token, risking prolonged unauthorized access to cloud storage and sensitive data."
+regex = '''(?i)[\w.-]{0,50}?(?:dropbox)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\-_=]{43})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["dropbox"]
+
+[[rules]]
+id = "dropbox-short-lived-api-token"
+description = "Discovered a Dropbox short-lived API token, posing a risk of temporary but potentially harmful data access and manipulation."
+regex = '''(?i)[\w.-]{0,50}?(?:dropbox)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(sl\.[a-z0-9\-=_]{135})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["dropbox"]
+
+[[rules]]
+id = "duffel-api-token"
+description = "Uncovered a Duffel API token, which may compromise travel platform integrations and sensitive customer data."
+regex = '''duffel_(?:test|live)_(?i)[a-z0-9_\-=]{43}'''
+entropy = 2
+keywords = ["duffel_"]
+
+[[rules]]
+id = "dynatrace-api-token"
+description = "Detected a Dynatrace API token, potentially risking application performance monitoring and data exposure."
+regex = '''dt0c01\.(?i)[a-z0-9]{24}\.[a-z0-9]{64}'''
+entropy = 4
+keywords = ["dt0c01."]
+
+[[rules]]
+id = "easypost-api-token"
+description = "Identified an EasyPost API token, which could lead to unauthorized postal and shipment service access and data exposure."
+regex = '''\bEZAK(?i)[a-z0-9]{54}\b'''
+entropy = 2
+keywords = ["ezak"]
+
+[[rules]]
+id = "easypost-test-api-token"
+description = "Detected an EasyPost test API token, risking exposure of test environments and potentially sensitive shipment data."
+regex = '''\bEZTK(?i)[a-z0-9]{54}\b'''
+entropy = 2
+keywords = ["eztk"]
+
+[[rules]]
+id = "etsy-access-token"
+description = "Found an Etsy Access Token, potentially compromising Etsy shop management and customer data."
+regex = '''(?i)[\w.-]{0,50}?(?:(?-i:ETSY|[Ee]tsy))(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{24})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["etsy"]
+
+[[rules]]
+id = "facebook-access-token"
+description = "Discovered a Facebook Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure."
+regex = '''(?i)\b(\d{15,16}(\||%)[0-9a-z\-_]{27,40})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["facebook"]
+
+[[rules]]
+id = "facebook-page-access-token"
+description = "Discovered a Facebook Page Access Token, posing a risk of unauthorized access to Facebook accounts and personal data exposure."
+regex = '''\b(EAA[MC](?i)[a-z0-9]{100,})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 4
+keywords = [
+ "eaam",
+ "eaac",
+]
+
+[[rules]]
+id = "facebook-secret"
+description = "Discovered a Facebook Application secret, posing a risk of unauthorized access to Facebook accounts and personal data exposure."
+regex = '''(?i)[\w.-]{0,50}?(?:facebook)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["facebook"]
+
+[[rules]]
+id = "fastly-api-token"
+description = "Uncovered a Fastly API key, which may compromise CDN and edge cloud services, leading to content delivery and security issues."
+regex = '''(?i)[\w.-]{0,50}?(?:fastly)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9=_\-]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["fastly"]
+
+[[rules]]
+id = "finicity-api-token"
+description = "Detected a Finicity API token, potentially risking financial data access and unauthorized financial operations."
+regex = '''(?i)[\w.-]{0,50}?(?:finicity)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["finicity"]
+
+[[rules]]
+id = "finicity-client-secret"
+description = "Identified a Finicity Client Secret, which could lead to compromised financial service integrations and data breaches."
+regex = '''(?i)[\w.-]{0,50}?(?:finicity)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{20})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["finicity"]
+
+[[rules]]
+id = "finnhub-access-token"
+description = "Found a Finnhub Access Token, risking unauthorized access to financial market data and analytics."
+regex = '''(?i)[\w.-]{0,50}?(?:finnhub)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{20})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["finnhub"]
+
+[[rules]]
+id = "flickr-access-token"
+description = "Discovered a Flickr Access Token, posing a risk of unauthorized photo management and potential data leakage."
+regex = '''(?i)[\w.-]{0,50}?(?:flickr)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["flickr"]
+
+[[rules]]
+id = "flutterwave-encryption-key"
+description = "Uncovered a Flutterwave Encryption Key, which may compromise payment processing and sensitive financial information."
+regex = '''FLWSECK_TEST-(?i)[a-h0-9]{12}'''
+entropy = 2
+keywords = ["flwseck_test"]
+
+[[rules]]
+id = "flutterwave-public-key"
+description = "Detected a Finicity Public Key, potentially exposing public cryptographic operations and integrations."
+regex = '''FLWPUBK_TEST-(?i)[a-h0-9]{32}-X'''
+entropy = 2
+keywords = ["flwpubk_test"]
+
+[[rules]]
+id = "flutterwave-secret-key"
+description = "Identified a Flutterwave Secret Key, risking unauthorized financial transactions and data breaches."
+regex = '''FLWSECK_TEST-(?i)[a-h0-9]{32}-X'''
+entropy = 2
+keywords = ["flwseck_test"]
+
+[[rules]]
+id = "flyio-access-token"
+description = "Uncovered a Fly.io API key"
+regex = '''\b((?:fo1_[\w-]{43}|fm1[ar]_[a-zA-Z0-9+\/]{100,}={0,3}|fm2_[a-zA-Z0-9+\/]{100,}={0,3}))(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 4
+keywords = [
+ "fo1_",
+ "fm1",
+ "fm2_",
+]
+
+[[rules]]
+id = "frameio-api-token"
+description = "Found a Frame.io API token, potentially compromising video collaboration and project management."
+regex = '''fio-u-(?i)[a-z0-9\-_=]{64}'''
+keywords = ["fio-u-"]
+
+[[rules]]
+id = "freemius-secret-key"
+description = "Detected a Freemius secret key, potentially exposing sensitive information."
+regex = '''(?i)["']secret_key["']\s*=>\s*["'](sk_[\S]{29})["']'''
+path = '''(?i)\.php$'''
+keywords = ["secret_key"]
+
+[[rules]]
+id = "freshbooks-access-token"
+description = "Discovered a Freshbooks Access Token, posing a risk to accounting software access and sensitive financial data exposure."
+regex = '''(?i)[\w.-]{0,50}?(?:freshbooks)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["freshbooks"]
+
+[[rules]]
+id = "gcp-api-key"
+description = "Uncovered a GCP API key, which could lead to unauthorized access to Google Cloud services and data breaches."
+regex = '''\b(AIza[\w-]{35})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 4
+keywords = ["aiza"]
+[[rules.allowlists]]
+regexes = [
+ '''AIzaSyabcdefghijklmnopqrstuvwxyz1234567''',
+ '''AIzaSyAnLA7NfeLquW1tJFpx_eQCxoX-oo6YyIs''',
+ '''AIzaSyCkEhVjf3pduRDt6d1yKOMitrUEke8agEM''',
+ '''AIzaSyDMAScliyLx7F0NPDEJi1QmyCgHIAODrlU''',
+ '''AIzaSyD3asb-2pEZVqMkmL6M9N6nHZRR_znhrh0''',
+ '''AIzayDNSXIbFmlXbIE6mCzDLQAqITYefhixbX4A''',
+ '''AIzaSyAdOS2zB6NCsk1pCdZ4-P6GBdi_UUPwX7c''',
+ '''AIzaSyASWm6HmTMdYWpgMnjRBjxcQ9CKctWmLd4''',
+ '''AIzaSyANUvH9H9BsUccjsu2pCmEkOPjjaXeDQgY''',
+ '''AIzaSyA5_iVawFQ8ABuTZNUdcwERLJv_a_p4wtM''',
+ '''AIzaSyA4UrcGxgwQFTfaI3no3t7Lt1sjmdnP5sQ''',
+ '''AIzaSyDSb51JiIcB6OJpwwMicseKRhhrOq1cS7g''',
+ '''AIzaSyBF2RrAIm4a0mO64EShQfqfd2AFnzAvvuU''',
+ '''AIzaSyBcE-OOIbhjyR83gm4r2MFCu4MJmprNXsw''',
+ '''AIzaSyB8qGxt4ec15vitgn44duC5ucxaOi4FmqE''',
+ '''AIzaSyA8vmApnrHNFE0bApF4hoZ11srVL_n0nvY''',
+]
+
+[[rules]]
+id = "generic-api-key"
+description = "Detected a Generic API Key, potentially exposing access to various services and sensitive operations."
+regex = '''(?i)[\w.-]{0,50}?(?:access|auth|(?-i:[Aa]pi|API)|credential|creds|key|passw(?:or)?d|secret|token)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([\w.=-]{10,150}|[a-z0-9][a-z0-9+/]{11,}={0,3})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3.5
+keywords = [
+ "access",
+ "api",
+ "auth",
+ "key",
+ "credential",
+ "creds",
+ "passwd",
+ "password",
+ "secret",
+ "token",
+]
+[[rules.allowlists]]
+regexes = [
+ '''^[a-zA-Z_.-]+$''',
+]
+[[rules.allowlists]]
+description = "Allowlist for Generic API Keys"
+regexTarget = "match"
+regexes = [
+ '''(?i)(?:access(?:ibility|or)|access[_.-]?id|random[_.-]?access|api[_.-]?(?:id|name|version)|rapid|capital|[a-z0-9-]*?api[a-z0-9-]*?:jar:|author|X-MS-Exchange-Organization-Auth|Authentication-Results|(?:credentials?[_.-]?id|withCredentials)|(?:bucket|foreign|hot|idx|natural|primary|pub(?:lic)?|schema|sequence)[_.-]?key|(?:turkey)|key[_.-]?(?:alias|board|code|frame|id|length|mesh|name|pair|press(?:ed)?|ring|selector|signature|size|stone|storetype|word|up|down|left|right)|key[_.-]?vault[_.-]?(?:id|name)|keyVaultToStoreSecrets|key(?:store|tab)[_.-]?(?:file|path)|issuerkeyhash|(?-i:[DdMm]onkey|[DM]ONKEY)|keying|(?:secret)[_.-]?(?:length|name|size)|UserSecretsId|(?:csrf)[_.-]?token|(?:io\.jsonwebtoken[ \t]?:[ \t]?[\w-]+)|(?:api|credentials|token)[_.-]?(?:endpoint|ur[il])|public[_.-]?token|(?:key|token)[_.-]?file|(?-i:(?:[A-Z_]+=\n[A-Z_]+=|[a-z_]+=\n[a-z_]+=)(?:\n|\z))|(?-i:(?:[A-Z.]+=\n[A-Z.]+=|[a-z.]+=\n[a-z.]+=)(?:\n|\z)))''',
+]
+stopwords = [
+ "000000",
+ "6fe4476ee5a1832882e326b506d14126",
+ "_ec2_",
+ "aaaaaa",
+ "about",
+ "abstract",
+ "academy",
+ "acces",
+ "account",
+ "act-",
+ "act.",
+ "act_",
+ "action",
+ "active",
+ "actively",
+ "activity",
+ "adapter",
+ "add-",
+ "add-on",
+ "add.",
+ "add_",
+ "addon",
+ "addres",
+ "admin",
+ "adobe",
+ "advanced",
+ "adventure",
+ "agent",
+ "agile",
+ "air-",
+ "air.",
+ "air_",
+ "ajax",
+ "akka",
+ "alert",
+ "alfred",
+ "algorithm",
+ "all-",
+ "all.",
+ "all_",
+ "alloy",
+ "alpha",
+ "amazon",
+ "amqp",
+ "analysi",
+ "analytic",
+ "analyzer",
+ "android",
+ "angular",
+ "angularj",
+ "animate",
+ "animation",
+ "another",
+ "ansible",
+ "answer",
+ "ant-",
+ "ant.",
+ "ant_",
+ "any-",
+ "any.",
+ "any_",
+ "apache",
+ "app-",
+ "app.",
+ "app_",
+ "apple",
+ "arch",
+ "archive",
+ "archived",
+ "arduino",
+ "array",
+ "art-",
+ "art.",
+ "art_",
+ "article",
+ "asp-",
+ "asp.",
+ "asp_",
+ "asset",
+ "async",
+ "atom",
+ "attention",
+ "audio",
+ "audit",
+ "aura",
+ "auth",
+ "author",
+ "authorize",
+ "auto",
+ "automated",
+ "automatic",
+ "awesome",
+ "aws_",
+ "azure",
+ "back",
+ "backbone",
+ "backend",
+ "backup",
+ "bar-",
+ "bar.",
+ "bar_",
+ "base",
+ "based",
+ "bash",
+ "basic",
+ "batch",
+ "been",
+ "beer",
+ "behavior",
+ "being",
+ "benchmark",
+ "best",
+ "beta",
+ "better",
+ "big-",
+ "big.",
+ "big_",
+ "binary",
+ "binding",
+ "bit-",
+ "bit.",
+ "bit_",
+ "bitcoin",
+ "block",
+ "blog",
+ "board",
+ "book",
+ "bookmark",
+ "boost",
+ "boot",
+ "bootstrap",
+ "bosh",
+ "bot-",
+ "bot.",
+ "bot_",
+ "bower",
+ "box-",
+ "box.",
+ "box_",
+ "boxen",
+ "bracket",
+ "branch",
+ "bridge",
+ "browser",
+ "brunch",
+ "buffer",
+ "bug-",
+ "bug.",
+ "bug_",
+ "build",
+ "builder",
+ "building",
+ "buildout",
+ "buildpack",
+ "built",
+ "bundle",
+ "busines",
+ "but-",
+ "but.",
+ "but_",
+ "button",
+ "cache",
+ "caching",
+ "cakephp",
+ "calendar",
+ "call",
+ "camera",
+ "campfire",
+ "can-",
+ "can.",
+ "can_",
+ "canva",
+ "captcha",
+ "capture",
+ "card",
+ "carousel",
+ "case",
+ "cassandra",
+ "cat-",
+ "cat.",
+ "cat_",
+ "category",
+ "center",
+ "cento",
+ "challenge",
+ "change",
+ "changelog",
+ "channel",
+ "chart",
+ "chat",
+ "cheat",
+ "check",
+ "checker",
+ "chef",
+ "ches",
+ "chinese",
+ "chosen",
+ "chrome",
+ "ckeditor",
+ "clas",
+ "classe",
+ "classic",
+ "clean",
+ "cli-",
+ "cli.",
+ "cli_",
+ "client",
+ "clojure",
+ "clone",
+ "closure",
+ "cloud",
+ "club",
+ "cluster",
+ "cms-",
+ "cms_",
+ "coco",
+ "code",
+ "coding",
+ "coffee",
+ "color",
+ "combination",
+ "combo",
+ "command",
+ "commander",
+ "comment",
+ "commit",
+ "common",
+ "community",
+ "compas",
+ "compiler",
+ "complete",
+ "component",
+ "composer",
+ "computer",
+ "computing",
+ "con-",
+ "con.",
+ "con_",
+ "concept",
+ "conf",
+ "config",
+ "connect",
+ "connector",
+ "console",
+ "contact",
+ "container",
+ "contao",
+ "content",
+ "contest",
+ "context",
+ "control",
+ "convert",
+ "converter",
+ "conway'",
+ "cookbook",
+ "cookie",
+ "cool",
+ "copy",
+ "cordova",
+ "core",
+ "couchbase",
+ "couchdb",
+ "countdown",
+ "counter",
+ "course",
+ "craft",
+ "crawler",
+ "create",
+ "creating",
+ "creator",
+ "credential",
+ "crm-",
+ "crm.",
+ "crm_",
+ "cros",
+ "crud",
+ "csv-",
+ "csv.",
+ "csv_",
+ "cube",
+ "cucumber",
+ "cuda",
+ "current",
+ "currently",
+ "custom",
+ "daemon",
+ "dark",
+ "dart",
+ "dash",
+ "dashboard",
+ "data",
+ "database",
+ "date",
+ "day-",
+ "day.",
+ "day_",
+ "dead",
+ "debian",
+ "debug",
+ "debugger",
+ "deck",
+ "define",
+ "del-",
+ "del.",
+ "del_",
+ "delete",
+ "demo",
+ "deploy",
+ "design",
+ "designer",
+ "desktop",
+ "detection",
+ "detector",
+ "dev-",
+ "dev.",
+ "dev_",
+ "develop",
+ "developer",
+ "device",
+ "devise",
+ "diff",
+ "digital",
+ "directive",
+ "directory",
+ "discovery",
+ "display",
+ "django",
+ "dns-",
+ "dns_",
+ "doc-",
+ "doc.",
+ "doc_",
+ "docker",
+ "docpad",
+ "doctrine",
+ "document",
+ "doe-",
+ "doe.",
+ "doe_",
+ "dojo",
+ "dom-",
+ "dom.",
+ "dom_",
+ "domain",
+ "don't",
+ "done",
+ "dot-",
+ "dot.",
+ "dot_",
+ "dotfile",
+ "download",
+ "draft",
+ "drag",
+ "drill",
+ "drive",
+ "driven",
+ "driver",
+ "drop",
+ "dropbox",
+ "drupal",
+ "dsl-",
+ "dsl.",
+ "dsl_",
+ "dynamic",
+ "easy",
+ "ecdsa",
+ "eclipse",
+ "edit",
+ "editing",
+ "edition",
+ "editor",
+ "element",
+ "emac",
+ "email",
+ "embed",
+ "embedded",
+ "ember",
+ "emitter",
+ "emulator",
+ "encoding",
+ "endpoint",
+ "engine",
+ "english",
+ "enhanced",
+ "entity",
+ "entry",
+ "env_",
+ "episode",
+ "erlang",
+ "error",
+ "espresso",
+ "event",
+ "evented",
+ "example",
+ "exchange",
+ "exercise",
+ "experiment",
+ "expire",
+ "exploit",
+ "explorer",
+ "export",
+ "exporter",
+ "expres",
+ "ext-",
+ "ext.",
+ "ext_",
+ "extended",
+ "extension",
+ "external",
+ "extra",
+ "extractor",
+ "fabric",
+ "facebook",
+ "factory",
+ "fake",
+ "fast",
+ "feature",
+ "feed",
+ "fewfwef",
+ "ffmpeg",
+ "field",
+ "file",
+ "filter",
+ "find",
+ "finder",
+ "firefox",
+ "firmware",
+ "first",
+ "fish",
+ "fix-",
+ "fix_",
+ "flash",
+ "flask",
+ "flat",
+ "flex",
+ "flexible",
+ "flickr",
+ "flow",
+ "fluent",
+ "fluentd",
+ "fluid",
+ "folder",
+ "font",
+ "force",
+ "foreman",
+ "fork",
+ "form",
+ "format",
+ "formatter",
+ "forum",
+ "foundry",
+ "framework",
+ "free",
+ "friend",
+ "friendly",
+ "front-end",
+ "frontend",
+ "ftp-",
+ "ftp.",
+ "ftp_",
+ "fuel",
+ "full",
+ "fun-",
+ "fun.",
+ "fun_",
+ "func",
+ "future",
+ "gaia",
+ "gallery",
+ "game",
+ "gateway",
+ "gem-",
+ "gem.",
+ "gem_",
+ "gen-",
+ "gen.",
+ "gen_",
+ "general",
+ "generator",
+ "generic",
+ "genetic",
+ "get-",
+ "get.",
+ "get_",
+ "getenv",
+ "getting",
+ "ghost",
+ "gist",
+ "git-",
+ "git.",
+ "git_",
+ "github",
+ "gitignore",
+ "gitlab",
+ "glas",
+ "gmail",
+ "gnome",
+ "gnu-",
+ "gnu.",
+ "gnu_",
+ "goal",
+ "golang",
+ "gollum",
+ "good",
+ "google",
+ "gpu-",
+ "gpu.",
+ "gpu_",
+ "gradle",
+ "grail",
+ "graph",
+ "graphic",
+ "great",
+ "grid",
+ "groovy",
+ "group",
+ "grunt",
+ "guard",
+ "gui-",
+ "gui.",
+ "gui_",
+ "guide",
+ "guideline",
+ "gulp",
+ "gwt-",
+ "gwt.",
+ "gwt_",
+ "hack",
+ "hackathon",
+ "hacker",
+ "hacking",
+ "hadoop",
+ "haml",
+ "handler",
+ "hardware",
+ "has-",
+ "has_",
+ "hash",
+ "haskell",
+ "have",
+ "haxe",
+ "hello",
+ "help",
+ "helper",
+ "here",
+ "hero",
+ "heroku",
+ "high",
+ "hipchat",
+ "history",
+ "home",
+ "homebrew",
+ "homepage",
+ "hook",
+ "host",
+ "hosting",
+ "hot-",
+ "hot.",
+ "hot_",
+ "house",
+ "how-",
+ "how.",
+ "how_",
+ "html",
+ "http",
+ "hub-",
+ "hub.",
+ "hub_",
+ "hubot",
+ "human",
+ "icon",
+ "ide-",
+ "ide.",
+ "ide_",
+ "idea",
+ "identity",
+ "idiomatic",
+ "image",
+ "impact",
+ "import",
+ "important",
+ "importer",
+ "impres",
+ "index",
+ "infinite",
+ "info",
+ "injection",
+ "inline",
+ "input",
+ "inside",
+ "inspector",
+ "instagram",
+ "install",
+ "installer",
+ "instant",
+ "intellij",
+ "interface",
+ "internet",
+ "interview",
+ "into",
+ "intro",
+ "ionic",
+ "iphone",
+ "ipython",
+ "irc-",
+ "irc_",
+ "iso-",
+ "iso.",
+ "iso_",
+ "issue",
+ "jade",
+ "jasmine",
+ "java",
+ "jbos",
+ "jekyll",
+ "jenkin",
+ "jetbrains",
+ "job-",
+ "job.",
+ "job_",
+ "joomla",
+ "jpa-",
+ "jpa.",
+ "jpa_",
+ "jquery",
+ "json",
+ "just",
+ "kafka",
+ "karma",
+ "kata",
+ "kernel",
+ "keyboard",
+ "kindle",
+ "kit-",
+ "kit.",
+ "kit_",
+ "kitchen",
+ "knife",
+ "koan",
+ "kohana",
+ "lab-",
+ "lab.",
+ "lab_",
+ "lambda",
+ "lamp",
+ "language",
+ "laravel",
+ "last",
+ "latest",
+ "latex",
+ "launcher",
+ "layer",
+ "layout",
+ "lazy",
+ "ldap",
+ "leaflet",
+ "league",
+ "learn",
+ "learning",
+ "led-",
+ "led.",
+ "led_",
+ "leetcode",
+ "les-",
+ "les.",
+ "les_",
+ "level",
+ "leveldb",
+ "lib-",
+ "lib.",
+ "lib_",
+ "librarie",
+ "library",
+ "license",
+ "life",
+ "liferay",
+ "light",
+ "lightbox",
+ "like",
+ "line",
+ "link",
+ "linked",
+ "linkedin",
+ "linux",
+ "lisp",
+ "list",
+ "lite",
+ "little",
+ "load",
+ "loader",
+ "local",
+ "location",
+ "lock",
+ "log-",
+ "log.",
+ "log_",
+ "logger",
+ "logging",
+ "logic",
+ "login",
+ "logstash",
+ "longer",
+ "look",
+ "love",
+ "lua-",
+ "lua.",
+ "lua_",
+ "mac-",
+ "mac.",
+ "mac_",
+ "machine",
+ "made",
+ "magento",
+ "magic",
+ "mail",
+ "make",
+ "maker",
+ "making",
+ "man-",
+ "man.",
+ "man_",
+ "manage",
+ "manager",
+ "manifest",
+ "manual",
+ "map-",
+ "map.",
+ "map_",
+ "mapper",
+ "mapping",
+ "markdown",
+ "markup",
+ "master",
+ "math",
+ "matrix",
+ "maven",
+ "md5",
+ "mean",
+ "media",
+ "mediawiki",
+ "meetup",
+ "memcached",
+ "memory",
+ "menu",
+ "merchant",
+ "message",
+ "messaging",
+ "meta",
+ "metadata",
+ "meteor",
+ "method",
+ "metric",
+ "micro",
+ "middleman",
+ "migration",
+ "minecraft",
+ "miner",
+ "mini",
+ "minimal",
+ "mirror",
+ "mit-",
+ "mit.",
+ "mit_",
+ "mobile",
+ "mocha",
+ "mock",
+ "mod-",
+ "mod.",
+ "mod_",
+ "mode",
+ "model",
+ "modern",
+ "modular",
+ "module",
+ "modx",
+ "money",
+ "mongo",
+ "mongodb",
+ "mongoid",
+ "mongoose",
+ "monitor",
+ "monkey",
+ "more",
+ "motion",
+ "moved",
+ "movie",
+ "mozilla",
+ "mqtt",
+ "mule",
+ "multi",
+ "multiple",
+ "music",
+ "mustache",
+ "mvc-",
+ "mvc.",
+ "mvc_",
+ "mysql",
+ "nagio",
+ "name",
+ "native",
+ "need",
+ "neo-",
+ "neo.",
+ "neo_",
+ "nest",
+ "nested",
+ "net-",
+ "net.",
+ "net_",
+ "nette",
+ "network",
+ "new-",
+ "new.",
+ "new_",
+ "next",
+ "nginx",
+ "ninja",
+ "nlp-",
+ "nlp.",
+ "nlp_",
+ "node",
+ "nodej",
+ "nosql",
+ "not-",
+ "not.",
+ "not_",
+ "note",
+ "notebook",
+ "notepad",
+ "notice",
+ "notifier",
+ "now-",
+ "now.",
+ "now_",
+ "number",
+ "oauth",
+ "object",
+ "objective",
+ "obsolete",
+ "ocaml",
+ "octopres",
+ "official",
+ "old-",
+ "old.",
+ "old_",
+ "onboard",
+ "online",
+ "only",
+ "open",
+ "opencv",
+ "opengl",
+ "openshift",
+ "openwrt",
+ "option",
+ "oracle",
+ "org-",
+ "org.",
+ "org_",
+ "origin",
+ "original",
+ "orm-",
+ "orm.",
+ "orm_",
+ "osx-",
+ "osx_",
+ "our-",
+ "our.",
+ "our_",
+ "out-",
+ "out.",
+ "out_",
+ "output",
+ "over",
+ "overview",
+ "own-",
+ "own.",
+ "own_",
+ "pack",
+ "package",
+ "packet",
+ "page",
+ "panel",
+ "paper",
+ "paperclip",
+ "para",
+ "parallax",
+ "parallel",
+ "parse",
+ "parser",
+ "parsing",
+ "particle",
+ "party",
+ "password",
+ "patch",
+ "path",
+ "pattern",
+ "payment",
+ "paypal",
+ "pdf-",
+ "pdf.",
+ "pdf_",
+ "pebble",
+ "people",
+ "perl",
+ "personal",
+ "phalcon",
+ "phoenix",
+ "phone",
+ "phonegap",
+ "photo",
+ "php-",
+ "php.",
+ "php_",
+ "physic",
+ "picker",
+ "pipeline",
+ "platform",
+ "play",
+ "player",
+ "please",
+ "plu-",
+ "plu.",
+ "plu_",
+ "plug-in",
+ "plugin",
+ "plupload",
+ "png-",
+ "png.",
+ "png_",
+ "poker",
+ "polyfill",
+ "polymer",
+ "pool",
+ "pop-",
+ "pop.",
+ "pop_",
+ "popcorn",
+ "popup",
+ "port",
+ "portable",
+ "portal",
+ "portfolio",
+ "post",
+ "power",
+ "powered",
+ "powerful",
+ "prelude",
+ "pretty",
+ "preview",
+ "principle",
+ "print",
+ "pro-",
+ "pro.",
+ "pro_",
+ "problem",
+ "proc",
+ "product",
+ "profile",
+ "profiler",
+ "program",
+ "progres",
+ "project",
+ "protocol",
+ "prototype",
+ "provider",
+ "proxy",
+ "public",
+ "pull",
+ "puppet",
+ "pure",
+ "purpose",
+ "push",
+ "pusher",
+ "pyramid",
+ "python",
+ "quality",
+ "query",
+ "queue",
+ "quick",
+ "rabbitmq",
+ "rack",
+ "radio",
+ "rail",
+ "railscast",
+ "random",
+ "range",
+ "raspberry",
+ "rdf-",
+ "rdf.",
+ "rdf_",
+ "react",
+ "reactive",
+ "read",
+ "reader",
+ "readme",
+ "ready",
+ "real",
+ "real-time",
+ "reality",
+ "realtime",
+ "recipe",
+ "recorder",
+ "red-",
+ "red.",
+ "red_",
+ "reddit",
+ "redi",
+ "redmine",
+ "reference",
+ "refinery",
+ "refresh",
+ "registry",
+ "related",
+ "release",
+ "remote",
+ "rendering",
+ "repo",
+ "report",
+ "request",
+ "require",
+ "required",
+ "requirej",
+ "research",
+ "resource",
+ "response",
+ "resque",
+ "rest",
+ "restful",
+ "resume",
+ "reveal",
+ "reverse",
+ "review",
+ "riak",
+ "rich",
+ "right",
+ "ring",
+ "robot",
+ "role",
+ "room",
+ "router",
+ "routing",
+ "rpc-",
+ "rpc.",
+ "rpc_",
+ "rpg-",
+ "rpg.",
+ "rpg_",
+ "rspec",
+ "ruby-",
+ "ruby.",
+ "ruby_",
+ "rule",
+ "run-",
+ "run.",
+ "run_",
+ "runner",
+ "running",
+ "runtime",
+ "rust",
+ "rvm-",
+ "rvm.",
+ "rvm_",
+ "salt",
+ "sample",
+ "sandbox",
+ "sas-",
+ "sas.",
+ "sas_",
+ "sbt-",
+ "sbt.",
+ "sbt_",
+ "scala",
+ "scalable",
+ "scanner",
+ "schema",
+ "scheme",
+ "school",
+ "science",
+ "scraper",
+ "scratch",
+ "screen",
+ "script",
+ "scroll",
+ "scs-",
+ "scs.",
+ "scs_",
+ "sdk-",
+ "sdk.",
+ "sdk_",
+ "sdl-",
+ "sdl.",
+ "sdl_",
+ "search",
+ "secure",
+ "security",
+ "see-",
+ "see.",
+ "see_",
+ "seed",
+ "select",
+ "selector",
+ "selenium",
+ "semantic",
+ "sencha",
+ "send",
+ "sentiment",
+ "serie",
+ "server",
+ "service",
+ "session",
+ "set-",
+ "set.",
+ "set_",
+ "setting",
+ "setup",
+ "sha1",
+ "sha2",
+ "sha256",
+ "share",
+ "shared",
+ "sharing",
+ "sheet",
+ "shell",
+ "shield",
+ "shipping",
+ "shop",
+ "shopify",
+ "shortener",
+ "should",
+ "show",
+ "showcase",
+ "side",
+ "silex",
+ "simple",
+ "simulator",
+ "single",
+ "site",
+ "skeleton",
+ "sketch",
+ "skin",
+ "slack",
+ "slide",
+ "slider",
+ "slim",
+ "small",
+ "smart",
+ "smtp",
+ "snake",
+ "snapshot",
+ "snippet",
+ "soap",
+ "social",
+ "socket",
+ "software",
+ "solarized",
+ "solr",
+ "solution",
+ "solver",
+ "some",
+ "soon",
+ "source",
+ "space",
+ "spark",
+ "spatial",
+ "spec",
+ "sphinx",
+ "spine",
+ "spotify",
+ "spree",
+ "spring",
+ "sprite",
+ "sql-",
+ "sql.",
+ "sql_",
+ "sqlite",
+ "ssh-",
+ "ssh.",
+ "ssh_",
+ "stack",
+ "staging",
+ "standard",
+ "stanford",
+ "start",
+ "started",
+ "starter",
+ "startup",
+ "stat",
+ "statamic",
+ "state",
+ "static",
+ "statistic",
+ "statsd",
+ "statu",
+ "steam",
+ "step",
+ "still",
+ "stm-",
+ "stm.",
+ "stm_",
+ "storage",
+ "store",
+ "storm",
+ "story",
+ "strategy",
+ "stream",
+ "streaming",
+ "string",
+ "stripe",
+ "structure",
+ "studio",
+ "study",
+ "stuff",
+ "style",
+ "sublime",
+ "sugar",
+ "suite",
+ "summary",
+ "super",
+ "support",
+ "supported",
+ "svg-",
+ "svg.",
+ "svg_",
+ "svn-",
+ "svn.",
+ "svn_",
+ "swagger",
+ "swift",
+ "switch",
+ "switcher",
+ "symfony",
+ "symphony",
+ "sync",
+ "synopsi",
+ "syntax",
+ "system",
+ "tab-",
+ "tab.",
+ "tab_",
+ "table",
+ "tag-",
+ "tag.",
+ "tag_",
+ "talk",
+ "target",
+ "task",
+ "tcp-",
+ "tcp.",
+ "tcp_",
+ "tdd-",
+ "tdd.",
+ "tdd_",
+ "team",
+ "tech",
+ "template",
+ "term",
+ "terminal",
+ "testing",
+ "tetri",
+ "text",
+ "textmate",
+ "theme",
+ "theory",
+ "three",
+ "thrift",
+ "time",
+ "timeline",
+ "timer",
+ "tiny",
+ "tinymce",
+ "tip-",
+ "tip.",
+ "tip_",
+ "title",
+ "todo",
+ "todomvc",
+ "token",
+ "tool",
+ "toolbox",
+ "toolkit",
+ "top-",
+ "top.",
+ "top_",
+ "tornado",
+ "touch",
+ "tower",
+ "tracker",
+ "tracking",
+ "traffic",
+ "training",
+ "transfer",
+ "translate",
+ "transport",
+ "tree",
+ "trello",
+ "try-",
+ "try.",
+ "try_",
+ "tumblr",
+ "tut-",
+ "tut.",
+ "tut_",
+ "tutorial",
+ "tweet",
+ "twig",
+ "twitter",
+ "type",
+ "typo",
+ "ubuntu",
+ "uiview",
+ "ultimate",
+ "under",
+ "unit",
+ "unity",
+ "universal",
+ "unix",
+ "update",
+ "updated",
+ "upgrade",
+ "upload",
+ "uploader",
+ "uri-",
+ "uri.",
+ "uri_",
+ "url-",
+ "url.",
+ "url_",
+ "usage",
+ "usb-",
+ "usb.",
+ "usb_",
+ "use-",
+ "use.",
+ "use_",
+ "used",
+ "useful",
+ "user",
+ "using",
+ "util",
+ "utilitie",
+ "utility",
+ "vagrant",
+ "validator",
+ "value",
+ "variou",
+ "varnish",
+ "version",
+ "via-",
+ "via.",
+ "via_",
+ "video",
+ "view",
+ "viewer",
+ "vim-",
+ "vim.",
+ "vim_",
+ "vimrc",
+ "virtual",
+ "vision",
+ "visual",
+ "vpn",
+ "want",
+ "warning",
+ "watch",
+ "watcher",
+ "wave",
+ "way-",
+ "way.",
+ "way_",
+ "weather",
+ "web-",
+ "web_",
+ "webapp",
+ "webgl",
+ "webhook",
+ "webkit",
+ "webrtc",
+ "website",
+ "websocket",
+ "welcome",
+ "what",
+ "what'",
+ "when",
+ "where",
+ "which",
+ "why-",
+ "why.",
+ "why_",
+ "widget",
+ "wifi",
+ "wiki",
+ "win-",
+ "win.",
+ "win_",
+ "window",
+ "wip-",
+ "wip.",
+ "wip_",
+ "within",
+ "without",
+ "wizard",
+ "word",
+ "wordpres",
+ "work",
+ "worker",
+ "workflow",
+ "working",
+ "workshop",
+ "world",
+ "wrapper",
+ "write",
+ "writer",
+ "writing",
+ "written",
+ "www-",
+ "www.",
+ "www_",
+ "xamarin",
+ "xcode",
+ "xml-",
+ "xml.",
+ "xml_",
+ "xmpp",
+ "xxxxxx",
+ "yahoo",
+ "yaml",
+ "yandex",
+ "yeoman",
+ "yet-",
+ "yet.",
+ "yet_",
+ "yii-",
+ "yii.",
+ "yii_",
+ "youtube",
+ "yui-",
+ "yui.",
+ "yui_",
+ "zend",
+ "zero",
+ "zip-",
+ "zip.",
+ "zip_",
+ "zsh-",
+ "zsh.",
+ "zsh_",
+]
+[[rules.allowlists]]
+regexTarget = "line"
+regexes = [
+ '''--mount=type=secret,''',
+ '''import[ \t]+{[ \t\w,]+}[ \t]+from[ \t]+['"][^'"]+['"]''',
+]
+[[rules.allowlists]]
+condition = "AND"
+paths = [
+ '''\.bb$''','''\.bbappend$''','''\.bbclass$''','''\.inc$''',
+]
+regexTarget = "line"
+regexes = [
+ '''LICENSE[^=]*=\s*"[^"]+''',
+ '''LIC_FILES_CHKSUM[^=]*=\s*"[^"]+''',
+ '''SRC[^=]*=\s*"[a-zA-Z0-9]+''',
+]
+
+[[rules]]
+id = "github-app-token"
+description = "Identified a GitHub App Token, which may compromise GitHub application integrations and source code security."
+regex = '''(?:ghu|ghs)_[0-9a-zA-Z]{36}'''
+entropy = 3
+keywords = [
+ "ghu_",
+ "ghs_",
+]
+[[rules.allowlists]]
+paths = [
+ '''(?:^|/)@octokit/auth-token/README\.md$''',
+]
+
+[[rules]]
+id = "github-fine-grained-pat"
+description = "Found a GitHub Fine-Grained Personal Access Token, risking unauthorized repository access and code manipulation."
+regex = '''github_pat_\w{82}'''
+entropy = 3
+keywords = ["github_pat_"]
+
+[[rules]]
+id = "github-oauth"
+description = "Discovered a GitHub OAuth Access Token, posing a risk of compromised GitHub account integrations and data leaks."
+regex = '''gho_[0-9a-zA-Z]{36}'''
+entropy = 3
+keywords = ["gho_"]
+
+[[rules]]
+id = "github-pat"
+description = "Uncovered a GitHub Personal Access Token, potentially leading to unauthorized repository access and sensitive content exposure."
+regex = '''ghp_[0-9a-zA-Z]{36}'''
+entropy = 3
+keywords = ["ghp_"]
+[[rules.allowlists]]
+paths = [
+ '''(?:^|/)@octokit/auth-token/README\.md$''',
+]
+
+[[rules]]
+id = "github-refresh-token"
+description = "Detected a GitHub Refresh Token, which could allow prolonged unauthorized access to GitHub services."
+regex = '''ghr_[0-9a-zA-Z]{36}'''
+entropy = 3
+keywords = ["ghr_"]
+
+[[rules]]
+id = "gitlab-cicd-job-token"
+description = "Identified a GitLab CI/CD Job Token, potential access to projects and some APIs on behalf of a user while the CI job is running."
+regex = '''glcbt-[0-9a-zA-Z]{1,5}_[0-9a-zA-Z_-]{20}'''
+entropy = 3
+keywords = ["glcbt-"]
+
+[[rules]]
+id = "gitlab-deploy-token"
+description = "Identified a GitLab Deploy Token, risking access to repositories, packages and containers with write access."
+regex = '''gldt-[0-9a-zA-Z_\-]{20}'''
+entropy = 3
+keywords = ["gldt-"]
+
+[[rules]]
+id = "gitlab-feature-flag-client-token"
+description = "Identified a GitLab feature flag client token, risks exposing user lists and features flags used by an application."
+regex = '''glffct-[0-9a-zA-Z_\-]{20}'''
+entropy = 3
+keywords = ["glffct-"]
+
+[[rules]]
+id = "gitlab-feed-token"
+description = "Identified a GitLab feed token, risking exposure of user data."
+regex = '''glft-[0-9a-zA-Z_\-]{20}'''
+entropy = 3
+keywords = ["glft-"]
+
+[[rules]]
+id = "gitlab-incoming-mail-token"
+description = "Identified a GitLab incoming mail token, risking manipulation of data sent by mail."
+regex = '''glimt-[0-9a-zA-Z_\-]{25}'''
+entropy = 3
+keywords = ["glimt-"]
+
+[[rules]]
+id = "gitlab-kubernetes-agent-token"
+description = "Identified a GitLab Kubernetes Agent token, risking access to repos and registry of projects connected via agent."
+regex = '''glagent-[0-9a-zA-Z_\-]{50}'''
+entropy = 3
+keywords = ["glagent-"]
+
+[[rules]]
+id = "gitlab-oauth-app-secret"
+description = "Identified a GitLab OIDC Application Secret, risking access to apps using GitLab as authentication provider."
+regex = '''gloas-[0-9a-zA-Z_\-]{64}'''
+entropy = 3
+keywords = ["gloas-"]
+
+[[rules]]
+id = "gitlab-pat"
+description = "Identified a GitLab Personal Access Token, risking unauthorized access to GitLab repositories and codebase exposure."
+regex = '''glpat-[\w-]{20}'''
+entropy = 3
+keywords = ["glpat-"]
+
+[[rules]]
+id = "gitlab-pat-routable"
+description = "Identified a GitLab Personal Access Token (routable), risking unauthorized access to GitLab repositories and codebase exposure."
+regex = '''\bglpat-[0-9a-zA-Z_-]{27,300}\.[0-9a-z]{2}[0-9a-z]{7}\b'''
+entropy = 4
+keywords = ["glpat-"]
+
+[[rules]]
+id = "gitlab-ptt"
+description = "Found a GitLab Pipeline Trigger Token, potentially compromising continuous integration workflows and project security."
+regex = '''glptt-[0-9a-f]{40}'''
+entropy = 3
+keywords = ["glptt-"]
+
+[[rules]]
+id = "gitlab-rrt"
+description = "Discovered a GitLab Runner Registration Token, posing a risk to CI/CD pipeline integrity and unauthorized access."
+regex = '''GR1348941[\w-]{20}'''
+entropy = 3
+keywords = ["gr1348941"]
+
+[[rules]]
+id = "gitlab-runner-authentication-token"
+description = "Discovered a GitLab Runner Authentication Token, posing a risk to CI/CD pipeline integrity and unauthorized access."
+regex = '''glrt-[0-9a-zA-Z_\-]{20}'''
+entropy = 3
+keywords = ["glrt-"]
+
+[[rules]]
+id = "gitlab-runner-authentication-token-routable"
+description = "Discovered a GitLab Runner Authentication Token (Routable), posing a risk to CI/CD pipeline integrity and unauthorized access."
+regex = '''\bglrt-t\d_[0-9a-zA-Z_\-]{27,300}\.[0-9a-z]{2}[0-9a-z]{7}\b'''
+entropy = 4
+keywords = ["glrt-"]
+
+[[rules]]
+id = "gitlab-scim-token"
+description = "Discovered a GitLab SCIM Token, posing a risk to unauthorized access for a organization or instance."
+regex = '''glsoat-[0-9a-zA-Z_\-]{20}'''
+entropy = 3
+keywords = ["glsoat-"]
+
+[[rules]]
+id = "gitlab-session-cookie"
+description = "Discovered a GitLab Session Cookie, posing a risk to unauthorized access to a user account."
+regex = '''_gitlab_session=[0-9a-z]{32}'''
+entropy = 3
+keywords = ["_gitlab_session="]
+
+[[rules]]
+id = "gitter-access-token"
+description = "Uncovered a Gitter Access Token, which may lead to unauthorized access to chat and communication services."
+regex = '''(?i)[\w.-]{0,50}?(?:gitter)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9_-]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["gitter"]
+
+[[rules]]
+id = "gocardless-api-token"
+description = "Detected a GoCardless API token, potentially risking unauthorized direct debit payment operations and financial data exposure."
+regex = '''(?i)[\w.-]{0,50}?(?:gocardless)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(live_(?i)[a-z0-9\-_=]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "live_",
+ "gocardless",
+]
+
+[[rules]]
+id = "grafana-api-key"
+description = "Identified a Grafana API key, which could compromise monitoring dashboards and sensitive data analytics."
+regex = '''(?i)\b(eyJrIjoi[A-Za-z0-9]{70,400}={0,3})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["eyjrijoi"]
+
+[[rules]]
+id = "grafana-cloud-api-token"
+description = "Found a Grafana cloud API token, risking unauthorized access to cloud-based monitoring services and data exposure."
+regex = '''(?i)\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["glc_"]
+
+[[rules]]
+id = "grafana-service-account-token"
+description = "Discovered a Grafana service account token, posing a risk of compromised monitoring services and data integrity."
+regex = '''(?i)\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["glsa_"]
+
+[[rules]]
+id = "harness-api-key"
+description = "Identified a Harness Access Token (PAT or SAT), risking unauthorized access to a Harness account."
+regex = '''(?:pat|sat)\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9]{24}\.[a-zA-Z0-9]{20}'''
+keywords = [
+ "pat.",
+ "sat.",
+]
+
+[[rules]]
+id = "hashicorp-tf-api-token"
+description = "Uncovered a HashiCorp Terraform user/org API token, which may lead to unauthorized infrastructure management and security breaches."
+regex = '''(?i)[a-z0-9]{14}\.(?-i:atlasv1)\.[a-z0-9\-_=]{60,70}'''
+entropy = 3.5
+keywords = ["atlasv1"]
+
+[[rules]]
+id = "hashicorp-tf-password"
+description = "Identified a HashiCorp Terraform password field, risking unauthorized infrastructure configuration and security breaches."
+regex = '''(?i)[\w.-]{0,50}?(?:administrator_login_password|password)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}("[a-z0-9=_\-]{8,20}")(?:[\x60'"\s;]|\\[nr]|$)'''
+path = '''(?i)\.(?:tf|hcl)$'''
+entropy = 2
+keywords = [
+ "administrator_login_password",
+ "password",
+]
+
+[[rules]]
+id = "heroku-api-key"
+description = "Detected a Heroku API Key, potentially compromising cloud application deployments and operational security."
+regex = '''(?i)[\w.-]{0,50}?(?:heroku)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["heroku"]
+
+[[rules]]
+id = "hubspot-api-key"
+description = "Found a HubSpot API Token, posing a risk to CRM data integrity and unauthorized marketing operations."
+regex = '''(?i)[\w.-]{0,50}?(?:hubspot)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["hubspot"]
+
+[[rules]]
+id = "huggingface-access-token"
+description = "Discovered a Hugging Face Access token, which could lead to unauthorized access to AI models and sensitive data."
+regex = '''\b(hf_(?i:[a-z]{34}))(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["hf_"]
+
+[[rules]]
+id = "huggingface-organization-api-token"
+description = "Uncovered a Hugging Face Organization API token, potentially compromising AI organization accounts and associated data."
+regex = '''\b(api_org_(?i:[a-z]{34}))(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["api_org_"]
+
+[[rules]]
+id = "infracost-api-token"
+description = "Detected an Infracost API Token, risking unauthorized access to cloud cost estimation tools and financial data."
+regex = '''\b(ico-[a-zA-Z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["ico-"]
+
+[[rules]]
+id = "intercom-api-key"
+description = "Identified an Intercom API Token, which could compromise customer communication channels and data privacy."
+regex = '''(?i)[\w.-]{0,50}?(?:intercom)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9=_\-]{60})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["intercom"]
+
+[[rules]]
+id = "intra42-client-secret"
+description = "Found a Intra42 client secret, which could lead to unauthorized access to the 42School API and sensitive data."
+regex = '''\b(s-s4t2(?:ud|af)-(?i)[abcdef0123456789]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = [
+ "intra",
+ "s-s4t2ud-",
+ "s-s4t2af-",
+]
+
+[[rules]]
+id = "jfrog-api-key"
+description = "Found a JFrog API Key, posing a risk of unauthorized access to software artifact repositories and build pipelines."
+regex = '''(?i)[\w.-]{0,50}?(?:jfrog|artifactory|bintray|xray)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{73})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "jfrog",
+ "artifactory",
+ "bintray",
+ "xray",
+]
+
+[[rules]]
+id = "jfrog-identity-token"
+description = "Discovered a JFrog Identity Token, potentially compromising access to JFrog services and sensitive software artifacts."
+regex = '''(?i)[\w.-]{0,50}?(?:jfrog|artifactory|bintray|xray)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "jfrog",
+ "artifactory",
+ "bintray",
+ "xray",
+]
+
+[[rules]]
+id = "jwt"
+description = "Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data."
+regex = '''\b(ey[a-zA-Z0-9]{17,}\.ey[a-zA-Z0-9\/\\_-]{17,}\.(?:[a-zA-Z0-9\/\\_-]{10,}={0,2})?)(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["ey"]
+
+[[rules]]
+id = "jwt-base64"
+description = "Detected a Base64-encoded JSON Web Token, posing a risk of exposing encoded authentication and data exchange information."
+regex = '''\bZXlK(?:(?P<alg>aGJHY2lPaU)|(?P<apu>aGNIVWlPaU)|(?P<apv>aGNIWWlPaU)|(?P<aud>aGRXUWlPaU)|(?P<b64>aU5qUWlP)|(?P<crit>amNtbDBJanBi)|(?P<cty>amRIa2lPaU)|(?P<epk>bGNHc2lPbn)|(?P<enc>bGJtTWlPaU)|(?P<jku>cWEzVWlPaU)|(?P<jwk>cWQyc2lPb)|(?P<iss>cGMzTWlPaU)|(?P<iv>cGRpSTZJ)|(?P<kid>cmFXUWlP)|(?P<key_ops>clpYbGZiM0J6SWpwY)|(?P<kty>cmRIa2lPaUp)|(?P<nonce>dWIyNWpaU0k2)|(?P<p2c>d01tTWlP)|(?P<p2s>d01uTWlPaU)|(?P<ppt>d2NIUWlPaU)|(?P<sub>emRXSWlPaU)|(?P<svt>emRuUWlP)|(?P<tag>MFlXY2lPaU)|(?P<typ>MGVYQWlPaUp)|(?P<url>MWNtd2l)|(?P<use>MWMyVWlPaUp)|(?P<ver>MlpYSWlPaU)|(?P<version>MlpYSnphVzl1SWpv)|(?P<x>NElqb2)|(?P<x5c>NE5XTWlP)|(?P<x5t>NE5YUWlPaU)|(?P<x5ts256>NE5YUWpVekkxTmlJNkl)|(?P<x5u>NE5YVWlPaU)|(?P<zip>NmFYQWlPaU))[a-zA-Z0-9\/\\_+\-\r\n]{40,}={0,2}'''
+entropy = 2
+keywords = ["zxlk"]
+
+[[rules]]
+id = "kraken-access-token"
+description = "Identified a Kraken Access Token, potentially compromising cryptocurrency trading accounts and financial security."
+regex = '''(?i)[\w.-]{0,50}?(?:kraken)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9\/=_\+\-]{80,90})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["kraken"]
+
+[[rules]]
+id = "kubernetes-secret-yaml"
+description = "Possible Kubernetes Secret detected, posing a risk of leaking credentials/tokens from your deployments"
+regex = '''(?i)(?:\bkind:[ \t]*["']?\bsecret\b["']?(?s:.){0,200}?\bdata:(?s:.){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))|\bdata:(?s:.){0,100}?\s+([\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:["']?[a-z0-9+/]{10,}={0,3}["']?|\{\{[ \t\w"|$:=,.-]+}}|""|''))(?s:.){0,200}?\bkind:[ \t]*["']?\bsecret\b["']?)'''
+path = '''(?i)\.ya?ml$'''
+keywords = ["secret"]
+[[rules.allowlists]]
+regexes = [
+ '''[\w.-]+:(?:[ \t]*(?:\||>[-+]?)\s+)?[ \t]*(?:\{\{[ \t\w"|$:=,.-]+}}|""|'')''',
+]
+[[rules.allowlists]]
+regexTarget = "match"
+regexes = [
+ '''(kind:(?s:.)+\n---\n(?s:.)+\bdata:|data:(?s:.)+\n---\n(?s:.)+\bkind:)''',
+]
+
+[[rules]]
+id = "kucoin-access-token"
+description = "Found a Kucoin Access Token, risking unauthorized access to cryptocurrency exchange services and transactions."
+regex = '''(?i)[\w.-]{0,50}?(?:kucoin)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{24})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["kucoin"]
+
+[[rules]]
+id = "kucoin-secret-key"
+description = "Discovered a Kucoin Secret Key, which could lead to compromised cryptocurrency operations and financial data breaches."
+regex = '''(?i)[\w.-]{0,50}?(?:kucoin)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["kucoin"]
+
+[[rules]]
+id = "launchdarkly-access-token"
+description = "Uncovered a Launchdarkly Access Token, potentially compromising feature flag management and application functionality."
+regex = '''(?i)[\w.-]{0,50}?(?:launchdarkly)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9=_\-]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["launchdarkly"]
+
+[[rules]]
+id = "linear-api-key"
+description = "Detected a Linear API Token, posing a risk to project management tools and sensitive task data."
+regex = '''lin_api_(?i)[a-z0-9]{40}'''
+entropy = 2
+keywords = ["lin_api_"]
+
+[[rules]]
+id = "linear-client-secret"
+description = "Identified a Linear Client Secret, which may compromise secure integrations and sensitive project management data."
+regex = '''(?i)[\w.-]{0,50}?(?:linear)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["linear"]
+
+[[rules]]
+id = "linkedin-client-id"
+description = "Found a LinkedIn Client ID, risking unauthorized access to LinkedIn integrations and professional data exposure."
+regex = '''(?i)[\w.-]{0,50}?(?:linked[_-]?in)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{14})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = [
+ "linkedin",
+ "linked_in",
+ "linked-in",
+]
+
+[[rules]]
+id = "linkedin-client-secret"
+description = "Discovered a LinkedIn Client secret, potentially compromising LinkedIn application integrations and user data."
+regex = '''(?i)[\w.-]{0,50}?(?:linked[_-]?in)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{16})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = [
+ "linkedin",
+ "linked_in",
+ "linked-in",
+]
+
+[[rules]]
+id = "lob-api-key"
+description = "Uncovered a Lob API Key, which could lead to unauthorized access to mailing and address verification services."
+regex = '''(?i)[\w.-]{0,50}?(?:lob)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}((live|test)_[a-f0-9]{35})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "test_",
+ "live_",
+]
+
+[[rules]]
+id = "lob-pub-api-key"
+description = "Detected a Lob Publishable API Key, posing a risk of exposing mail and print service integrations."
+regex = '''(?i)[\w.-]{0,50}?(?:lob)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}((test|live)_pub_[a-f0-9]{31})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "test_pub",
+ "live_pub",
+ "_pub",
+]
+
+[[rules]]
+id = "mailchimp-api-key"
+description = "Identified a Mailchimp API key, potentially compromising email marketing campaigns and subscriber data."
+regex = '''(?i)[\w.-]{0,50}?(?:MailchimpSDK.initialize|mailchimp)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{32}-us\d\d)(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["mailchimp"]
+
+[[rules]]
+id = "mailgun-private-api-token"
+description = "Found a Mailgun private API token, risking unauthorized email service operations and data breaches."
+regex = '''(?i)[\w.-]{0,50}?(?:mailgun)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(key-[a-f0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["mailgun"]
+
+[[rules]]
+id = "mailgun-pub-key"
+description = "Discovered a Mailgun public validation key, which could expose email verification processes and associated data."
+regex = '''(?i)[\w.-]{0,50}?(?:mailgun)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(pubkey-[a-f0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["mailgun"]
+
+[[rules]]
+id = "mailgun-signing-key"
+description = "Uncovered a Mailgun webhook signing key, potentially compromising email automation and data integrity."
+regex = '''(?i)[\w.-]{0,50}?(?:mailgun)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["mailgun"]
+
+[[rules]]
+id = "mapbox-api-token"
+description = "Detected a MapBox API token, posing a risk to geospatial services and sensitive location data exposure."
+regex = '''(?i)[\w.-]{0,50}?(?:mapbox)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(pk\.[a-z0-9]{60}\.[a-z0-9]{22})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["mapbox"]
+
+[[rules]]
+id = "mattermost-access-token"
+description = "Identified a Mattermost Access Token, which may compromise team communication channels and data privacy."
+regex = '''(?i)[\w.-]{0,50}?(?:mattermost)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{26})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["mattermost"]
+
+[[rules]]
+id = "maxmind-license-key"
+description = "Discovered a potential MaxMind license key."
+regex = '''\b([A-Za-z0-9]{6}_[A-Za-z0-9]{29}_mmk)(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 4
+keywords = ["_mmk"]
+
+[[rules]]
+id = "messagebird-api-token"
+description = "Found a MessageBird API token, risking unauthorized access to communication platforms and message data."
+regex = '''(?i)[\w.-]{0,50}?(?:message[_-]?bird)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{25})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "messagebird",
+ "message-bird",
+ "message_bird",
+]
+
+[[rules]]
+id = "messagebird-client-id"
+description = "Discovered a MessageBird client ID, potentially compromising API integrations and sensitive communication data."
+regex = '''(?i)[\w.-]{0,50}?(?:message[_-]?bird)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "messagebird",
+ "message-bird",
+ "message_bird",
+]
+
+[[rules]]
+id = "microsoft-teams-webhook"
+description = "Uncovered a Microsoft Teams Webhook, which could lead to unauthorized access to team collaboration tools and data leaks."
+regex = '''https://[a-z0-9]+\.webhook\.office\.com/webhookb2/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}/IncomingWebhook/[a-z0-9]{32}/[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}'''
+keywords = [
+ "webhook.office.com",
+ "webhookb2",
+ "incomingwebhook",
+]
+
+[[rules]]
+id = "netlify-access-token"
+description = "Detected a Netlify Access Token, potentially compromising web hosting services and site management."
+regex = '''(?i)[\w.-]{0,50}?(?:netlify)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9=_\-]{40,46})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["netlify"]
+
+[[rules]]
+id = "new-relic-browser-api-token"
+description = "Identified a New Relic ingest browser API token, risking unauthorized access to application performance data and analytics."
+regex = '''(?i)[\w.-]{0,50}?(?:new-relic|newrelic|new_relic)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(NRJS-[a-f0-9]{19})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["nrjs-"]
+
+[[rules]]
+id = "new-relic-insert-key"
+description = "Discovered a New Relic insight insert key, compromising data injection into the platform."
+regex = '''(?i)[\w.-]{0,50}?(?:new-relic|newrelic|new_relic)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(NRII-[a-z0-9-]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["nrii-"]
+
+[[rules]]
+id = "new-relic-user-api-id"
+description = "Found a New Relic user API ID, posing a risk to application monitoring services and data integrity."
+regex = '''(?i)[\w.-]{0,50}?(?:new-relic|newrelic|new_relic)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "new-relic",
+ "newrelic",
+ "new_relic",
+]
+
+[[rules]]
+id = "new-relic-user-api-key"
+description = "Discovered a New Relic user API Key, which could lead to compromised application insights and performance monitoring."
+regex = '''(?i)[\w.-]{0,50}?(?:new-relic|newrelic|new_relic)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(NRAK-[a-z0-9]{27})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["nrak"]
+
+[[rules]]
+id = "npm-access-token"
+description = "Uncovered an npm access token, potentially compromising package management and code repository access."
+regex = '''(?i)\b(npm_[a-z0-9]{36})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["npm_"]
+
+[[rules]]
+id = "nuget-config-password"
+description = "Identified a password within a Nuget config file, potentially compromising package management access."
+regex = '''(?i)<add key=\"(?:(?:ClearText)?Password)\"\s*value=\"(.{8,})\"\s*/>'''
+path = '''(?i)nuget\.config$'''
+entropy = 1
+keywords = ["<add key="]
+[[rules.allowlists]]
+regexes = [
+ '''33f!!lloppa''',
+ '''hal\+9ooo_da!sY''',
+ '''^\%\S.*\%$''',
+]
+
+[[rules]]
+id = "nytimes-access-token"
+description = "Detected a Nytimes Access Token, risking unauthorized access to New York Times APIs and content services."
+regex = '''(?i)[\w.-]{0,50}?(?:nytimes|new-york-times,|newyorktimes)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9=_\-]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "nytimes",
+ "new-york-times",
+ "newyorktimes",
+]
+
+[[rules]]
+id = "octopus-deploy-api-key"
+description = "Discovered a potential Octopus Deploy API key, risking application deployments and operational security."
+regex = '''\b(API-[A-Z0-9]{26})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["api-"]
+
+[[rules]]
+id = "okta-access-token"
+description = "Identified an Okta Access Token, which may compromise identity management services and user authentication data."
+regex = '''[\w.-]{0,50}?(?i:[\w.-]{0,50}?(?:(?-i:[Oo]kta|OKTA))(?:[ \t\w.-]{0,20})[\s'"]{0,3})(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(00[\w=\-]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 4
+keywords = ["okta"]
+
+[[rules]]
+id = "openai-api-key"
+description = "Found an OpenAI API Key, posing a risk of unauthorized access to AI services and data manipulation."
+regex = '''\b(sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})\b|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["t3blbkfj"]
+
+[[rules]]
+id = "openshift-user-token"
+description = "Found an OpenShift user token, potentially compromising an OpenShift/Kubernetes cluster."
+regex = '''\b(sha256~[\w-]{43})(?:[^\w-]|\z)'''
+entropy = 3.5
+keywords = ["sha256~"]
+
+[[rules]]
+id = "perplexity-api-key"
+description = "Detected a Perplexity API key, which could lead to unauthorized access to Perplexity AI services and data exposure."
+regex = '''\b(pplx-[a-zA-Z0-9]{48})(?:[\x60'"\s;]|\\[nr]|$|\b)'''
+entropy = 4
+keywords = ["pplx-"]
+
+[[rules]]
+id = "pkcs12-file"
+description = "Found a PKCS #12 file, which commonly contain bundled private keys."
+path = '''(?i)(?:^|\/)[^\/]+\.p(?:12|fx)$'''
+
+[[rules]]
+id = "plaid-api-token"
+description = "Discovered a Plaid API Token, potentially compromising financial data aggregation and banking services."
+regex = '''(?i)[\w.-]{0,50}?(?:plaid)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(access-(?:sandbox|development|production)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["plaid"]
+
+[[rules]]
+id = "plaid-client-id"
+description = "Uncovered a Plaid Client ID, which could lead to unauthorized financial service integrations and data breaches."
+regex = '''(?i)[\w.-]{0,50}?(?:plaid)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{24})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3.5
+keywords = ["plaid"]
+
+[[rules]]
+id = "plaid-secret-key"
+description = "Detected a Plaid Secret key, risking unauthorized access to financial accounts and sensitive transaction data."
+regex = '''(?i)[\w.-]{0,50}?(?:plaid)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{30})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3.5
+keywords = ["plaid"]
+
+[[rules]]
+id = "planetscale-api-token"
+description = "Identified a PlanetScale API token, potentially compromising database management and operations."
+regex = '''\b(pscale_tkn_(?i)[\w=\.-]{32,64})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["pscale_tkn_"]
+
+[[rules]]
+id = "planetscale-oauth-token"
+description = "Found a PlanetScale OAuth token, posing a risk to database access control and sensitive data integrity."
+regex = '''\b(pscale_oauth_[\w=\.-]{32,64})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["pscale_oauth_"]
+
+[[rules]]
+id = "planetscale-password"
+description = "Discovered a PlanetScale password, which could lead to unauthorized database operations and data breaches."
+regex = '''(?i)\b(pscale_pw_(?i)[\w=\.-]{32,64})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["pscale_pw_"]
+
+[[rules]]
+id = "postman-api-token"
+description = "Uncovered a Postman API token, potentially compromising API testing and development workflows."
+regex = '''\b(PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["pmak-"]
+
+[[rules]]
+id = "prefect-api-token"
+description = "Detected a Prefect API token, risking unauthorized access to workflow management and automation services."
+regex = '''\b(pnu_[a-zA-Z0-9]{36})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["pnu_"]
+
+[[rules]]
+id = "private-key"
+description = "Identified a Private Key, which may compromise cryptographic security and sensitive data encryption."
+regex = '''(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\s\S-]{64,}?KEY(?: BLOCK)?-----'''
+keywords = ["-----begin"]
+
+[[rules]]
+id = "privateai-api-token"
+description = "Identified a PrivateAI Token, posing a risk of unauthorized access to AI services and data manipulation."
+regex = '''[\w.-]{0,50}?(?i:[\w.-]{0,50}?(?:private[_-]?ai)(?:[ \t\w.-]{0,20})[\s'"]{0,3})(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{32})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = [
+ "privateai",
+ "private_ai",
+ "private-ai",
+]
+
+[[rules]]
+id = "pulumi-api-token"
+description = "Found a Pulumi API token, posing a risk to infrastructure as code services and cloud resource management."
+regex = '''\b(pul-[a-f0-9]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["pul-"]
+
+[[rules]]
+id = "pypi-upload-token"
+description = "Discovered a PyPI upload token, potentially compromising Python package distribution and repository integrity."
+regex = '''pypi-AgEIcHlwaS5vcmc[\w-]{50,1000}'''
+entropy = 3
+keywords = ["pypi-ageichlwas5vcmc"]
+
+[[rules]]
+id = "rapidapi-access-token"
+description = "Uncovered a RapidAPI Access Token, which could lead to unauthorized access to various APIs and data services."
+regex = '''(?i)[\w.-]{0,50}?(?:rapidapi)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9_-]{50})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["rapidapi"]
+
+[[rules]]
+id = "readme-api-token"
+description = "Detected a Readme API token, risking unauthorized documentation management and content exposure."
+regex = '''\b(rdme_[a-z0-9]{70})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["rdme_"]
+
+[[rules]]
+id = "rubygems-api-token"
+description = "Identified a Rubygem API token, potentially compromising Ruby library distribution and package management."
+regex = '''\b(rubygems_[a-f0-9]{48})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["rubygems_"]
+
+[[rules]]
+id = "scalingo-api-token"
+description = "Found a Scalingo API token, posing a risk to cloud platform services and application deployment security."
+regex = '''\b(tk-us-[\w-]{48})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["tk-us-"]
+
+[[rules]]
+id = "sendbird-access-id"
+description = "Discovered a Sendbird Access ID, which could compromise chat and messaging platform integrations."
+regex = '''(?i)[\w.-]{0,50}?(?:sendbird)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["sendbird"]
+
+[[rules]]
+id = "sendbird-access-token"
+description = "Uncovered a Sendbird Access Token, potentially risking unauthorized access to communication services and user data."
+regex = '''(?i)[\w.-]{0,50}?(?:sendbird)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["sendbird"]
+
+[[rules]]
+id = "sendgrid-api-token"
+description = "Detected a SendGrid API token, posing a risk of unauthorized email service operations and data exposure."
+regex = '''\b(SG\.(?i)[a-z0-9=_\-\.]{66})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["sg."]
+
+[[rules]]
+id = "sendinblue-api-token"
+description = "Identified a Sendinblue API token, which may compromise email marketing services and subscriber data privacy."
+regex = '''\b(xkeysib-[a-f0-9]{64}\-(?i)[a-z0-9]{16})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["xkeysib-"]
+
+[[rules]]
+id = "sentry-access-token"
+description = "Found a Sentry.io Access Token (old format), risking unauthorized access to error tracking services and sensitive application data."
+regex = '''(?i)[\w.-]{0,50}?(?:sentry)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["sentry"]
+
+[[rules]]
+id = "sentry-org-token"
+description = "Found a Sentry.io Organization Token, risking unauthorized access to error tracking services and sensitive application data."
+regex = '''\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}(?:[^a-zA-Z0-9+/]|\z)'''
+entropy = 4.5
+keywords = ["sntrys_eyjpyxqio"]
+
+[[rules]]
+id = "sentry-user-token"
+description = "Found a Sentry.io User Token, risking unauthorized access to error tracking services and sensitive application data."
+regex = '''\b(sntryu_[a-f0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3.5
+keywords = ["sntryu_"]
+
+[[rules]]
+id = "settlemint-application-access-token"
+description = "Found a Settlemint Application Access Token."
+regex = '''\b(sm_aat_[a-zA-Z0-9]{16})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["sm_aat"]
+
+[[rules]]
+id = "settlemint-personal-access-token"
+description = "Found a Settlemint Personal Access Token."
+regex = '''\b(sm_pat_[a-zA-Z0-9]{16})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["sm_pat"]
+
+[[rules]]
+id = "settlemint-service-access-token"
+description = "Found a Settlemint Service Access Token."
+regex = '''\b(sm_sat_[a-zA-Z0-9]{16})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["sm_sat"]
+
+[[rules]]
+id = "shippo-api-token"
+description = "Discovered a Shippo API token, potentially compromising shipping services and customer order data."
+regex = '''\b(shippo_(?:live|test)_[a-fA-F0-9]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = ["shippo_"]
+
+[[rules]]
+id = "shopify-access-token"
+description = "Uncovered a Shopify access token, which could lead to unauthorized e-commerce platform access and data breaches."
+regex = '''shpat_[a-fA-F0-9]{32}'''
+entropy = 2
+keywords = ["shpat_"]
+
+[[rules]]
+id = "shopify-custom-access-token"
+description = "Detected a Shopify custom access token, potentially compromising custom app integrations and e-commerce data security."
+regex = '''shpca_[a-fA-F0-9]{32}'''
+entropy = 2
+keywords = ["shpca_"]
+
+[[rules]]
+id = "shopify-private-app-access-token"
+description = "Identified a Shopify private app access token, risking unauthorized access to private app data and store operations."
+regex = '''shppa_[a-fA-F0-9]{32}'''
+entropy = 2
+keywords = ["shppa_"]
+
+[[rules]]
+id = "shopify-shared-secret"
+description = "Found a Shopify shared secret, posing a risk to application authentication and e-commerce platform security."
+regex = '''shpss_[a-fA-F0-9]{32}'''
+entropy = 2
+keywords = ["shpss_"]
+
+[[rules]]
+id = "sidekiq-secret"
+description = "Discovered a Sidekiq Secret, which could lead to compromised background job processing and application data breaches."
+regex = '''(?i)[\w.-]{0,50}?(?:BUNDLE_ENTERPRISE__CONTRIBSYS__COM|BUNDLE_GEMS__CONTRIBSYS__COM)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-f0-9]{8}:[a-f0-9]{8})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = [
+ "bundle_enterprise__contribsys__com",
+ "bundle_gems__contribsys__com",
+]
+
+[[rules]]
+id = "sidekiq-sensitive-url"
+description = "Uncovered a Sidekiq Sensitive URL, potentially exposing internal job queues and sensitive operation details."
+regex = '''(?i)\bhttps?://([a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\/|\#|\?|:]|$)'''
+keywords = [
+ "gems.contribsys.com",
+ "enterprise.contribsys.com",
+]
+
+[[rules]]
+id = "slack-app-token"
+description = "Detected a Slack App-level token, risking unauthorized access to Slack applications and workspace data."
+regex = '''(?i)xapp-\d-[A-Z0-9]+-\d+-[a-z0-9]+'''
+entropy = 2
+keywords = ["xapp"]
+
+[[rules]]
+id = "slack-bot-token"
+description = "Identified a Slack Bot token, which may compromise bot integrations and communication channel security."
+regex = '''xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*'''
+entropy = 3
+keywords = ["xoxb"]
+
+[[rules]]
+id = "slack-config-access-token"
+description = "Found a Slack Configuration access token, posing a risk to workspace configuration and sensitive data access."
+regex = '''(?i)xoxe.xox[bp]-\d-[A-Z0-9]{163,166}'''
+entropy = 2
+keywords = [
+ "xoxe.xoxb-",
+ "xoxe.xoxp-",
+]
+
+[[rules]]
+id = "slack-config-refresh-token"
+description = "Discovered a Slack Configuration refresh token, potentially allowing prolonged unauthorized access to configuration settings."
+regex = '''(?i)xoxe-\d-[A-Z0-9]{146}'''
+entropy = 2
+keywords = ["xoxe-"]
+
+[[rules]]
+id = "slack-legacy-bot-token"
+description = "Uncovered a Slack Legacy bot token, which could lead to compromised legacy bot operations and data exposure."
+regex = '''xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26}'''
+entropy = 2
+keywords = ["xoxb"]
+
+[[rules]]
+id = "slack-legacy-token"
+description = "Detected a Slack Legacy token, risking unauthorized access to older Slack integrations and user data."
+regex = '''xox[os]-\d+-\d+-\d+-[a-fA-F\d]+'''
+entropy = 2
+keywords = [
+ "xoxo",
+ "xoxs",
+]
+
+[[rules]]
+id = "slack-legacy-workspace-token"
+description = "Identified a Slack Legacy Workspace token, potentially compromising access to workspace data and legacy features."
+regex = '''xox[ar]-(?:\d-)?[0-9a-zA-Z]{8,48}'''
+entropy = 2
+keywords = [
+ "xoxa",
+ "xoxr",
+]
+
+[[rules]]
+id = "slack-user-token"
+description = "Found a Slack User token, posing a risk of unauthorized user impersonation and data access within Slack workspaces."
+regex = '''xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}'''
+entropy = 2
+keywords = [
+ "xoxp-",
+ "xoxe-",
+]
+
+[[rules]]
+id = "slack-webhook-url"
+description = "Discovered a Slack Webhook, which could lead to unauthorized message posting and data leakage in Slack channels."
+regex = '''(?:https?://)?hooks.slack.com/(?:services|workflows|triggers)/[A-Za-z0-9+/]{43,56}'''
+keywords = ["hooks.slack.com"]
+
+[[rules]]
+id = "snyk-api-token"
+description = "Uncovered a Snyk API token, potentially compromising software vulnerability scanning and code security."
+regex = '''(?i)[\w.-]{0,50}?(?:snyk[_.-]?(?:(?:api|oauth)[_.-]?)?(?:key|token))(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["snyk"]
+
+[[rules]]
+id = "sonar-api-token"
+description = "Uncovered a Sonar API token, potentially compromising software vulnerability scanning and code security."
+regex = '''(?i)[\w.-]{0,50}?(?:sonar[_.-]?(login|token))(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9=_\-]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["sonar"]
+
+[[rules]]
+id = "sourcegraph-access-token"
+description = "Sourcegraph is a code search and navigation engine."
+regex = '''(?i)\b(\b(sgp_(?:[a-fA-F0-9]{16}|local)_[a-fA-F0-9]{40}|sgp_[a-fA-F0-9]{40}|[a-fA-F0-9]{40})\b)(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = [
+ "sgp_",
+ "sourcegraph",
+]
+
+[[rules]]
+id = "square-access-token"
+description = "Detected a Square Access Token, risking unauthorized payment processing and financial transaction exposure."
+regex = '''\b((?:EAAA|sq0atp-)[\w-]{22,60})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = [
+ "sq0atp-",
+ "eaaa",
+]
+
+[[rules]]
+id = "squarespace-access-token"
+description = "Identified a Squarespace Access Token, which may compromise website management and content control on Squarespace."
+regex = '''(?i)[\w.-]{0,50}?(?:squarespace)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["squarespace"]
+
+[[rules]]
+id = "stripe-access-token"
+description = "Found a Stripe Access Token, posing a risk to payment processing services and sensitive financial data."
+regex = '''\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 2
+keywords = [
+ "sk_test",
+ "sk_live",
+ "sk_prod",
+ "rk_test",
+ "rk_live",
+ "rk_prod",
+]
+
+[[rules]]
+id = "sumologic-access-id"
+description = "Discovered a SumoLogic Access ID, potentially compromising log management services and data analytics integrity."
+regex = '''[\w.-]{0,50}?(?i:[\w.-]{0,50}?(?:(?-i:[Ss]umo|SUMO))(?:[ \t\w.-]{0,20})[\s'"]{0,3})(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(su[a-zA-Z0-9]{12})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["sumo"]
+
+[[rules]]
+id = "sumologic-access-token"
+description = "Uncovered a SumoLogic Access Token, which could lead to unauthorized access to log data and analytics insights."
+regex = '''(?i)[\w.-]{0,50}?(?:(?-i:[Ss]umo|SUMO))(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{64})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3
+keywords = ["sumo"]
+
+[[rules]]
+id = "telegram-bot-api-token"
+description = "Detected a Telegram Bot API Token, risking unauthorized bot operations and message interception on Telegram."
+regex = '''(?i)[\w.-]{0,50}?(?:telegr)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9]{5,16}:(?-i:A)[a-z0-9_\-]{34})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["telegr"]
+
+[[rules]]
+id = "travisci-access-token"
+description = "Identified a Travis CI Access Token, potentially compromising continuous integration services and codebase security."
+regex = '''(?i)[\w.-]{0,50}?(?:travis)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{22})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["travis"]
+
+[[rules]]
+id = "twilio-api-key"
+description = "Found a Twilio API Key, posing a risk to communication services and sensitive customer interaction data."
+regex = '''SK[0-9a-fA-F]{32}'''
+entropy = 3
+keywords = ["sk"]
+
+[[rules]]
+id = "twitch-api-token"
+description = "Discovered a Twitch API token, which could compromise streaming services and account integrations."
+regex = '''(?i)[\w.-]{0,50}?(?:twitch)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{30})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["twitch"]
+
+[[rules]]
+id = "twitter-access-secret"
+description = "Uncovered a Twitter Access Secret, potentially risking unauthorized Twitter integrations and data breaches."
+regex = '''(?i)[\w.-]{0,50}?(?:twitter)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{45})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["twitter"]
+
+[[rules]]
+id = "twitter-access-token"
+description = "Detected a Twitter Access Token, posing a risk of unauthorized account operations and social media data exposure."
+regex = '''(?i)[\w.-]{0,50}?(?:twitter)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([0-9]{15,25}-[a-zA-Z0-9]{20,40})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["twitter"]
+
+[[rules]]
+id = "twitter-api-key"
+description = "Identified a Twitter API Key, which may compromise Twitter application integrations and user data security."
+regex = '''(?i)[\w.-]{0,50}?(?:twitter)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{25})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["twitter"]
+
+[[rules]]
+id = "twitter-api-secret"
+description = "Found a Twitter API Secret, risking the security of Twitter app integrations and sensitive data access."
+regex = '''(?i)[\w.-]{0,50}?(?:twitter)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{50})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["twitter"]
+
+[[rules]]
+id = "twitter-bearer-token"
+description = "Discovered a Twitter Bearer Token, potentially compromising API access and data retrieval from Twitter."
+regex = '''(?i)[\w.-]{0,50}?(?:twitter)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(A{22}[a-zA-Z0-9%]{80,100})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["twitter"]
+
+[[rules]]
+id = "typeform-api-token"
+description = "Uncovered a Typeform API token, which could lead to unauthorized survey management and data collection."
+regex = '''(?i)[\w.-]{0,50}?(?:typeform)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(tfp_[a-z0-9\-_\.=]{59})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["tfp_"]
+
+[[rules]]
+id = "vault-batch-token"
+description = "Detected a Vault Batch Token, risking unauthorized access to secret management services and sensitive data."
+regex = '''\b(hvb\.[\w-]{138,300})(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 4
+keywords = ["hvb."]
+
+[[rules]]
+id = "vault-service-token"
+description = "Identified a Vault Service Token, potentially compromising infrastructure security and access to sensitive credentials."
+regex = '''\b((?:hvs\.[\w-]{90,120}|s\.(?i:[a-z0-9]{24})))(?:[\x60'"\s;]|\\[nr]|$)'''
+entropy = 3.5
+keywords = [
+ "hvs.",
+ "s.",
+]
+[[rules.allowlists]]
+regexes = [
+ '''s\.[A-Za-z]{24}''',
+]
+
+[[rules]]
+id = "yandex-access-token"
+description = "Found a Yandex Access Token, posing a risk to Yandex service integrations and user data privacy."
+regex = '''(?i)[\w.-]{0,50}?(?:yandex)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["yandex"]
+
+[[rules]]
+id = "yandex-api-key"
+description = "Discovered a Yandex API Key, which could lead to unauthorized access to Yandex services and data manipulation."
+regex = '''(?i)[\w.-]{0,50}?(?:yandex)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(AQVN[A-Za-z0-9_\-]{35,38})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["yandex"]
+
+[[rules]]
+id = "yandex-aws-access-token"
+description = "Uncovered a Yandex AWS Access Token, potentially compromising cloud resource access and data security on Yandex Cloud."
+regex = '''(?i)[\w.-]{0,50}?(?:yandex)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}(YC[a-zA-Z0-9_\-]{38})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["yandex"]
+
+[[rules]]
+id = "zendesk-secret-key"
+description = "Detected a Zendesk Secret Key, risking unauthorized access to customer support services and sensitive ticketing data."
+regex = '''(?i)[\w.-]{0,50}?(?:zendesk)(?:[ \t\w.-]{0,20})[\s'"]{0,3}(?:=|>|:{1,3}=|\|\||:|=>|\?=|,)[\x60'"\s=]{0,5}([a-z0-9]{40})(?:[\x60'"\s;]|\\[nr]|$)'''
+keywords = ["zendesk"]
+
diff --git a/cli/detect/config/rule.go b/cli/detect/config/rule.go
new file mode 100644
index 0000000000..6d2b61326e
--- /dev/null
+++ b/cli/detect/config/rule.go
@@ -0,0 +1,114 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package config
+
+import (
+ "fmt"
+ "strings"
+
+ "github.com/Infisical/infisical-merge/detect/regexp"
+)
+
+// Rules contain information that define details on how to detect secrets
+type Rule struct {
+ // RuleID is a unique identifier for this rule
+ RuleID string
+
+ // Description is the description of the rule.
+ Description string
+
+ // Entropy is a float representing the minimum shannon
+ // entropy a regex group must have to be considered a secret.
+ Entropy float64
+
+ // SecretGroup is an int used to extract secret from regex
+ // match and used as the group that will have its entropy
+ // checked if `entropy` is set.
+ SecretGroup int
+
+ // Regex is a golang regular expression used to detect secrets.
+ Regex *regexp.Regexp
+
+ // Path is a golang regular expression used to
+ // filter secrets by path
+ Path *regexp.Regexp
+
+ // Tags is an array of strings used for metadata
+ // and reporting purposes.
+ Tags []string
+
+ // Keywords are used for pre-regex check filtering. Rules that contain
+ // keywords will perform a quick string compare check to make sure the
+ // keyword(s) are in the content being scanned.
+ Keywords []string
+
+ // Allowlists allows a rule to be ignored for specific commits, paths, regexes, and/or stopwords.
+ Allowlists []*Allowlist
+
+ // validated is an internal flag to track whether `Validate()` has been called.
+ validated bool
+}
+
+// Validate guards against common misconfigurations.
+func (r *Rule) Validate() error {
+ if r.validated {
+ return nil
+ }
+
+ // Ensure |id| is present.
+ if strings.TrimSpace(r.RuleID) == "" {
+ // Try to provide helpful context, since |id| is empty.
+ var context string
+ if r.Regex != nil {
+ context = ", regex: " + r.Regex.String()
+ } else if r.Path != nil {
+ context = ", path: " + r.Path.String()
+ } else if r.Description != "" {
+ context = ", description: " + r.Description
+ }
+ return fmt.Errorf("rule |id| is missing or empty" + context)
+ }
+
+ // Ensure the rule actually matches something.
+ if r.Regex == nil && r.Path == nil {
+ return fmt.Errorf("%s: both |regex| and |path| are empty, this rule will have no effect", r.RuleID)
+ }
+
+ // Ensure |secretGroup| works.
+ if r.Regex != nil && r.SecretGroup > r.Regex.NumSubexp() {
+ return fmt.Errorf("%s: invalid regex secret group %d, max regex secret group %d", r.RuleID, r.SecretGroup, r.Regex.NumSubexp())
+ }
+
+ for _, allowlist := range r.Allowlists {
+ // This will probably never happen.
+ if allowlist == nil {
+ continue
+ }
+ if err := allowlist.Validate(); err != nil {
+ return fmt.Errorf("%s: %w", r.RuleID, err)
+ }
+ }
+
+ r.validated = true
+ return nil
+}
diff --git a/cli/report/report.go b/cli/detect/config/utils.go
similarity index 65%
rename from cli/report/report.go
rename to cli/detect/config/utils.go
index 1191a4f331..e28a5cb378 100644
--- a/cli/report/report.go
+++ b/cli/detect/config/utils.go
@@ -20,35 +20,27 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-package report
+package config
import (
- "os"
- "strings"
-
- "github.com/Infisical/infisical-merge/config"
+ "github.com/Infisical/infisical-merge/detect/regexp"
)
-const (
- // https://cwe.mitre.org/data/definitions/798.html
- CWE = "CWE-798"
- CWE_DESCRIPTION = "Use of Hard-coded Credentials"
-)
+func anyRegexMatch(f string, res []*regexp.Regexp) bool {
+ for _, re := range res {
+ if regexMatched(f, re) {
+ return true
+ }
+ }
+ return false
+}
-func Write(findings []Finding, cfg config.Config, ext string, reportPath string) error {
- file, err := os.Create(reportPath)
- if err != nil {
- return err
+func regexMatched(f string, re *regexp.Regexp) bool {
+ if re == nil {
+ return false
}
- ext = strings.ToLower(ext)
- switch ext {
- case ".json", "json":
- err = writeJson(findings, file)
- case ".csv", "csv":
- err = writeCsv(findings, file)
- case ".sarif", "sarif":
- err = writeSarif(cfg, findings, file)
+ if re.FindString(f) != "" {
+ return true
}
-
- return err
+ return false
}
diff --git a/cli/detect/decoder.go b/cli/detect/decoder.go
new file mode 100644
index 0000000000..6ec5097575
--- /dev/null
+++ b/cli/detect/decoder.go
@@ -0,0 +1,328 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package detect
+
+import (
+ "bytes"
+ "encoding/base64"
+ "fmt"
+ "regexp"
+ "unicode"
+
+ "github.com/Infisical/infisical-merge/detect/logging"
+)
+
+var b64LikelyChars [128]byte
+var b64Regexp = regexp.MustCompile(`[\w/+-]{16,}={0,3}`)
+var decoders = []func(string) ([]byte, error){
+ base64.StdEncoding.DecodeString,
+ base64.RawURLEncoding.DecodeString,
+}
+
+func init() {
+ // Basically look for anything that isn't just letters
+ for _, c := range `0123456789+/-_` {
+ b64LikelyChars[c] = 1
+ }
+}
+
+// EncodedSegment represents a portion of text that is encoded in some way.
+// `decode` supports recusive decoding and can result in "segment trees".
+// There can be multiple segments in the original text, so each can be thought
+// of as its own tree with the root being the original segment.
+type EncodedSegment struct {
+ // The parent segment in a segment tree. If nil, it is a root segment
+ parent *EncodedSegment
+
+ // Relative start/end are the bounds of the encoded value in the current pass.
+ relativeStart int
+ relativeEnd int
+
+ // Absolute start/end refer to the bounds of the root segment in this segment
+ // tree
+ absoluteStart int
+ absoluteEnd int
+
+ // Decoded start/end refer to the bounds of the decoded value in the current
+ // pass. These can differ from relative values because decoding can shrink
+ // or grow the size of the segment.
+ decodedStart int
+ decodedEnd int
+
+ // This is the actual decoded content in the segment
+ decodedValue string
+
+ // This is the type of encoding
+ encoding string
+}
+
+// isChildOf inspects the bounds of two segments to determine
+// if one should be the child of another
+func (s EncodedSegment) isChildOf(parent EncodedSegment) bool {
+ return parent.decodedStart <= s.relativeStart && parent.decodedEnd >= s.relativeEnd
+}
+
+// decodedOverlaps checks if the decoded bounds of the segment overlaps a range
+func (s EncodedSegment) decodedOverlaps(start, end int) bool {
+ return start <= s.decodedEnd && end >= s.decodedStart
+}
+
+// adjustMatchIndex takes the matchIndex from the current decoding pass and
+// updates it to match the absolute matchIndex in the original text.
+func (s EncodedSegment) adjustMatchIndex(matchIndex []int) []int {
+ // The match is within the bounds of the segment so we just return
+ // the absolute start and end of the root segment.
+ if s.decodedStart <= matchIndex[0] && matchIndex[1] <= s.decodedEnd {
+ return []int{
+ s.absoluteStart,
+ s.absoluteEnd,
+ }
+ }
+
+ // Since it overlaps one side and/or the other, we're going to have to adjust
+ // and climb parents until we're either at the root or we've determined
+ // we're fully inside one of the parent segments.
+ adjustedMatchIndex := make([]int, 2)
+
+ if matchIndex[0] < s.decodedStart {
+ // It starts before the encoded segment so adjust the start to match
+ // the location before it was decoded
+ matchStartDelta := s.decodedStart - matchIndex[0]
+ adjustedMatchIndex[0] = s.relativeStart - matchStartDelta
+ } else {
+ // It starts within the encoded segment so set the bound to the
+ // relative start
+ adjustedMatchIndex[0] = s.relativeStart
+ }
+
+ if matchIndex[1] > s.decodedEnd {
+ // It ends after the encoded segment so adjust the end to match
+ // the location before it was decoded
+ matchEndDelta := matchIndex[1] - s.decodedEnd
+ adjustedMatchIndex[1] = s.relativeEnd + matchEndDelta
+ } else {
+ // It ends within the encoded segment so set the bound to the relative end
+ adjustedMatchIndex[1] = s.relativeEnd
+ }
+
+ // We're still not at a root segment so we'll need to keep on adjusting
+ if s.parent != nil {
+ return s.parent.adjustMatchIndex(adjustedMatchIndex)
+ }
+
+ return adjustedMatchIndex
+}
+
+// depth reports how many levels of decoding needed to be done (default is 1)
+func (s EncodedSegment) depth() int {
+ depth := 1
+
+ // Climb the tree and increment the depth
+ for current := &s; current.parent != nil; current = current.parent {
+ depth++
+ }
+
+ return depth
+}
+
+// tags returns additional meta data tags related to the types of segments
+func (s EncodedSegment) tags() []string {
+ return []string{
+ fmt.Sprintf("decoded:%s", s.encoding),
+ fmt.Sprintf("decode-depth:%d", s.depth()),
+ }
+}
+
+// Decoder decodes various types of data in place
+type Decoder struct {
+ decodedMap map[string]string
+}
+
+// NewDecoder creates a default decoder struct
+func NewDecoder() *Decoder {
+ return &Decoder{
+ decodedMap: make(map[string]string),
+ }
+}
+
+// decode returns the data with the values decoded in-place
+func (d *Decoder) decode(data string, parentSegments []EncodedSegment) (string, []EncodedSegment) {
+ segments := d.findEncodedSegments(data, parentSegments)
+
+ if len(segments) > 0 {
+ result := bytes.NewBuffer(make([]byte, 0, len(data)))
+
+ relativeStart := 0
+ for _, segment := range segments {
+ result.WriteString(data[relativeStart:segment.relativeStart])
+ result.WriteString(segment.decodedValue)
+ relativeStart = segment.relativeEnd
+ }
+ result.WriteString(data[relativeStart:])
+
+ return result.String(), segments
+ }
+
+ return data, segments
+}
+
+// findEncodedSegments finds the encoded segments in the data and updates the
+// segment tree for this pass
+func (d *Decoder) findEncodedSegments(data string, parentSegments []EncodedSegment) []EncodedSegment {
+ if len(data) == 0 {
+ return []EncodedSegment{}
+ }
+
+ matchIndices := b64Regexp.FindAllStringIndex(data, -1)
+ if matchIndices == nil {
+ return []EncodedSegment{}
+ }
+
+ segments := make([]EncodedSegment, 0, len(matchIndices))
+
+ // Keeps up with offsets from the text changing size as things are decoded
+ decodedShift := 0
+
+ for _, matchIndex := range matchIndices {
+ encodedValue := data[matchIndex[0]:matchIndex[1]]
+
+ if !isLikelyB64(encodedValue) {
+ d.decodedMap[encodedValue] = ""
+ continue
+ }
+
+ decodedValue, alreadyDecoded := d.decodedMap[encodedValue]
+
+ // We haven't decoded this yet, so go ahead and decode it
+ if !alreadyDecoded {
+ decodedValue = decodeValue(encodedValue)
+ d.decodedMap[encodedValue] = decodedValue
+ }
+
+ // Skip this segment because there was nothing to check
+ if len(decodedValue) == 0 {
+ continue
+ }
+
+ // Create a segment for the encoded data
+ segment := EncodedSegment{
+ relativeStart: matchIndex[0],
+ relativeEnd: matchIndex[1],
+ absoluteStart: matchIndex[0],
+ absoluteEnd: matchIndex[1],
+ decodedStart: matchIndex[0] + decodedShift,
+ decodedEnd: matchIndex[0] + decodedShift + len(decodedValue),
+ decodedValue: decodedValue,
+ encoding: "base64",
+ }
+
+ // Shift decoded start and ends based on size changes
+ decodedShift += len(decodedValue) - len(encodedValue)
+
+ // Adjust the absolute position of segments contained in parent segments
+ for _, parentSegment := range parentSegments {
+ if segment.isChildOf(parentSegment) {
+ segment.absoluteStart = parentSegment.absoluteStart
+ segment.absoluteEnd = parentSegment.absoluteEnd
+ segment.parent = &parentSegment
+ break
+ }
+ }
+
+ logging.Debug().Msgf("segment found: %#v", segment)
+ segments = append(segments, segment)
+ }
+
+ return segments
+}
+
+// decoders tries a list of decoders and returns the first successful one
+func decodeValue(encodedValue string) string {
+ for _, decoder := range decoders {
+ decodedValue, err := decoder(encodedValue)
+
+ if err == nil && len(decodedValue) > 0 && isASCII(decodedValue) {
+ return string(decodedValue)
+ }
+ }
+
+ return ""
+}
+
+func isASCII(b []byte) bool {
+ for i := 0; i < len(b); i++ {
+ if b[i] > unicode.MaxASCII || b[i] < '\t' {
+ return false
+ }
+ }
+
+ return true
+}
+
+// Skip a lot of method signatures and things at the risk of missing about
+// 1% of base64
+func isLikelyB64(s string) bool {
+ for _, c := range s {
+ if b64LikelyChars[c] != 0 {
+ return true
+ }
+ }
+
+ return false
+}
+
+// Find a segment where the decoded bounds overlaps a range
+func segmentWithDecodedOverlap(encodedSegments []EncodedSegment, start, end int) *EncodedSegment {
+ for _, segment := range encodedSegments {
+ if segment.decodedOverlaps(start, end) {
+ return &segment
+ }
+ }
+
+ return nil
+}
+
+func (s EncodedSegment) currentLine(currentRaw string) string {
+ start := 0
+ end := len(currentRaw)
+
+ // Find the start of the range
+ for i := s.decodedStart; i > -1; i-- {
+ c := currentRaw[i]
+ if c == '\n' {
+ start = i
+ break
+ }
+ }
+
+ // Find the end of the range
+ for i := s.decodedEnd; i < end; i++ {
+ c := currentRaw[i]
+ if c == '\n' {
+ end = i
+ break
+ }
+ }
+
+ return currentRaw[start:end]
+}
diff --git a/cli/detect/detect.go b/cli/detect/detect.go
index 84f058d4b6..f2e42ccccc 100644
--- a/cli/detect/detect.go
+++ b/cli/detect/detect.go
@@ -26,39 +26,37 @@ import (
"bufio"
"context"
"fmt"
- "io"
- "io/fs"
"os"
- "path/filepath"
- "regexp"
+ "runtime"
"strings"
"sync"
+ "sync/atomic"
+ "time"
- "github.com/h2non/filetype"
-
- "github.com/Infisical/infisical-merge/config"
- "github.com/Infisical/infisical-merge/detect/git"
- "github.com/Infisical/infisical-merge/report"
+ "github.com/Infisical/infisical-merge/detect/config"
+ "github.com/Infisical/infisical-merge/detect/logging"
+ "github.com/Infisical/infisical-merge/detect/regexp"
+ "github.com/Infisical/infisical-merge/detect/report"
+ ahocorasick "github.com/BobuSumisu/aho-corasick"
"github.com/fatih/semgroup"
- "github.com/gitleaks/go-gitdiff/gitdiff"
- ahocorasick "github.com/petar-dambovaliev/aho-corasick"
- "github.com/rs/zerolog/log"
+ "github.com/rs/zerolog"
"github.com/spf13/viper"
+ "golang.org/x/exp/maps"
)
-// Type used to differentiate between git scan types:
-// $ gitleaks detect
-// $ gitleaks protect
-// $ gitleaks protect staged
-type GitScanType int
-
const (
- DetectType GitScanType = iota
- ProtectType
- ProtectStagedType
+ gitleaksAllowSignature = "gitleaks:allow"
+ chunkSize = 100 * 1_000 // 100kb
+
+ // SlowWarningThreshold is the amount of time to wait before logging that a file is slow.
+ // This is useful for identifying problematic files and tuning the allowlist.
+ SlowWarningThreshold = 5 * time.Second
+)
- gitleaksAllowSignature = "infisical-scan:ignore"
+var (
+ newLineRegexp = regexp.MustCompile("\n")
+ isWindows = runtime.GOOS == "windows"
)
// Detector is the main detector struct
@@ -69,11 +67,14 @@ type Detector struct {
// Redact is a flag to redact findings. This is exported
// so users using gitleaks as a library can set this flag
// without calling `detector.Start(cmd *cobra.Command)`
- Redact bool
+ Redact uint
// verbose is a flag to print findings
Verbose bool
+ // MaxDecodeDepths limits how many recursive decoding passes are allowed
+ MaxDecodeDepth int
+
// files larger than this will be skipped
MaxTargetMegaBytes int
@@ -83,6 +84,9 @@ type Detector struct {
// NoColor is a flag to disable color output
NoColor bool
+ // IgnoreGitleaksAllow is a flag to ignore gitleaks:allow comments.
+ IgnoreGitleaksAllow bool
+
// commitMap is used to keep track of commits that have been scanned.
// This is only used for logging purposes and git scans.
commitMap map[string]bool
@@ -98,7 +102,7 @@ type Detector struct {
// prefilter is a ahocorasick struct used for doing efficient string
// matching given a set of words (keywords from the rules in the config)
- prefilter ahocorasick.AhoCorasick
+ prefilter ahocorasick.Trie
// a list of known findings that should be ignored
baseline []report.Finding
@@ -107,7 +111,16 @@ type Detector struct {
baselinePath string
// gitleaksIgnore
- gitleaksIgnore map[string]bool
+ gitleaksIgnore map[string]struct{}
+
+ // Sema (https://github.com/fatih/semgroup) controls the concurrency
+ Sema *semgroup.Group
+
+ // report-related settings.
+ ReportPath string
+ Reporter report.Reporter
+
+ TotalBytes atomic.Uint64
}
// Fragment contains the data to be scanned
@@ -115,9 +128,15 @@ type Fragment struct {
// Raw is the raw content of the fragment
Raw string
- // FilePath is the path to the file if applicable
+ Bytes []byte
+
+ // FilePath is the path to the file, if applicable.
+ // The path separator MUST be normalized to `/`.
FilePath string
SymlinkFile string
+ // WindowsFilePath is the path with the original separator.
+ // This provides a backwards-compatible solution to https://github.com/gitleaks/gitleaks/issues/1565.
+ WindowsFilePath string `json:"-"` // TODO: remove this in v9.
// CommitSHA is the SHA of the commit if applicable
CommitSHA string
@@ -125,28 +144,18 @@ type Fragment struct {
// newlineIndices is a list of indices of newlines in the raw content.
// This is used to calculate the line location of a finding
newlineIndices [][]int
-
- // keywords is a map of all the keywords contain within the contents
- // of this fragment
- keywords map[string]bool
}
// NewDetector creates a new detector with the given config
func NewDetector(cfg config.Config) *Detector {
- builder := ahocorasick.NewAhoCorasickBuilder(ahocorasick.Opts{
- AsciiCaseInsensitive: true,
- MatchOnlyWholeWords: false,
- MatchKind: ahocorasick.LeftMostLongestMatch,
- DFA: true,
- })
-
return &Detector{
commitMap: make(map[string]bool),
- gitleaksIgnore: make(map[string]bool),
+ gitleaksIgnore: make(map[string]struct{}),
findingMutex: &sync.Mutex{},
findings: make([]report.Finding, 0),
Config: cfg,
- prefilter: builder.Build(cfg.Keywords),
+ prefilter: *ahocorasick.NewTrieBuilder().AddStrings(maps.Keys(cfg.Keywords)).Build(),
+ Sema: semgroup.NewGroup(context.Background(), 40),
}
}
@@ -170,55 +179,44 @@ func NewDetectorDefaultConfig() (*Detector, error) {
}
func (d *Detector) AddGitleaksIgnore(gitleaksIgnorePath string) error {
- log.Debug().Msg("found .gitleaksignore file")
+ logging.Debug().Msgf("found .gitleaksignore file: %s", gitleaksIgnorePath)
file, err := os.Open(gitleaksIgnorePath)
-
if err != nil {
return err
}
-
- // https://github.com/securego/gosec/issues/512
defer func() {
+ // https://github.com/securego/gosec/issues/512
if err := file.Close(); err != nil {
- log.Warn().Msgf("Error closing .gitleaksignore file: %s\n", err)
+ logging.Warn().Msgf("Error closing .gitleaksignore file: %s\n", err)
}
}()
- scanner := bufio.NewScanner(file)
+ scanner := bufio.NewScanner(file)
+ replacer := strings.NewReplacer("\\", "/")
for scanner.Scan() {
- d.gitleaksIgnore[scanner.Text()] = true
- }
- return nil
-}
-
-func (d *Detector) AddBaseline(baselinePath string, source string) error {
- if baselinePath != "" {
- absoluteSource, err := filepath.Abs(source)
- if err != nil {
- return err
- }
-
- absoluteBaseline, err := filepath.Abs(baselinePath)
- if err != nil {
- return err
- }
-
- relativeBaseline, err := filepath.Rel(absoluteSource, absoluteBaseline)
- if err != nil {
- return err
+ line := strings.TrimSpace(scanner.Text())
+ // Skip lines that start with a comment
+ if line == "" || strings.HasPrefix(line, "#") {
+ continue
}
- baseline, err := LoadBaseline(baselinePath)
- if err != nil {
- return err
+ // Normalize the path.
+ // TODO: Make this a breaking change in v9.
+ s := strings.Split(line, ":")
+ switch len(s) {
+ case 3:
+ // Global fingerprint.
+ // `file:rule-id:start-line`
+ s[0] = replacer.Replace(s[0])
+ case 4:
+ // Commit fingerprint.
+ // `commit:file:rule-id:start-line`
+ s[1] = replacer.Replace(s[1])
+ default:
+ logging.Warn().Str("fingerprint", line).Msg("Invalid .gitleaksignore entry")
}
-
- d.baseline = baseline
- baselinePath = relativeBaseline
-
+ d.gitleaksIgnore[strings.Join(s, ":")] = struct{}{}
}
-
- d.baselinePath = baselinePath
return nil
}
@@ -234,56 +232,179 @@ func (d *Detector) DetectString(content string) []report.Finding {
})
}
-// detectRule scans the given fragment for the given rule and returns a list of findings
-func (d *Detector) detectRule(fragment Fragment, rule config.Rule) []report.Finding {
- var findings []report.Finding
+// Detect scans the given fragment and returns a list of findings
+func (d *Detector) Detect(fragment Fragment) []report.Finding {
+ if fragment.Bytes == nil {
+ d.TotalBytes.Add(uint64(len(fragment.Raw)))
+ }
+ d.TotalBytes.Add(uint64(len(fragment.Bytes)))
+
+ var (
+ findings []report.Finding
+ logger = func() zerolog.Logger {
+ l := logging.With().Str("path", fragment.FilePath)
+ if fragment.CommitSHA != "" {
+ l = l.Str("commit", fragment.CommitSHA)
+ }
+ return l.Logger()
+ }()
+ )
- // check if filepath or commit is allowed for this rule
- if rule.Allowlist.CommitAllowed(fragment.CommitSHA) ||
- rule.Allowlist.PathAllowed(fragment.FilePath) {
+ // check if filepath is allowed
+ if fragment.FilePath != "" {
+ // is the path our config or baseline file?
+ if fragment.FilePath == d.Config.Path || (d.baselinePath != "" && fragment.FilePath == d.baselinePath) {
+ logging.Trace().Msg("skipping file: matches config or baseline path")
+ return findings
+ }
+ }
+ // check if commit or filepath is allowed.
+ if isAllowed, event := checkCommitOrPathAllowed(logger, fragment, d.Config.Allowlists); isAllowed {
+ event.Msg("skipping file: global allowlist")
return findings
}
- if rule.Path != nil && rule.Regex == nil {
- // Path _only_ rule
- if rule.Path.Match([]byte(fragment.FilePath)) {
- finding := report.Finding{
- Description: rule.Description,
- File: fragment.FilePath,
- SymlinkFile: fragment.SymlinkFile,
- RuleID: rule.RuleID,
- Match: fmt.Sprintf("file detected: %s", fragment.FilePath),
- Tags: rule.Tags,
+ // add newline indices for location calculation in detectRule
+ fragment.newlineIndices = newLineRegexp.FindAllStringIndex(fragment.Raw, -1)
+
+ // setup variables to handle different decoding passes
+ currentRaw := fragment.Raw
+ encodedSegments := []EncodedSegment{}
+ currentDecodeDepth := 0
+ decoder := NewDecoder()
+
+ for {
+ // build keyword map for prefiltering rules
+ keywords := make(map[string]bool)
+ normalizedRaw := strings.ToLower(currentRaw)
+ matches := d.prefilter.MatchString(normalizedRaw)
+ for _, m := range matches {
+ keywords[normalizedRaw[m.Pos():int(m.Pos())+len(m.Match())]] = true
+ }
+
+ for _, rule := range d.Config.Rules {
+ if len(rule.Keywords) == 0 {
+ // if no keywords are associated with the rule always scan the
+ // fragment using the rule
+ findings = append(findings, d.detectRule(fragment, currentRaw, rule, encodedSegments)...)
+ continue
+ }
+
+ // check if keywords are in the fragment
+ for _, k := range rule.Keywords {
+ if _, ok := keywords[strings.ToLower(k)]; ok {
+ findings = append(findings, d.detectRule(fragment, currentRaw, rule, encodedSegments)...)
+ break
+ }
}
- return append(findings, finding)
}
- } else if rule.Path != nil {
- // if path is set _and_ a regex is set, then we need to check both
- // so if the path does not match, then we should return early and not
- // consider the regex
- if !rule.Path.Match([]byte(fragment.FilePath)) {
- return findings
+
+ // increment the depth by 1 as we start our decoding pass
+ currentDecodeDepth++
+
+ // stop the loop if we've hit our max decoding depth
+ if currentDecodeDepth > d.MaxDecodeDepth {
+ break
+ }
+
+ // decode the currentRaw for the next pass
+ currentRaw, encodedSegments = decoder.decode(currentRaw, encodedSegments)
+
+ // stop the loop when there's nothing else to decode
+ if len(encodedSegments) == 0 {
+ break
+ }
+ }
+
+ return filter(findings, d.Redact)
+}
+
+// detectRule scans the given fragment for the given rule and returns a list of findings
+func (d *Detector) detectRule(fragment Fragment, currentRaw string, r config.Rule, encodedSegments []EncodedSegment) []report.Finding {
+ var (
+ findings []report.Finding
+ logger = func() zerolog.Logger {
+ l := logging.With().Str("rule-id", r.RuleID).Str("path", fragment.FilePath)
+ if fragment.CommitSHA != "" {
+ l = l.Str("commit", fragment.CommitSHA)
+ }
+ return l.Logger()
+ }()
+ )
+
+ // check if commit or file is allowed for this rule.
+ if isAllowed, event := checkCommitOrPathAllowed(logger, fragment, r.Allowlists); isAllowed {
+ event.Msg("skipping file: rule allowlist")
+ return findings
+ }
+
+ if r.Path != nil {
+ if r.Regex == nil && len(encodedSegments) == 0 {
+ // Path _only_ rule
+ if r.Path.MatchString(fragment.FilePath) || (fragment.WindowsFilePath != "" && r.Path.MatchString(fragment.WindowsFilePath)) {
+ finding := report.Finding{
+ RuleID: r.RuleID,
+ Description: r.Description,
+ File: fragment.FilePath,
+ SymlinkFile: fragment.SymlinkFile,
+ Match: fmt.Sprintf("file detected: %s", fragment.FilePath),
+ Tags: r.Tags,
+ }
+ return append(findings, finding)
+ }
+ } else {
+ // if path is set _and_ a regex is set, then we need to check both
+ // so if the path does not match, then we should return early and not
+ // consider the regex
+ if !(r.Path.MatchString(fragment.FilePath) || (fragment.WindowsFilePath != "" && r.Path.MatchString(fragment.WindowsFilePath))) {
+ return findings
+ }
}
}
// if path only rule, skip content checks
- if rule.Regex == nil {
+ if r.Regex == nil {
return findings
}
- // If flag configure and raw data size bigger then the flag
+ // if flag configure and raw data size bigger then the flag
if d.MaxTargetMegaBytes > 0 {
- rawLength := len(fragment.Raw) / 1000000
+ rawLength := len(currentRaw) / 1000000
if rawLength > d.MaxTargetMegaBytes {
- log.Debug().Msgf("skipping file: %s scan due to size: %d", fragment.FilePath, rawLength)
+ logger.Debug().
+ Int("size", rawLength).
+ Int("max-size", d.MaxTargetMegaBytes).
+ Msg("skipping fragment: size")
return findings
}
}
- matchIndices := rule.Regex.FindAllStringIndex(fragment.Raw, -1)
- for _, matchIndex := range matchIndices {
- // extract secret from match
- secret := strings.Trim(fragment.Raw[matchIndex[0]:matchIndex[1]], "\n")
+ // use currentRaw instead of fragment.Raw since this represents the current
+ // decoding pass on the text
+ for _, matchIndex := range r.Regex.FindAllStringIndex(currentRaw, -1) {
+ // Extract secret from match
+ secret := strings.Trim(currentRaw[matchIndex[0]:matchIndex[1]], "\n")
+
+ // For any meta data from decoding
+ var metaTags []string
+ currentLine := ""
+
+ // Check if the decoded portions of the segment overlap with the match
+ // to see if its potentially a new match
+ if len(encodedSegments) > 0 {
+ if segment := segmentWithDecodedOverlap(encodedSegments, matchIndex[0], matchIndex[1]); segment != nil {
+ matchIndex = segment.adjustMatchIndex(matchIndex)
+ metaTags = append(metaTags, segment.tags()...)
+ currentLine = segment.currentLine(currentRaw)
+ } else {
+ // This item has already been added to a finding
+ continue
+ }
+ } else {
+ // Fixes: https://github.com/gitleaks/gitleaks/issues/1352
+ // removes the incorrectly following line that was detected by regex expression '\n'
+ matchIndex[1] = matchIndex[0] + len(secret)
+ }
// determine location of match. Note that the location
// in the finding will be the line/column numbers of the _match_
@@ -296,357 +417,283 @@ func (d *Detector) detectRule(fragment Fragment, rule config.Rule) []report.Find
}
finding := report.Finding{
- Description: rule.Description,
- File: fragment.FilePath,
- SymlinkFile: fragment.SymlinkFile,
- RuleID: rule.RuleID,
+ RuleID: r.RuleID,
+ Description: r.Description,
StartLine: loc.startLine,
EndLine: loc.endLine,
StartColumn: loc.startColumn,
EndColumn: loc.endColumn,
- Secret: secret,
- Match: secret,
- Tags: rule.Tags,
Line: fragment.Raw[loc.startLineIndex:loc.endLineIndex],
+ Match: secret,
+ Secret: secret,
+ File: fragment.FilePath,
+ SymlinkFile: fragment.SymlinkFile,
+ Tags: append(r.Tags, metaTags...),
}
- if strings.Contains(fragment.Raw[loc.startLineIndex:loc.endLineIndex],
- gitleaksAllowSignature) {
+ if !d.IgnoreGitleaksAllow && strings.Contains(finding.Line, gitleaksAllowSignature) {
+ logger.Trace().
+ Str("finding", finding.Secret).
+ Msg("skipping finding: 'gitleaks:allow' signature")
continue
}
- // extract secret from secret group if set
- if rule.SecretGroup != 0 {
- groups := rule.Regex.FindStringSubmatch(secret)
- if len(groups) <= rule.SecretGroup || len(groups) == 0 {
- // Config validation should prevent this
- continue
- }
- secret = groups[rule.SecretGroup]
- finding.Secret = secret
- }
-
- // check if the regexTarget is defined in the allowlist "regexes" entry
- allowlistTarget := finding.Secret
- switch rule.Allowlist.RegexTarget {
- case "match":
- allowlistTarget = finding.Match
- case "line":
- allowlistTarget = finding.Line
+ if currentLine == "" {
+ currentLine = finding.Line
}
- globalAllowlistTarget := finding.Secret
- switch d.Config.Allowlist.RegexTarget {
- case "match":
- globalAllowlistTarget = finding.Match
- case "line":
- globalAllowlistTarget = finding.Line
- }
- if rule.Allowlist.RegexAllowed(allowlistTarget) ||
- d.Config.Allowlist.RegexAllowed(globalAllowlistTarget) {
- continue
- }
-
- // check if the secret is in the list of stopwords
- if rule.Allowlist.ContainsStopWord(finding.Secret) ||
- d.Config.Allowlist.ContainsStopWord(finding.Secret) {
- continue
+ // Set the value of |secret|, if the pattern contains at least one capture group.
+ // (The first element is the full match, hence we check >= 2.)
+ groups := r.Regex.FindStringSubmatch(finding.Secret)
+ if len(groups) >= 2 {
+ if r.SecretGroup > 0 {
+ if len(groups) <= r.SecretGroup {
+ // Config validation should prevent this
+ continue
+ }
+ finding.Secret = groups[r.SecretGroup]
+ } else {
+ // If |secretGroup| is not set, we will use the first suitable capture group.
+ for _, s := range groups[1:] {
+ if len(s) > 0 {
+ finding.Secret = s
+ break
+ }
+ }
+ }
}
// check entropy
entropy := shannonEntropy(finding.Secret)
finding.Entropy = float32(entropy)
- if rule.Entropy != 0.0 {
- if entropy <= rule.Entropy {
- // entropy is too low, skip this finding
+ if r.Entropy != 0.0 {
+ // entropy is too low, skip this finding
+ if entropy <= r.Entropy {
+ logger.Trace().
+ Str("finding", finding.Secret).
+ Float32("entropy", finding.Entropy).
+ Msg("skipping finding: low entropy")
continue
}
- // NOTE: this is a goofy hack to get around the fact there golang's regex engine
- // does not support positive lookaheads. Ideally we would want to add a
- // restriction on generic rules regex that requires the secret match group
- // contains both numbers and alphabetical characters, not just alphabetical characters.
- // What this bit of code does is check if the ruleid is prepended with "generic" and enforces the
- // secret contains both digits and alphabetical characters.
- // TODO: this should be replaced with stop words
- if strings.HasPrefix(rule.RuleID, "generic") {
- if !containsDigit(secret) {
- continue
- }
- }
}
+ // check if the result matches any of the global allowlists.
+ if isAllowed, event := checkFindingAllowed(logger, finding, fragment, currentLine, d.Config.Allowlists); isAllowed {
+ event.Msg("skipping finding: global allowlist")
+ continue
+ }
+
+ // check if the result matches any of the rule allowlists.
+ if isAllowed, event := checkFindingAllowed(logger, finding, fragment, currentLine, r.Allowlists); isAllowed {
+ event.Msg("skipping finding: rule allowlist")
+ continue
+ }
findings = append(findings, finding)
}
return findings
}
-// GitScan accepts a *gitdiff.File channel which contents a git history generated from
-// the output of `git log -p ...`. startGitScan will look at each file (patch) in the history
-// and determine if the patch contains any findings.
-func (d *Detector) DetectGit(source string, logOpts string, gitScanType GitScanType) ([]report.Finding, error) {
- var (
- gitdiffFiles <-chan *gitdiff.File
- err error
- )
- switch gitScanType {
- case DetectType:
- gitdiffFiles, err = git.GitLog(source, logOpts)
- if err != nil {
- return d.findings, err
- }
- case ProtectType:
- gitdiffFiles, err = git.GitDiff(source, false)
- if err != nil {
- return d.findings, err
- }
- case ProtectStagedType:
- gitdiffFiles, err = git.GitDiff(source, true)
- if err != nil {
- return d.findings, err
- }
+// AddFinding synchronously adds a finding to the findings slice
+func (d *Detector) AddFinding(finding report.Finding) {
+ globalFingerprint := fmt.Sprintf("%s:%s:%d", finding.File, finding.RuleID, finding.StartLine)
+ if finding.Commit != "" {
+ finding.Fingerprint = fmt.Sprintf("%s:%s:%s:%d", finding.Commit, finding.File, finding.RuleID, finding.StartLine)
+ } else {
+ finding.Fingerprint = globalFingerprint
}
- s := semgroup.NewGroup(context.Background(), 4)
-
- for gitdiffFile := range gitdiffFiles {
- gitdiffFile := gitdiffFile
-
- // skip binary files
- if gitdiffFile.IsBinary || gitdiffFile.IsDelete {
- continue
- }
-
- // Check if commit is allowed
- commitSHA := ""
- if gitdiffFile.PatchHeader != nil {
- commitSHA = gitdiffFile.PatchHeader.SHA
- if d.Config.Allowlist.CommitAllowed(gitdiffFile.PatchHeader.SHA) {
- continue
- }
+ // check if we should ignore this finding
+ logger := logging.With().Str("finding", finding.Secret).Logger()
+ if _, ok := d.gitleaksIgnore[globalFingerprint]; ok {
+ logger.Debug().
+ Str("fingerprint", globalFingerprint).
+ Msg("skipping finding: global fingerprint")
+ return
+ } else if finding.Commit != "" {
+ // Awkward nested if because I'm not sure how to chain these two conditions.
+ if _, ok := d.gitleaksIgnore[finding.Fingerprint]; ok {
+ logger.Debug().
+ Str("fingerprint", finding.Fingerprint).
+ Msgf("skipping finding: fingerprint")
+ return
}
- d.addCommit(commitSHA)
-
- s.Go(func() error {
- for _, textFragment := range gitdiffFile.TextFragments {
- if textFragment == nil {
- return nil
- }
-
- fragment := Fragment{
- Raw: textFragment.Raw(gitdiff.OpAdd),
- CommitSHA: commitSHA,
- FilePath: gitdiffFile.NewName,
- }
-
- for _, finding := range d.Detect(fragment) {
- d.addFinding(augmentGitFinding(finding, textFragment, gitdiffFile))
- }
- }
- return nil
- })
}
- if err := s.Wait(); err != nil {
- return d.findings, err
+ if d.baseline != nil && !IsNew(finding, d.Redact, d.baseline) {
+ logger.Debug().
+ Str("fingerprint", finding.Fingerprint).
+ Msgf("skipping finding: baseline")
+ return
}
- log.Info().Msgf("%d commits scanned.", len(d.commitMap))
- log.Debug().Msg("Note: this number might be smaller than expected due to commits with no additions")
- if git.ErrEncountered {
- return d.findings, fmt.Errorf("%s", "git error encountered, see logs")
+
+ d.findingMutex.Lock()
+ d.findings = append(d.findings, finding)
+ if d.Verbose {
+ printFinding(finding, d.NoColor)
}
- return d.findings, nil
+ d.findingMutex.Unlock()
}
-type scanTarget struct {
- Path string
- Symlink string
+// Findings returns the findings added to the detector
+func (d *Detector) Findings() []report.Finding {
+ return d.findings
}
-// DetectFiles accepts a path to a source directory or file and begins a scan of the
-// file or directory.
-func (d *Detector) DetectFiles(source string) ([]report.Finding, error) {
- s := semgroup.NewGroup(context.Background(), 4)
- paths := make(chan scanTarget)
- s.Go(func() error {
- defer close(paths)
- return filepath.Walk(source,
- func(path string, fInfo os.FileInfo, err error) error {
- if err != nil {
- return err
- }
- if fInfo.Name() == ".git" && fInfo.IsDir() {
- return filepath.SkipDir
- }
- if fInfo.Size() == 0 {
- return nil
- }
- if fInfo.Mode().IsRegular() {
- paths <- scanTarget{
- Path: path,
- Symlink: "",
- }
- }
- if fInfo.Mode().Type() == fs.ModeSymlink && d.FollowSymlinks {
- realPath, err := filepath.EvalSymlinks(path)
- if err != nil {
- return err
- }
- realPathFileInfo, _ := os.Stat(realPath)
- if realPathFileInfo.IsDir() {
- log.Debug().Msgf("found symlinked directory: %s -> %s [skipping]", path, realPath)
- return nil
- }
- paths <- scanTarget{
- Path: realPath,
- Symlink: path,
- }
- }
- return nil
- })
- })
- for pa := range paths {
- p := pa
- s.Go(func() error {
- b, err := os.ReadFile(p.Path)
- if err != nil {
- return err
- }
+// AddCommit synchronously adds a commit to the commit slice
+func (d *Detector) addCommit(commit string) {
+ d.commitMap[commit] = true
+}
- mimetype, err := filetype.Match(b)
- if err != nil {
- return err
- }
- if mimetype.MIME.Type == "application" {
- return nil // skip binary files
- }
+// checkCommitOrPathAllowed evaluates |fragment| against all provided |allowlists|.
+//
+// If the match condition is "OR", only commit and path are checked.
+// Otherwise, if regexes or stopwords are defined this will fail.
+func checkCommitOrPathAllowed(
+ logger zerolog.Logger,
+ fragment Fragment,
+ allowlists []*config.Allowlist,
+) (bool, *zerolog.Event) {
+ if fragment.FilePath == "" && fragment.CommitSHA == "" {
+ return false, nil
+ }
- fragment := Fragment{
- Raw: string(b),
- FilePath: p.Path,
+ for _, a := range allowlists {
+ var (
+ isAllowed bool
+ allowlistChecks []bool
+ commitAllowed, _ = a.CommitAllowed(fragment.CommitSHA)
+ pathAllowed = a.PathAllowed(fragment.FilePath) || (fragment.WindowsFilePath != "" && a.PathAllowed(fragment.WindowsFilePath))
+ )
+ // If the condition is "AND" we need to check all conditions.
+ if a.MatchCondition == config.AllowlistMatchAnd {
+ if len(a.Commits) > 0 {
+ allowlistChecks = append(allowlistChecks, commitAllowed)
}
- if p.Symlink != "" {
- fragment.SymlinkFile = p.Symlink
+ if len(a.Paths) > 0 {
+ allowlistChecks = append(allowlistChecks, pathAllowed)
}
- for _, finding := range d.Detect(fragment) {
- // need to add 1 since line counting starts at 1
- finding.EndLine++
- finding.StartLine++
- d.addFinding(finding)
+ // These will be checked later.
+ if len(a.Regexes) > 0 {
+ continue
}
-
- return nil
- })
- }
-
- if err := s.Wait(); err != nil {
- return d.findings, err
- }
-
- return d.findings, nil
-}
-
-// DetectReader accepts an io.Reader and a buffer size for the reader in KB
-func (d *Detector) DetectReader(r io.Reader, bufSize int) ([]report.Finding, error) {
- reader := bufio.NewReader(r)
- buf := make([]byte, 0, 1000*bufSize)
- findings := []report.Finding{}
-
- for {
- n, err := reader.Read(buf[:cap(buf)])
- buf = buf[:n]
- if err != nil {
- if err != io.EOF {
- return findings, err
+ if len(a.StopWords) > 0 {
+ continue
}
- break
- }
- fragment := Fragment{
- Raw: string(buf),
+ isAllowed = allTrue(allowlistChecks)
+ } else {
+ isAllowed = commitAllowed || pathAllowed
}
- for _, finding := range d.Detect(fragment) {
- findings = append(findings, finding)
- if d.Verbose {
- printFinding(finding, d.NoColor)
+ if isAllowed {
+ event := logger.Trace().Str("condition", a.MatchCondition.String())
+ if commitAllowed {
+ event.Bool("allowed-commit", commitAllowed)
}
+ if pathAllowed {
+ event.Bool("allowed-path", pathAllowed)
+ }
+ return true, event
}
}
-
- return findings, nil
+ return false, nil
}
-// Detect scans the given fragment and returns a list of findings
-func (d *Detector) Detect(fragment Fragment) []report.Finding {
- var findings []report.Finding
-
- // initiate fragment keywords
- fragment.keywords = make(map[string]bool)
-
- // check if filepath is allowed
- if fragment.FilePath != "" && (d.Config.Allowlist.PathAllowed(fragment.FilePath) ||
- fragment.FilePath == d.Config.Path || (d.baselinePath != "" && fragment.FilePath == d.baselinePath)) {
- return findings
- }
-
- // add newline indices for location calculation in detectRule
- fragment.newlineIndices = regexp.MustCompile("\n").FindAllStringIndex(fragment.Raw, -1)
+// checkFindingAllowed evaluates |finding| against all provided |allowlists|.
+//
+// If the match condition is "OR", only regex and stopwords are run. (Commit and path should be handled separately).
+// Otherwise, all conditions are checked.
+//
+// TODO: The method signature is awkward. I can't think of a better way to log helpful info.
+func checkFindingAllowed(
+ logger zerolog.Logger,
+ finding report.Finding,
+ fragment Fragment,
+ currentLine string,
+ allowlists []*config.Allowlist,
+) (bool, *zerolog.Event) {
+ for _, a := range allowlists {
+ allowlistTarget := finding.Secret
+ switch a.RegexTarget {
+ case "match":
+ allowlistTarget = finding.Match
+ case "line":
+ allowlistTarget = currentLine
+ }
- // build keyword map for prefiltering rules
- normalizedRaw := strings.ToLower(fragment.Raw)
- matches := d.prefilter.FindAll(normalizedRaw)
- for _, m := range matches {
- fragment.keywords[normalizedRaw[m.Start():m.End()]] = true
- }
+ var (
+ checks []bool
+ isAllowed bool
+ commitAllowed bool
+ commit string
+ pathAllowed bool
+ regexAllowed = a.RegexAllowed(allowlistTarget)
+ containsStopword, word = a.ContainsStopWord(finding.Secret)
+ )
+ // If the condition is "AND" we need to check all conditions.
+ if a.MatchCondition == config.AllowlistMatchAnd {
+ // Determine applicable checks.
+ if len(a.Commits) > 0 {
+ commitAllowed, commit = a.CommitAllowed(fragment.CommitSHA)
+ checks = append(checks, commitAllowed)
+ }
+ if len(a.Paths) > 0 {
+ pathAllowed = a.PathAllowed(fragment.FilePath) || (fragment.WindowsFilePath != "" && a.PathAllowed(fragment.WindowsFilePath))
+ checks = append(checks, pathAllowed)
+ }
+ if len(a.Regexes) > 0 {
+ checks = append(checks, regexAllowed)
+ }
+ if len(a.StopWords) > 0 {
+ checks = append(checks, containsStopword)
+ }
- for _, rule := range d.Config.Rules {
- if len(rule.Keywords) == 0 {
- // if not keywords are associated with the rule always scan the
- // fragment using the rule
- findings = append(findings, d.detectRule(fragment, rule)...)
- continue
+ isAllowed = allTrue(checks)
+ } else {
+ isAllowed = regexAllowed || containsStopword
}
- fragmentContainsKeyword := false
- // check if keywords are in the fragment
- for _, k := range rule.Keywords {
- if _, ok := fragment.keywords[strings.ToLower(k)]; ok {
- fragmentContainsKeyword = true
+
+ if isAllowed {
+ event := logger.Trace().
+ Str("finding", finding.Secret).
+ Str("condition", a.MatchCondition.String())
+ if commitAllowed {
+ event.Str("allowed-commit", commit)
}
- }
- if fragmentContainsKeyword {
- findings = append(findings, d.detectRule(fragment, rule)...)
+ if pathAllowed {
+ event.Bool("allowed-path", pathAllowed)
+ }
+ if regexAllowed {
+ event.Bool("allowed-regex", regexAllowed)
+ }
+ if containsStopword {
+ event.Str("allowed-stopword", word)
+ }
+ return true, event
}
}
- return filter(findings, d.Redact)
+ return false, nil
}
-// addFinding synchronously adds a finding to the findings slice
-func (d *Detector) addFinding(finding report.Finding) {
- if finding.Commit == "" {
- finding.Fingerprint = fmt.Sprintf("%s:%s:%d", finding.File, finding.RuleID, finding.StartLine)
- } else {
- finding.Fingerprint = fmt.Sprintf("%s:%s:%s:%d", finding.Commit, finding.File, finding.RuleID, finding.StartLine)
- }
- // check if we should ignore this finding
- if _, ok := d.gitleaksIgnore[finding.Fingerprint]; ok {
- log.Debug().Msgf("ignoring finding with Fingerprint %s",
- finding.Fingerprint)
- return
+func allTrue(bools []bool) bool {
+ for _, check := range bools {
+ if !check {
+ return false
+ }
}
+ return true
+}
- if d.baseline != nil && !IsNew(finding, d.baseline) {
- log.Debug().Msgf("baseline duplicate -- ignoring finding with Fingerprint %s", finding.Fingerprint)
- return
+func fileExists(fileName string) bool {
+ // check for a .infisicalignore file
+ info, err := os.Stat(fileName)
+ if err != nil && !os.IsNotExist(err) {
+ return false
}
- d.findingMutex.Lock()
- d.findings = append(d.findings, finding)
- if d.Verbose {
- printFinding(finding, d.NoColor)
+ if info != nil && err == nil {
+ if !info.IsDir() {
+ return true
+ }
}
- d.findingMutex.Unlock()
-}
-
-// addCommit synchronously adds a commit to the commit slice
-func (d *Detector) addCommit(commit string) {
- d.commitMap[commit] = true
+ return false
}
diff --git a/cli/detect/detect_test.go b/cli/detect/detect_test.go
deleted file mode 100644
index 5a0f508283..0000000000
--- a/cli/detect/detect_test.go
+++ /dev/null
@@ -1,754 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package detect
-
-import (
- "fmt"
- "os"
- "path/filepath"
- "testing"
-
- "github.com/spf13/viper"
- "github.com/stretchr/testify/assert"
-
- "github.com/Infisical/infisical-merge/config"
- "github.com/Infisical/infisical-merge/report"
-)
-
-const configPath = "../testdata/config/"
-const repoBasePath = "../testdata/repos/"
-
-func TestDetect(t *testing.T) {
- tests := []struct {
- cfgName string
- baselinePath string
- fragment Fragment
- // NOTE: for expected findings, all line numbers will be 0
- // because line deltas are added _after_ the finding is created.
- // I.e, if the finding is from a --no-git file, the line number will be
- // increase by 1 in DetectFromFiles(). If the finding is from git,
- // the line number will be increased by the patch delta.
- expectedFindings []report.Finding
- wantError error
- }{
- {
- cfgName: "simple",
- fragment: Fragment{
- Raw: `awsToken := \"AKIALALEMEL33243OKIA\ // infisical-scan:ignore"`,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{},
- },
- {
- cfgName: "simple",
- fragment: Fragment{
- Raw: `awsToken := \
-
- \"AKIALALEMEL33243OKIA\ // infisical-scan:ignore"
-
- `,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{},
- },
- {
- cfgName: "simple",
- fragment: Fragment{
- Raw: `awsToken := \"AKIALALEMEL33243OKIA\"
-
- // infisical-scan:ignore"
-
- `,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{
- {
- Description: "AWS Access Key",
- Secret: "AKIALALEMEL33243OKIA",
- Match: "AKIALALEMEL33243OKIA",
- File: "tmp.go",
- Line: `awsToken := \"AKIALALEMEL33243OKIA\"`,
- RuleID: "aws-access-key",
- Tags: []string{"key", "AWS"},
- StartLine: 0,
- EndLine: 0,
- StartColumn: 15,
- EndColumn: 34,
- Entropy: 3.1464393,
- },
- },
- },
- {
- cfgName: "escaped_character_group",
- fragment: Fragment{
- Raw: `pypi-AgEIcHlwaS5vcmcAAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAAB`,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{
- {
- Description: "PyPI upload token",
- Secret: "pypi-AgEIcHlwaS5vcmcAAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAAB",
- Match: "pypi-AgEIcHlwaS5vcmcAAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAAB",
- Line: `pypi-AgEIcHlwaS5vcmcAAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAAB`,
- File: "tmp.go",
- RuleID: "pypi-upload-token",
- Tags: []string{"key", "pypi"},
- StartLine: 0,
- EndLine: 0,
- StartColumn: 1,
- EndColumn: 86,
- Entropy: 1.9606875,
- },
- },
- },
- {
- cfgName: "simple",
- fragment: Fragment{
- Raw: `awsToken := \"AKIALALEMEL33243OLIA\"`,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{
- {
- Description: "AWS Access Key",
- Secret: "AKIALALEMEL33243OLIA",
- Match: "AKIALALEMEL33243OLIA",
- Line: `awsToken := \"AKIALALEMEL33243OLIA\"`,
- File: "tmp.go",
- RuleID: "aws-access-key",
- Tags: []string{"key", "AWS"},
- StartLine: 0,
- EndLine: 0,
- StartColumn: 15,
- EndColumn: 34,
- Entropy: 3.0841837,
- },
- },
- },
- {
- cfgName: "simple",
- fragment: Fragment{
- Raw: `export BUNDLE_ENTERPRISE__CONTRIBSYS__COM=cafebabe:deadbeef;`,
- FilePath: "tmp.sh",
- },
- expectedFindings: []report.Finding{
- {
- Description: "Sidekiq Secret",
- Match: "BUNDLE_ENTERPRISE__CONTRIBSYS__COM=cafebabe:deadbeef;",
- Secret: "cafebabe:deadbeef",
- Line: `export BUNDLE_ENTERPRISE__CONTRIBSYS__COM=cafebabe:deadbeef;`,
- File: "tmp.sh",
- RuleID: "sidekiq-secret",
- Tags: []string{},
- Entropy: 2.6098502,
- StartLine: 0,
- EndLine: 0,
- StartColumn: 8,
- EndColumn: 60,
- },
- },
- },
- {
- cfgName: "simple",
- fragment: Fragment{
- Raw: `echo hello1; export BUNDLE_ENTERPRISE__CONTRIBSYS__COM="cafebabe:deadbeef" && echo hello2`,
- FilePath: "tmp.sh",
- },
- expectedFindings: []report.Finding{
- {
- Description: "Sidekiq Secret",
- Match: "BUNDLE_ENTERPRISE__CONTRIBSYS__COM=\"cafebabe:deadbeef\"",
- Secret: "cafebabe:deadbeef",
- File: "tmp.sh",
- Line: `echo hello1; export BUNDLE_ENTERPRISE__CONTRIBSYS__COM="cafebabe:deadbeef" && echo hello2`,
- RuleID: "sidekiq-secret",
- Tags: []string{},
- Entropy: 2.6098502,
- StartLine: 0,
- EndLine: 0,
- StartColumn: 21,
- EndColumn: 74,
- },
- },
- },
- {
- cfgName: "simple",
- fragment: Fragment{
- Raw: `url = "http://cafeb4b3:[email protected]:80/path?param1=true&param2=false#heading1"`,
- FilePath: "tmp.sh",
- },
- expectedFindings: []report.Finding{
- {
- Description: "Sidekiq Sensitive URL",
- Match: "http://cafeb4b3:[email protected]:",
- Secret: "cafeb4b3:d3adb33f",
- File: "tmp.sh",
- Line: `url = "http://cafeb4b3:[email protected]:80/path?param1=true&param2=false#heading1"`,
- RuleID: "sidekiq-sensitive-url",
- Tags: []string{},
- Entropy: 2.984234,
- StartLine: 0,
- EndLine: 0,
- StartColumn: 8,
- EndColumn: 58,
- },
- },
- },
- {
- cfgName: "allow_aws_re",
- fragment: Fragment{
- Raw: `awsToken := \"AKIALALEMEL33243OLIA\"`,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{},
- },
- {
- cfgName: "allow_path",
- fragment: Fragment{
- Raw: `awsToken := \"AKIALALEMEL33243OLIA\"`,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{},
- },
- {
- cfgName: "allow_commit",
- fragment: Fragment{
- Raw: `awsToken := \"AKIALALEMEL33243OLIA\"`,
- FilePath: "tmp.go",
- CommitSHA: "allowthiscommit",
- },
- expectedFindings: []report.Finding{},
- },
- {
- cfgName: "entropy_group",
- fragment: Fragment{
- Raw: `const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{
- {
- Description: "Discord API key",
- Match: "Discord_Public_Key = \"e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5\"",
- Secret: "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5",
- Line: `const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
- File: "tmp.go",
- RuleID: "discord-api-key",
- Tags: []string{},
- Entropy: 3.7906237,
- StartLine: 0,
- EndLine: 0,
- StartColumn: 7,
- EndColumn: 93,
- },
- },
- },
- {
- cfgName: "generic_with_py_path",
- fragment: Fragment{
- Raw: `const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{},
- },
- {
- cfgName: "generic_with_py_path",
- fragment: Fragment{
- Raw: `const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
- FilePath: "tmp.py",
- },
- expectedFindings: []report.Finding{
- {
- Description: "Generic API Key",
- Match: "Key = \"e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5\"",
- Secret: "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5",
- Line: `const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
- File: "tmp.py",
- RuleID: "generic-api-key",
- Tags: []string{},
- Entropy: 3.7906237,
- StartLine: 0,
- EndLine: 0,
- StartColumn: 22,
- EndColumn: 93,
- },
- },
- },
- {
- cfgName: "path_only",
- fragment: Fragment{
- Raw: `const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
- FilePath: "tmp.py",
- },
- expectedFindings: []report.Finding{
- {
- Description: "Python Files",
- Match: "file detected: tmp.py",
- File: "tmp.py",
- RuleID: "python-files-only",
- Tags: []string{},
- },
- },
- },
- {
- cfgName: "bad_entropy_group",
- fragment: Fragment{
- Raw: `const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{},
- wantError: fmt.Errorf("Discord API key invalid regex secret group 5, max regex secret group 3"),
- },
- {
- cfgName: "simple",
- fragment: Fragment{
- Raw: `awsToken := \"AKIALALEMEL33243OLIA\"`,
- FilePath: filepath.Join(configPath, "simple.toml"),
- },
- expectedFindings: []report.Finding{},
- },
- {
- cfgName: "allow_global_aws_re",
- fragment: Fragment{
- Raw: `awsToken := \"AKIALALEMEL33243OLIA\"`,
- FilePath: "tmp.go",
- },
- expectedFindings: []report.Finding{},
- },
- {
- cfgName: "generic_with_py_path",
- fragment: Fragment{
- Raw: `const Discord_Public_Key = "load2523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
- FilePath: "tmp.py",
- },
- expectedFindings: []report.Finding{},
- },
- {
- cfgName: "path_only",
- baselinePath: ".baseline.json",
- fragment: Fragment{
- Raw: `const Discord_Public_Key = "e7322523fb86ed64c836a979cf8465fbd436378c653c1db38f9ae87bc62a6fd5"`,
- FilePath: ".baseline.json",
- },
- expectedFindings: []report.Finding{},
- },
- }
-
- for _, tt := range tests {
- viper.Reset()
- viper.AddConfigPath(configPath)
- viper.SetConfigName(tt.cfgName)
- viper.SetConfigType("toml")
- err := viper.ReadInConfig()
- if err != nil {
- t.Error(err)
- }
-
- var vc config.ViperConfig
- err = viper.Unmarshal(&vc)
- if err != nil {
- t.Error(err)
- }
- cfg, err := vc.Translate()
- cfg.Path = filepath.Join(configPath, tt.cfgName+".toml")
- if tt.wantError != nil {
- if err == nil {
- t.Errorf("expected error")
- }
- assert.Equal(t, tt.wantError, err)
- }
- d := NewDetector(cfg)
- d.baselinePath = tt.baselinePath
-
- findings := d.Detect(tt.fragment)
- assert.ElementsMatch(t, tt.expectedFindings, findings)
- }
-}
-
-// TestFromGit tests the FromGit function
-func TestFromGit(t *testing.T) {
- tests := []struct {
- cfgName string
- source string
- logOpts string
- expectedFindings []report.Finding
- }{
- {
- source: filepath.Join(repoBasePath, "small"),
- cfgName: "simple",
- expectedFindings: []report.Finding{
- {
- Description: "AWS Access Key",
- StartLine: 20,
- EndLine: 20,
- StartColumn: 19,
- EndColumn: 38,
- Line: "\n awsToken := \"AKIALALEMEL33243OLIA\"",
- Secret: "AKIALALEMEL33243OLIA",
- Match: "AKIALALEMEL33243OLIA",
- File: "main.go",
- Date: "2021-11-02T23:37:53Z",
- Commit: "1b6da43b82b22e4eaa10bcf8ee591e91abbfc587",
- Author: "Zachary Rice",
- Email: "[email protected]",
- Message: "Accidentally add a secret",
- RuleID: "aws-access-key",
- Tags: []string{"key", "AWS"},
- Entropy: 3.0841837,
- Fingerprint: "1b6da43b82b22e4eaa10bcf8ee591e91abbfc587:main.go:aws-access-key:20",
- },
- {
- Description: "AWS Access Key",
- StartLine: 9,
- EndLine: 9,
- StartColumn: 17,
- EndColumn: 36,
- Secret: "AKIALALEMEL33243OLIA",
- Match: "AKIALALEMEL33243OLIA",
- Line: "\n\taws_token := \"AKIALALEMEL33243OLIA\"",
- File: "foo/foo.go",
- Date: "2021-11-02T23:48:06Z",
- Commit: "491504d5a31946ce75e22554cc34203d8e5ff3ca",
- Author: "Zach Rice",
- Email: "[email protected]",
- Message: "adding foo package with secret",
- RuleID: "aws-access-key",
- Tags: []string{"key", "AWS"},
- Entropy: 3.0841837,
- Fingerprint: "491504d5a31946ce75e22554cc34203d8e5ff3ca:foo/foo.go:aws-access-key:9",
- },
- },
- },
- {
- source: filepath.Join(repoBasePath, "small"),
- logOpts: "--all foo...",
- cfgName: "simple",
- expectedFindings: []report.Finding{
- {
- Description: "AWS Access Key",
- StartLine: 9,
- EndLine: 9,
- StartColumn: 17,
- EndColumn: 36,
- Secret: "AKIALALEMEL33243OLIA",
- Line: "\n\taws_token := \"AKIALALEMEL33243OLIA\"",
- Match: "AKIALALEMEL33243OLIA",
- Date: "2021-11-02T23:48:06Z",
- File: "foo/foo.go",
- Commit: "491504d5a31946ce75e22554cc34203d8e5ff3ca",
- Author: "Zach Rice",
- Email: "[email protected]",
- Message: "adding foo package with secret",
- RuleID: "aws-access-key",
- Tags: []string{"key", "AWS"},
- Entropy: 3.0841837,
- Fingerprint: "491504d5a31946ce75e22554cc34203d8e5ff3ca:foo/foo.go:aws-access-key:9",
- },
- },
- },
- }
-
- err := moveDotGit("dotGit", ".git")
- if err != nil {
- t.Fatal(err)
- }
- defer func() {
- if err := moveDotGit(".git", "dotGit"); err != nil {
- t.Error(err)
- }
- }()
-
- for _, tt := range tests {
-
- viper.AddConfigPath(configPath)
- viper.SetConfigName("simple")
- viper.SetConfigType("toml")
- err = viper.ReadInConfig()
- if err != nil {
- t.Error(err)
- }
-
- var vc config.ViperConfig
- err = viper.Unmarshal(&vc)
- if err != nil {
- t.Error(err)
- }
- cfg, err := vc.Translate()
- if err != nil {
- t.Error(err)
- }
- detector := NewDetector(cfg)
- findings, err := detector.DetectGit(tt.source, tt.logOpts, DetectType)
- if err != nil {
- t.Error(err)
- }
-
- for _, f := range findings {
- f.Match = "" // remove lines cause copying and pasting them has some wack formatting
- }
- assert.ElementsMatch(t, tt.expectedFindings, findings)
- }
-}
-func TestFromGitStaged(t *testing.T) {
- tests := []struct {
- cfgName string
- source string
- logOpts string
- expectedFindings []report.Finding
- }{
- {
- source: filepath.Join(repoBasePath, "staged"),
- cfgName: "simple",
- expectedFindings: []report.Finding{
- {
- Description: "AWS Access Key",
- StartLine: 7,
- EndLine: 7,
- StartColumn: 18,
- EndColumn: 37,
- Line: "\n\taws_token2 := \"AKIALALEMEL33243OLIA\" // this one is not",
- Match: "AKIALALEMEL33243OLIA",
- Secret: "AKIALALEMEL33243OLIA",
- File: "api/api.go",
- SymlinkFile: "",
- Commit: "",
- Entropy: 3.0841837,
- Author: "",
- Email: "",
- Date: "0001-01-01T00:00:00Z",
- Message: "",
- Tags: []string{
- "key",
- "AWS",
- },
- RuleID: "aws-access-key",
- Fingerprint: "api/api.go:aws-access-key:7",
- },
- },
- },
- }
-
- err := moveDotGit("dotGit", ".git")
- if err != nil {
- t.Fatal(err)
- }
- defer func() {
- if err := moveDotGit(".git", "dotGit"); err != nil {
- t.Error(err)
- }
- }()
-
- for _, tt := range tests {
-
- viper.AddConfigPath(configPath)
- viper.SetConfigName("simple")
- viper.SetConfigType("toml")
- err = viper.ReadInConfig()
- if err != nil {
- t.Error(err)
- }
-
- var vc config.ViperConfig
- err = viper.Unmarshal(&vc)
- if err != nil {
- t.Error(err)
- }
- cfg, err := vc.Translate()
- if err != nil {
- t.Error(err)
- }
- detector := NewDetector(cfg)
- detector.AddGitleaksIgnore(filepath.Join(tt.source, ".gitleaksignore"))
- findings, err := detector.DetectGit(tt.source, tt.logOpts, ProtectStagedType)
- if err != nil {
- t.Error(err)
- }
-
- for _, f := range findings {
- f.Match = "" // remove lines cause copying and pasting them has some wack formatting
- }
- assert.ElementsMatch(t, tt.expectedFindings, findings)
- }
-}
-
-// TestFromFiles tests the FromFiles function
-func TestFromFiles(t *testing.T) {
- tests := []struct {
- cfgName string
- source string
- expectedFindings []report.Finding
- }{
- {
- source: filepath.Join(repoBasePath, "nogit"),
- cfgName: "simple",
- expectedFindings: []report.Finding{
- {
- Description: "AWS Access Key",
- StartLine: 20,
- EndLine: 20,
- StartColumn: 16,
- EndColumn: 35,
- Match: "AKIALALEMEL33243OLIA",
- Secret: "AKIALALEMEL33243OLIA",
- Line: "\n\tawsToken := \"AKIALALEMEL33243OLIA\"",
- File: "../testdata/repos/nogit/main.go",
- SymlinkFile: "",
- RuleID: "aws-access-key",
- Tags: []string{"key", "AWS"},
- Entropy: 3.0841837,
- Fingerprint: "../testdata/repos/nogit/main.go:aws-access-key:20",
- },
- },
- },
- {
- source: filepath.Join(repoBasePath, "nogit", "main.go"),
- cfgName: "simple",
- expectedFindings: []report.Finding{
- {
- Description: "AWS Access Key",
- StartLine: 20,
- EndLine: 20,
- StartColumn: 16,
- EndColumn: 35,
- Match: "AKIALALEMEL33243OLIA",
- Secret: "AKIALALEMEL33243OLIA",
- Line: "\n\tawsToken := \"AKIALALEMEL33243OLIA\"",
- File: "../testdata/repos/nogit/main.go",
- RuleID: "aws-access-key",
- Tags: []string{"key", "AWS"},
- Entropy: 3.0841837,
- Fingerprint: "../testdata/repos/nogit/main.go:aws-access-key:20",
- },
- },
- },
- }
-
- for _, tt := range tests {
- viper.AddConfigPath(configPath)
- viper.SetConfigName("simple")
- viper.SetConfigType("toml")
- err := viper.ReadInConfig()
- if err != nil {
- t.Error(err)
- }
-
- var vc config.ViperConfig
- err = viper.Unmarshal(&vc)
- if err != nil {
- t.Error(err)
- }
- cfg, _ := vc.Translate()
- detector := NewDetector(cfg)
- detector.FollowSymlinks = true
- findings, err := detector.DetectFiles(tt.source)
- if err != nil {
- t.Error(err)
- }
-
- assert.ElementsMatch(t, tt.expectedFindings, findings)
- }
-}
-
-func TestDetectWithSymlinks(t *testing.T) {
- tests := []struct {
- cfgName string
- source string
- expectedFindings []report.Finding
- }{
- {
- source: filepath.Join(repoBasePath, "symlinks/file_symlink"),
- cfgName: "simple",
- expectedFindings: []report.Finding{
- {
- Description: "Asymmetric Private Key",
- StartLine: 1,
- EndLine: 1,
- StartColumn: 1,
- EndColumn: 35,
- Match: "-----BEGIN OPENSSH PRIVATE KEY-----",
- Secret: "-----BEGIN OPENSSH PRIVATE KEY-----",
- Line: "-----BEGIN OPENSSH PRIVATE KEY-----",
- File: "../testdata/repos/symlinks/source_file/id_ed25519",
- SymlinkFile: "../testdata/repos/symlinks/file_symlink/symlinked_id_ed25519",
- RuleID: "apkey",
- Tags: []string{"key", "AsymmetricPrivateKey"},
- Entropy: 3.587164,
- Fingerprint: "../testdata/repos/symlinks/source_file/id_ed25519:apkey:1",
- },
- },
- },
- }
-
- for _, tt := range tests {
- viper.AddConfigPath(configPath)
- viper.SetConfigName("simple")
- viper.SetConfigType("toml")
- err := viper.ReadInConfig()
- if err != nil {
- t.Error(err)
- }
-
- var vc config.ViperConfig
- err = viper.Unmarshal(&vc)
- if err != nil {
- t.Error(err)
- }
- cfg, _ := vc.Translate()
- detector := NewDetector(cfg)
- detector.FollowSymlinks = true
- findings, err := detector.DetectFiles(tt.source)
- if err != nil {
- t.Error(err)
- }
- assert.ElementsMatch(t, tt.expectedFindings, findings)
- }
-}
-
-func moveDotGit(from, to string) error {
- repoDirs, err := os.ReadDir("../testdata/repos")
- if err != nil {
- return err
- }
- for _, dir := range repoDirs {
- if to == ".git" {
- _, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), "dotGit"))
- if os.IsNotExist(err) {
- // dont want to delete the only copy of .git accidentally
- continue
- }
- os.RemoveAll(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), ".git"))
- }
- if !dir.IsDir() {
- continue
- }
- _, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from))
- if os.IsNotExist(err) {
- continue
- }
-
- err = os.Rename(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from),
- fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), to))
- if err != nil {
- return err
- }
- }
- return nil
-}
diff --git a/cli/detect/directory.go b/cli/detect/directory.go
new file mode 100644
index 0000000000..56f4999f2e
--- /dev/null
+++ b/cli/detect/directory.go
@@ -0,0 +1,225 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package detect
+
+import (
+ "bufio"
+ "bytes"
+ "io"
+ "os"
+ "path/filepath"
+ "strings"
+ "time"
+
+ "github.com/h2non/filetype"
+
+ "github.com/Infisical/infisical-merge/detect/logging"
+ "github.com/Infisical/infisical-merge/detect/report"
+ "github.com/Infisical/infisical-merge/detect/sources"
+)
+
+const maxPeekSize = 25 * 1_000 // 10kb
+
+func (d *Detector) DetectFiles(paths <-chan sources.ScanTarget) ([]report.Finding, error) {
+ for pa := range paths {
+ d.Sema.Go(func() error {
+ logger := logging.With().Str("path", pa.Path).Logger()
+ logger.Trace().Msg("Scanning path")
+
+ f, err := os.Open(pa.Path)
+ if err != nil {
+ if os.IsPermission(err) {
+ logger.Warn().Msg("Skipping file: permission denied")
+ return nil
+ }
+ return err
+ }
+ defer func() {
+ _ = f.Close()
+ }()
+
+ // Get file size
+ fileInfo, err := f.Stat()
+ if err != nil {
+ return err
+ }
+ fileSize := fileInfo.Size()
+ if d.MaxTargetMegaBytes > 0 {
+ rawLength := fileSize / 1000000
+ if rawLength > int64(d.MaxTargetMegaBytes) {
+ logger.Debug().
+ Int64("size", rawLength).
+ Msg("Skipping file: exceeds --max-target-megabytes")
+ return nil
+ }
+ }
+
+ var (
+ // Buffer to hold file chunks
+ reader = bufio.NewReaderSize(f, chunkSize)
+ buf = make([]byte, chunkSize)
+ totalLines = 0
+ )
+ for {
+ n, err := reader.Read(buf)
+
+ // "Callers should always process the n > 0 bytes returned before considering the error err."
+ // https://pkg.go.dev/io#Reader
+ if n > 0 {
+ // Only check the filetype at the start of file.
+ if totalLines == 0 {
+ // TODO: could other optimizations be introduced here?
+ if mimetype, err := filetype.Match(buf[:n]); err != nil {
+ return nil
+ } else if mimetype.MIME.Type == "application" {
+ return nil // skip binary files
+ }
+ }
+
+ // Try to split chunks across large areas of whitespace, if possible.
+ peekBuf := bytes.NewBuffer(buf[:n])
+ if readErr := readUntilSafeBoundary(reader, n, maxPeekSize, peekBuf); readErr != nil {
+ return readErr
+ }
+
+ // Count the number of newlines in this chunk
+ chunk := peekBuf.String()
+ linesInChunk := strings.Count(chunk, "\n")
+ totalLines += linesInChunk
+ fragment := Fragment{
+ Raw: chunk,
+ Bytes: peekBuf.Bytes(),
+ }
+ if pa.Symlink != "" {
+ fragment.SymlinkFile = pa.Symlink
+ }
+
+ if isWindows {
+ fragment.FilePath = filepath.ToSlash(pa.Path)
+ fragment.SymlinkFile = filepath.ToSlash(fragment.SymlinkFile)
+ fragment.WindowsFilePath = pa.Path
+ } else {
+ fragment.FilePath = pa.Path
+ }
+
+ timer := time.AfterFunc(SlowWarningThreshold, func() {
+ logger.Debug().Msgf("Taking longer than %s to inspect fragment", SlowWarningThreshold.String())
+ })
+ for _, finding := range d.Detect(fragment) {
+ // need to add 1 since line counting starts at 1
+ finding.StartLine += (totalLines - linesInChunk) + 1
+ finding.EndLine += (totalLines - linesInChunk) + 1
+ d.AddFinding(finding)
+ }
+ if timer != nil {
+ timer.Stop()
+ timer = nil
+ }
+ }
+
+ if err != nil {
+ if err == io.EOF {
+ return nil
+ }
+ return err
+ }
+ }
+ })
+ }
+
+ if err := d.Sema.Wait(); err != nil {
+ return d.findings, err
+ }
+
+ return d.findings, nil
+}
+
+// readUntilSafeBoundary consumes |f| until it finds two consecutive `\n` characters, up to |maxPeekSize|.
+// This hopefully avoids splitting. (https://github.com/gitleaks/gitleaks/issues/1651)
+func readUntilSafeBoundary(r *bufio.Reader, n int, maxPeekSize int, peekBuf *bytes.Buffer) error {
+ if peekBuf.Len() == 0 {
+ return nil
+ }
+
+ // Does the buffer end in consecutive newlines?
+ var (
+ data = peekBuf.Bytes()
+ lastChar = data[len(data)-1]
+ newlineCount = 0 // Tracks consecutive newlines
+ )
+ if isWhitespace(lastChar) {
+ for i := len(data) - 1; i >= 0; i-- {
+ lastChar = data[i]
+ if lastChar == '\n' {
+ newlineCount++
+
+ // Stop if two consecutive newlines are found
+ if newlineCount >= 2 {
+ return nil
+ }
+ } else if lastChar == '\r' || lastChar == ' ' || lastChar == '\t' {
+ // The presence of other whitespace characters (`\r`, ` `, `\t`) shouldn't reset the count.
+ // (Intentionally do nothing.)
+ } else {
+ break
+ }
+ }
+ }
+
+ // If not, read ahead until we (hopefully) find some.
+ newlineCount = 0
+ for {
+ data = peekBuf.Bytes()
+ // Check if the last character is a newline.
+ lastChar = data[len(data)-1]
+ if lastChar == '\n' {
+ newlineCount++
+
+ // Stop if two consecutive newlines are found
+ if newlineCount >= 2 {
+ break
+ }
+ } else if lastChar == '\r' || lastChar == ' ' || lastChar == '\t' {
+ // The presence of other whitespace characters (`\r`, ` `, `\t`) shouldn't reset the count.
+ // (Intentionally do nothing.)
+ } else {
+ newlineCount = 0 // Reset if a non-newline character is found
+ }
+
+ // Stop growing the buffer if it reaches maxSize
+ if (peekBuf.Len() - n) >= maxPeekSize {
+ break
+ }
+
+ // Read additional data into a temporary buffer
+ b, err := r.ReadByte()
+ if err != nil {
+ if err == io.EOF {
+ break
+ }
+ return err
+ }
+ peekBuf.WriteByte(b)
+ }
+ return nil
+}
diff --git a/cli/detect/git.go b/cli/detect/git.go
new file mode 100644
index 0000000000..ddde0757df
--- /dev/null
+++ b/cli/detect/git.go
@@ -0,0 +1,214 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package detect
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "net/url"
+ "os/exec"
+ "regexp"
+ "strings"
+ "time"
+
+ "github.com/Infisical/infisical-merge/detect/cmd/scm"
+ "github.com/gitleaks/go-gitdiff/gitdiff"
+
+ "github.com/Infisical/infisical-merge/detect/logging"
+ "github.com/Infisical/infisical-merge/detect/report"
+ "github.com/Infisical/infisical-merge/detect/sources"
+)
+
+func (d *Detector) DetectGit(cmd *sources.GitCmd, remote *RemoteInfo) ([]report.Finding, error) {
+ defer cmd.Wait()
+ var (
+ diffFilesCh = cmd.DiffFilesCh()
+ errCh = cmd.ErrCh()
+ )
+
+ // loop to range over both DiffFiles (stdout) and ErrCh (stderr)
+ for diffFilesCh != nil || errCh != nil {
+ select {
+ case gitdiffFile, open := <-diffFilesCh:
+ if !open {
+ diffFilesCh = nil
+ break
+ }
+
+ // skip binary files
+ if gitdiffFile.IsBinary || gitdiffFile.IsDelete {
+ continue
+ }
+
+ // Check if commit is allowed
+ commitSHA := ""
+ if gitdiffFile.PatchHeader != nil {
+ commitSHA = gitdiffFile.PatchHeader.SHA
+ for _, a := range d.Config.Allowlists {
+ if ok, c := a.CommitAllowed(gitdiffFile.PatchHeader.SHA); ok {
+ logging.Trace().Str("allowed-commit", c).Msg("skipping commit: global allowlist")
+ continue
+ }
+ }
+ }
+ d.addCommit(commitSHA)
+
+ d.Sema.Go(func() error {
+ for _, textFragment := range gitdiffFile.TextFragments {
+ if textFragment == nil {
+ return nil
+ }
+
+ fragment := Fragment{
+ Raw: textFragment.Raw(gitdiff.OpAdd),
+ CommitSHA: commitSHA,
+ FilePath: gitdiffFile.NewName,
+ }
+
+ timer := time.AfterFunc(SlowWarningThreshold, func() {
+ logging.Debug().
+ Str("commit", commitSHA[:7]).
+ Str("path", fragment.FilePath).
+ Msgf("Taking longer than %s to inspect fragment", SlowWarningThreshold.String())
+ })
+ for _, finding := range d.Detect(fragment) {
+ d.AddFinding(augmentGitFinding(remote, finding, textFragment, gitdiffFile))
+ }
+ if timer != nil {
+ timer.Stop()
+ timer = nil
+ }
+ }
+ return nil
+ })
+ case err, open := <-errCh:
+ if !open {
+ errCh = nil
+ break
+ }
+
+ return d.findings, err
+ }
+ }
+
+ if err := d.Sema.Wait(); err != nil {
+ return d.findings, err
+ }
+ logging.Info().Msgf("%d commits scanned.", len(d.commitMap))
+ logging.Debug().Msg("Note: this number might be smaller than expected due to commits with no additions")
+ return d.findings, nil
+}
+
+type RemoteInfo struct {
+ Platform scm.Platform
+ Url string
+}
+
+func NewRemoteInfo(platform scm.Platform, source string) *RemoteInfo {
+ if platform == scm.NoPlatform {
+ return &RemoteInfo{Platform: platform}
+ }
+
+ remoteUrl, err := getRemoteUrl(source)
+ if err != nil {
+ if strings.Contains(err.Error(), "No remote configured") {
+ logging.Debug().Msg("skipping finding links: repository has no configured remote.")
+ platform = scm.NoPlatform
+ } else {
+ logging.Error().Err(err).Msg("skipping finding links: unable to parse remote URL")
+ }
+ goto End
+ }
+
+ if platform == scm.UnknownPlatform {
+ platform = platformFromHost(remoteUrl)
+ if platform == scm.UnknownPlatform {
+ logging.Info().
+ Str("host", remoteUrl.Hostname()).
+ Msg("Unknown SCM platform. Use --platform to include links in findings.")
+ } else {
+ logging.Debug().
+ Str("host", remoteUrl.Hostname()).
+ Str("platform", platform.String()).
+ Msg("SCM platform parsed from host")
+ }
+ }
+
+End:
+ var rUrl string
+ if remoteUrl != nil {
+ rUrl = remoteUrl.String()
+ }
+ return &RemoteInfo{
+ Platform: platform,
+ Url: rUrl,
+ }
+}
+
+var sshUrlpat = regexp.MustCompile(`^git@([a-zA-Z0-9.-]+):([\w/.-]+?)(?:\.git)?$`)
+
+func getRemoteUrl(source string) (*url.URL, error) {
+ // This will return the first remote — typically, "origin".
+ cmd := exec.Command("git", "ls-remote", "--quiet", "--get-url")
+ if source != "." {
+ cmd.Dir = source
+ }
+
+ stdout, err := cmd.Output()
+ if err != nil {
+ var exitError *exec.ExitError
+ if errors.As(err, &exitError) {
+ return nil, fmt.Errorf("command failed (%d): %w, stderr: %s", exitError.ExitCode(), err, string(bytes.TrimSpace(exitError.Stderr)))
+ }
+ return nil, err
+ }
+
+ remoteUrl := string(bytes.TrimSpace(stdout))
+ if matches := sshUrlpat.FindStringSubmatch(remoteUrl); matches != nil {
+ remoteUrl = fmt.Sprintf("https://%s/%s", matches[1], matches[2])
+ }
+ remoteUrl = strings.TrimSuffix(remoteUrl, ".git")
+
+ parsedUrl, err := url.Parse(remoteUrl)
+ if err != nil {
+ return nil, fmt.Errorf("unable to parse remote URL: %w", err)
+ }
+
+ // Remove any user info.
+ parsedUrl.User = nil
+ return parsedUrl, nil
+}
+
+func platformFromHost(u *url.URL) scm.Platform {
+ switch strings.ToLower(u.Hostname()) {
+ case "github.com":
+ return scm.GitHubPlatform
+ case "gitlab.com":
+ return scm.GitLabPlatform
+ case "dev.azure.com", "visualstudio.com":
+ return scm.AzureDevOpsPlatform
+ default:
+ return scm.UnknownPlatform
+ }
+}
diff --git a/cli/detect/git/git.go b/cli/detect/git/git.go
deleted file mode 100644
index 6eb5e9d6de..0000000000
--- a/cli/detect/git/git.go
+++ /dev/null
@@ -1,143 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package git
-
-import (
- "bufio"
- "io"
- "os/exec"
- "path/filepath"
- "strings"
- "time"
-
- "github.com/gitleaks/go-gitdiff/gitdiff"
- "github.com/rs/zerolog/log"
-)
-
-var ErrEncountered bool
-
-// GitLog returns a channel of gitdiff.File objects from the
-// git log -p command for the given source.
-func GitLog(source string, logOpts string) (<-chan *gitdiff.File, error) {
- sourceClean := filepath.Clean(source)
- var cmd *exec.Cmd
- if logOpts != "" {
- args := []string{"-C", sourceClean, "log", "-p", "-U0"}
- args = append(args, strings.Split(logOpts, " ")...)
- cmd = exec.Command("git", args...)
- } else {
- cmd = exec.Command("git", "-C", sourceClean, "log", "-p", "-U0",
- "--full-history", "--all")
- }
-
- log.Debug().Msgf("executing: %s", cmd.String())
-
- stdout, err := cmd.StdoutPipe()
- if err != nil {
- return nil, err
- }
- stderr, err := cmd.StderrPipe()
- if err != nil {
- return nil, err
- }
-
- go listenForStdErr(stderr)
-
- if err := cmd.Start(); err != nil {
- return nil, err
- }
- // HACK: to avoid https://github.com/zricethezav/gitleaks/issues/722
- time.Sleep(50 * time.Millisecond)
-
- return gitdiff.Parse(cmd, stdout)
-}
-
-// GitDiff returns a channel of gitdiff.File objects from
-// the git diff command for the given source.
-func GitDiff(source string, staged bool) (<-chan *gitdiff.File, error) {
- sourceClean := filepath.Clean(source)
- var cmd *exec.Cmd
- cmd = exec.Command("git", "-C", sourceClean, "diff", "-U0", ".")
- if staged {
- cmd = exec.Command("git", "-C", sourceClean, "diff", "-U0",
- "--staged", ".")
- }
- log.Debug().Msgf("executing: %s", cmd.String())
-
- stdout, err := cmd.StdoutPipe()
- if err != nil {
- return nil, err
- }
- stderr, err := cmd.StderrPipe()
- if err != nil {
- return nil, err
- }
-
- go listenForStdErr(stderr)
-
- if err := cmd.Start(); err != nil {
- return nil, err
- }
- // HACK: to avoid https://github.com/zricethezav/gitleaks/issues/722
- time.Sleep(50 * time.Millisecond)
-
- return gitdiff.Parse(cmd, stdout)
-}
-
-// listenForStdErr listens for stderr output from git and prints it to stdout
-// then exits with exit code 1
-func listenForStdErr(stderr io.ReadCloser) {
- scanner := bufio.NewScanner(stderr)
- for scanner.Scan() {
- // if git throws one of the following errors:
- //
- // exhaustive rename detection was skipped due to too many files.
- // you may want to set your diff.renameLimit variable to at least
- // (some large number) and retry the command.
- //
- // inexact rename detection was skipped due to too many files.
- // you may want to set your diff.renameLimit variable to at least
- // (some large number) and retry the command.
- //
- // we skip exiting the program as git log -p/git diff will continue
- // to send data to stdout and finish executing. This next bit of
- // code prevents gitleaks from stopping mid scan if this error is
- // encountered
- if strings.Contains(scanner.Text(),
- "exhaustive rename detection was skipped") ||
- strings.Contains(scanner.Text(),
- "inexact rename detection was skipped") ||
- strings.Contains(scanner.Text(),
- "you may want to set your diff.renameLimit") {
- log.Warn().Msg(scanner.Text())
- } else {
- log.Error().Msgf("[git] %s", scanner.Text())
-
- // asynchronously set this error flag to true so that we can
- // capture a log message and exit with a non-zero exit code
- // This value should get set before the `git` command exits so it's
- // safe-ish, although I know I know, bad practice.
- ErrEncountered = true
- }
- }
-}
diff --git a/cli/detect/git/git_test.go b/cli/detect/git/git_test.go
deleted file mode 100644
index 3a2ea9c359..0000000000
--- a/cli/detect/git/git_test.go
+++ /dev/null
@@ -1,158 +0,0 @@
-package git_test
-
-// TODO: commenting out this test for now because it's flaky. Alternatives to consider to get this working:
-// -- use `git stash` instead of `restore()`
-
-// const repoBasePath = "../../testdata/repos/"
-
-// const expectPath = "../../testdata/expected/"
-
-// func TestGitLog(t *testing.T) {
-// tests := []struct {
-// source string
-// logOpts string
-// expected string
-// }{
-// {
-// source: filepath.Join(repoBasePath, "small"),
-// expected: filepath.Join(expectPath, "git", "small.txt"),
-// },
-// {
-// source: filepath.Join(repoBasePath, "small"),
-// expected: filepath.Join(expectPath, "git", "small-branch-foo.txt"),
-// logOpts: "--all foo...",
-// },
-// }
-
-// err := moveDotGit("dotGit", ".git")
-// if err != nil {
-// t.Fatal(err)
-// }
-// defer func() {
-// if err = moveDotGit(".git", "dotGit"); err != nil {
-// t.Fatal(err)
-// }
-// }()
-
-// for _, tt := range tests {
-// files, err := git.GitLog(tt.source, tt.logOpts)
-// if err != nil {
-// t.Error(err)
-// }
-
-// var diffSb strings.Builder
-// for f := range files {
-// for _, tf := range f.TextFragments {
-// diffSb.WriteString(tf.Raw(gitdiff.OpAdd))
-// }
-// }
-
-// expectedBytes, err := os.ReadFile(tt.expected)
-// if err != nil {
-// t.Error(err)
-// }
-// expected := string(expectedBytes)
-// if expected != diffSb.String() {
-// // write string builder to .got file using os.Create
-// err = os.WriteFile(strings.Replace(tt.expected, ".txt", ".got.txt", 1), []byte(diffSb.String()), 0644)
-// if err != nil {
-// t.Error(err)
-// }
-// t.Error("expected: ", expected, "got: ", diffSb.String())
-// }
-// }
-// }
-
-// func TestGitDiff(t *testing.T) {
-// tests := []struct {
-// source string
-// expected string
-// additions string
-// target string
-// }{
-// {
-// source: filepath.Join(repoBasePath, "small"),
-// expected: "this line is added\nand another one",
-// additions: "this line is added\nand another one",
-// target: filepath.Join(repoBasePath, "small", "main.go"),
-// },
-// }
-
-// err := moveDotGit("dotGit", ".git")
-// if err != nil {
-// t.Fatal(err)
-// }
-// defer func() {
-// if err = moveDotGit(".git", "dotGit"); err != nil {
-// t.Fatal(err)
-// }
-// }()
-
-// for _, tt := range tests {
-// noChanges, err := os.ReadFile(tt.target)
-// if err != nil {
-// t.Error(err)
-// }
-// err = os.WriteFile(tt.target, []byte(tt.additions), 0644)
-// if err != nil {
-// restore(tt.target, noChanges, t)
-// t.Error(err)
-// }
-
-// files, err := git.GitDiff(tt.source, false)
-// if err != nil {
-// restore(tt.target, noChanges, t)
-// t.Error(err)
-// }
-
-// for f := range files {
-// sb := strings.Builder{}
-// for _, tf := range f.TextFragments {
-// sb.WriteString(tf.Raw(gitdiff.OpAdd))
-// }
-// if sb.String() != tt.expected {
-// restore(tt.target, noChanges, t)
-// t.Error("expected: ", tt.expected, "got: ", sb.String())
-// }
-// }
-// restore(tt.target, noChanges, t)
-// }
-// }
-
-// func restore(path string, data []byte, t *testing.T) {
-// err := os.WriteFile(path, data, 0644)
-// if err != nil {
-// t.Fatal(err)
-// }
-// }
-
-// func moveDotGit(from, to string) error {
-// repoDirs, err := os.ReadDir("../../testdata/repos")
-// if err != nil {
-// return err
-// }
-// for _, dir := range repoDirs {
-// if to == ".git" {
-// _, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), "dotGit"))
-// if os.IsNotExist(err) {
-// // dont want to delete the only copy of .git accidentally
-// continue
-// }
-// os.RemoveAll(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), ".git"))
-// }
-// if !dir.IsDir() {
-// continue
-// }
-// _, err := os.Stat(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from))
-// if os.IsNotExist(err) {
-// continue
-// }
-
-// err = os.Rename(fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), from),
-// fmt.Sprintf("%s/%s/%s", repoBasePath, dir.Name(), to))
-// if err != nil {
-// return err
-// }
-// }
-// return nil
-// }
diff --git a/cli/detect/location.go b/cli/detect/location.go
index 418af83f6b..81419511c3 100644
--- a/cli/detect/location.go
+++ b/cli/detect/location.go
@@ -72,6 +72,7 @@ func location(fragment Fragment, matchIndex []int) Location {
location.endColumn = (end - prevNewLine)
location.endLineIndex = newLineByteIndex
}
+
prevNewLine = pair[0]
}
diff --git a/cli/detect/location_test.go b/cli/detect/location_test.go
deleted file mode 100644
index f76a6f814f..0000000000
--- a/cli/detect/location_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package detect
-
-import (
- "testing"
-)
-
-// TestGetLocation tests the getLocation function.
-func TestGetLocation(t *testing.T) {
- tests := []struct {
- linePairs [][]int
- start int
- end int
- wantLocation Location
- }{
- {
- linePairs: [][]int{
- {0, 39},
- {40, 55},
- {56, 57},
- },
- start: 35,
- end: 38,
- wantLocation: Location{
- startLine: 1,
- startColumn: 36,
- endLine: 1,
- endColumn: 38,
- startLineIndex: 0,
- endLineIndex: 40,
- },
- },
- {
- linePairs: [][]int{
- {0, 39},
- {40, 55},
- {56, 57},
- },
- start: 40,
- end: 44,
- wantLocation: Location{
- startLine: 2,
- startColumn: 1,
- endLine: 2,
- endColumn: 4,
- startLineIndex: 40,
- endLineIndex: 56,
- },
- },
- }
-
- for _, test := range tests {
- loc := location(Fragment{newlineIndices: test.linePairs}, []int{test.start, test.end})
- if loc != test.wantLocation {
- t.Errorf("\nstartLine %d\nstartColumn: %d\nendLine: %d\nendColumn: %d\nstartLineIndex: %d\nendlineIndex %d",
- loc.startLine, loc.startColumn, loc.endLine, loc.endColumn, loc.startLineIndex, loc.endLineIndex)
-
- t.Error("got", loc, "want", test.wantLocation)
- }
- }
-}
diff --git a/cli/detect/logging/log.go b/cli/detect/logging/log.go
new file mode 100644
index 0000000000..efac01725d
--- /dev/null
+++ b/cli/detect/logging/log.go
@@ -0,0 +1,72 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package logging
+
+import (
+ "os"
+
+ "github.com/rs/zerolog"
+)
+
+var Logger zerolog.Logger
+
+func init() {
+ // send all logs to stdout
+ Logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).
+ Level(zerolog.InfoLevel).
+ With().Timestamp().Logger()
+}
+
+func With() zerolog.Context {
+ return Logger.With()
+}
+
+func Trace() *zerolog.Event {
+ return Logger.Trace()
+}
+
+func Debug() *zerolog.Event {
+ return Logger.Debug()
+}
+func Info() *zerolog.Event {
+ return Logger.Info()
+}
+func Warn() *zerolog.Event {
+ return Logger.Warn()
+}
+
+func Error() *zerolog.Event {
+ return Logger.Error()
+}
+
+func Err(err error) *zerolog.Event {
+ return Logger.Err(err)
+}
+
+func Fatal() *zerolog.Event {
+ return Logger.Fatal()
+}
+
+func Panic() *zerolog.Event {
+ return Logger.Panic()
+}
diff --git a/cli/detect/reader.go b/cli/detect/reader.go
new file mode 100644
index 0000000000..d3559b68a4
--- /dev/null
+++ b/cli/detect/reader.go
@@ -0,0 +1,149 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package detect
+
+import (
+ "bufio"
+ "bytes"
+ "errors"
+ "io"
+
+ "github.com/Infisical/infisical-merge/detect/report"
+)
+
+// DetectReader accepts an io.Reader and a buffer size for the reader in KB
+func (d *Detector) DetectReader(r io.Reader, bufSize int) ([]report.Finding, error) {
+ reader := bufio.NewReader(r)
+ buf := make([]byte, 1000*bufSize)
+ findings := []report.Finding{}
+
+ for {
+ n, err := reader.Read(buf)
+
+ // "Callers should always process the n > 0 bytes returned before considering the error err."
+ // https://pkg.go.dev/io#Reader
+ if n > 0 {
+ // Try to split chunks across large areas of whitespace, if possible.
+ peekBuf := bytes.NewBuffer(buf[:n])
+ if readErr := readUntilSafeBoundary(reader, n, maxPeekSize, peekBuf); readErr != nil {
+ return findings, readErr
+ }
+
+ fragment := Fragment{
+ Raw: peekBuf.String(),
+ }
+ for _, finding := range d.Detect(fragment) {
+ findings = append(findings, finding)
+ if d.Verbose {
+ printFinding(finding, d.NoColor)
+ }
+ }
+ }
+
+ if err != nil {
+ if err == io.EOF {
+ break
+ }
+ return findings, err
+ }
+ }
+
+ return findings, nil
+}
+
+// StreamDetectReader streams the detection results from the provided io.Reader.
+// It reads data using the specified buffer size (in KB) and processes each chunk through
+// the existing detection logic. Findings are sent down the returned findings channel as soon as
+// they are detected, while a separate error channel signals a terminal error (or nil upon successful completion).
+// The function returns two channels:
+// - findingsCh: a receive-only channel that emits report.Finding objects as they are found.
+// - errCh: a receive-only channel that emits a single final error (or nil if no error occurred)
+// once the stream ends.
+//
+// Recommended Usage:
+//
+// Since there will only ever be a single value on the errCh, it is recommended to consume the findingsCh
+// first. Once findingsCh is closed, the consumer should then read from errCh to determine
+// if the stream completed successfully or if an error occurred.
+//
+// This design avoids the need for a select loop, keeping client code simple.
+//
+// Example:
+//
+// // Assume detector is an instance of *Detector and myReader implements io.Reader.
+// findingsCh, errCh := detector.StreamDetectReader(myReader, 64) // using 64 KB buffer size
+//
+// // Process findings as they arrive.
+// for finding := range findingsCh {
+// fmt.Printf("Found secret: %+v\n", finding)
+// }
+//
+// // After the findings channel is closed, check the final error.
+// if err := <-errCh; err != nil {
+// log.Fatalf("StreamDetectReader encountered an error: %v", err)
+// } else {
+// fmt.Println("Scanning completed successfully.")
+// }
+func (d *Detector) StreamDetectReader(r io.Reader, bufSize int) (<-chan report.Finding, <-chan error) {
+ findingsCh := make(chan report.Finding, 1)
+ errCh := make(chan error, 1)
+
+ go func() {
+ defer close(findingsCh)
+ defer close(errCh)
+
+ reader := bufio.NewReader(r)
+ buf := make([]byte, 1000*bufSize)
+
+ for {
+ n, err := reader.Read(buf)
+
+ if n > 0 {
+ peekBuf := bytes.NewBuffer(buf[:n])
+ if readErr := readUntilSafeBoundary(reader, n, maxPeekSize, peekBuf); readErr != nil {
+ errCh <- readErr
+ return
+ }
+
+ fragment := Fragment{Raw: peekBuf.String()}
+ for _, finding := range d.Detect(fragment) {
+ findingsCh <- finding
+ if d.Verbose {
+ printFinding(finding, d.NoColor)
+ }
+ }
+ }
+
+ if err != nil {
+ if errors.Is(err, io.EOF) {
+ errCh <- nil
+ return
+ }
+ errCh <- err
+ return
+ }
+ }
+ }()
+
+ return findingsCh, errCh
+}
diff --git a/cli/detect/regexp/stdlib_regex.go b/cli/detect/regexp/stdlib_regex.go
new file mode 100644
index 0000000000..81e2089b78
--- /dev/null
+++ b/cli/detect/regexp/stdlib_regex.go
@@ -0,0 +1,37 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+//go:build !gore2regex
+
+package regexp
+
+import (
+ re "regexp"
+)
+
+const Version = "stdlib"
+
+type Regexp = re.Regexp
+
+func MustCompile(str string) *re.Regexp {
+ return re.MustCompile(str)
+}
diff --git a/cli/detect/regexp/wasilibs_regex.go b/cli/detect/regexp/wasilibs_regex.go
new file mode 100644
index 0000000000..bc64fb14b0
--- /dev/null
+++ b/cli/detect/regexp/wasilibs_regex.go
@@ -0,0 +1,37 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+//go:build gore2regex
+
+package regexp
+
+import (
+ re "github.com/wasilibs/go-re2"
+)
+
+const Version = "github.com/wasilibs/go-re2"
+
+type Regexp = re.Regexp
+
+func MustCompile(str string) *re.Regexp {
+ return re.MustCompile(str)
+}
diff --git a/cli/report/constants.go b/cli/detect/report/constants.go
similarity index 99%
rename from cli/report/constants.go
rename to cli/detect/report/constants.go
index 8bad495cb9..c4f06a9a3f 100644
--- a/cli/report/constants.go
+++ b/cli/detect/report/constants.go
@@ -19,6 +19,7 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+
package report
const version = "v8.0.0"
diff --git a/cli/report/csv.go b/cli/detect/report/csv.go
similarity index 72%
rename from cli/report/csv.go
rename to cli/detect/report/csv.go
index 0a30c9fd59..1f8812f970 100644
--- a/cli/report/csv.go
+++ b/cli/detect/report/csv.go
@@ -26,16 +26,24 @@ import (
"encoding/csv"
"io"
"strconv"
+ "strings"
)
-// writeCsv writes the list of findings to a writeCloser.
-func writeCsv(f []Finding, w io.WriteCloser) error {
- if len(f) == 0 {
+type CsvReporter struct {
+}
+
+var _ Reporter = (*CsvReporter)(nil)
+
+func (r *CsvReporter) Write(w io.WriteCloser, findings []Finding) error {
+ if len(findings) == 0 {
return nil
}
- defer w.Close()
- cw := csv.NewWriter(w)
- err := cw.Write([]string{"RuleID",
+
+ var (
+ cw = csv.NewWriter(w)
+ err error
+ )
+ columns := []string{"RuleID",
"Commit",
"File",
"SymlinkFile",
@@ -50,12 +58,18 @@ func writeCsv(f []Finding, w io.WriteCloser) error {
"Date",
"Email",
"Fingerprint",
- })
- if err != nil {
+ "Tags",
+ }
+ // A miserable attempt at "omitempty" so tests don't yell at me.
+ if findings[0].Link != "" {
+ columns = append(columns, "Link")
+ }
+
+ if err = cw.Write(columns); err != nil {
return err
}
- for _, f := range f {
- err = cw.Write([]string{f.RuleID,
+ for _, f := range findings {
+ row := []string{f.RuleID,
f.Commit,
f.File,
f.SymlinkFile,
@@ -70,8 +84,13 @@ func writeCsv(f []Finding, w io.WriteCloser) error {
f.Date,
f.Email,
f.Fingerprint,
- })
- if err != nil {
+ strings.Join(f.Tags, " "),
+ }
+ if findings[0].Link != "" {
+ row = append(row, f.Link)
+ }
+
+ if err = cw.Write(row); err != nil {
return err
}
}
diff --git a/cli/report/finding.go b/cli/detect/report/finding.go
similarity index 75%
rename from cli/report/finding.go
rename to cli/detect/report/finding.go
index be461072b6..c53f16ee70 100644
--- a/cli/report/finding.go
+++ b/cli/detect/report/finding.go
@@ -23,13 +23,17 @@
package report
import (
+ "math"
"strings"
)
// Finding contains information about strings that
// have been captured by a tree-sitter query.
type Finding struct {
+ // Rule is the name of the rule that was matched
+ RuleID string
Description string
+
StartLine int
EndLine int
StartColumn int
@@ -47,6 +51,7 @@ type Finding struct {
File string
SymlinkFile string
Commit string
+ Link string `json:",omitempty"`
// Entropy is the shannon entropy of Value
Entropy float32
@@ -57,16 +62,31 @@ type Finding struct {
Message string
Tags []string
- // Rule is the name of the rule that was matched
- RuleID string
-
- // unique identifer
+ // unique identifier
Fingerprint string
}
// Redact removes sensitive information from a finding.
-func (f *Finding) Redact() {
- f.Line = strings.Replace(f.Line, f.Secret, "REDACTED", -1)
- f.Match = strings.Replace(f.Match, f.Secret, "REDACTED", -1)
- f.Secret = "REDACTED"
+func (f *Finding) Redact(percent uint) {
+ secret := maskSecret(f.Secret, percent)
+ if percent >= 100 {
+ secret = "REDACTED"
+ }
+ f.Line = strings.Replace(f.Line, f.Secret, secret, -1)
+ f.Match = strings.Replace(f.Match, f.Secret, secret, -1)
+ f.Secret = secret
+}
+
+func maskSecret(secret string, percent uint) string {
+ if percent > 100 {
+ percent = 100
+ }
+ len := float64(len(secret))
+ if len <= 0 {
+ return secret
+ }
+ prc := float64(100 - percent)
+ lth := int64(math.RoundToEven(len * prc / float64(100)))
+
+ return secret[:lth] + "..."
}
diff --git a/cli/report/json.go b/cli/detect/report/json.go
similarity index 89%
rename from cli/report/json.go
rename to cli/detect/report/json.go
index d091ac3c58..f47b7eee06 100644
--- a/cli/report/json.go
+++ b/cli/detect/report/json.go
@@ -27,10 +27,12 @@ import (
"io"
)
-func writeJson(findings []Finding, w io.WriteCloser) error {
- if len(findings) == 0 {
- findings = []Finding{}
- }
+type JsonReporter struct {
+}
+
+var _ Reporter = (*JsonReporter)(nil)
+
+func (t *JsonReporter) Write(w io.WriteCloser, findings []Finding) error {
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
return encoder.Encode(findings)
diff --git a/cli/detect/report/junit.go b/cli/detect/report/junit.go
new file mode 100644
index 0000000000..0862a45f1e
--- /dev/null
+++ b/cli/detect/report/junit.go
@@ -0,0 +1,129 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package report
+
+import (
+ "encoding/json"
+ "encoding/xml"
+ "fmt"
+ "io"
+ "strconv"
+)
+
+type JunitReporter struct {
+}
+
+var _ Reporter = (*JunitReporter)(nil)
+
+func (r *JunitReporter) Write(w io.WriteCloser, findings []Finding) error {
+ testSuites := TestSuites{
+ TestSuites: getTestSuites(findings),
+ }
+
+ io.WriteString(w, xml.Header)
+ encoder := xml.NewEncoder(w)
+ encoder.Indent("", "\t")
+ return encoder.Encode(testSuites)
+}
+
+func getTestSuites(findings []Finding) []TestSuite {
+ return []TestSuite{
+ {
+ Failures: strconv.Itoa(len(findings)),
+ Name: "gitleaks",
+ Tests: strconv.Itoa(len(findings)),
+ TestCases: getTestCases(findings),
+ Time: "",
+ },
+ }
+}
+
+func getTestCases(findings []Finding) []TestCase {
+ testCases := []TestCase{}
+ for _, f := range findings {
+ testCase := TestCase{
+ Classname: f.Description,
+ Failure: getFailure(f),
+ File: f.File,
+ Name: getMessage(f),
+ Time: "",
+ }
+ testCases = append(testCases, testCase)
+ }
+ return testCases
+}
+
+func getFailure(f Finding) Failure {
+ return Failure{
+ Data: getData(f),
+ Message: getMessage(f),
+ Type: f.Description,
+ }
+}
+
+func getData(f Finding) string {
+ data, err := json.MarshalIndent(f, "", "\t")
+ if err != nil {
+ fmt.Println(err)
+ return ""
+ }
+ return string(data)
+}
+
+func getMessage(f Finding) string {
+ if f.Commit == "" {
+ return fmt.Sprintf("%s has detected a secret in file %s, line %s.", f.RuleID, f.File, strconv.Itoa(f.StartLine))
+ }
+
+ return fmt.Sprintf("%s has detected a secret in file %s, line %s, at commit %s.", f.RuleID, f.File, strconv.Itoa(f.StartLine), f.Commit)
+}
+
+type TestSuites struct {
+ XMLName xml.Name `xml:"testsuites"`
+ TestSuites []TestSuite
+}
+
+type TestSuite struct {
+ XMLName xml.Name `xml:"testsuite"`
+ Failures string `xml:"failures,attr"`
+ Name string `xml:"name,attr"`
+ Tests string `xml:"tests,attr"`
+ TestCases []TestCase `xml:"testcase"`
+ Time string `xml:"time,attr"`
+}
+
+type TestCase struct {
+ XMLName xml.Name `xml:"testcase"`
+ Classname string `xml:"classname,attr"`
+ Failure Failure `xml:"failure"`
+ File string `xml:"file,attr"`
+ Name string `xml:"name,attr"`
+ Time string `xml:"time,attr"`
+}
+
+type Failure struct {
+ XMLName xml.Name `xml:"failure"`
+ Data string `xml:",chardata"`
+ Message string `xml:"message,attr"`
+ Type string `xml:"type,attr"`
+}
diff --git a/cli/report/finding_test.go b/cli/detect/report/report.go
similarity index 73%
rename from cli/report/finding_test.go
rename to cli/detect/report/report.go
index cdb74a3291..120841bb80 100644
--- a/cli/report/finding_test.go
+++ b/cli/detect/report/report.go
@@ -19,30 +19,20 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+
package report
-import "testing"
-
-func TestRedact(t *testing.T) {
- tests := []struct {
- findings []Finding
- redact bool
- }{
- {
- redact: true,
- findings: []Finding{
- {
- Secret: "line containing secret",
- Match: "secret",
- },
- }},
- }
- for _, test := range tests {
- for _, f := range test.findings {
- f.Redact()
- if f.Secret != "REDACTED" {
- t.Error("redact not redacting: ", f.Secret)
- }
- }
- }
+import (
+ "io"
+)
+
+const (
+ // https://cwe.mitre.org/data/definitions/798.html
+ CWE = "CWE-798"
+ CWE_DESCRIPTION = "Use of Hard-coded Credentials"
+ StdoutReportPath = "-"
+)
+
+type Reporter interface {
+ Write(w io.WriteCloser, findings []Finding) error
}
diff --git a/cli/report/sarif.go b/cli/detect/report/sarif.go
similarity index 84%
rename from cli/report/sarif.go
rename to cli/detect/report/sarif.go
index e5120887af..f7457eb57e 100644
--- a/cli/report/sarif.go
+++ b/cli/detect/report/sarif.go
@@ -27,14 +27,20 @@ import (
"fmt"
"io"
- "github.com/Infisical/infisical-merge/config"
+ "github.com/Infisical/infisical-merge/detect/config"
)
-func writeSarif(cfg config.Config, findings []Finding, w io.WriteCloser) error {
+type SarifReporter struct {
+ OrderedRules []config.Rule
+}
+
+var _ Reporter = (*SarifReporter)(nil)
+
+func (r *SarifReporter) Write(w io.WriteCloser, findings []Finding) error {
sarif := Sarif{
Schema: "https://json.schemastore.org/sarif-2.1.0.json",
Version: "2.1.0",
- Runs: getRuns(cfg, findings),
+ Runs: r.getRuns(findings),
}
encoder := json.NewEncoder(w)
@@ -42,22 +48,22 @@ func writeSarif(cfg config.Config, findings []Finding, w io.WriteCloser) error {
return encoder.Encode(sarif)
}
-func getRuns(cfg config.Config, findings []Finding) []Runs {
+func (r *SarifReporter) getRuns(findings []Finding) []Runs {
return []Runs{
{
- Tool: getTool(cfg),
+ Tool: r.getTool(),
Results: getResults(findings),
},
}
}
-func getTool(cfg config.Config) Tool {
+func (r *SarifReporter) getTool() Tool {
tool := Tool{
Driver: Driver{
Name: driver,
SemanticVersion: version,
- InformationUri: "https://github.com/Infisical/infisical",
- Rules: getRules(cfg),
+ InformationUri: "https://github.com/gitleaks/gitleaks",
+ Rules: r.getRules(),
},
}
@@ -73,26 +79,15 @@ func hasEmptyRules(tool Tool) bool {
return len(tool.Driver.Rules) == 0
}
-func getRules(cfg config.Config) []Rules {
+func (r *SarifReporter) getRules() []Rules {
// TODO for _, rule := range cfg.Rules {
var rules []Rules
- for _, rule := range cfg.OrderedRules() {
- shortDescription := ShortDescription{
- Text: rule.Description,
- }
- if rule.Regex != nil {
- shortDescription = ShortDescription{
- Text: rule.Regex.String(),
- }
- } else if rule.Path != nil {
- shortDescription = ShortDescription{
- Text: rule.Path.String(),
- }
- }
+ for _, rule := range r.OrderedRules {
rules = append(rules, Rules{
- ID: rule.RuleID,
- Name: rule.Description,
- Description: shortDescription,
+ ID: rule.RuleID,
+ Description: ShortDescription{
+ Text: rule.Description,
+ },
})
}
return rules
@@ -125,6 +120,9 @@ func getResults(findings []Finding) []Results {
Date: f.Date,
Author: f.Author,
},
+ Properties: Properties{
+ Tags: f.Tags,
+ },
}
results = append(results, r)
}
@@ -180,7 +178,6 @@ type FullDescription struct {
type Rules struct {
ID string `json:"id"`
- Name string `json:"name"`
Description ShortDescription `json:"shortDescription"`
}
@@ -224,11 +221,16 @@ type Locations struct {
PhysicalLocation PhysicalLocation `json:"physicalLocation"`
}
+type Properties struct {
+ Tags []string `json:"tags"`
+}
+
type Results struct {
Message Message `json:"message"`
RuleId string `json:"ruleId"`
Locations []Locations `json:"locations"`
PartialFingerPrints `json:"partialFingerprints"`
+ Properties Properties `json:"properties"`
}
type Runs struct {
diff --git a/cli/detect/report/template.go b/cli/detect/report/template.go
new file mode 100644
index 0000000000..094aaaea94
--- /dev/null
+++ b/cli/detect/report/template.go
@@ -0,0 +1,68 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package report
+
+import (
+ "fmt"
+ "io"
+ "os"
+ "text/template"
+
+ "github.com/Masterminds/sprig/v3"
+)
+
+type TemplateReporter struct {
+ template *template.Template
+}
+
+var _ Reporter = (*TemplateReporter)(nil)
+
+func NewTemplateReporter(templatePath string) (*TemplateReporter, error) {
+ if templatePath == "" {
+ return nil, fmt.Errorf("template path cannot be empty")
+ }
+
+ file, err := os.ReadFile(templatePath)
+ if err != nil {
+ return nil, fmt.Errorf("error reading file: %w", err)
+ }
+ templateText := string(file)
+
+ // TODO: Add helper functions like escaping for JSON, XML, etc.
+ t := template.New("custom")
+ t = t.Funcs(sprig.TxtFuncMap())
+ t, err = t.Parse(templateText)
+ if err != nil {
+ return nil, fmt.Errorf("error parsing file: %w", err)
+ }
+ return &TemplateReporter{template: t}, nil
+}
+
+// writeTemplate renders the findings using the user-provided template.
+// https://www.digitalocean.com/community/tutorials/how-to-use-templates-in-go
+func (t *TemplateReporter) Write(w io.WriteCloser, findings []Finding) error {
+ if err := t.template.Execute(w, findings); err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/cli/detect/sources/directory.go b/cli/detect/sources/directory.go
new file mode 100644
index 0000000000..0ad46c3d82
--- /dev/null
+++ b/cli/detect/sources/directory.go
@@ -0,0 +1,127 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package sources
+
+import (
+ "io/fs"
+ "os"
+ "path/filepath"
+ "runtime"
+
+ "github.com/fatih/semgroup"
+
+ "github.com/Infisical/infisical-merge/detect/config"
+ "github.com/Infisical/infisical-merge/detect/logging"
+)
+
+type ScanTarget struct {
+ Path string
+ Symlink string
+}
+
+var isWindows = runtime.GOOS == "windows"
+
+func DirectoryTargets(source string, s *semgroup.Group, followSymlinks bool, allowlists []*config.Allowlist) (<-chan ScanTarget, error) {
+ paths := make(chan ScanTarget)
+ s.Go(func() error {
+ defer close(paths)
+ return filepath.Walk(source,
+ func(path string, fInfo os.FileInfo, err error) error {
+ logger := logging.With().Str("path", path).Logger()
+
+ if err != nil {
+ if os.IsPermission(err) {
+ // This seems to only fail on directories at this stage.
+ logger.Warn().Msg("Skipping directory: permission denied")
+ return filepath.SkipDir
+ }
+ return err
+ }
+
+ // Empty; nothing to do here.
+ if fInfo.Size() == 0 {
+ return nil
+ }
+
+ // Unwrap symlinks, if |followSymlinks| is set.
+ scanTarget := ScanTarget{
+ Path: path,
+ }
+ if fInfo.Mode().Type() == fs.ModeSymlink {
+ if !followSymlinks {
+ logger.Debug().Msg("Skipping symlink")
+ return nil
+ }
+
+ realPath, err := filepath.EvalSymlinks(path)
+ if err != nil {
+ return err
+ }
+
+ realPathFileInfo, _ := os.Stat(realPath)
+ if realPathFileInfo.IsDir() {
+ logger.Warn().Str("target", realPath).Msg("Skipping symlinked directory")
+ return nil
+ }
+
+ scanTarget.Path = realPath
+ scanTarget.Symlink = path
+ }
+
+ // TODO: Also run this check against the resolved symlink?
+ var skip bool
+ for _, a := range allowlists {
+ skip = a.PathAllowed(path) ||
+ // TODO: Remove this in v9.
+ // This is an awkward hack to mitigate https://github.com/gitleaks/gitleaks/issues/1641.
+ (isWindows && a.PathAllowed(filepath.ToSlash(path)))
+ if skip {
+ break
+ }
+ }
+ if fInfo.IsDir() {
+ // Directory
+ if skip {
+ logger.Debug().Msg("Skipping directory due to global allowlist")
+ return filepath.SkipDir
+ }
+
+ if fInfo.Name() == ".git" {
+ // Don't scan .git directories.
+ // TODO: Add this to the config allowlist, instead of hard-coding it.
+ return filepath.SkipDir
+ }
+ } else {
+ // File
+ if skip {
+ logger.Debug().Msg("Skipping file due to global allowlist")
+ return nil
+ }
+
+ paths <- scanTarget
+ }
+ return nil
+ })
+ })
+ return paths, nil
+}
diff --git a/cli/detect/sources/git.go b/cli/detect/sources/git.go
new file mode 100644
index 0000000000..95b829a9af
--- /dev/null
+++ b/cli/detect/sources/git.go
@@ -0,0 +1,211 @@
+// MIT License
+
+// Copyright (c) 2019 Zachary Rice
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+package sources
+
+import (
+ "bufio"
+ "errors"
+ "io"
+ "os/exec"
+ "path/filepath"
+ "regexp"
+ "strings"
+
+ "github.com/gitleaks/go-gitdiff/gitdiff"
+
+ "github.com/Infisical/infisical-merge/detect/logging"
+)
+
+var quotedOptPattern = regexp.MustCompile(`^(?:"[^"]+"|'[^']+')$`)
+
+// GitCmd helps to work with Git's output.
+type GitCmd struct {
+ cmd *exec.Cmd
+ diffFilesCh <-chan *gitdiff.File
+ errCh <-chan error
+}
+
+// NewGitLogCmd returns `*DiffFilesCmd` with two channels: `<-chan *gitdiff.File` and `<-chan error`.
+// Caller should read everything from channels until receiving a signal about their closure and call
+// the `func (*DiffFilesCmd) Wait()` error in order to release resources.
+func NewGitLogCmd(source string, logOpts string) (*GitCmd, error) {
+ sourceClean := filepath.Clean(source)
+ var cmd *exec.Cmd
+ if logOpts != "" {
+ args := []string{"-C", sourceClean, "log", "-p", "-U0"}
+
+ // Ensure that the user-provided |logOpts| aren't wrapped in quotes.
+ // https://github.com/gitleaks/gitleaks/issues/1153
+ userArgs := strings.Split(logOpts, " ")
+ var quotedOpts []string
+ for _, element := range userArgs {
+ if quotedOptPattern.MatchString(element) {
+ quotedOpts = append(quotedOpts, element)
+ }
+ }
+ if len(quotedOpts) > 0 {
+ logging.Warn().Msgf("the following `--log-opts` values may not work as expected: %v\n\tsee https://github.com/gitleaks/gitleaks/issues/1153 for more information", quotedOpts)
+ }
+
+ args = append(args, userArgs...)
+ cmd = exec.Command("git", args...)
+ } else {
+ cmd = exec.Command("git", "-C", sourceClean, "log", "-p", "-U0",
+ "--full-history", "--all")
+ }
+
+ logging.Debug().Msgf("executing: %s", cmd.String())
+
+ stdout, err := cmd.StdoutPipe()
+ if err != nil {
+ return nil, err
+ }
+ stderr, err := cmd.StderrPipe()
+ if err != nil {
+ return nil, err
+ }
+ if err := cmd.Start(); err != nil {
+ return nil, err
+ }
+
+ errCh := make(chan error)
+ go listenForStdErr(stderr, errCh)
+
+ gitdiffFiles, err := gitdiff.Parse(stdout)
+ if err != nil {
+ return nil, err
+ }
+
+ return &GitCmd{
+ cmd: cmd,
+ diffFilesCh: gitdiffFiles,
+ errCh: errCh,
+ }, nil
+}
+
+// NewGitDiffCmd returns `*DiffFilesCmd` with two channels: `<-chan *gitdiff.File` and `<-chan error`.
+// Caller should read everything from channels until receiving a signal about their closure and call
+// the `func (*DiffFilesCmd) Wait()` error in order to release resources.
+func NewGitDiffCmd(source string, staged bool) (*GitCmd, error) {
+ sourceClean := filepath.Clean(source)
+ var cmd *exec.Cmd
+ cmd = exec.Command("git", "-C", sourceClean, "diff", "-U0", "--no-ext-diff", ".")
+ if staged {
+ cmd = exec.Command("git", "-C", sourceClean, "diff", "-U0", "--no-ext-diff",
+ "--staged", ".")
+ }
+ logging.Debug().Msgf("executing: %s", cmd.String())
+
+ stdout, err := cmd.StdoutPipe()
+ if err != nil {
+ return nil, err
+ }
+ stderr, err := cmd.StderrPipe()
+ if err != nil {
+ return nil, err
+ }
+ if err := cmd.Start(); err != nil {
+ return nil, err
+ }
+
+ errCh := make(chan error)
+ go listenForStdErr(stderr, errCh)
+
+ gitdiffFiles, err := gitdiff.Parse(stdout)
+ if err != nil {
+ return nil, err
+ }
+
+ return &GitCmd{
+ cmd: cmd,
+ diffFilesCh: gitdiffFiles,
+ errCh: errCh,
+ }, nil
+}
+
+// DiffFilesCh returns a channel with *gitdiff.File.
+func (c *GitCmd) DiffFilesCh() <-chan *gitdiff.File {
+ return c.diffFilesCh
+}
+
+// ErrCh returns a channel that could produce an error if there is something in stderr.
+func (c *GitCmd) ErrCh() <-chan error {
+ return c.errCh
+}
+
+// Wait waits for the command to exit and waits for any copying to
+// stdin or copying from stdout or stderr to complete.
+//
+// Wait also closes underlying stdout and stderr.
+func (c *GitCmd) Wait() (err error) {
+ return c.cmd.Wait()
+}
+
+// listenForStdErr listens for stderr output from git, prints it to stdout,
+// sends to errCh and closes it.
+func listenForStdErr(stderr io.ReadCloser, errCh chan<- error) {
+ defer close(errCh)
+
+ var errEncountered bool
+
+ scanner := bufio.NewScanner(stderr)
+ for scanner.Scan() {
+ // if git throws one of the following errors:
+ //
+ // exhaustive rename detection was skipped due to too many files.
+ // you may want to set your diff.renameLimit variable to at least
+ // (some large number) and retry the command.
+ //
+ // inexact rename detection was skipped due to too many files.
+ // you may want to set your diff.renameLimit variable to at least
+ // (some large number) and retry the command.
+ //
+ // Auto packing the repository in background for optimum performance.
+ // See "git help gc" for manual housekeeping.
+ //
+ // we skip exiting the program as git log -p/git diff will continue
+ // to send data to stdout and finish executing. This next bit of
+ // code prevents gitleaks from stopping mid scan if this error is
+ // encountered
+ if strings.Contains(scanner.Text(),
+ "exhaustive rename detection was skipped") ||
+ strings.Contains(scanner.Text(),
+ "inexact rename detection was skipped") ||
+ strings.Contains(scanner.Text(),
+ "you may want to set your diff.renameLimit") ||
+ strings.Contains(scanner.Text(),
+ "See \"git help gc\" for manual housekeeping") ||
+ strings.Contains(scanner.Text(),
+ "Auto packing the repository in background for optimum performance") {
+ logging.Warn().Msg(scanner.Text())
+ } else {
+ logging.Error().Msgf("[git] %s", scanner.Text())
+ errEncountered = true
+ }
+ }
+
+ if errEncountered {
+ errCh <- errors.New("stderr is not empty")
+ return
+ }
+}
diff --git a/cli/detect/utils.go b/cli/detect/utils.go
index 462716239a..255d01fbe3 100644
--- a/cli/detect/utils.go
+++ b/cli/detect/utils.go
@@ -26,20 +26,21 @@ import (
// "encoding/json"
"fmt"
"math"
+ "path/filepath"
"strings"
"time"
- "github.com/charmbracelet/lipgloss"
-
- "github.com/Infisical/infisical-merge/report"
+ "github.com/Infisical/infisical-merge/detect/cmd/scm"
+ "github.com/Infisical/infisical-merge/detect/logging"
+ "github.com/Infisical/infisical-merge/detect/report"
+ "github.com/charmbracelet/lipgloss"
"github.com/gitleaks/go-gitdiff/gitdiff"
- "github.com/rs/zerolog/log"
)
// augmentGitFinding updates the start and end line numbers of a finding to include the
// delta from the git diff
-func augmentGitFinding(finding report.Finding, textFragment *gitdiff.TextFragment, f *gitdiff.File) report.Finding {
+func augmentGitFinding(remote *RemoteInfo, finding report.Finding, textFragment *gitdiff.TextFragment, f *gitdiff.File) report.Finding {
if !strings.HasPrefix(finding.Match, "file detected") {
finding.StartLine += int(textFragment.NewPosition)
finding.EndLine += int(textFragment.NewPosition)
@@ -47,16 +48,76 @@ func augmentGitFinding(finding report.Finding, textFragment *gitdiff.TextFragmen
if f.PatchHeader != nil {
finding.Commit = f.PatchHeader.SHA
- finding.Message = f.PatchHeader.Message()
if f.PatchHeader.Author != nil {
finding.Author = f.PatchHeader.Author.Name
finding.Email = f.PatchHeader.Author.Email
}
finding.Date = f.PatchHeader.AuthorDate.UTC().Format(time.RFC3339)
+ finding.Message = f.PatchHeader.Message()
+ // Results from `git diff` shouldn't have a link.
+ if finding.Commit != "" {
+ finding.Link = createScmLink(remote.Platform, remote.Url, finding)
+ }
}
return finding
}
+var linkCleaner = strings.NewReplacer(
+ " ", "%20",
+ "%", "%25",
+)
+
+func createScmLink(scmPlatform scm.Platform, remoteUrl string, finding report.Finding) string {
+ if scmPlatform == scm.UnknownPlatform || scmPlatform == scm.NoPlatform {
+ return ""
+ }
+
+ // Clean the path.
+ var (
+ filePath = linkCleaner.Replace(finding.File)
+ ext = strings.ToLower(filepath.Ext(filePath))
+ )
+
+ switch scmPlatform {
+ case scm.GitHubPlatform:
+ link := fmt.Sprintf("%s/blob/%s/%s", remoteUrl, finding.Commit, filePath)
+ if ext == ".ipynb" || ext == ".md" {
+ link += "?plain=1"
+ }
+ if finding.StartLine != 0 {
+ link += fmt.Sprintf("#L%d", finding.StartLine)
+ }
+ if finding.EndLine != finding.StartLine {
+ link += fmt.Sprintf("-L%d", finding.EndLine)
+ }
+ return link
+ case scm.GitLabPlatform:
+ link := fmt.Sprintf("%s/blob/%s/%s", remoteUrl, finding.Commit, filePath)
+ if finding.StartLine != 0 {
+ link += fmt.Sprintf("#L%d", finding.StartLine)
+ }
+ if finding.EndLine != finding.StartLine {
+ link += fmt.Sprintf("-%d", finding.EndLine)
+ }
+ return link
+ case scm.AzureDevOpsPlatform:
+ link := fmt.Sprintf("%s/commit/%s?path=/%s", remoteUrl, finding.Commit, filePath)
+ // Add line information if applicable
+ if finding.StartLine != 0 {
+ link += fmt.Sprintf("&line=%d", finding.StartLine)
+ }
+ if finding.EndLine != finding.StartLine {
+ link += fmt.Sprintf("&lineEnd=%d", finding.EndLine)
+ }
+ // This is a bit dirty, but Azure DevOps does not highlight the line when the lineStartColumn and lineEndColumn are not provided
+ link += "&lineStartColumn=1&lineEndColumn=10000000&type=2&lineStyle=plain&_a=files"
+ return link
+ default:
+ // This should never happen.
+ return ""
+ }
+}
+
// shannonEntropy calculates the entropy of data using the formula defined here:
// https://en.wiktionary.org/wiki/Shannon_entropy
// Another way to think about what this is doing is calculating the number of bits
@@ -82,7 +143,7 @@ func shannonEntropy(data string) (entropy float64) {
}
// filter will dedupe and redact findings
-func filter(findings []report.Finding, redact bool) []report.Finding {
+func filter(findings []report.Finding, redact uint) []report.Finding {
var retFindings []report.Finding
for _, f := range findings {
include := true
@@ -96,15 +157,15 @@ func filter(findings []report.Finding, redact bool) []report.Finding {
genericMatch := strings.Replace(f.Match, f.Secret, "REDACTED", -1)
betterMatch := strings.Replace(fPrime.Match, fPrime.Secret, "REDACTED", -1)
- log.Trace().Msgf("skipping %s finding (%s), %s rule takes precendence (%s)", f.RuleID, genericMatch, fPrime.RuleID, betterMatch)
+ logging.Trace().Msgf("skipping %s finding (%s), %s rule takes precedence (%s)", f.RuleID, genericMatch, fPrime.RuleID, betterMatch)
include = false
break
}
}
}
- if redact {
- f.Redact()
+ if redact > 0 {
+ f.Redact(redact)
}
if include {
retFindings = append(retFindings, f)
@@ -152,7 +213,7 @@ func printFinding(f report.Finding, noColor bool) {
lineEndIdx := matchInLineIDX + len(f.Match)
if len(f.Line)-1 <= lineEndIdx {
- lineEndIdx = len(f.Line) - 1
+ lineEndIdx = len(f.Line)
}
lineEnd := f.Line[lineEndIdx:]
@@ -184,6 +245,9 @@ func printFinding(f report.Finding, noColor bool) {
fmt.Println("")
return
}
+ if len(f.Tags) > 0 {
+ fmt.Printf("%-12s %s\n", "Tags:", f.Tags)
+ }
fmt.Printf("%-12s %s\n", "File:", f.File)
fmt.Printf("%-12s %d\n", "Line:", f.StartLine)
if f.Commit == "" {
@@ -196,16 +260,12 @@ func printFinding(f report.Finding, noColor bool) {
fmt.Printf("%-12s %s\n", "Email:", f.Email)
fmt.Printf("%-12s %s\n", "Date:", f.Date)
fmt.Printf("%-12s %s\n", "Fingerprint:", f.Fingerprint)
+ if f.Link != "" {
+ fmt.Printf("%-12s %s\n", "Link:", f.Link)
+ }
fmt.Println("")
}
-func containsDigit(s string) bool {
- for _, c := range s {
- switch c {
- case '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return true
- }
-
- }
- return false
+func isWhitespace(ch byte) bool {
+ return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'
}
diff --git a/cli/go.mod b/cli/go.mod
index 52cb79f384..a2b256f8af 100644
--- a/cli/go.mod
+++ b/cli/go.mod
@@ -10,7 +10,7 @@ require (
github.com/creack/pty v1.1.21
github.com/denisbrodbeck/machineid v1.0.1
github.com/fatih/semgroup v1.2.0
- github.com/gitleaks/go-gitdiff v0.8.0
+ github.com/gitleaks/go-gitdiff v0.9.1
github.com/h2non/filetype v1.1.3
github.com/infisical/go-sdk v0.5.92
github.com/infisical/infisical-kmip v0.3.5
@@ -42,6 +42,11 @@ require (
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
cloud.google.com/go/compute/metadata v0.4.0 // indirect
cloud.google.com/go/iam v1.1.11 // indirect
+ dario.cat/mergo v1.0.1 // indirect
+ github.com/BobuSumisu/aho-corasick v1.0.3 // indirect
+ github.com/Masterminds/goutils v1.1.1 // indirect
+ github.com/Masterminds/semver/v3 v3.3.0 // indirect
+ github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
github.com/aws/aws-sdk-go-v2 v1.27.2 // indirect
@@ -74,17 +79,21 @@ require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/pprof v0.0.0-20250302191652-9094ed2288e7 // indirect
github.com/google/s2a-go v0.1.7 // indirect
+ github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.5 // indirect
github.com/gosimple/slug v1.15.0 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
+ github.com/huandu/xstrings v1.5.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
+ github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
+ github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/muesli/mango v0.1.0 // indirect
github.com/muesli/mango-pflag v0.1.0 // indirect
@@ -98,8 +107,9 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
+ github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
- github.com/spf13/cast v1.3.1 // indirect
+ github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
diff --git a/cli/go.sum b/cli/go.sum
index 49566f1cce..cb1b1c1cf8 100644
--- a/cli/go.sum
+++ b/cli/go.sum
@@ -44,13 +44,23 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
+dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
+dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
+github.com/BobuSumisu/aho-corasick v1.0.3 h1:uuf+JHwU9CHP2Vx+wAy6jcksJThhJS9ehR8a+4nPE9g=
+github.com/BobuSumisu/aho-corasick v1.0.3/go.mod h1:hm4jLcvZKI2vRF2WDU1N4p/jpWtpOzp3nLmi9AzX/XE=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Infisical/go-keyring v1.0.2 h1:dWOkI/pB/7RocfSJgGXbXxLDcVYsdslgjEPmVhb+nl8=
github.com/Infisical/go-keyring v1.0.2/go.mod h1:LWOnn/sw9FxDW/0VY+jHFAfOFEe03xmwBVSfJnBowto=
github.com/Infisical/turn/v4 v4.0.1 h1:omdelNsnFfzS5cu86W5OBR68by68a8sva4ogR0lQQnw=
github.com/Infisical/turn/v4 v4.0.1/go.mod h1:pMMKP/ieNAG/fN5cZiN4SDuyKsXtNTr0ccN7IToA1zs=
+github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
+github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
+github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
+github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
+github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
+github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
@@ -142,6 +152,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gitleaks/go-gitdiff v0.8.0 h1:7aExTZm+K/M/EQKOyYcub8rIAdWK6ONxPGuRzxmWW+0=
github.com/gitleaks/go-gitdiff v0.8.0/go.mod h1:pKz0X4YzCKZs30BL+weqBIG7mx0jl4tF1uXV9ZyNvrA=
+github.com/gitleaks/go-gitdiff v0.9.1 h1:ni6z6/3i9ODT685OLCTf+s/ERlWUNWQF4x1pvoNICw0=
+github.com/gitleaks/go-gitdiff v0.9.1/go.mod h1:pKz0X4YzCKZs30BL+weqBIG7mx0jl4tF1uXV9ZyNvrA=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -273,6 +285,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
+github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
+github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
@@ -315,6 +329,8 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
+github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
+github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
@@ -324,6 +340,8 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
+github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
+github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
@@ -393,6 +411,8 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
+github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
+github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
@@ -402,6 +422,8 @@ github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
+github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
+github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
diff --git a/cli/packages/cmd/agent.go b/cli/packages/cmd/agent.go
index b14fd04e2a..4459416748 100644
--- a/cli/packages/cmd/agent.go
+++ b/cli/packages/cmd/agent.go
@@ -884,6 +884,12 @@ func (tm *AgentManager) MonitorSecretChanges(secretTemplate Template, templateId
if err != nil {
log.Error().Msgf("unable to process template because %v", err)
+
+ // case: if exit-after-auth is true, it should exit the agent once an error on secret fetching occurs with the appropriate exit code (1)
+ // previous behavior would exit after 25 sec with status code 0, even if this step errors
+ if tm.exitAfterAuth {
+ os.Exit(1)
+ }
} else {
if (existingEtag != currentEtag) || firstRun {
diff --git a/cli/packages/cmd/scan.go b/cli/packages/cmd/scan.go
index 1226e33199..42ff0f1e1f 100644
--- a/cli/packages/cmd/scan.go
+++ b/cli/packages/cmd/scan.go
@@ -32,10 +32,13 @@ import (
"strings"
"time"
- "github.com/Infisical/infisical-merge/config"
"github.com/Infisical/infisical-merge/detect"
+ "github.com/Infisical/infisical-merge/detect/cmd/scm"
+ "github.com/Infisical/infisical-merge/detect/config"
+ "github.com/Infisical/infisical-merge/detect/logging"
+ "github.com/Infisical/infisical-merge/detect/report"
+ "github.com/Infisical/infisical-merge/detect/sources"
"github.com/Infisical/infisical-merge/packages/util"
- "github.com/Infisical/infisical-merge/report"
"github.com/manifoldco/promptui"
"github.com/posthog/posthog-go"
"github.com/rs/zerolog/log"
@@ -240,9 +243,17 @@ var scanCmd = &cobra.Command{
log.Fatal().Err(err).Msg("")
}
// set redact flag
- if detector.Redact, err = cmd.Flags().GetBool("redact"); err != nil {
+
+ redactFlag, err := cmd.Flags().GetBool("redact")
+ if err != nil {
log.Fatal().Err(err).Msg("")
}
+ if redactFlag {
+ detector.Redact = 100
+ } else {
+ detector.Redact = 0
+ }
+
if detector.MaxTargetMegaBytes, err = cmd.Flags().GetInt("max-target-megabytes"); err != nil {
log.Fatal().Err(err).Msg("")
}
@@ -293,31 +304,49 @@ var scanCmd = &cobra.Command{
// start the detector scan
if noGit {
- findings, err = detector.DetectFiles(source)
+ paths, err := sources.DirectoryTargets(
+ source,
+ detector.Sema,
+ detector.FollowSymlinks,
+ detector.Config.Allowlists,
+ )
if err != nil {
+ logging.Fatal().Err(err).Send()
+ }
+
+ if findings, err = detector.DetectFiles(paths); err != nil {
// don't exit on error, just log it
- log.Error().Err(err).Msg("")
+ logging.Error().Err(err).Msg("failed scan directory")
}
} else if fromPipe {
- findings, err = detector.DetectReader(os.Stdin, 10)
- if err != nil {
+ if findings, err = detector.DetectReader(os.Stdin, 10); err != nil {
// log fatal to exit, no need to continue since a report
// will not be generated when scanning from a pipe...for now
- log.Fatal().Err(err).Msg("")
+ logging.Fatal().Err(err).Msg("failed scan input from stdin")
}
} else {
+ var (
+ gitCmd *sources.GitCmd
+ scmPlatform scm.Platform
+ remote *detect.RemoteInfo
+ )
+
var logOpts string
logOpts, err = cmd.Flags().GetString("log-opts")
- if err != nil {
- log.Fatal().Err(err).Msg("")
+
+ if gitCmd, err = sources.NewGitLogCmd(source, logOpts); err != nil {
+ logging.Fatal().Err(err).Msg("could not create Git cmd")
}
- findings, err = detector.DetectGit(source, logOpts, detect.DetectType)
- if err != nil {
+ if scmPlatform, err = scm.PlatformFromString("github"); err != nil {
+ logging.Fatal().Err(err).Send()
+ }
+ remote = detect.NewRemoteInfo(scmPlatform, source)
+
+ if findings, err = detector.DetectGit(gitCmd, remote); err != nil {
// don't exit on error, just log it
- log.Error().Err(err).Msg("")
+ logging.Error().Err(err).Msg("failed to scan Git repository")
}
}
-
// log info about the scan
if err == nil {
log.Info().Msgf("scan completed in %s", FormatDuration(time.Since(start)))
@@ -341,9 +370,7 @@ var scanCmd = &cobra.Command{
reportPath, _ := cmd.Flags().GetString("report-path")
ext, _ := cmd.Flags().GetString("report-format")
if reportPath != "" {
- if err := report.Write(findings, cfg, ext, reportPath); err != nil {
- log.Fatal().Err(err).Msg("could not write")
- }
+ reportFindings(findings, reportPath, ext, &cfg)
}
if err != nil {
@@ -375,7 +402,6 @@ var scanGitChangesCmd = &cobra.Command{
cfg.Path, _ = cmd.Flags().GetString("config")
exitCode, _ := cmd.Flags().GetInt("exit-code")
staged, _ := cmd.Flags().GetBool("staged")
- start := time.Now()
// Setup detector
detector := detect.NewDetector(cfg)
@@ -397,9 +423,17 @@ var scanGitChangesCmd = &cobra.Command{
log.Fatal().Err(err).Msg("")
}
// set redact flag
- if detector.Redact, err = cmd.Flags().GetBool("redact"); err != nil {
+
+ redactFlag, err := cmd.Flags().GetBool("redact")
+ if err != nil {
log.Fatal().Err(err).Msg("")
}
+ if redactFlag {
+ detector.Redact = 100
+ } else {
+ detector.Redact = 0
+ }
+
if detector.MaxTargetMegaBytes, err = cmd.Flags().GetInt("max-target-megabytes"); err != nil {
log.Fatal().Err(err).Msg("")
}
@@ -414,32 +448,22 @@ var scanGitChangesCmd = &cobra.Command{
}
}
- // get log options for git scan
- logOpts, err := cmd.Flags().GetString("log-opts")
- if err != nil {
- log.Fatal().Err(err).Msg("")
- }
+ // start git scan
+ var (
+ findings []report.Finding
- log.Info().Msgf("scanning for exposed secrets...")
+ gitCmd *sources.GitCmd
+ remote *detect.RemoteInfo
+ )
- // start git scan
- var findings []report.Finding
- if staged {
- findings, err = detector.DetectGit(source, logOpts, detect.ProtectStagedType)
- } else {
- findings, err = detector.DetectGit(source, logOpts, detect.ProtectType)
- }
- if err != nil {
- // don't exit on error, just log it
- log.Error().Err(err).Msg("")
+ if gitCmd, err = sources.NewGitDiffCmd(source, staged); err != nil {
+ logging.Fatal().Err(err).Msg("could not create Git diff cmd")
}
+ remote = &detect.RemoteInfo{Platform: scm.NoPlatform}
- // log info about the scan
- log.Info().Msgf("scan completed in %s", FormatDuration(time.Since(start)))
- if len(findings) != 0 {
- log.Warn().Msgf("leaks found: %d", len(findings))
- } else {
- log.Info().Msg("no leaks found")
+ if findings, err = detector.DetectGit(gitCmd, remote); err != nil {
+ // don't exit on error, just log it
+ logging.Error().Err(err).Msg("failed to scan Git repository")
}
Telemetry.CaptureEvent("cli-command:scan git-changes", posthog.NewProperties().Set("risks", len(findings)).Set("version", util.CLI_VERSION))
@@ -447,9 +471,7 @@ var scanGitChangesCmd = &cobra.Command{
reportPath, _ := cmd.Flags().GetString("report-path")
ext, _ := cmd.Flags().GetString("report-format")
if reportPath != "" {
- if err = report.Write(findings, cfg, ext, reportPath); err != nil {
- log.Fatal().Err(err).Msg("")
- }
+ reportFindings(findings, reportPath, ext, &cfg)
}
if len(findings) != 0 {
os.Exit(exitCode)
@@ -457,6 +479,36 @@ var scanGitChangesCmd = &cobra.Command{
},
}
+func reportFindings(findings []report.Finding, reportPath string, ext string, cfg *config.Config) {
+
+ var reporter report.Reporter
+
+ switch ext {
+ case "csv":
+ reporter = &report.CsvReporter{}
+ case "json":
+ reporter = &report.JsonReporter{}
+ case "junit":
+ reporter = &report.JunitReporter{}
+ case "sarif":
+ reporter = &report.SarifReporter{
+ OrderedRules: cfg.GetOrderedRules(),
+ }
+ default:
+ logging.Fatal().Msgf("unknown report format %s", ext)
+ }
+
+ file, err := os.Create(reportPath)
+ if err != nil {
+ log.Fatal().Err(err).Msg("could not create file")
+ }
+
+ if err := reporter.Write(file, findings); err != nil {
+ log.Fatal().Err(err).Msg("could not write")
+ }
+
+}
+
func fileExists(fileName string) bool {
// check for a .infisicalignore file
info, err := os.Stat(fileName)
diff --git a/cli/report/csv_test.go b/cli/report/csv_test.go
deleted file mode 100644
index 9670265197..0000000000
--- a/cli/report/csv_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package report
-
-import (
- "os"
- "path/filepath"
- "strings"
- "testing"
-)
-
-func TestWriteCSV(t *testing.T) {
- tests := []struct {
- findings []Finding
- testReportName string
- expected string
- wantEmpty bool
- }{
- {
- testReportName: "simple",
- expected: filepath.Join(expectPath, "report", "csv_simple.csv"),
- findings: []Finding{
- {
- RuleID: "test-rule",
- Match: "line containing secret",
- Secret: "a secret",
- StartLine: 1,
- EndLine: 2,
- StartColumn: 1,
- EndColumn: 2,
- Message: "opps",
- File: "auth.py",
- SymlinkFile: "",
- Commit: "0000000000000000",
- Author: "John Doe",
- Email: "[email protected]",
- Date: "10-19-2003",
- Fingerprint: "fingerprint",
- },
- }},
- {
-
- wantEmpty: true,
- testReportName: "empty",
- expected: filepath.Join(expectPath, "report", "this_should_not_exist.csv"),
- findings: []Finding{}},
- }
-
- for _, test := range tests {
- tmpfile, err := os.Create(filepath.Join(tmpPath, test.testReportName+".csv"))
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
- err = writeCsv(test.findings, tmpfile)
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
- got, err := os.ReadFile(tmpfile.Name())
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
- if test.wantEmpty {
- if len(got) > 0 {
- t.Errorf("Expected empty file, got %s", got)
- }
- os.Remove(tmpfile.Name())
- continue
- }
- want, err := os.ReadFile(test.expected)
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
-
- if string(got) != string(want) {
- err = os.WriteFile(strings.Replace(test.expected, ".csv", ".got.csv", 1), got, 0644)
- if err != nil {
- t.Error(err)
- }
- t.Errorf("got %s, want %s", string(got), string(want))
- }
-
- os.Remove(tmpfile.Name())
- }
-}
diff --git a/cli/report/json_test.go b/cli/report/json_test.go
deleted file mode 100644
index e81aaa8278..0000000000
--- a/cli/report/json_test.go
+++ /dev/null
@@ -1,111 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package report
-
-import (
- "os"
- "path/filepath"
- "strings"
- "testing"
-)
-
-func TestWriteJSON(t *testing.T) {
- tests := []struct {
- findings []Finding
- testReportName string
- expected string
- wantEmpty bool
- }{
- {
- testReportName: "simple",
- expected: filepath.Join(expectPath, "report", "json_simple.json"),
- findings: []Finding{
- {
-
- Description: "",
- RuleID: "test-rule",
- Match: "line containing secret",
- Secret: "a secret",
- StartLine: 1,
- EndLine: 2,
- StartColumn: 1,
- EndColumn: 2,
- Message: "opps",
- File: "auth.py",
- SymlinkFile: "",
- Commit: "0000000000000000",
- Author: "John Doe",
- Email: "[email protected]",
- Date: "10-19-2003",
- Tags: []string{},
- },
- }},
- {
-
- testReportName: "empty",
- expected: filepath.Join(expectPath, "report", "empty.json"),
- findings: []Finding{}},
- }
-
- for _, test := range tests {
- // create tmp file using os.TempDir()
- tmpfile, err := os.Create(filepath.Join(tmpPath, test.testReportName+".json"))
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
- err = writeJson(test.findings, tmpfile)
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
- got, err := os.ReadFile(tmpfile.Name())
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
- if test.wantEmpty {
- if len(got) > 0 {
- os.Remove(tmpfile.Name())
- t.Errorf("Expected empty file, got %s", got)
- }
- os.Remove(tmpfile.Name())
- continue
- }
- want, err := os.ReadFile(test.expected)
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
-
- if string(got) != string(want) {
- err = os.WriteFile(strings.Replace(test.expected, ".json", ".got.json", 1), got, 0644)
- if err != nil {
- t.Error(err)
- }
- t.Errorf("got %s, want %s", string(got), string(want))
- }
-
- os.Remove(tmpfile.Name())
- }
-}
diff --git a/cli/report/report_test.go b/cli/report/report_test.go
deleted file mode 100644
index ef38f19c26..0000000000
--- a/cli/report/report_test.go
+++ /dev/null
@@ -1,133 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package report
-
-import (
- "os"
- "path/filepath"
- "strconv"
- "testing"
-
- "github.com/Infisical/infisical-merge/config"
-)
-
-const (
- expectPath = "../testdata/expected/"
- tmpPath = "../testdata/tmp"
-)
-
-func TestReport(t *testing.T) {
- tests := []struct {
- findings []Finding
- ext string
- wantEmpty bool
- }{
- {
- ext: "json",
- findings: []Finding{
- {
- RuleID: "test-rule",
- },
- },
- },
- {
- ext: ".json",
- findings: []Finding{
- {
- RuleID: "test-rule",
- },
- },
- },
- {
- ext: ".jsonj",
- findings: []Finding{
- {
- RuleID: "test-rule",
- },
- },
- wantEmpty: true,
- },
- {
- ext: ".csv",
- findings: []Finding{
- {
- RuleID: "test-rule",
- },
- },
- },
- {
- ext: "csv",
- findings: []Finding{
- {
- RuleID: "test-rule",
- },
- },
- },
- {
- ext: "CSV",
- findings: []Finding{
- {
- RuleID: "test-rule",
- },
- },
- },
- // {
- // ext: "SARIF",
- // findings: []Finding{
- // {
- // RuleID: "test-rule",
- // },
- // },
- // },
- }
-
- for i, test := range tests {
- tmpfile, err := os.Create(filepath.Join(tmpPath, strconv.Itoa(i)+test.ext))
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
- err = Write(test.findings, config.Config{}, test.ext, tmpfile.Name())
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
- got, err := os.ReadFile(tmpfile.Name())
- if err != nil {
- os.Remove(tmpfile.Name())
- t.Error(err)
- }
- os.Remove(tmpfile.Name())
-
- if len(got) == 0 && !test.wantEmpty {
- t.Errorf("got empty file with extension " + test.ext)
- }
-
- if test.wantEmpty {
- if len(got) > 0 {
- t.Errorf("Expected empty file, got %s", got)
- }
- continue
- }
- }
-}
diff --git a/cli/report/sarif_test.go b/cli/report/sarif_test.go
deleted file mode 100644
index 9331060f1c..0000000000
--- a/cli/report/sarif_test.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// MIT License
-
-// Copyright (c) 2019 Zachary Rice
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-package report
-
-const configPath = "../testdata/config/"
-
-// func TestWriteSarif(t *testing.T) {
-// tests := []struct {
-// findings []Finding
-// testReportName string
-// expected string
-// wantEmpty bool
-// cfgName string
-// }{
-// {
-// cfgName: "simple",
-// testReportName: "simple",
-// expected: filepath.Join(expectPath, "report", "sarif_simple.sarif"),
-// findings: []Finding{
-// {
-
-// Description: "A test rule",
-// RuleID: "test-rule",
-// Match: "line containing secret",
-// Secret: "a secret",
-// StartLine: 1,
-// EndLine: 2,
-// StartColumn: 1,
-// EndColumn: 2,
-// Message: "opps",
-// File: "auth.py",
-// Commit: "0000000000000000",
-// Author: "John Doe",
-// Email: "[email protected]",
-// Date: "10-19-2003",
-// Tags: []string{},
-// },
-// }},
-// }
-
-// for _, test := range tests {
-// // create tmp file using os.TempDir()
-// tmpfile, err := os.Create(filepath.Join(tmpPath, test.testReportName+".json"))
-// if err != nil {
-// os.Remove(tmpfile.Name())
-// t.Error(err)
-// }
-// viper.Reset()
-// viper.AddConfigPath(configPath)
-// viper.SetConfigName(test.cfgName)
-// viper.SetConfigType("toml")
-// err = viper.ReadInConfig()
-// if err != nil {
-// t.Error(err)
-// }
-
-// var vc config.ViperConfig
-// err = viper.Unmarshal(&vc)
-// if err != nil {
-// t.Error(err)
-// }
-
-// cfg, err := vc.Translate()
-// if err != nil {
-// t.Error(err)
-// }
-// err = writeSarif(cfg, test.findings, tmpfile)
-// fmt.Println(cfg)
-// if err != nil {
-// os.Remove(tmpfile.Name())
-// t.Error(err)
-// }
-// got, err := os.ReadFile(tmpfile.Name())
-// if err != nil {
-// os.Remove(tmpfile.Name())
-// t.Error(err)
-// }
-// if test.wantEmpty {
-// if len(got) > 0 {
-// os.Remove(tmpfile.Name())
-// t.Errorf("Expected empty file, got %s", got)
-// }
-// os.Remove(tmpfile.Name())
-// continue
-// }
-// want, err := os.ReadFile(test.expected)
-// if err != nil {
-// os.Remove(tmpfile.Name())
-// t.Error(err)
-// }
-
-// if string(got) != string(want) {
-// err = os.WriteFile(strings.Replace(test.expected, ".sarif", ".got.sarif", 1), got, 0644)
-// if err != nil {
-// t.Error(err)
-// }
-// t.Errorf("got %s, want %s", string(got), string(want))
-// }
-
-// os.Remove(tmpfile.Name())
-// }
-// }
diff --git a/company/handbook/spending-money.mdx b/company/handbook/spending-money.mdx
index 1e32aeaf50..864984f10e 100644
--- a/company/handbook/spending-money.mdx
+++ b/company/handbook/spending-money.mdx
@@ -6,9 +6,14 @@ description: "The guide to spending money at Infisical."
Fairly frequently, you might run into situations when you need to spend company money.
-<Note>
-Please spend money in a way that you think is in the best interest of the company.
-</Note>
+
+# Expensing Meals
+
+As a perk of working at Infisical, we cover some of your meal expenses.
+
+HQ team members: meals and unlimited snacks are provided on-site at no cost.
+
+Remote team members: a food stipend is allocated based on location.
# Trivial expenses
@@ -18,6 +23,10 @@ This means expenses that are:
1. Non-recurring AND less than $75/month in total.
2. Recurring AND less than $20/month.
+<Note>
+Please spend money in a way that you think is in the best interest of the company.
+</Note>
+
## Saving receipts
Make sure you keep copies for all receipts. If you expense something on a company card and cannot provide a receipt, this may be deducted from your pay.
diff --git a/docs/api-reference/endpoints/app-connections/oci/available.mdx b/docs/api-reference/endpoints/app-connections/oci/available.mdx
new file mode 100644
index 0000000000..19d83e5b7e
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/oci/available.mdx
@@ -0,0 +1,4 @@
+---
+title: "Available"
+openapi: "GET /api/v1/app-connections/oci/available"
+---
diff --git a/docs/api-reference/endpoints/app-connections/oci/create.mdx b/docs/api-reference/endpoints/app-connections/oci/create.mdx
new file mode 100644
index 0000000000..e158771216
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/oci/create.mdx
@@ -0,0 +1,8 @@
+---
+title: "Create"
+openapi: "POST /api/v1/app-connections/oci"
+---
+
+<Note>
+ Check out the configuration docs for [OCI Connections](/integrations/app-connections/oci) to learn how to obtain the required credentials.
+</Note>
diff --git a/docs/api-reference/endpoints/app-connections/oci/delete.mdx b/docs/api-reference/endpoints/app-connections/oci/delete.mdx
new file mode 100644
index 0000000000..990700885b
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/oci/delete.mdx
@@ -0,0 +1,4 @@
+---
+title: "Delete"
+openapi: "DELETE /api/v1/app-connections/oci/{connectionId}"
+---
diff --git a/docs/api-reference/endpoints/app-connections/oci/get-by-id.mdx b/docs/api-reference/endpoints/app-connections/oci/get-by-id.mdx
new file mode 100644
index 0000000000..a7541b2275
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/oci/get-by-id.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by ID"
+openapi: "GET /api/v1/app-connections/oci/{connectionId}"
+---
diff --git a/docs/api-reference/endpoints/app-connections/oci/get-by-name.mdx b/docs/api-reference/endpoints/app-connections/oci/get-by-name.mdx
new file mode 100644
index 0000000000..1c920e14fa
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/oci/get-by-name.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by Name"
+openapi: "GET /api/v1/app-connections/oci/connection-name/{connectionName}"
+---
diff --git a/docs/api-reference/endpoints/app-connections/oci/list.mdx b/docs/api-reference/endpoints/app-connections/oci/list.mdx
new file mode 100644
index 0000000000..ba44300734
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/oci/list.mdx
@@ -0,0 +1,4 @@
+---
+title: "List"
+openapi: "GET /api/v1/app-connections/oci"
+---
diff --git a/docs/api-reference/endpoints/app-connections/oci/update.mdx b/docs/api-reference/endpoints/app-connections/oci/update.mdx
new file mode 100644
index 0000000000..c012009a24
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/oci/update.mdx
@@ -0,0 +1,8 @@
+---
+title: "Update"
+openapi: "PATCH /api/v1/app-connections/oci/{connectionId}"
+---
+
+<Note>
+ Check out the configuration docs for [OCI Connections](/integrations/app-connections/oci) to learn how to obtain the required credentials.
+</Note>
diff --git a/docs/api-reference/endpoints/certificates/bundle.mdx b/docs/api-reference/endpoints/certificates/bundle.mdx
new file mode 100644
index 0000000000..60d37a2d80
--- /dev/null
+++ b/docs/api-reference/endpoints/certificates/bundle.mdx
@@ -0,0 +1,8 @@
+---
+title: "Get Certificate Bundle"
+openapi: "GET /api/v1/pki/certificates/{serialNumber}/bundle"
+---
+
+<Note>
+ You must have the certificate `read-private-key` permission in order to call this endpoint.
+</Note>
diff --git a/docs/api-reference/endpoints/certificates/private-key.mdx b/docs/api-reference/endpoints/certificates/private-key.mdx
new file mode 100644
index 0000000000..d0b93e65c9
--- /dev/null
+++ b/docs/api-reference/endpoints/certificates/private-key.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get Certificate Private Key"
+openapi: "GET /api/v1/pki/certificates/{serialNumber}/private-key"
+---
diff --git a/docs/api-reference/endpoints/ldap-auth/attach.mdx b/docs/api-reference/endpoints/ldap-auth/attach.mdx
new file mode 100644
index 0000000000..5128788876
--- /dev/null
+++ b/docs/api-reference/endpoints/ldap-auth/attach.mdx
@@ -0,0 +1,4 @@
+---
+title: "Attach"
+openapi: "POST /api/v1/auth/ldap-auth/identities/{identityId}"
+---
diff --git a/docs/api-reference/endpoints/ldap-auth/login.mdx b/docs/api-reference/endpoints/ldap-auth/login.mdx
new file mode 100644
index 0000000000..737afb8570
--- /dev/null
+++ b/docs/api-reference/endpoints/ldap-auth/login.mdx
@@ -0,0 +1,4 @@
+---
+title: "Login"
+openapi: "POST /api/v1/auth/ldap-auth/login"
+---
diff --git a/docs/api-reference/endpoints/ldap-auth/retrieve.mdx b/docs/api-reference/endpoints/ldap-auth/retrieve.mdx
new file mode 100644
index 0000000000..fe4974cde9
--- /dev/null
+++ b/docs/api-reference/endpoints/ldap-auth/retrieve.mdx
@@ -0,0 +1,4 @@
+---
+title: "Retrieve"
+openapi: "GET /api/v1/auth/ldap-auth/identities/{identityId}"
+---
diff --git a/docs/api-reference/endpoints/ldap-auth/revoke.mdx b/docs/api-reference/endpoints/ldap-auth/revoke.mdx
new file mode 100644
index 0000000000..2ef0996fd1
--- /dev/null
+++ b/docs/api-reference/endpoints/ldap-auth/revoke.mdx
@@ -0,0 +1,4 @@
+---
+title: "Revoke"
+openapi: "DELETE /api/v1/auth/ldap-auth/identities/{identityId}"
+---
diff --git a/docs/api-reference/endpoints/ldap-auth/update.mdx b/docs/api-reference/endpoints/ldap-auth/update.mdx
new file mode 100644
index 0000000000..74b54efd38
--- /dev/null
+++ b/docs/api-reference/endpoints/ldap-auth/update.mdx
@@ -0,0 +1,4 @@
+---
+title: "Update"
+openapi: "PATCH /api/v1/auth/ldap-auth/identities/{identityId}"
+---
diff --git a/docs/api-reference/endpoints/oci-auth/attach.mdx b/docs/api-reference/endpoints/oci-auth/attach.mdx
new file mode 100644
index 0000000000..039e99064b
--- /dev/null
+++ b/docs/api-reference/endpoints/oci-auth/attach.mdx
@@ -0,0 +1,4 @@
+---
+title: "Attach"
+openapi: "POST /api/v1/auth/oci-auth/identities/{identityId}"
+---
diff --git a/docs/api-reference/endpoints/oci-auth/login.mdx b/docs/api-reference/endpoints/oci-auth/login.mdx
new file mode 100644
index 0000000000..400addcbd0
--- /dev/null
+++ b/docs/api-reference/endpoints/oci-auth/login.mdx
@@ -0,0 +1,4 @@
+---
+title: "Login"
+openapi: "POST /api/v1/auth/oci-auth/login"
+---
diff --git a/docs/api-reference/endpoints/oci-auth/retrieve.mdx b/docs/api-reference/endpoints/oci-auth/retrieve.mdx
new file mode 100644
index 0000000000..31883fb779
--- /dev/null
+++ b/docs/api-reference/endpoints/oci-auth/retrieve.mdx
@@ -0,0 +1,4 @@
+---
+title: "Retrieve"
+openapi: "GET /api/v1/auth/oci-auth/identities/{identityId}"
+---
diff --git a/docs/api-reference/endpoints/oci-auth/revoke.mdx b/docs/api-reference/endpoints/oci-auth/revoke.mdx
new file mode 100644
index 0000000000..5cc6090036
--- /dev/null
+++ b/docs/api-reference/endpoints/oci-auth/revoke.mdx
@@ -0,0 +1,4 @@
+---
+title: "Revoke"
+openapi: "DELETE /api/v1/auth/oci-auth/identities/{identityId}"
+---
diff --git a/docs/api-reference/endpoints/oci-auth/update.mdx b/docs/api-reference/endpoints/oci-auth/update.mdx
new file mode 100644
index 0000000000..72c1dfdf03
--- /dev/null
+++ b/docs/api-reference/endpoints/oci-auth/update.mdx
@@ -0,0 +1,4 @@
+---
+title: "Update"
+openapi: "PATCH /api/v1/auth/oci-auth/identities/{identityId}"
+---
diff --git a/docs/api-reference/endpoints/pki/subscribers/create.mdx b/docs/api-reference/endpoints/pki/subscribers/create.mdx
new file mode 100644
index 0000000000..14a53b7fa0
--- /dev/null
+++ b/docs/api-reference/endpoints/pki/subscribers/create.mdx
@@ -0,0 +1,4 @@
+---
+title: "Create"
+openapi: "POST /api/v1/pki/subscribers"
+---
diff --git a/docs/api-reference/endpoints/pki/subscribers/delete.mdx b/docs/api-reference/endpoints/pki/subscribers/delete.mdx
new file mode 100644
index 0000000000..5975b89e98
--- /dev/null
+++ b/docs/api-reference/endpoints/pki/subscribers/delete.mdx
@@ -0,0 +1,4 @@
+---
+title: "Delete"
+openapi: "DELETE /api/v1/pki/subscribers/{subscriberName}"
+---
diff --git a/docs/api-reference/endpoints/pki/subscribers/issue-cert.mdx b/docs/api-reference/endpoints/pki/subscribers/issue-cert.mdx
new file mode 100644
index 0000000000..be57ab01b1
--- /dev/null
+++ b/docs/api-reference/endpoints/pki/subscribers/issue-cert.mdx
@@ -0,0 +1,4 @@
+---
+title: "Issue Certificate"
+openapi: "POST /api/v1/pki/subscribers/{subscriberName}/issue-cert"
+---
diff --git a/docs/api-reference/endpoints/pki/subscribers/list-certs.mdx b/docs/api-reference/endpoints/pki/subscribers/list-certs.mdx
new file mode 100644
index 0000000000..3a4607303d
--- /dev/null
+++ b/docs/api-reference/endpoints/pki/subscribers/list-certs.mdx
@@ -0,0 +1,4 @@
+---
+title: "List Certificates"
+openapi: "GET /api/v1/pki/subscribers/{subscriberName}/certificates"
+---
diff --git a/docs/api-reference/endpoints/pki/subscribers/read.mdx b/docs/api-reference/endpoints/pki/subscribers/read.mdx
new file mode 100644
index 0000000000..0d223217d9
--- /dev/null
+++ b/docs/api-reference/endpoints/pki/subscribers/read.mdx
@@ -0,0 +1,4 @@
+---
+title: "Retrieve"
+openapi: "GET /api/v1/pki/subscribers/{subscriberName}"
+---
diff --git a/docs/api-reference/endpoints/pki/subscribers/sign-cert.mdx b/docs/api-reference/endpoints/pki/subscribers/sign-cert.mdx
new file mode 100644
index 0000000000..d31d30239e
--- /dev/null
+++ b/docs/api-reference/endpoints/pki/subscribers/sign-cert.mdx
@@ -0,0 +1,4 @@
+---
+title: "Sign Certificate"
+openapi: "POST /api/v1/pki/subscribers/{subscriberName}/sign-certificate"
+---
diff --git a/docs/api-reference/endpoints/pki/subscribers/update.mdx b/docs/api-reference/endpoints/pki/subscribers/update.mdx
new file mode 100644
index 0000000000..5b62cbe7d8
--- /dev/null
+++ b/docs/api-reference/endpoints/pki/subscribers/update.mdx
@@ -0,0 +1,4 @@
+---
+title: "Update"
+openapi: "PATCH /api/v1/pki/subscribers/{subscriberName}"
+---
diff --git a/docs/api-reference/endpoints/secret-syncs/oci-vault/create.mdx b/docs/api-reference/endpoints/secret-syncs/oci-vault/create.mdx
new file mode 100644
index 0000000000..fa3ac27380
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-syncs/oci-vault/create.mdx
@@ -0,0 +1,4 @@
+---
+title: "Create"
+openapi: "POST /api/v1/secret-syncs/oci-vault"
+---
diff --git a/docs/api-reference/endpoints/secret-syncs/oci-vault/delete.mdx b/docs/api-reference/endpoints/secret-syncs/oci-vault/delete.mdx
new file mode 100644
index 0000000000..81f2083080
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-syncs/oci-vault/delete.mdx
@@ -0,0 +1,4 @@
+---
+title: "Delete"
+openapi: "DELETE /api/v1/secret-syncs/oci-vault/{syncId}"
+---
diff --git a/docs/api-reference/endpoints/secret-syncs/oci-vault/get-by-id.mdx b/docs/api-reference/endpoints/secret-syncs/oci-vault/get-by-id.mdx
new file mode 100644
index 0000000000..52b3201dcf
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-syncs/oci-vault/get-by-id.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by ID"
+openapi: "GET /api/v1/secret-syncs/oci-vault/{syncId}"
+---
diff --git a/docs/api-reference/endpoints/secret-syncs/oci-vault/get-by-name.mdx b/docs/api-reference/endpoints/secret-syncs/oci-vault/get-by-name.mdx
new file mode 100644
index 0000000000..eabc8794c3
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-syncs/oci-vault/get-by-name.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by Name"
+openapi: "GET /api/v1/secret-syncs/oci-vault/sync-name/{syncName}"
+---
diff --git a/docs/api-reference/endpoints/secret-syncs/oci-vault/import-secrets.mdx b/docs/api-reference/endpoints/secret-syncs/oci-vault/import-secrets.mdx
new file mode 100644
index 0000000000..27ca686d6e
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-syncs/oci-vault/import-secrets.mdx
@@ -0,0 +1,4 @@
+---
+title: "Import Secrets"
+openapi: "POST /api/v1/secret-syncs/oci-vault/{syncId}/import-secrets"
+---
diff --git a/docs/api-reference/endpoints/secret-syncs/oci-vault/list.mdx b/docs/api-reference/endpoints/secret-syncs/oci-vault/list.mdx
new file mode 100644
index 0000000000..88cd2a44ac
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-syncs/oci-vault/list.mdx
@@ -0,0 +1,4 @@
+---
+title: "List"
+openapi: "GET /api/v1/secret-syncs/oci-vault"
+---
diff --git a/docs/api-reference/endpoints/secret-syncs/oci-vault/remove-secrets.mdx b/docs/api-reference/endpoints/secret-syncs/oci-vault/remove-secrets.mdx
new file mode 100644
index 0000000000..e98e7140e7
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-syncs/oci-vault/remove-secrets.mdx
@@ -0,0 +1,4 @@
+---
+title: "Remove Secrets"
+openapi: "POST /api/v1/secret-syncs/oci-vault/{syncId}/remove-secrets"
+---
diff --git a/docs/api-reference/endpoints/secret-syncs/oci-vault/sync-secrets.mdx b/docs/api-reference/endpoints/secret-syncs/oci-vault/sync-secrets.mdx
new file mode 100644
index 0000000000..38ea4331c0
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-syncs/oci-vault/sync-secrets.mdx
@@ -0,0 +1,4 @@
+---
+title: "Sync Secrets"
+openapi: "POST /api/v1/secret-syncs/oci-vault/{syncId}/sync-secrets"
+---
diff --git a/docs/api-reference/endpoints/secret-syncs/oci-vault/update.mdx b/docs/api-reference/endpoints/secret-syncs/oci-vault/update.mdx
new file mode 100644
index 0000000000..06f1d9d1c4
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-syncs/oci-vault/update.mdx
@@ -0,0 +1,4 @@
+---
+title: "Update"
+openapi: "PATCH /api/v1/secret-syncs/oci-vault/{syncId}"
+---
diff --git a/docs/api-reference/endpoints/ssh/groups/add-host.mdx b/docs/api-reference/endpoints/ssh/groups/add-host.mdx
index 9f903eccd9..77257cd401 100644
--- a/docs/api-reference/endpoints/ssh/groups/add-host.mdx
+++ b/docs/api-reference/endpoints/ssh/groups/add-host.mdx
@@ -1,4 +1,4 @@
---
title: "Add Host"
-openapi: "POST /api/v1/ssh/host-groups/{sshHostGroupId}/hosts"
+openapi: "POST /api/v1/ssh/host-groups/{sshHostGroupId}/hosts/{hostId}"
---
diff --git a/docs/api-reference/endpoints/ssh/groups/remove-host.mdx b/docs/api-reference/endpoints/ssh/groups/remove-host.mdx
index 6933e5c9f6..b1de7f4ae6 100644
--- a/docs/api-reference/endpoints/ssh/groups/remove-host.mdx
+++ b/docs/api-reference/endpoints/ssh/groups/remove-host.mdx
@@ -1,4 +1,4 @@
---
title: "Remove Host"
-openapi: "DELETE /api/v1/ssh/host-groups/{sshHostGroupId}/hosts/{sshHostId}"
+openapi: "DELETE /api/v1/ssh/host-groups/{sshHostGroupId}/hosts/{hostId}"
---
diff --git a/docs/api-reference/endpoints/ssh/hosts/list-my.mdx b/docs/api-reference/endpoints/ssh/hosts/list-my.mdx
index 2b7ab51c03..6ccc4e325a 100644
--- a/docs/api-reference/endpoints/ssh/hosts/list-my.mdx
+++ b/docs/api-reference/endpoints/ssh/hosts/list-my.mdx
@@ -1,4 +1,4 @@
---
title: "List My Hosts"
-openapi: "GET /api/v1/ssh/hosts/"
+openapi: "GET /api/v1/ssh/hosts"
---
diff --git a/docs/api-reference/overview/authentication.mdx b/docs/api-reference/overview/authentication.mdx
index bdd7df83bf..4358e18d25 100644
--- a/docs/api-reference/overview/authentication.mdx
+++ b/docs/api-reference/overview/authentication.mdx
@@ -13,17 +13,17 @@ To interact with the Infisical API, you will need to obtain an access token. Fol
<AccordionGroup>
<Accordion title="Why can I not create, read, update, or delete an identity?">
There are a few reasons for why this might happen:
-
+
- You have insufficient organization permissions to create, read, update, delete identities.
- The identity you are trying to read, update, or delete is more privileged than yourself.
- The role you are trying to create an identity for or update an identity to is more privileged than yours.
</Accordion>
<Accordion title="Why is the Infisical API rejecting my identity credentials?">
There are a few reasons for why this might happen:
-
+
- The client secret or access token has expired.
- - The identity is insufficently permissioned to interact with the resources you wish to access.
+ - The identity is insufficiently permissioned to interact with the resources you wish to access.
- You are attempting to access a `/raw` secrets endpoint that requires your project to disable E2EE.
- The client secret/access token is being used from an untrusted IP.
</Accordion>
-</AccordionGroup>
\ No newline at end of file
+</AccordionGroup>
diff --git a/docs/documentation/getting-started/api.mdx b/docs/documentation/getting-started/api.mdx
index 48a6f2ee0e..c638c4d70e 100644
--- a/docs/documentation/getting-started/api.mdx
+++ b/docs/documentation/getting-started/api.mdx
@@ -10,15 +10,15 @@ In this brief, we'll explore how to fetch a secret back from a project on [Infis
<Step title="Create a project with a secret">
To create a project, head to your Organization Overview and press **Add New Project**; we'll call the project **Demo App**.
![create project](../../images/getting-started/api/org-create-project-1.png)
-
+
![create project](../../images/getting-started/api/org-create-project-2.png)
-
+
Next, let's head to the **Development** environment of the project and add a secret `FOO=BAR` to it.
-
+
![explore project env](../../images/getting-started/api/project-explore-env.png)
-
+
![create secret](../../images/getting-started/api/project-create-secret.png)
-
+
![project dashboard](../../images/getting-started/api/project-dashboard.png)
<Note>
@@ -29,13 +29,13 @@ In this brief, we'll explore how to fetch a secret back from a project on [Infis
Next, we need to create an identity to represent your application. To create one, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
![identities organization](../../images/platform/identities/identities-org.png)
-
+
When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles.
-
+
![identities organization create](../../images/platform/identities/identities-org-create.png)
-
+
Once you've created an identity, you'll be prompted to configure the **Universal Auth** authentication method for it.
-
+
![identities organization create auth method](../../images/platform/identities/identities-org-create-auth-method.png)
</Step>
@@ -44,7 +44,7 @@ In this brief, we'll explore how to fetch a secret back from a project on [Infis
of the identity and a **Client Secret** for it; you can think of these credentials akin to a username
and password used to authenticate with the Infisical API. With that, press on the key icon on the identity to generate a **Client Secret**
for it.
-
+
![identities client secret create](../../images/platform/identities/identities-org-client-secret.png)
![identities client secret create](../../images/platform/identities/identities-org-client-secret-create-1.png)
![identities client secret create](../../images/platform/identities/identities-org-client-secret-create-2.png)
@@ -55,14 +55,14 @@ In this brief, we'll explore how to fetch a secret back from a project on [Infis
Next, select the identity you want to add to the project and the role you want to assign it.
![identities project](../../images/platform/identities/identities-project.png)
-
+
![identities project create](../../images/platform/identities/identities-project-create.png)
</Step>
<Step title="Get an access token for the Infisical API">
To access the Infisical API as the identity, you should first perform a login operation
that is to exchange the **Client ID** and **Client Secret** of the identity for an access token
by making a request to the `/api/v1/auth/universal-auth/login` endpoint.
-
+
#### Sample request
```
@@ -71,9 +71,9 @@ In this brief, we'll explore how to fetch a secret back from a project on [Infis
--data-urlencode 'clientSecret=<client_secret>' \
--data-urlencode 'clientId=<client_id>'
```
-
+
#### Sample response
-
+
```
{
"accessToken": "...",
@@ -83,9 +83,9 @@ In this brief, we'll explore how to fetch a secret back from a project on [Infis
```
Next, we can use the access token to authenticate with the [Infisical API](/api-reference/overview/introduction) to read/write secrets
-
+
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
@@ -96,12 +96,12 @@ In this brief, we'll explore how to fetch a secret back from a project on [Infis
Finally, you can fetch the secret `FOO=BAR` back from **Step 1** by including the access token in the previous step in another request to the `/api/v3/secrets/raw/{secretName}` endpoint.
### Sample request
-
+
```
curl --location --request GET 'http://localhost:8080/api/v3/secrets/raw/FOO?workspaceId=657830d579cfc8415d06ce5b&environment=dev' \
--header 'Authorization: Bearer <access_token>'
```
-
+
### Sample response
```
@@ -118,11 +118,11 @@ In this brief, we'll explore how to fetch a secret back from a project on [Infis
}
}
```
-
+
Note that you can fetch a list of secrets back by making a request to the `/api/v3/secrets/raw` endpoint.
</Step>
</Steps>
See also:
-- [API Reference](/api-reference/overview/introduction)
\ No newline at end of file
+- [API Reference](/api-reference/overview/introduction)
diff --git a/docs/documentation/platform/access-controls/abac/managing-user-metadata.mdx b/docs/documentation/platform/access-controls/abac/managing-user-metadata.mdx
index 3f62a3b61e..b6d1d691fc 100644
--- a/docs/documentation/platform/access-controls/abac/managing-user-metadata.mdx
+++ b/docs/documentation/platform/access-controls/abac/managing-user-metadata.mdx
@@ -27,7 +27,7 @@ User identities can have metadata attributes assigned directly. These attributes
</Tabs>
#### Applying ABAC Policies with User Metadata
-Attribute-based access controls are currently only available for polices defined on Secrets Manager projects.
+Attribute-based access controls are currently only available for policies defined on Secrets Manager projects.
You can set ABAC permissions to dynamically set access to environments, folders, secrets, and secret tags.
<img src="/images/platform/access-controls/example-abac-1.png" />
diff --git a/docs/documentation/platform/gateways/overview.mdx b/docs/documentation/platform/gateways/overview.mdx
index 7ccc098cdc..ae4a3c7add 100644
--- a/docs/documentation/platform/gateways/overview.mdx
+++ b/docs/documentation/platform/gateways/overview.mdx
@@ -158,14 +158,4 @@ Once authenticated, the Gateway establishes a secure connection with Infisical t
To confirm your Gateway is working, check the deployment status by looking for the message **"Gateway started successfully"** in the Gateway logs. This indicates the Gateway is running properly. Next, verify its registration by opening your Infisical dashboard, navigating to **Organization Access Control**, and selecting the **Gateways** tab. Your newly deployed Gateway should appear in the list.
![Gateway List](../../../images/platform/gateways/gateway-list.png)
</Step>
-
- <Step title="Link Gateway to Projects">
- To enable Infisical features like dynamic secrets or secret rotation to access private resources through the Gateway, you need to link the Gateway to the relevant projects.
-
- Start by accessing the **Gateway settings** then locate the Gateway in the list, click the options menu (**:**), and select **Edit Details**.
- ![Edit Gateway Option](../../../images/platform/gateways/edit-gateway.png)
- In the edit modal that appears, choose the projects you want the Gateway to access and click **Save** to confirm your selections.
- ![Project Assignment Modal](../../../images/platform/gateways/assign-project.png)
- Once added to a project, the Gateway becomes available for use by any feature that supports Gateways within that project.
- </Step>
</Steps>
diff --git a/docs/documentation/platform/github-org-sync.mdx b/docs/documentation/platform/github-org-sync.mdx
index 00c9bf4c45..519e12db84 100644
--- a/docs/documentation/platform/github-org-sync.mdx
+++ b/docs/documentation/platform/github-org-sync.mdx
@@ -13,7 +13,7 @@ To enable and configure GitHub Organization Synchronization, follow these steps:
<Steps>
<Step title="Set up GitHub organization configuration">
- 1. Navigate to **Organization Settings** and select the **Security Tab**.
+ 1. Navigate to the **Single Sign-On (SSO)** page and select the **Provisioning** tab.
![config](../../images/platform/external-syncs/github-org-sync-section.png)
2. Click the **Configure** button and provide the name of your GitHub Organization.
![config-modal](../../images/platform/external-syncs/github-org-sync-config-modal.png)
diff --git a/docs/documentation/platform/identities/aws-auth.mdx b/docs/documentation/platform/identities/aws-auth.mdx
index 494606ccd7..f27d5c7bf9 100644
--- a/docs/documentation/platform/identities/aws-auth.mdx
+++ b/docs/documentation/platform/identities/aws-auth.mdx
@@ -62,7 +62,7 @@ access the Infisical API using the AWS Auth authentication method.
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -311,7 +311,7 @@ access the Infisical API using the AWS Auth authentication method.
</Tip>
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
diff --git a/docs/documentation/platform/identities/azure-auth.mdx b/docs/documentation/platform/identities/azure-auth.mdx
index 03d997ffb8..7a7c112efa 100644
--- a/docs/documentation/platform/identities/azure-auth.mdx
+++ b/docs/documentation/platform/identities/azure-auth.mdx
@@ -62,7 +62,7 @@ access the Infisical API using the Azure Auth authentication method.
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -173,7 +173,7 @@ access the Infisical API using the Azure Auth authentication method.
We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using Azure Auth as they handle the authentication process including retrieving the client access token.
</Tip>
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
a new access token should be obtained by performing another login operation.
diff --git a/docs/documentation/platform/identities/gcp-auth.mdx b/docs/documentation/platform/identities/gcp-auth.mdx
index 6573544ded..8d6a1f177a 100644
--- a/docs/documentation/platform/identities/gcp-auth.mdx
+++ b/docs/documentation/platform/identities/gcp-auth.mdx
@@ -68,7 +68,7 @@ access the Infisical API using the GCP ID Token authentication method.
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -168,7 +168,7 @@ access the Infisical API using the GCP ID Token authentication method.
We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using GCP IAM Auth as they handle the authentication process including generating the signed JWT token.
</Tip>
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
a new access token should be obtained by performing another login operation.
@@ -179,7 +179,7 @@ access the Infisical API using the GCP ID Token authentication method.
</Tab>
<Tab title="GCP IAM Auth">
-
+
## Diagram
The following sequence diagram illustrates the GCP IAM Auth workflow for authenticating GCP IAM service accounts with Infisical.
@@ -237,7 +237,7 @@ access the Infisical API using the GCP IAM authentication method.
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -352,7 +352,7 @@ access the Infisical API using the GCP IAM authentication method.
We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using GCP IAM Auth as they handle the authentication process including generating the signed JWT token.
</Tip>
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
a new access token should be obtained by performing another login operation.
@@ -361,5 +361,5 @@ access the Infisical API using the GCP IAM authentication method.
</Steps>
</Tab>
-
+
</Tabs>
diff --git a/docs/documentation/platform/identities/jwt-auth.mdx b/docs/documentation/platform/identities/jwt-auth.mdx
index 3dcf12b290..3391388811 100644
--- a/docs/documentation/platform/identities/jwt-auth.mdx
+++ b/docs/documentation/platform/identities/jwt-auth.mdx
@@ -57,7 +57,7 @@ In the following steps, we explore how to create and use identities to access th
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
diff --git a/docs/documentation/platform/identities/kubernetes-auth.mdx b/docs/documentation/platform/identities/kubernetes-auth.mdx
index 58069f09ed..9daff1e819 100644
--- a/docs/documentation/platform/identities/kubernetes-auth.mdx
+++ b/docs/documentation/platform/identities/kubernetes-auth.mdx
@@ -56,7 +56,7 @@ In the following steps, we explore how to create and use identities for your app
<Step title="Obtaining the token reviewer JWT for Infisical">
<Tabs>
<Tab title="Option 1: Reviewer JWT Token">
-
+
<Note>
**When to use this option**: Choose this approach when you want centralized authentication management. Only one service account needs special permissions, and your application service accounts remain unchanged.
</Note>
@@ -163,7 +163,7 @@ In the following steps, we explore how to create and use identities for your app
</Step>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -190,7 +190,7 @@ In the following steps, we explore how to create and use identities for your app
Here's some more guidance on each field:
- Kubernetes Host / Base Kubernetes API URL: The host string, host:port pair, or URL to the base of the Kubernetes API server. This can usually be obtained by running `kubectl cluster-info`.
- - Token Reviewer JWT: A long-lived service account JWT token for Infisical to access the [TokenReview API](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/) to validate other service account JWT tokens submitted by applications/pods. This is the JWT token obtained from step 1.5(Reviewer Tab). If omitted, the client's own JWT will be used instead, which requires the client to have the `system:auth-delegator` ClusterRole binding.
+ - Token Reviewer JWT: A long-lived service account JWT token for Infisical to access the [TokenReview API](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/) to validate other service account JWT tokens submitted by applications/pods. This is the JWT token obtained from step 1.5(Reviewer Tab). If omitted, the client's own JWT will be used instead, which requires the client to have the `system:auth-delegator` ClusterRole binding.
This is shown in step 1, option 2.
- Allowed Service Account Names: A comma-separated list of trusted service account names that are allowed to authenticate with Infisical.
- Allowed Namespaces: A comma-separated list of trusted namespaces that service accounts must belong to authenticate with Infisical.
@@ -257,7 +257,7 @@ In the following steps, we explore how to create and use identities for your app
</Tip>
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted.
If an identity access token exceeds its max ttl, it can no longer authenticate with the Infisical API. In this case,
@@ -280,7 +280,7 @@ In the following steps, we explore how to create and use identities for your app
There are a few reasons for why this might happen:
- The access token has expired.
-- The identity is insufficently permissioned to interact with the resources you wish to access.
+- The identity is insufficiently permissioned to interact with the resources you wish to access.
- The client access token is being used from an untrusted IP.
</Accordion>
diff --git a/docs/documentation/platform/identities/ldap-auth/general.mdx b/docs/documentation/platform/identities/ldap-auth/general.mdx
new file mode 100644
index 0000000000..7fb2798c76
--- /dev/null
+++ b/docs/documentation/platform/identities/ldap-auth/general.mdx
@@ -0,0 +1,87 @@
+---
+title: General
+description: "Learn how to authenticate with Infisical using LDAP."
+---
+
+**LDAP Auth** is an LDAP based authentication method that allows you to authenticate with Infisical using a machine identity configured with an [LDAP](https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol) directory.
+
+## Guide
+<Steps>
+ <Step title="Creating an identity">
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
+
+ ![Create identity](/images/platform/identities/ldap/identities-org-create-identity.png)
+
+ When creating an identity, you specify an organization level role for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles.
+
+ ![Create identity modal](/images/platform/identities/ldap/identities-org-create-identity-modal.png)
+
+ Now input a few details for your new identity. Here's some guidance for each field:
+
+ - Name (required): A friendly name for the identity.
+ - Role (required): A role from the Organization Roles tab for the identity to assume. The organization role assigned will determine what organization level resources this identity can have access to.
+
+ Once you've created an identity, you'll be redirected to a page where you can manage the identity.
+ </Step>
+
+ <Step title="Configuring LDAP auth for your identity">
+ To configure LDAP auth for your identity, press the **Add Auth Method** button on the identity's page.
+
+ ![Add auth method](/images/platform/identities/ldap/identities-org-add-auth-method.png)
+
+ Now select **LDAP Auth** from the list of available auth methods for the identity.
+
+ ![Select LDAP auth](/images/platform/identities/ldap/identities-org-add-auth-method-modal.png)
+
+
+ After selecting **LDAP Auth**, you'll see the form you need to fill out to configure LDAP auth for your identity. The following fields are available:
+
+ - `URL`: The LDAP server to connect to such as `ldap://ldap.your-org.com`, `ldaps://ldap.myorg.com:636` _(for connection over SSL/TLS)_, etc.
+ - `Bind DN`: The DN to bind to the LDAP server with.
+ - `Bind Pass`: The password to bind to the LDAP server with.
+ - `Search Base / DN`: Base DN under which to perform user search such as `ou=Users,dc=acme,dc=com`.
+ - `User Search Filter`: Template used to construct the LDAP user search filter such as `(uid={{username}})`; use literal `{{username}}` to have the given username used in the search. The default is `(uid={{username}})` which is compatible with several common directory schemas.
+ - `Required Attributes`: A key/value pair of attributes that must be present in the LDAP user entry for them to be authenticated. As an example, if you set key `uid` to value `user1,user2,user3`, then only users with `uid` of `user1`, `user2`, or `user3` will be able to login with this identity. Each value is a comma separated list of attributes.
+ - `CA Certificate`: The CA certificate to use when verifying the LDAP server certificate. This field is optional but recommended.
+ - `Access Token TTL` _(default is 2592000 equivalent to 30 days)_: The lifetime for an access token in seconds. This value will be referenced at renewal time.
+ - `Access Token Max TTL` _(default is 2592000 equivalent to 30 days)_: The maximum lifetime for an access token in seconds. This value will be referenced at renewal time.
+ - `Access Token Max Number of Uses` _(default is 0)_: The maximum number of times that an access token can be used; a value of 0 implies infinite number of uses.
+ - `Access Token Trusted IPs`: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the 0.0.0.0/0, allowing usage from any network address.
+
+ Once you've filled out the form, press **Add** to save your changes.
+
+ ![Configure LDAP auth](/images/platform/identities/ldap/identities-org-configure-ldap.png)
+
+ <Step title="Authenticating with the identity">
+ After configuring LDAP auth for your identity, you can authenticate with the identity and obtain an access token using your LDAP credentials.
+
+ ```bash
+ curl --request POST \
+ --url https://app.infisical.com/api/v1/auth/ldap-auth/login \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "identityId": "<string>",
+ "username": "<string>",
+ "password": "<string>"
+ }'
+ ```
+
+ <Note>
+ For EU Cloud and Self-Hosted users, make sure to replace `https://app.infisical.com` with `https://eu.infisical.com` or your self-hosted instance's URL in the request URL.
+ </Note>
+
+ If successful, you'll receive an access token in the response body.
+
+ ```json
+ {
+ "accessToken": "your-access-token",
+ "expiresIn": 2592000,
+ "accessTokenMaxTTL": 2592000,
+ "tokenType": "Bearer"
+ }
+ ```
+
+ You can read more about the login API endpoint [here](/api-reference/endpoints/ldap-auth/login).
+ </Step>
+ </Step>
+</Steps>
diff --git a/docs/documentation/platform/identities/ldap-auth/jumpcloud.mdx b/docs/documentation/platform/identities/ldap-auth/jumpcloud.mdx
new file mode 100644
index 0000000000..4bd497eac8
--- /dev/null
+++ b/docs/documentation/platform/identities/ldap-auth/jumpcloud.mdx
@@ -0,0 +1,97 @@
+---
+title: JumpCloud
+description: "Learn how to authenticate with Infisical using LDAP with JumpCloud."
+---
+
+**LDAP Auth** is an LDAP based authentication method that allows you to authenticate with Infisical using a machine identity configured with an [LDAP](https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol) directory.
+
+## Guide
+<Steps>
+
+ <Step title="Prepare LDAP in JumpCloud">
+ In JumpCloud, head to USER MANAGEMENT > Users and create a new user via the Manual user entry option.
+ This user will be used as a privileged service account to facilitate Infisical's ability to bind/search the LDAP directory.
+
+ Next after creating the user, under User Security Settings and Permissions > Permission Settings, check the box next to Enable as LDAP Bind DN.
+
+ ![User management](/images/platform/identities/ldap/jumpcloud-users-management.png)
+ </Step>
+
+ <Step title="Creating an identity">
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
+
+ ![Create identity](/images/platform/identities/ldap/identities-org-create-identity.png)
+
+ When creating an identity, you specify an organization level role for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles.
+
+ ![Create identity modal](/images/platform/identities/ldap/identities-org-create-identity-modal.png)
+
+ Now input a few details for your new identity. Here's some guidance for each field:
+
+ - Name (required): A friendly name for the identity.
+ - Role (required): A role from the Organization Roles tab for the identity to assume. The organization role assigned will determine what organization level resources this identity can have access to.
+
+ Once you've created an identity, you'll be redirected to a page where you can manage the identity.
+ </Step>
+
+ <Step title="Configuring LDAP auth for your identity">
+ To configure LDAP auth for your identity, press the **Add Auth Method** button on the identity's page.
+
+ ![Add auth method](/images/platform/identities/ldap/identities-org-add-auth-method.png)
+
+ Now select **LDAP Auth** from the list of available auth methods for the identity.
+
+ ![Select LDAP auth](/images/platform/identities/ldap/identities-org-add-auth-method-modal.png)
+
+
+ After selecting **LDAP Auth**, you'll see the form you need to fill out to configure LDAP auth for your identity. The following fields are available:
+
+ - `URL`: The LDAP server to connect to (`ldaps://ldap.jumpcloud.com:636`).
+ - `Bind DN`: The distinguished name of object to bind when performing the user search (`uid=<ldap-user-username>,ou=Users,o=<your-org-id>,dc=jumpcloud,dc=com`).
+ - `Bind Pass`: The password to use along with Bind DN when performing the user search. This is the password for the user created in the previous step.
+ - `Search Base / DN`: Base DN under which to perform user search (`ou=Users,o=<your-org-id>,dc=jumpcloud,dc=com`).
+ - `User Search Filter`: Template used to construct the LDAP user search filter (`(uid={{username}})`).
+ - `Required Attributes`: A key/value pair of attributes that must be present in the LDAP user entry for them to be authenticated. As an example, if you set key `uid` to value `user1,user2,user3`, then only users with `uid` of `user1`, `user2`, or `user3` will be able to login with this identity. Each value is a comma separated list of attributes.
+ - `CA Certificate`: The CA certificate to use when verifying the LDAP server certificate (instructions to obtain the certificate for JumpCloud [here](https://jumpcloud.com/support/connect-to-ldap-with-tls-ssl)).
+ - `Access Token TTL` _(default is 2592000 equivalent to 30 days)_: The lifetime for an access token in seconds. This value will be referenced at renewal time.
+ - `Access Token Max TTL` _(default is 2592000 equivalent to 30 days)_: The maximum lifetime for an access token in seconds. This value will be referenced at renewal time.
+ - `Access Token Max Number of Uses` _(default is 0)_: The maximum number of times that an access token can be used; a value of 0 implies infinite number of uses.
+ - `Access Token Trusted IPs`: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the 0.0.0.0/0, allowing usage from any network address.
+
+ Once you've filled out the form, press **Add** to save your changes.
+
+ ![Configure LDAP auth](/images/platform/identities/ldap/identities-org-configure-ldap.png)
+
+ <Step title="Authenticating with the identity">
+ After configuring LDAP auth for your identity, you can authenticate with the identity and obtain an access token using your LDAP credentials.
+
+ ```bash
+ curl --request POST \
+ --url https://app.infisical.com/api/v1/auth/ldap-auth/login \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "identityId": "<string>",
+ "username": "<string>",
+ "password": "<string>"
+ }'
+ ```
+
+ <Note>
+ For EU Cloud and Self-Hosted users, make sure to replace `https://app.infisical.com` with `https://eu.infisical.com` or your self-hosted instance's URL in the request URL.
+ </Note>
+
+ If successful, you'll receive an access token in the response body.
+
+ ```json
+ {
+ "accessToken": "your-access-token",
+ "expiresIn": 2592000,
+ "accessTokenMaxTTL": 2592000,
+ "tokenType": "Bearer"
+ }
+ ```
+
+ You can read more about the login API endpoint [here](/api-reference/endpoints/ldap-auth/login).
+ </Step>
+ </Step>
+</Steps>
diff --git a/docs/documentation/platform/identities/oci-auth.mdx b/docs/documentation/platform/identities/oci-auth.mdx
new file mode 100644
index 0000000000..ef5fafa4c3
--- /dev/null
+++ b/docs/documentation/platform/identities/oci-auth.mdx
@@ -0,0 +1,212 @@
+---
+title: OCI Auth
+description: "Learn how to authenticate with Infisical using OCI user accounts."
+---
+
+**OCI Auth** is an OCI-native authentication method that verifies Oracle Cloud Infrastructure users through signature validation, allowing secure access to Infisical resources.
+
+## Diagram
+
+The following sequence diagram illustrates the OCI Auth workflow for authenticating OCI users with Infisical.
+
+```mermaid
+sequenceDiagram
+ participant Client
+ participant Infisical
+ participant OCI
+
+ Note over Client,Client: Step 1: Sign user identity request
+
+ Note over Client,Infisical: Step 2: Login Operation
+ Client->>Infisical: Send signed request details to /api/v1/auth/oci-auth/login
+
+ Note over Infisical,OCI: Step 3: Request verification
+ Infisical->>OCI: Forward signed request
+ OCI-->>Infisical: Return user details
+
+ Note over Infisical: Step 4: Identity property validation
+ Infisical->>Client: Return short-lived access token
+
+ Note over Client,Infisical: Step 5: Access Infisical API with token
+ Client->>Infisical: Make authenticated requests using the short-lived access token
+```
+
+## Concept
+
+At a high level, Infisical authenticates an OCI user by verifying its identity and checking that it meets specific requirements (e.g., its username is authorized, its part of a tenancy) at the `/api/v1/auth/oci-auth/login` endpoint. If successful,
+then Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
+
+To be more specific:
+1. The client [signs](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/signingrequests.htm) a `/20160918/users/{userId}` request using an OCI user's [private key](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#Required_Keys_and_OCIDs); this is done using the [OCI SDK](https://infisical.com/docs/documentation/platform/identities/oci-auth#accessing-the-infisical-api-with-the-identity) or API.
+2. The client sends the signed request's headers and their user OCID to Infisical at the `/api/v1/auth/oci-auth/login` endpoint.
+3. Infisical reconstructs the request and sends it to OCI via the [Get User](https://docs.oracle.com/en/engineered-systems/private-cloud-appliance/3.0-latest/ceapi/op-20160918-users-user_id-get.html) endpoint for verification and obtains the identity associated with the OCI user.
+4. Infisical checks the user's properties against set criteria such as **Allowed Usernames** and **Tenancy OCID**.
+5. If all checks pass, Infisical returns a short-lived access token that the client can use to make authenticated requests to the Infisical API.
+
+## Prerequisite
+
+In order to sign requests, you must have an OCI user with credentials such as the private key. If you're unaware of how to create a user and obtain the needed credentials, expand the menu below.
+
+<Accordion title="Creating an OCI user">
+ <Steps>
+ <Step title="Search for 'Domains' and click as shown">
+ ![Search Domains](/images/app-connections/oci/search-domains.png)
+ </Step>
+ <Step title="Select domain">
+ Select the domain in which you want to create the Infisical user account.
+
+ ![Select Domain](/images/app-connections/oci/select-domain.png)
+ </Step>
+ <Step title="Navigate to 'Users'">
+ ![Select Users](/images/app-connections/oci/select-users.png)
+ </Step>
+ <Step title="Click 'Create user'">
+ ![Click Create User](/images/app-connections/oci/click-create-user.png)
+ </Step>
+ <Step title="Create user">
+ The name, email, and username can be anything.
+
+ ![Create User](/images/app-connections/oci/create-user.png)
+ </Step>
+ <Step title="Navigate to 'API keys'">
+ After you've created a user, you'll be redirected to the user's page. Navigate to 'API keys'.
+
+ ![Select API Keys](/images/app-connections/oci/select-api-keys.png)
+ </Step>
+ <Step title="Add API key">
+ Click on 'Add API key' and then download or import the private key. After you've obtained the private key, click 'Add'.
+
+ ![Add API Key](/images/app-connections/oci/add-api-key.png)
+
+ <Note>
+ At the end of the downloaded private key file, you'll see `OCI_API_KEY`. This is not apart of the private key, and should not be included when you use the private key to sign requests.
+ </Note>
+
+ </Step>
+ <Step title="Store configuration">
+ After creating the API key, you'll be shown a modal with relevant information. Save the highlighted values (and the private key) for later steps.
+
+ ![User Info](/images/app-connections/oci/user-info.png)
+ </Step>
+ </Steps>
+</Accordion>
+
+## Guide
+
+In the following steps, we explore how to create and use identities for your workloads and applications on OCI to
+access the Infisical API using the OCI request signing authentication method.
+
+### Creating an identity
+
+To create an identity, head to your Organization Settings > Access Control > [Identities](https://app.infisical.com/organization/access-management?selectedTab=identities) and press **Create identity**.
+
+![identities organization](/images/platform/identities/identities-org.png)
+
+When creating an identity, you specify an organization-level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > [Organization Roles](https://app.infisical.com/organization/access-management?selectedTab=roles).
+
+![identities organization create](/images/platform/identities/identities-org-create.png)
+
+Input some details for your new identity:
+- **Name (required):** A friendly name for the identity.
+- **Role (required):** A role from the [**Organization Roles**](https://app.infisical.com/organization/access-management?selectedTab=roles) tab for the identity to assume. The organization role assigned will determine what organization-level resources this identity can have access to.
+
+Once you've created an identity, you'll be redirected to a page where you can manage the identity.
+
+![identities page](/images/platform/identities/identities-page.png)
+
+Since the identity has been configured with [Universal Auth](https://infisical.com/docs/documentation/platform/identities/universal-auth) by default, you should reconfigure it to use OCI Auth instead. To do this, click the cog next to **Universal Auth** and then select **Delete** in the options dropdown.
+
+![identities press cog](/images/platform/identities/identities-press-cog.png)
+
+![identities page remove default auth](/images/platform/identities/identities-page-remove-default-auth.png)
+
+Now create a new OCI Auth Method.
+
+![identities create oci auth method](/images/platform/identities/identities-org-create-oci-auth-method.png)
+
+Here's some information about each field:
+- **Tenancy OCID:** The OCID of your tenancy. All users authenticating must be part of this Tenancy.
+- **Allowed Usernames:** A comma-separated list of trusted OCI users that are allowed to authenticate with Infisical.
+- **Access Token TTL (default is `2592000` equivalent to 30 days):** The lifetime for an access token in seconds. This value will be referenced at renewal time.
+- **Access Token Max TTL (default is `2592000` equivalent to 30 days):** The maximum lifetime for an access token in seconds. This value will be referenced at renewal time.
+- **Access Token Max Number of Uses (default is `0`):** The maximum number of times that an access token can be used; a value of `0` implies an infinite number of uses.
+- **Access Token Trusted IPs:** The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address.
+
+### Adding an identity to a project
+
+In order to allow an identity to access project-level resources such as secrets, you must add it to the relevant projects.
+
+To do this, head over to the project you want to add the identity to and navigate to Project Settings > Access Control > Machine Identities and press **Add Identity**.
+
+![identities project](/images/platform/identities/identities-project.png)
+
+Select the identity you want to add to the project and the project-level role you want it to assume. The project role given to the identity will determine what project-level resources this identity can access.
+
+![identities project create](/images/platform/identities/identities-project-create.png)
+
+### Accessing the Infisical API with the identity
+
+To access the Infisical API as the identity, you need to construct a signed [Get User](https://docs.oracle.com/en/engineered-systems/private-cloud-appliance/3.0-latest/ceapi/op-20160918-users-user_id-get.html) request using [OCI Signature v1](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/signingrequests.htm#Request_Signatures) and then make a request to the `/api/v1/auth/oci-auth/login` endpoint passing the signed header data and user OCID.
+
+Below is an example of how you can authenticate with Infisical using the `oci-sdk` for NodeJS.
+
+```typescript
+import { common } from "oci-sdk";
+
+// Change these credentials to match your OCI user
+const tenancyId = "ocid1.tenancy.oc1..example";
+const userId = "ocid1.user.oc1..example";
+const fingerprint = "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00";
+const region = "us-ashburn-1";
+const privateKey = "..."; // Must be PEM format
+
+const provider = new common.SimpleAuthenticationDetailsProvider(
+ tenancyId,
+ userId,
+ fingerprint,
+ privateKey,
+ null,
+ common.Region.fromRegionId(region),
+);
+
+// Build request
+const headers = new Headers({
+ host: `identity.${region}.oraclecloud.com`,
+});
+
+const request: common.HttpRequest = {
+ method: "GET",
+ uri: `/20160918/users/${userId}`,
+ headers,
+ body: null,
+};
+
+// Sign request
+const signer = new common.DefaultRequestSigner(provider);
+await signer.signHttpRequest(request);
+
+// Forward signed request to Infisical
+const requestAsJson = {
+ identityId: "2dd11664-68e3-471d-b366-907206ab1bff",
+ userOcid: userId,
+ headers: Object.fromEntries(request.headers.entries()),
+};
+
+const res = await fetch("https://app.infisical.com/api/v1/auth/oci-auth/login", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(requestAsJson),
+});
+
+const json = await res.json();
+
+console.log("Infisical Response:", json);
+```
+
+<Note>
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation; the default TTL is `7200` seconds, which can be adjusted.
+
+ If an identity access token expires, it can no longer access the Infisical API. A new access token should be obtained by performing another login operation.
+</Note>
diff --git a/docs/documentation/platform/identities/oidc-auth/circleci.mdx b/docs/documentation/platform/identities/oidc-auth/circleci.mdx
index ddf74e3fa5..bb5999f551 100644
--- a/docs/documentation/platform/identities/oidc-auth/circleci.mdx
+++ b/docs/documentation/platform/identities/oidc-auth/circleci.mdx
@@ -52,7 +52,7 @@ In the following steps, we explore how to create and use identities to access th
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -163,7 +163,7 @@ In the following steps, we explore how to create and use identities to access th
}
```
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
diff --git a/docs/documentation/platform/identities/oidc-auth/general.mdx b/docs/documentation/platform/identities/oidc-auth/general.mdx
index 776d175a4f..f847f51fea 100644
--- a/docs/documentation/platform/identities/oidc-auth/general.mdx
+++ b/docs/documentation/platform/identities/oidc-auth/general.mdx
@@ -56,7 +56,7 @@ In the following steps, we explore how to create and use identities to access th
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -159,7 +159,7 @@ In the following steps, we explore how to create and use identities to access th
</Tip>
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
diff --git a/docs/documentation/platform/identities/oidc-auth/github.mdx b/docs/documentation/platform/identities/oidc-auth/github.mdx
index 47352a3392..567f38d057 100644
--- a/docs/documentation/platform/identities/oidc-auth/github.mdx
+++ b/docs/documentation/platform/identities/oidc-auth/github.mdx
@@ -55,7 +55,7 @@ In the following steps, we explore how to create and use identities to access th
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -159,7 +159,7 @@ In the following steps, we explore how to create and use identities to access th
</Tip>
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
diff --git a/docs/documentation/platform/identities/oidc-auth/gitlab.mdx b/docs/documentation/platform/identities/oidc-auth/gitlab.mdx
index 228392aa6c..b52d2f8949 100644
--- a/docs/documentation/platform/identities/oidc-auth/gitlab.mdx
+++ b/docs/documentation/platform/identities/oidc-auth/gitlab.mdx
@@ -55,7 +55,7 @@ In the following steps, we explore how to create and use identities to access th
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
diff --git a/docs/documentation/platform/identities/token-auth.mdx b/docs/documentation/platform/identities/token-auth.mdx
index 59c5f9abf6..f31e865177 100644
--- a/docs/documentation/platform/identities/token-auth.mdx
+++ b/docs/documentation/platform/identities/token-auth.mdx
@@ -38,7 +38,7 @@ using the Token Auth authentication method.
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -77,9 +77,9 @@ using the Token Auth authentication method.
</Step>
<Step title="Creating a Token">
- In order to use the identity with Token Auth, you'll need to create an (access) token; you can think of this token akin
+ In order to use the identity with Token Auth, you'll need to create an (access) token; you can think of this token akin
to an API Key used to authenticate with the Infisical API. With that, press **Create Token**.
-
+
![identities client secret create](/images/platform/identities/identities-token-auth-create-1.png)
![identities client secret create](/images/platform/identities/identities-token-auth-create-2.png)
@@ -106,7 +106,7 @@ using the Token Auth authentication method.
to authenticate with the [Infisical API](/api-reference/overview/introduction).
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted in the Token Auth configuration.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
@@ -121,14 +121,14 @@ using the Token Auth authentication method.
<AccordionGroup>
<Accordion title="Why is the Infisical API rejecting my access token?">
There are a few reasons for why this might happen:
-
+
- The access token has expired. If this is the case, you should obtain a new access token or consider extending the token's TTL.
- - The identity is insufficently permissioned to interact with the resources you wish to access.
+ - The identity is insufficiently permissioned to interact with the resources you wish to access.
- The access token is being used from an untrusted IP.
</Accordion>
<Accordion title="What is access token renewal and TTL/Max TTL?">
A identity access token can have a time-to-live (TTL) or incremental lifetime after which it expires.
-
+
In certain cases, you may want to extend the lifespan of an access token; to do so, you must set a max TTL parameter.
A token can be renewed any number of times where each call to renew it can extend the token's lifetime by increments of the access token's TTL.
diff --git a/docs/documentation/platform/identities/universal-auth.mdx b/docs/documentation/platform/identities/universal-auth.mdx
index 4d66e30b49..44f468a178 100644
--- a/docs/documentation/platform/identities/universal-auth.mdx
+++ b/docs/documentation/platform/identities/universal-auth.mdx
@@ -42,7 +42,7 @@ using the Universal Auth authentication method.
<Steps>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -84,15 +84,15 @@ using the Universal Auth authentication method.
<Step title="Creating a Client Secret">
In order to use the identity, you'll need the non-sensitive **Client ID**
of the identity and a **Client Secret** for it; you can think of these credentials akin to a username
- and password used to authenticate with the Infisical API.
+ and password used to authenticate with the Infisical API.
With that, press **Create Client Secret**.
-
+
![identities client secret create](/images/platform/identities/identities-universal-auth-create-1.png)
![identities client secret create](/images/platform/identities/identities-universal-auth-create-2.png)
![identities client secret create](/images/platform/identities/identities-universal-auth-create-3.png)
-
+
Feel free to input any (optional) details for the **Client Secret** configuration:
-
+
- Description: A description for the **Client Secret**.
- TTL (default is `0`): The time-to-live for the **Client Secret**. By default, the TTL will be set to 0 which implies that the **Client Secret** will never expire; a value of `0` implies an infinite lifetime.
- Max Number of Uses (default is `0`): The maximum number of times that the **Client Secret** can be used together with the **Client ID** to get back an access token; a value of `0` implies infinite number of uses.
@@ -113,10 +113,10 @@ using the Universal Auth authentication method.
To access the Infisical API as the identity, you should first perform a login operation
that is to exchange the **Client ID** and **Client Secret** of the identity for an access token
by making a request to the `/api/v1/auth/universal-auth/login` endpoint.
-
+
<Tip>
Choose the correct base URL based on your region:
-
+
- For Infisical Cloud US users: `https://app.infisical.com`
- For Infisical Cloud EU users: `https://eu.infisical.com`
</Tip>
@@ -144,7 +144,7 @@ using the Universal Auth authentication method.
Next, you can use the access token to authenticate with the [Infisical API](/api-reference/overview/introduction)
<Note>
- Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation;
+ Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation;
the default TTL is `7200` seconds which can be adjusted in the Universal Auth configuration.
If an identity access token expires, it can no longer authenticate with the Infisical API. In this case,
@@ -159,14 +159,14 @@ using the Universal Auth authentication method.
<AccordionGroup>
<Accordion title="Why is the Infisical API rejecting my identity credentials?">
There are a few reasons for why this might happen:
-
+
- The client secret or access token has expired.
- - The identity is insufficently permissioned to interact with the resources you wish to access.
+ - The identity is insufficiently permissioned to interact with the resources you wish to access.
- The client secret/access token is being used from an untrusted IP.
</Accordion>
<Accordion title="What is access token renewal and TTL/Max TTL?">
A identity access token can have a time-to-live (TTL) or incremental lifetime after which it expires.
-
+
In certain cases, you may want to extend the lifespan of an access token; to do so, you must set a max TTL parameter.
A token can be renewed any number of times where each call to renew it can extend the token's lifetime by increments of the access token's TTL.
diff --git a/docs/documentation/platform/kms/hsm-integration.mdx b/docs/documentation/platform/kms/hsm-integration.mdx
index a9ab2c8321..33a28305f4 100644
--- a/docs/documentation/platform/kms/hsm-integration.mdx
+++ b/docs/documentation/platform/kms/hsm-integration.mdx
@@ -38,7 +38,7 @@ Enabling HSM encryption has a set of key benefits:
### Requirements
- An Infisical instance with a version number that is equal to or greater than `v0.91.0`.
- If you are using Docker, your instance must be using the `infisical/infisical-fips` image.
-- An HSM device from a provider such as [Thales Luna HSM](https://cpl.thalesgroup.com/encryption/data-protection-on-demand/services/luna-cloud-hsm), [AWS CloudHSM](https://aws.amazon.com/cloudhsm/), or others.
+- An HSM device from a provider such as [Thales Luna HSM](https://cpl.thalesgroup.com/encryption/data-protection-on-demand/services/luna-cloud-hsm), [AWS CloudHSM](https://aws.amazon.com/cloudhsm/), [Fortanix HSM](https://www.fortanix.com/platform/data-security-manager), or others.
### FIPS Compliance
@@ -53,14 +53,14 @@ For organizations that work with US government agencies, FIPS compliance is almo
<Steps>
<Step title="Setting up an HSM Device">
- To set up HSM encryption, you need to configure an HSM provider and HSM key. The HSM provider is used to connect to the HSM device, and the HSM key is used to encrypt Infisical's KMS keys. We recommend using a Cloud HSM provider such as [Thales Luna HSM](https://cpl.thalesgroup.com/encryption/data-protection-on-demand/services/luna-cloud-hsm) or [AWS CloudHSM](https://aws.amazon.com/cloudhsm/).
+ To set up HSM encryption, you need to configure an HSM provider and HSM key. The HSM provider is used to connect to the HSM device, and the HSM key is used to encrypt Infisical's KMS keys. We recommend using a Cloud HSM provider such as [Thales Luna HSM](https://cpl.thalesgroup.com/encryption/data-protection-on-demand/services/luna-cloud-hsm), [AWS CloudHSM](https://aws.amazon.com/cloudhsm/), or [Fortanix HSM](https://www.fortanix.com/platform/data-security-manager).
You need to follow the instructions provided by the HSM provider to set up the HSM device. Once the HSM device is set up, the HSM device can be used within Infisical.
After setting up the HSM from your provider, you will have a set of files that you can use to access the HSM. These files need to be present on the machine where Infisical is running.
If you are using containers, you will need to mount the folder where these files are stored as a volume in the container.
- The setup process for an HSM device varies depending on the provider. We have created a guide for Thales Luna Cloud HSM, which you can find below.
+ The setup process for an HSM device varies depending on the provider. We have created guides for Thales Luna Cloud HSM and Fortanix HSM, which you can find below.
</Step>
<Step title="Configure HSM on Infisical">
@@ -255,6 +255,78 @@ For organizations that work with US government agencies, FIPS compliance is almo
</Steps>
After following these steps, your Docker setup will be ready to use HSM encryption.
</Tab>
+ <Tab title="Fortanix HSM">
+ <Steps>
+ <Step title="Set up Fortanix HSM">
+ To use Fortanix HSM with Infisical, you need to:
+
+ 1. Create an App in Fortanix:
+ - Set Interface value to be PKCS#11
+ - Select API key as authentication method
+ - Assign app to a group
+
+ ![Fortanix HSM Setup](/images/platform/kms/hsm/fortanix-hsm-setup.png)
+
+ 2. Take note of the domain (e.g., apac.smartkey.io). You will need this to set up the configuration file for the Fortanix client.
+ </Step>
+
+ <Step title="Install PKCS11 Library">
+ The easiest approach would be to download the `.so` file for Linux directly from the [Fortanix PKCS#11 installation page](https://fortanix.zendesk.com/hc/en-us/sections/4408769080724-PKCS-11).
+
+ Create a configuration file named `pkcs11.conf` with the following content:
+
+ ```
+ api_endpoint = "https://apac.smartkey.io"
+ prevent_duplicate_opaque_objects = true
+ retry_timeout_millis = 60000
+ ```
+
+ Note: Replace `apac.smartkey.io` with your actual Fortanix domain if different. For more details about the configuration file format and additional options, refer to the [Fortanix PKCS#11 Configuration File Documentation](https://support.fortanix.com/docs/clients-pkcs11-library#511-configuration-file-format).
+ </Step>
+
+ <Step title="Create a directory for Fortanix files">
+ Create a directory to store the Fortanix library and configuration file:
+
+ ```bash
+ mkdir -p /etc/fortanix-hsm
+ ```
+
+ Copy the downloaded `.so` file and the `pkcs11.conf` file to this directory:
+
+ ```bash
+ cp /path/to/fortanix_pkcs11_4.37.2554.so /etc/fortanix-hsm/
+ cp /path/to/pkcs11.conf /etc/fortanix-hsm/
+ ```
+ </Step>
+
+ <Step title="Run Docker">
+ Run Docker with Fortanix HSM by mounting the directory and setting the required environment variables:
+
+ ```bash
+ docker run -p 80:8080 \
+ -v /etc/fortanix-hsm:/etc/fortanix-hsm \
+ -e HSM_LIB_PATH="/etc/fortanix-hsm/fortanix_pkcs11_4.37.2554.so" \ # Path to the PKCS#11 library
+ -e HSM_PIN="MDE3YWUxO..." \ # Your Fortanix app API key used for authentication
+ -e HSM_SLOT=0 \ # Slot value (arbitrary for Fortanix HSM)
+ -e HSM_KEY_LABEL="hsm-key-label" \ # Label to identify the encryption key in the HSM
+ -e FORTANIX_PKCS11_CONFIG_PATH="/etc/fortanix-hsm/pkcs11.conf" \ # Path to Fortanix configuration file
+
+ # The rest are unrelated to HSM setup...
+ -e ENCRYPTION_KEY="<>" \
+ -e AUTH_SECRET="<>" \
+ -e DB_CONNECTION_URI="<>" \
+ -e REDIS_URL="<>" \
+ -e SITE_URL="<>" \
+ infisical/infisical-fips:<version> # Replace <version> with the version you want to use
+ ```
+
+ <Warning>
+ Note: Fortanix HSM integration only works for AMD64 CPU architectures.
+ </Warning>
+ </Step>
+ </Steps>
+ After following these steps, your Docker setup will be ready to use Fortanix HSM encryption.
+ </Tab>
</Tabs>
</Tab>
<Tab title="Kubernetes">
@@ -569,6 +641,173 @@ For organizations that work with US government agencies, FIPS compliance is almo
</Steps>
After following these steps, your Kubernetes setup will be ready to use HSM encryption.
</Tab>
+ <Tab title="Fortanix HSM">
+ <Steps>
+ <Step title="Set up Fortanix HSM">
+ First, you need to set up Fortanix HSM by:
+
+ 1. Creating an App in Fortanix:
+ - Set Interface value to be PKCS#11
+ - Select API key as authentication method
+ - Assign app to a group
+
+ ![Fortanix HSM Setup](/images/platform/kms/hsm/fortanix-hsm-setup.png)
+
+ 2. Take note of the domain (e.g., apac.smartkey.io). You will need this when setting up the configuration file.
+ </Step>
+
+ <Step title="Create configuration files">
+ Create a directory to store the Fortanix configuration files:
+
+ ```bash
+ mkdir -p /etc/fortanix-hsm
+ ```
+
+ Download the Fortanix PKCS#11 library for Linux from the [Fortanix PKCS#11 installation page](https://fortanix.zendesk.com/hc/en-us/sections/4408769080724-PKCS-11).
+
+ Create a configuration file named `pkcs11.conf` with the following content:
+
+ ```
+ api_endpoint = "https://apac.smartkey.io"
+ prevent_duplicate_opaque_objects = true
+ retry_timeout_millis = 60000
+ ```
+
+ Note: Replace `apac.smartkey.io` with your actual Fortanix domain if different.
+ </Step>
+
+ <Step title="Creating a Persistent Volume Claim (PVC)">
+ Create a Persistent Volume Claim to store the Fortanix files:
+
+ ```bash
+ kubectl apply -f - <<EOF
+ apiVersion: v1
+ kind: PersistentVolumeClaim
+ metadata:
+ name: fortanix-hsm-pvc
+ spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 100Mi
+ EOF
+ ```
+
+ Create a temporary pod to upload the files:
+
+ ```bash
+ kubectl apply -f - <<EOF
+ apiVersion: v1
+ kind: Pod
+ metadata:
+ name: fortanix-setup-pod
+ spec:
+ containers:
+ - name: setup
+ image: busybox
+ command: ["/bin/sh", "-c", "sleep 3600"]
+ volumeMounts:
+ - name: fortanix-data
+ mountPath: /data
+ volumes:
+ - name: fortanix-data
+ persistentVolumeClaim:
+ claimName: fortanix-hsm-pvc
+ EOF
+ ```
+
+ Ensure the pod is running:
+
+ ```bash
+ kubectl wait --for=condition=Ready pod/fortanix-setup-pod --timeout=60s
+ ```
+
+ Copy the Fortanix files to the PVC:
+
+ ```bash
+ kubectl exec fortanix-setup-pod -- mkdir -p /data/
+ kubectl cp /etc/fortanix-hsm/fortanix_pkcs11_4.37.2554.so fortanix-setup-pod:/data/
+ kubectl cp /etc/fortanix-hsm/pkcs11.conf fortanix-setup-pod:/data/
+ kubectl exec fortanix-setup-pod -- chmod -R 755 /data/
+ ```
+
+ Delete the temporary pod:
+
+ ```bash
+ kubectl delete pod fortanix-setup-pod
+ ```
+ </Step>
+
+ <Step title="Update the Kubernetes Secret">
+ Update your Kubernetes secret with the Fortanix HSM environment variables:
+
+ ```yaml
+ apiVersion: v1
+ kind: Secret
+ metadata:
+ name: infisical-secrets
+ type: Opaque
+ stringData:
+ # ... Other environment variables ...
+ HSM_LIB_PATH: "/etc/fortanix-hsm/fortanix_pkcs11_4.37.2554.so" # Path to the PKCS#11 library in the container
+ HSM_PIN: "<your-fortanix-api-key>" # Your Fortanix app API key used for authentication
+ HSM_SLOT: "0" # Slot value (can be set to 0 for Fortanix HSM as it's arbitrary)
+ HSM_KEY_LABEL: "hsm-key-label" # Label to identify the encryption key in the HSM
+ FORTANIX_PKCS11_CONFIG_PATH: "/etc/fortanix-hsm/pkcs11.conf" # Path to Fortanix configuration file
+ ```
+
+ Apply the updated secret:
+
+ ```bash
+ kubectl apply -f ./secret-file-name.yaml
+ ```
+ </Step>
+
+ <Step title="Update Helm Values">
+ Update your Helm values to use the FIPS-compliant image and mount the Fortanix HSM files:
+
+ ```yaml
+ # ... The rest of the values.yaml file ...
+
+ image:
+ repository: infisical/infisical-fips # Must use "infisical/infisical-fips"
+ tag: "v0.117.1-postgres"
+ pullPolicy: IfNotPresent
+
+ extraVolumeMounts:
+ - name: fortanix-data
+ mountPath: /etc/fortanix-hsm # The path where Fortanix files will be available
+
+ extraVolumes:
+ - name: fortanix-data
+ persistentVolumeClaim:
+ claimName: fortanix-hsm-pvc
+
+ # ... The rest of the values.yaml file ...
+ ```
+
+ <Warning>
+ Note: Fortanix HSM integration only works for AMD64 CPU architectures.
+ </Warning>
+ </Step>
+
+ <Step title="Upgrade and Restart">
+ Upgrade the Helm chart with the new values:
+
+ ```bash
+ helm upgrade --install infisical infisical-helm-charts/infisical-standalone --values /path/to/values.yaml
+ ```
+
+ Restart the deployment:
+
+ ```bash
+ kubectl rollout restart deployment/infisical-infisical
+ ```
+ </Step>
+ </Steps>
+ After following these steps, your Kubernetes setup will be ready to use Fortanix HSM encryption.
+ </Tab>
</Tabs>
</Tab>
</Tabs>
diff --git a/docs/documentation/platform/ldap/general.mdx b/docs/documentation/platform/ldap/general.mdx
index 939eaa7270..c1d062ef59 100644
--- a/docs/documentation/platform/ldap/general.mdx
+++ b/docs/documentation/platform/ldap/general.mdx
@@ -18,7 +18,9 @@ Prerequisites:
<Steps>
<Step title="Prepare the LDAP configuration in Infisical">
- In Infisical, head to your Organization Settings > Security > LDAP and select **Manage**.
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Select **Connect** for **LDAP**.
+
+ ![LDAP SSO Connect](../../../images/sso/connect-ldap.png)
Next, input your LDAP server settings.
diff --git a/docs/documentation/platform/ldap/jumpcloud.mdx b/docs/documentation/platform/ldap/jumpcloud.mdx
index 39579b7850..d520598d18 100644
--- a/docs/documentation/platform/ldap/jumpcloud.mdx
+++ b/docs/documentation/platform/ldap/jumpcloud.mdx
@@ -27,7 +27,9 @@ Prerequisites:
![LDAP JumpCloud](/images/platform/ldap/jumpcloud/ldap-jumpcloud-enable-bind-dn.png)
</Step>
<Step title="Prepare the LDAP configuration in Infisical">
- In Infisical, head to your Organization Settings > Security > LDAP and select **Manage**.
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Select **Connect** for **LDAP**.
+
+ ![LDAP SSO Connect](../../../images/sso/connect-ldap.png)
Next, input your JumpCloud LDAP server settings.
diff --git a/docs/documentation/platform/organization.mdx b/docs/documentation/platform/organization.mdx
index 3a53484fb8..6c3b218aba 100644
--- a/docs/documentation/platform/organization.mdx
+++ b/docs/documentation/platform/organization.mdx
@@ -20,6 +20,7 @@ The **Settings** page lets you manage information about your organization includ
- **Slug**: The slug of your organization.
- **Default Organization Member Role**: The role assigned to users when joining your organization unless otherwise specified.
- **Incident Contacts**: Emails that should be alerted if anything abnormal is detected within the organization.
+- **Enabled Products**: Products which are enabled for your organization. This setting strictly affects the sidebar UI; disabling a product does not disable its API or routes.
![organization settings general](../../images/platform/organization/organization-settings-general.png)
@@ -43,7 +44,7 @@ In the **Organization Roles** tab, you can edit current or create new custom rol
<Info>
Note that Role-Based Access Management (RBAC) is partly a paid feature.
-
+
Infisical provides immutable roles like `admin`, `member`, etc.
at the organization and project level for free.
diff --git a/docs/documentation/platform/pki/certificates.mdx b/docs/documentation/platform/pki/certificates.mdx
index 4976b5e184..f1c434e9cf 100644
--- a/docs/documentation/platform/pki/certificates.mdx
+++ b/docs/documentation/platform/pki/certificates.mdx
@@ -75,8 +75,8 @@ In the following steps, we explore how to issue a X.509 certificate under a CA.
Here's some guidance on each field:
- Friendly Name: A friendly name for the certificate; this is only for display and defaults to the common name of the certificate if left empty.
- - Common Name (CN): The (common) name for the certificate like `service.acme.com`.
- - Alternative Names (SANs): A comma-delimited list of Subject Alternative Names (SANs) for the certificate; these can be host names or email addresses like `app1.acme.com, app2.acme.com`.
+ - Common Name (CN): The common name for the certificate like `service.acme.com`.
+ - Alternative Names (SANs): A comma-delimited list of Subject Alternative Names (SANs) for the certificate; these can be hostnames or email addresses like `app1.acme.com, app2.acme.com`.
- TTL: The lifetime of the certificate in seconds.
- Key Usage: The key usage extension of the certificate.
- Extended Key Usage: The extended key usage extension of the certificate.
@@ -240,7 +240,7 @@ openssl verify -crl_check -CAfile chain.pem -CRLfile crl.pem cert.pem
```
Note that you can also obtain the CRL from the certificate itself by
-referencing the CRL distribution point extension on the certificate itself.
+referencing the CRL distribution point extension on the certificate.
To check a certificate against the CRL distribution point specified within it with OpenSSL, you can use the following command:
diff --git a/docs/documentation/platform/pki/overview.mdx b/docs/documentation/platform/pki/overview.mdx
index 259f15a5d6..8ee9b113da 100644
--- a/docs/documentation/platform/pki/overview.mdx
+++ b/docs/documentation/platform/pki/overview.mdx
@@ -4,9 +4,10 @@ sidebarTitle: "Overview"
description: "Learn how to create a Private CA hierarchy and issue X.509 certificates."
---
-Infisical can be used to create a Private Certificate Authority (CA) hierarchy and issue X.509 certificates for internal use. This allows you to manage your own PKI infrastructure and issue digital certificates for services, applications, and devices.
+Infisical can be used to create a Private Certificate Authority (CA) hierarchy and issue X.509 certificates for internal use. This allows you to manage your own PKI infrastructure and issue digital certificates for subscribers such as services, applications, and devices.
-Infisical's internal PKI offering is split into two modules:
+Infisical's PKI offering is split into three components:
-- [Private CA](/documentation/platform/pki/private-ca): Infisical lets you create private CAs, including root and intermediary CAs.
-- [Certificates](/documentation/platform/pki/certificates): Infisical allows you to issue X.509 certificates using the private CAs you create.
+- [Certificate Authorities](/documentation/platform/pki/private-ca): Create and manage private CAs, including root and intermediate CAs.
+- [Subscribers](/documentation/platform/pki/subscribers): Define and manage entities that will request X.509 certificates from CAs. This module provides a centralized view of all subscribers, enabling you to issue certificates and monitor their status.
+- [Certificates](/documentation/platform/pki/certificates): Track and monitor issued X.509 certificates, maintaining a comprehensive inventory of all active and expired certificates.
diff --git a/docs/documentation/platform/pki/private-ca.mdx b/docs/documentation/platform/pki/private-ca.mdx
index d7f3f896c4..7d7ee12202 100644
--- a/docs/documentation/platform/pki/private-ca.mdx
+++ b/docs/documentation/platform/pki/private-ca.mdx
@@ -7,7 +7,7 @@ description: "Learn how to create a Private CA hierarchy with Infisical."
## Concept
The first step to creating your Internal PKI is to create a Private Certificate Authority (CA) hierarchy that is a structure of entities
-used to issue digital certificates for services, applications, and devices.
+used to issue digital certificates for your [subscribers](/documentation/platform/pki/subscribers).
<div align="center">
@@ -24,7 +24,7 @@ graph TD
A typical workflow for setting up a Private CA hierarchy consists of the following steps:
-1. Configuring an Infisical root CA with details like name, validity period, and path length — This step is optional if you wish to use an external root CA.
+1. Configuring an Infisical root CA with details like name, validity period, and path length — This step is optional if you wish to use an external root CA with Infisical only serving the intermediate CAs.
2. Configuring and chaining intermediate CA(s) with details like name, validity period, path length, and imported certificate to your Root CA.
3. Managing the CA lifecycle events such as CA succession.
@@ -99,7 +99,7 @@ consisting of an (optional) root CA and an intermediate CA.
![pki cas](/images/platform/pki/ca/cas.png)
Great! You've successfully created a Private CA hierarchy with a root CA and an intermediate CA.
- Now check out the [Certificates](/documentation/platform/pki/certificates) page to learn more about how to issue X.509 certificates using the intermediate CA.
+ Now check out the [Subscribers](/documentation/platform/pki/subscribers) page to learn more about how to issue X.509 certificates using the intermediate CA.
2.3b. If you have an external root CA, select **External CA** for the **Parent CA Type** field.
@@ -110,7 +110,7 @@ consisting of an (optional) root CA and an intermediate CA.
Finally, press **Install** to import the certificate and certificate chain as part of the installation step for the intermediate CA
Great! You've successfully created a Private CA hierarchy with an intermediate CA chained to an external root CA.
- Now check out the [Certificates](/documentation/platform/pki/certificates) page to learn more about how to issue X.509 certificates using the intermediate CA.
+ Now check out the [Subscribers](/documentation/platform/pki/subscribers) page to learn more about how to issue X.509 certificates using the intermediate CA.
</Step>
</Steps>
@@ -255,7 +255,7 @@ consisting of an (optional) root CA and an intermediate CA.
}
```
- Great! You’ve successfully created a Private CA hierarchy with a root CA and an intermediate CA. Now check out the Certificates page to learn more about how to issue X.509 certificates using the intermediate CA.
+ Great! You’ve successfully created a Private CA hierarchy with a root CA and an intermediate CA. Now check out the [Subscribers](/documentation/platform/pki/subscribers) page to learn more about how to issue X.509 certificates using the intermediate CA.
</Step>
</Steps>
diff --git a/docs/documentation/platform/pki/subscribers.mdx b/docs/documentation/platform/pki/subscribers.mdx
new file mode 100644
index 0000000000..3aebe50e28
--- /dev/null
+++ b/docs/documentation/platform/pki/subscribers.mdx
@@ -0,0 +1,130 @@
+---
+title: "Subscribers"
+sidebarTitle: "Subscribers"
+description: "Learn how to manage PKI subscribers and issue X.509 certificates for them."
+---
+
+## Concept
+
+In Infisical PKI, subscribers are logical representations of entities such as devices, servers, applications that request and receive certificates from Certificate Authorities (CAs).
+
+<div align="center">
+
+```mermaid
+graph TD
+A[Issuing CA] --> C1[Certificate]
+ C1 --> S1[Subscriber]
+ A --> C2[Certificate]
+ C2 --> S2[Subscriber]
+```
+
+</div>
+
+## Workflow
+
+The typical workflow for managing subscribers consists of the following steps:
+
+1. Creating a subscriber and defining which (issuing) CA will issue X.509 certificates for it as well as attributes to be included on the certificates including common name, subject alternative names, TLL, etc.
+2. Requesting for a certificate against the subscriber with or without a certificate signing request (CSR).
+3. Managing certificate lifecycle events such as certificate renewal and revocation. As part of the certificate revocation flow,
+ you can also query for a Certificate Revocation List [CRL](https://en.wikipedia.org/wiki/Certificate_revocation_list), a time-stamped, signed
+ data structure issued by a CA containing a list of revoked certificates to check if a certificate has been revoked.
+
+<Note>
+ Note that this workflow can be executed via the Infisical UI or manually such
+ as via API.
+</Note>
+
+## Guide to Issuing Certificates with Subscribers
+
+In the following steps, we explore how to issue a X.509 certificate for a subscriber.
+
+<Steps>
+ <Step title="Creating a subscriber">
+ A subscriber is the logical representation of an entity that requests and
+ receives certificates from a CA. With a subscriber, you can specify the
+ attributes that must be present on the X.509 certificates issued for it.
+
+ Head to your Infisical PKI Project > Subscribers to create a subscriber.
+
+ ![pki create subscriber](/images/platform/pki/subscriber/subscriber-create.png)
+
+ ![pki create subscriber 2](/images/platform/pki/subscriber/subscriber-create-2.png)
+
+ Here's some guidance on each field.
+
+ - Subscriber Name: A slug-friendly name for the subscriber such as `web-service`.
+ - Issuing CA: The Certificate Authority (CA) that will issue X.509 certificates for the subscriber.
+ - Common Name (CN): The common name to be included on certificates to be issued to the subscriber.
+ - Subject Alternative Names (SANs): A comma-delimited list of Subject Alternative Names (SANs) to be included on certificates; these can be hostnames or email addresses like `app1.acme.com, app2.acme.com`.
+ - TTL: The lifetime of the certificate.
+ - Key Usage: The key usage extension of the certificate.
+ - Extended Key Usage: The extended key usage extension of the certificate.
+
+ <Note>
+ It's possible to issue certificates for a subscriber with or without a certificate signing request (CSR).
+ - If requesting without a CSR, the attributes specified on the subscriber will be used to issue a certificate for the subscriber.
+ - If requesting with a CSR, the attributes on it will be validated against the attributes specified on the subscriber
+ and a certificate is only issued if they comply.
+ </Note>
+
+ </Step>
+ <Step title="Requesting a certificate">
+ Once you have created a subscriber from step 1, you can issue a certificate for it.
+
+ Press on the subscriber you want to issue a certificate for and click on the **Issue Certificate** button on that subscriber's page.
+
+ ![pki issue subscriber certificate](/images/platform/pki/subscriber/subscriber-issue-cert.png)
+
+ ![pki issue subscriber certificate 2](/images/platform/pki/subscriber/subscriber-issue-cert-2.png)
+
+ </Step>
+</Steps>
+
+## Guide to Revoking Certificates
+
+In the following steps, we explore how to revoke a X.509 certificate and obtain a Certificate Revocation List (CRL) for a CA.
+
+<Steps>
+ <Step title="Revoking a Certificate">
+ Assuming that you've issued a certificate for a subscriber, you can revoke it by
+ selecting the **Revoke Certificate** option on the certificate you wish to revoke
+ on the subscriber's page.
+
+ ![pki revoke subscriber certificate](/images/platform/pki/subscriber/subscriber-revoke-cert.png)
+
+ </Step>
+ <Step title="Obtaining a CRL">
+ In order to check the revocation status of a certificate, you can check it
+ against the CRL of a CA by heading to its Issuing CA and downloading the CRL.
+
+ ![pki view crl](/images/platform/pki/subscriber/subscriber-ca-crl.png)
+
+ To verify a certificate against the
+ downloaded CRL with OpenSSL, you can use the following command:
+
+```bash
+openssl verify -crl_check -CAfile chain.pem -CRLfile crl.pem cert.pem
+```
+
+Note that you can also obtain the CRL from the certificate itself by
+referencing the CRL distribution point extension on the certificate.
+
+To check a certificate against the CRL distribution point specified within it with OpenSSL, you can use the following command:
+
+```bash
+openssl verify -verbose -crl_check -crl_download -CAfile chain.pem cert.pem
+```
+
+ </Step>
+</Steps>
+
+## FAQ
+
+<AccordionGroup>
+ <Accordion title="What is the workflow for renewing a certificate?">
+ To renew a certificate, you have to issue a new certificate for the same
+ subscriber. The original certificate will continue to be valid through its
+ original TTL unless explicitly revoked.
+ </Accordion>
+</AccordionGroup>
diff --git a/docs/documentation/platform/pr-workflows.mdx b/docs/documentation/platform/pr-workflows.mdx
index 187bae5d48..ffa85f6c59 100644
--- a/docs/documentation/platform/pr-workflows.mdx
+++ b/docs/documentation/platform/pr-workflows.mdx
@@ -5,23 +5,23 @@ description: "Learn how to enable a set of policies to manage changes to sensiti
<Info>
Approval Workflows is a paid feature.
-
- If you're using Infisical Cloud, then it is available under the **Pro Tier** and **Enterprise Tire**.
+
+ If you're using Infisical Cloud, then it is available under the **Pro Tier** and **Enterprise Tier**.
If you're self-hosting Infisical, then you should contact [email protected] to purchase an enterprise license to use it.
</Info>
## Problem at hand
-Updating secrets in high-stakes environments (e.g., production) can have a number of problematic issues:
-- Most developers should not have access to secrets in production environments. Yet, they are the ones who often need to add new secrets or change the existing ones. Many organizations have in-house policies with regards to what person should be contacted in the case of needing to make changes to secrets. This slows down software development lifecycle and distracts engineers from working on things that matter the most.
-- As a general rule, before making changes in production environments, those changes have to be looked over by at least another person. An extra pair of eyes can help reduce the risk of human error and make sure that the change will not affect the application in an unintended way.
-- After making updates to secrets, the corresponding applications need to be redeployed with the right set of secrets and configurations. This process is often not automated and hence prone to human error.
+Updating secrets in high-stakes environments (e.g., production) can have a number of problematic issues:
+- Most developers should not have access to secrets in production environments. Yet, they are the ones who often need to add new secrets or change the existing ones. Many organizations have in-house policies with regards to what person should be contacted in the case of needing to make changes to secrets. This slows down software development lifecycle and distracts engineers from working on things that matter the most.
+- As a general rule, before making changes in production environments, those changes have to be looked over by at least another person. An extra pair of eyes can help reduce the risk of human error and make sure that the change will not affect the application in an unintended way.
+- After making updates to secrets, the corresponding applications need to be redeployed with the right set of secrets and configurations. This process is often not automated and hence prone to human error.
## Solution
-As a wide-spread software engineering practice, developers have to submit their code as a PR that needs to be approved before the code is merged into the main branch.
+As a wide-spread software engineering practice, developers have to submit their code as a PR that needs to be approved before the code is merged into the main branch.
-In a similar way, to solve the above-mentioned issues, Infisical provides a feature called `Approval Workflows` for secret management. This is a set of policies and workflows that help advance access controls, compliance procedures, and stability of a particular environment. In other words, **Approval Workflows** help you secure, stabilize, and streamline the change of secrets in high-stakes environments.
+In a similar way, to solve the above-mentioned issues, Infisical provides a feature called `Approval Workflows` for secret management. This is a set of policies and workflows that help advance access controls, compliance procedures, and stability of a particular environment. In other words, **Approval Workflows** help you secure, stabilize, and streamline the change of secrets in high-stakes environments.
### Setting a policy
@@ -33,6 +33,10 @@ First, you would need to create a set of policies for a certain environment. In
The enforcement level determines how strict the policy is. A **Hard** enforcement level means that any change that matches the policy will need full approval prior merging. A **Soft** enforcement level allows for break glass functionality on the request. If a change request is bypassed, the approvers will be notified via email.
+### Self approvals
+
+If the **Self Approvals** option is enabled, users who are designated as approvers on the policy can approve requests that they themselves have submitted.
+
### Example of creating a change policy
When creating a policy, you can choose the type of policy you want to create. In this case, we will be creating a `Change Policy`. Other types of policies include `Access Policy` that creates policies for **[Access Requests](/documentation/platform/access-controls/access-requests)**.
@@ -41,10 +45,18 @@ When creating a policy, you can choose the type of policy you want to create. In
### Example of updating secrets with Approval workflows
-When a user submits a change to an enviropnment that is under a particular policy, a corresponsing change request will go to a predefined approver (or multiple approvers).
+When a user submits a change to an environment that is under a particular policy, a corresponding change request will go to a predefined approver (or multiple approvers).
![secret update change requests](../../images/platform/pr-workflows/secret-update-request.png)
Approvers are notified by email and/or Slack as soon as the request is initiated. In the Infisical Dashboard, they will be able to `approve` and `merge` (or `deny`) a request for a change in a particular environment. After that, depending on the workflows setup, the change will be automatically propagated to the right applications (e.g., using [Infisical Kubernetes Operator](https://infisical.com/docs/integrations/platforms/kubernetes)).
![secrets update pull request](../../images/platform/pr-workflows/secret-update-pr.png)
+
+## FAQ
+
+<AccordionGroup>
+ <Accordion title="Is it possible to disable self-approval for policies?">
+ Yes, if you'd like to require an approval from an approver other than the one who created the request, then you can disable the **Self Approvals** feature inside of your target policy.
+ </Accordion>
+</AccordionGroup>
diff --git a/docs/documentation/platform/project-templates.mdx b/docs/documentation/platform/project-templates.mdx
index d84c6bdc1c..7dd5ceb502 100644
--- a/docs/documentation/platform/project-templates.mdx
+++ b/docs/documentation/platform/project-templates.mdx
@@ -33,7 +33,7 @@ In the following steps, we'll explore how to set up a project template.
<Tab title="Infisical UI">
<Steps>
<Step title="Creating a Project Template">
- Navigate to the Project Templates tab on the Organization Settings page and tap on the **Add Template** button.
+ Navigate to the **Project Templates** tab on the Feature Settings page for the project type you want to create a template for and tap on the **Add Template** button.
![project template add button](/images/platform/project-templates/project-template-add-button.png)
Specify your template details. Here's some guidance on each field:
@@ -67,6 +67,7 @@ In the following steps, we'll explore how to set up a project template.
--header 'Content-Type: application/json' \
--data '{
"name": "my-project-template",
+ "type": "secret-manager",
"description": "...",
"environments": "[...]",
"roles": "[...]",
diff --git a/docs/documentation/platform/scim/azure.mdx b/docs/documentation/platform/scim/azure.mdx
index 0e86f61493..e755f8750b 100644
--- a/docs/documentation/platform/scim/azure.mdx
+++ b/docs/documentation/platform/scim/azure.mdx
@@ -15,7 +15,7 @@ Prerequisites:
<Steps>
<Step title="Create a SCIM token in Infisical">
- In Infisical, head to your Organization Settings > Security > SCIM Configuration and
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **Provisioning** tab. Under SCIM Configuration,
press the **Enable SCIM provisioning** toggle to allow Azure to provision/deprovision users for your organization.
![SCIM enable provisioning](/images/platform/scim/scim-enable-provisioning.png)
diff --git a/docs/documentation/platform/scim/jumpcloud.mdx b/docs/documentation/platform/scim/jumpcloud.mdx
index 42d33247a2..be4caf738b 100644
--- a/docs/documentation/platform/scim/jumpcloud.mdx
+++ b/docs/documentation/platform/scim/jumpcloud.mdx
@@ -15,7 +15,7 @@ Prerequisites:
<Steps>
<Step title="Create a SCIM token in Infisical">
- In Infisical, head to your Organization Settings > Security > SCIM Configuration and
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **Provisioning** tab. Under SCIM Configuration,
press the **Enable SCIM provisioning** toggle to allow JumpCloud to provision/deprovision users and user groups for your organization.
![SCIM enable provisioning](/images/platform/scim/scim-enable-provisioning.png)
diff --git a/docs/documentation/platform/scim/okta.mdx b/docs/documentation/platform/scim/okta.mdx
index d33bd242de..cf2c177246 100644
--- a/docs/documentation/platform/scim/okta.mdx
+++ b/docs/documentation/platform/scim/okta.mdx
@@ -15,7 +15,7 @@ Prerequisites:
<Steps>
<Step title="Create a SCIM token in Infisical">
- In Infisical, head to your Organization Settings > Security > SCIM Configuration and
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **Provisioning** tab. Under SCIM Configuration,
press the **Enable SCIM provisioning** toggle to allow Okta to provision/deprovision users and user groups for your organization.
![SCIM enable provisioning](/images/platform/scim/scim-enable-provisioning.png)
diff --git a/docs/documentation/platform/secret-rotation/aws-iam-user-secret.mdx b/docs/documentation/platform/secret-rotation/aws-iam-user-secret.mdx
index 1e8eb39503..c44d06d4a9 100644
--- a/docs/documentation/platform/secret-rotation/aws-iam-user-secret.mdx
+++ b/docs/documentation/platform/secret-rotation/aws-iam-user-secret.mdx
@@ -182,10 +182,10 @@ In the following steps, we explore the end-to-end workflow for setting up this s
<AccordionGroup>
<Accordion title="Why are my AWS IAM credentials not rotating?">
- There are a few reasons for why this might happen:
+ There are a few reasons for why this might happen:
- The strategy configuration is invalid (e.g. the managing IAM user's credentials are incorrect, the target AWS region is incorrect, etc.)
- - The managing IAM user is insufficently permissioned to rotate the credentials of the target IAM user. For instance, you may have setup
+ - The managing IAM user is insufficiently permissioned to rotate the credentials of the target IAM user. For instance, you may have setup
[paths](https://aws.amazon.com/blogs/security/optimize-aws-administration-with-iam-paths/) for the managing IAM user and the policy does not have the necessary
- permissions to rotate the credentials.
+ permissions to rotate the credentials.
</Accordion>
</AccordionGroup>
diff --git a/docs/documentation/platform/secret-scanning.mdx b/docs/documentation/platform/secret-scanning.mdx
index 4f030e8820..da28bfa551 100644
--- a/docs/documentation/platform/secret-scanning.mdx
+++ b/docs/documentation/platform/secret-scanning.mdx
@@ -7,6 +7,113 @@ The Infisical Secret Scanner allows you to keep an overview and stay alert of ex
To further enhance security, we recommend you also use our [CLI Secret Scanner](/cli/scanning-overview#automatically-scan-changes-before-you-commit) to scan for exposed secrets prior to pushing your changes.
+
+<Accordion title="Self-hosting">
+
+ To setup secret scanning on your own instance of Infisical, you can follow the steps below.
+
+ <Steps>
+ <Step title="Create a GitHub App">
+ Create a new GitHub app in your GitHub organization or personal [Developer Settings](https://github.com/settings/apps).
+
+ ![Create GitHub App](/images/platform/secret-scanning/github-create-app.png)
+
+ ### Configure the GitHub App
+ To configure the GitHub app to work with Infisical, you'll need to modify the following settings:
+ - **Homepage URL**: Required to be set. Set it to the URL of your Infisical instance. (e.g. `https://app.infisical.com`)
+ - **Setup URL**: Set this to `https://<your-infisical-instance.com>/organization/secret-scanning`
+ - **Webhook URL**: Set this to `https://<your-infisical-instance.com>/api/v1/secret-scanning/webhook`
+ - **Webhook Secret**: Set this to a random string. This is used to verify the webhook request from Infisical. Use `openssl rand -base64 32` in your terminal to generate a random secret.
+
+ <Note>
+ Remember to save the webhook secret as you will need it in the next step.
+ </Note>
+
+ ![GitHub App Settings](/images/platform/secret-scanning/github-configure-app.png)
+
+ ### Configure the GitHub App Permissions
+ The GitHub app needs the following permissions:
+
+ Repository permissions:
+ - `Checks`: Read and Write
+ - `Contents`: Read-only
+ - `Issues`: Read and Write
+ - `Pull Requests`: Read and Write
+ - `Metadata`: Read-only (enabled by default)
+
+ ![Github App Repository Permissions](/images/platform/secret-scanning/github-repo-permissions.png)
+
+ Subscribed events:
+ - `Check run`
+ - `Pull request`
+ - `Push`
+
+ ![Github App Subscribed Events](/images/platform/secret-scanning/github-subscribed-events.png)
+
+
+ ### Create the GitHub App
+ Now you can create the GitHub app by clicking on the "Create GitHub App" button.
+
+ <Note>
+ If you want other Github users to be able to install the app, you need to tick the "Any account" option under "Where can this GitHub App be installed?"
+ </Note>
+
+ ![Create GitHub App](/images/platform/secret-scanning/github-create-app-button.png)
+ </Step>
+
+ <Step title="Retrieve the GitHub App ID">
+ After clicking the "Create GitHub App" button, you will be redirected to the GitHub settings page. Here you can copy the "App ID" and save it for later when you need to configure your environment variables for your Infisical instance.
+
+ ![Github App ID](/images/platform/secret-scanning/github-app-copy-app-id.png)
+ </Step>
+
+ <Step title="Retrieve your GitHub App slug">
+ The GitHub App slug is the name of the app you created in a slug friendly format. You can find the slug in the URL of the app you created.
+
+ ![Github App Slug](/images/platform/secret-scanning/github-app-copy-slug.png)
+ </Step>
+
+ <Step title="Create a new GitHub App private key">
+ Create a new app private key by clicking on the "Generate a private key" button under the "Private keys" section.
+
+ Once you click the "Generate a private key" button, the private key will be downloaded to your computer. Save this file for later as you will need the private key when configuring Infisical.
+
+ ![Github App Private Key](/images/platform/secret-scanning/github-app-create-private-key.png)
+
+ <Note>
+ Remember to save the private key as you will need it in the next step.
+ </Note>
+
+ </Step>
+
+
+ <Step title="Configure your Infisical instance">
+ Now you can configure your Infisical instance by setting the following environment variables:
+
+ - `SECRET_SCANNING_GIT_APP_ID`: The App ID of your GitHub App.
+ - `SECRET_SCANNING_GIT_APP_SLUG`: The slug of your GitHub App.
+ - `SECRET_SCANNING_PRIVATE_KEY`: The private key of your GitHub App that you created in a previous step.
+ - `SECRET_SCANNING_WEBHOOK_SECRET`: The webhook secret of your GitHub App that you created in a previous step.
+ </Step>
+ </Steps>
+
+ After restarting your Infisical instance, you should be able to use the secret scanning feature within your organization. Follow the steps below to add the GitHub App to your Infisical organization.
+</Accordion>
+
+## Install the Infisical Radar GitHub App
+
+To install the GitHub App, press the "Integrate With GitHub" button in the top right corner of your Infisical Secret Scanning dashboard.
+
+![Integrate With GitHub](/images/platform/secret-scanning/infisical-connect-secret-scanner.png)
+
+Next, you'll be prompted to select which organization you'd like to install the app into. Select the organization you'd like to install the app into by clicking the organization in the menu.
+
+![Select Organization](/images/platform/secret-scanning/github-select-org-2.png)
+
+Select the repositories you'd like to scan for secrets and press the "Install" button.
+
+![Select Repositories](/images/platform/secret-scanning/github-select-repos.png)
+
## Code Scanning
![Scanning Overview](/images/platform/secret-scanning/overview.png)
diff --git a/docs/documentation/platform/ssh/overview.mdx b/docs/documentation/platform/ssh/overview.mdx
index e71eeabe1a..a252e1f712 100644
--- a/docs/documentation/platform/ssh/overview.mdx
+++ b/docs/documentation/platform/ssh/overview.mdx
@@ -31,16 +31,9 @@ we will register a remote host with Infisical through a [machine identity](/docu
<Steps>
<Step title="Create an Infisical SSH project">
- 1.1. Start by creating a new Infisical SSH project in Infisical.
+ Start by creating a new Infisical SSH project in Infisical.
![ssh project create](/images/platform/ssh/v2/ssh-create-project.png)
-
- 1.2. Create a custom role in the project under Access Control > Project Roles to grant the machine identity that we will create in step 2 the ability to **Create** and **Issue Host Certificates** on the **SSH Host** resource; this will enable the linked machine identity to bootstrap a remote host with Infisical
- and establish the necessary configuration on it.
-
- ![ssh custom role bootstrap 1](/images/platform/ssh/v2/ssh-add-bootstrap-role-1.png)
-
- ![ssh custom role bootstrap 2](/images/platform/ssh/v2/ssh-add-bootstrap-role-2.png)
</Step>
<Step title="Create a machine identity for bootstrapping Infisical SSH">
2.1. Follow the instructions [here](/documentation/platform/identities/universal-auth) to configure a [machine identity](/documentation/platform/identities/machine-identities) in Infisical with Universal Auth.
@@ -52,7 +45,14 @@ we will register a remote host with Infisical through a [machine identity](/docu
You may use other authentication methods as suitable (e.g. [AWS Auth](/documentation/platform/identities/aws-auth), [Azure Auth](/documentation/platform/identities/azure-auth), [GCP Auth](/documentation/platform/identities/gcp-auth), etc.) as part of the machine identity configuration but, to keep this example simple, we will be using Universal Auth.
</Note>
- 2.2. Add the machine identity to the Infisical SSH project you created in the previous step and assign it the custom role you created in step 1.2.
+ 2.2. Add the machine identity to the Infisical SSH project you created in the previous step and assign it the **SSH Host Bootstrapper** role.
+
+ This role grants the ability to **Create** and **Issue Host Certificates** on the **SSH Host** resource; this will enable the linked machine identity to bootstrap a remote host with Infisical
+ and establish the necessary configuration on it.
+
+ <Tip>
+ If you plan to use a custom role to bootstrap SSH hosts, ensure the role has the **Create** and **Issue Host Certificates** on the **SSH Host** resource.
+ </Tip>
![ssh add identity to project](/images/platform/ssh/v2/ssh-add-identity-to-project.png)
diff --git a/docs/documentation/platform/sso/auth0-oidc.mdx b/docs/documentation/platform/sso/auth0-oidc.mdx
index e8b532c1c7..0665a7b30b 100644
--- a/docs/documentation/platform/sso/auth0-oidc.mdx
+++ b/docs/documentation/platform/sso/auth0-oidc.mdx
@@ -39,8 +39,8 @@ description: "Learn how to configure Auth0 OIDC for Infisical SSO."
</Step>
<Step title="Finish configuring OIDC in Infisical">
- 3.1. Back in Infisical, in the Organization settings > Security > OIDC, click **Connect**.
- ![OIDC auth0 manage org Infisical](../../../images/sso/auth0-oidc/org-oidc-overview.png)
+ 3.1. Back in Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Click **Connect** for **OIDC**.
+ ![OIDC SSO Connect](../../../images/sso/connect-oidc.png)
3.2. For configuration type, select **Discovery URL**. Then, set **Discovery Document URL**, **JWT Signature Algorithm**, **Client ID**, and **Client Secret** from step 2.1 and 2.2.
![OIDC auth0 paste values into Infisical](../../../images/sso/auth0-oidc/org-update-oidc.png)
diff --git a/docs/documentation/platform/sso/auth0-saml.mdx b/docs/documentation/platform/sso/auth0-saml.mdx
index b426d1aaea..562360ecb0 100644
--- a/docs/documentation/platform/sso/auth0-saml.mdx
+++ b/docs/documentation/platform/sso/auth0-saml.mdx
@@ -12,7 +12,9 @@ description: "Learn how to configure Auth0 SAML for Infisical SSO."
<Steps>
<Step title="Prepare the SAML SSO configuration in Infisical">
- In Infisical, head to Organization Settings > Security and click **Connect** for SAML under the Connect to an Identity Provider section. Select Auth0, then click **Connect** again.
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Click **Connect** for **SAML** under the Connect to an Identity Provider section. Select **Auth0**, then click **Connect** again.
+
+ ![SSO connect section](../../../images/sso/connect-saml.png)
Next, note the **Application Callback URL** and **Audience** to use when configuring the Auth0 SAML application.
diff --git a/docs/documentation/platform/sso/azure.mdx b/docs/documentation/platform/sso/azure.mdx
index 282cddae5d..137dc65647 100644
--- a/docs/documentation/platform/sso/azure.mdx
+++ b/docs/documentation/platform/sso/azure.mdx
@@ -12,7 +12,9 @@ description: "Learn how to configure Microsoft Entra ID for Infisical SSO."
<Steps>
<Step title="Prepare the SAML SSO configuration in Infisical">
- In Infisical, head to Organization Settings > Security and click **Connect** for SAML under the Connect to an Identity Provider section. Select Azure / Entra, then click **Connect** again.
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Click **Connect** for **SAML** under the Connect to an Identity Provider section. Select **Azure / Entra**, then click **Connect** again.
+
+ ![SSO connect section](../../../images/sso/connect-saml.png)
Next, copy the **Reply URL (Assertion Consumer Service URL)** and **Identifier (Entity ID)** to use when configuring the Azure SAML application.
diff --git a/docs/documentation/platform/sso/general-oidc/group-membership-mapping.mdx b/docs/documentation/platform/sso/general-oidc/group-membership-mapping.mdx
new file mode 100644
index 0000000000..fd405fdfc8
--- /dev/null
+++ b/docs/documentation/platform/sso/general-oidc/group-membership-mapping.mdx
@@ -0,0 +1,55 @@
+---
+title: "General OIDC Group Membership Mapping"
+sidebarTitle: "Group Membership Mapping"
+description: "Learn how to sync OIDC group members to matching groups in Infisical."
+---
+
+You can have Infisical automatically sync group
+memberships between your OIDC provider and Infisical by configuring a `groups` claim on your provider tokens.
+When a user logs in via OIDC, they will be added to Infisical groups that are present in their OIDC `groups` claim,
+and removed from any Infisical groups not present in the claim.
+
+<Info>
+ When enabled, manual
+ management of Infisical group memberships will be disabled.
+</Info>
+
+<Warning>
+ Group membership changes in your OIDC provider only sync with Infisical when a
+ user logs in via OIDC. For example, if you remove a user from a group in your OIDC provider,
+ this change will not be reflected in Infisical until their next OIDC login.
+ To ensure this behavior, Infisical recommends enabling Enforce OIDC SSO in the OIDC settings.
+</Warning>
+
+
+<Steps>
+ <Step title="Configure a groups claim in your OIDC provider">
+ To enable OIDC Group Membership Mapping, you must configure a `groups` claim in your OIDC provider.
+
+ Add a `groups` property with a list of the user's OIDC group names to your token.
+
+ Example of expected token payload:
+ ```json
+ {
+ // "email": "[email protected]",
+ // "given_name": "John",
+ // ...other claims
+ "groups": ["Billing Group", "Sales Group"]
+ }
+ ```
+
+ <Note>
+ Setup varies between OIDC providers. Please refer to your OIDC provider's documentation for more information.
+ </Note>
+ </Step>
+ <Step title="Setup groups in Infisical and enable OIDC Group Membership Mapping">
+ 2.1. In Infisical, create any groups you would like to sync users to. Make sure the name of the Infisical group is an exact match of the OIDC group name.
+ ![OIDC general infisical group](/images/sso/keycloak-oidc/group-membership-mapping/create-infisical-group.png)
+
+ 2.2. Next, enable **OIDC Group Membership Mapping** on the **Single Sign-On (SSO)** page under the **General** tab.
+ ![OIDC general enable group membership mapping](/images/sso/keycloak-oidc/group-membership-mapping/enable-group-membership-mapping.png)
+
+ 2.3. The next time a user logs in they will be synced to their matching OIDC groups.
+ ![OIDC general synced users](/images/sso/keycloak-oidc/group-membership-mapping/synced-users.png)
+ </Step>
+</Steps>
\ No newline at end of file
diff --git a/docs/documentation/platform/sso/general-oidc.mdx b/docs/documentation/platform/sso/general-oidc/overview.mdx
similarity index 89%
rename from docs/documentation/platform/sso/general-oidc.mdx
rename to docs/documentation/platform/sso/general-oidc/overview.mdx
index 76e364b2fa..76ac982f86 100644
--- a/docs/documentation/platform/sso/general-oidc.mdx
+++ b/docs/documentation/platform/sso/general-oidc/overview.mdx
@@ -1,5 +1,6 @@
---
title: "General OIDC"
+sidebarTitle: "Overview"
description: "Learn how to configure OIDC for Infisical SSO with any OIDC-compliant identity provider"
---
@@ -28,8 +29,8 @@ Prerequisites:
1.4. Access the IdP’s OIDC discovery document (usually located at `https://<idp-domain>/.well-known/openid-configuration`). This document contains important endpoints such as authorization, token, userinfo, and keys.
</Step>
<Step title="Finish configuring OIDC in Infisical">
- 2.1. Back in Infisical, in the Organization settings > Security > OIDC, click Connect.
- ![OIDC general manage org Infisical](../../../images/sso/general-oidc/org-oidc-manage.png)
+ 2.1. Back in Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Select **Connect** for **OIDC**.
+ ![OIDC SSO Connect](../../../../images/sso/connect-oidc.png)
2.2. You can configure OIDC either through the Discovery URL (Recommended) or by inputting custom endpoints.
@@ -39,10 +40,10 @@ Prerequisites:
Note that the Discovery Document URL typically takes the form: `https://<idp-domain>/.well-known/openid-configuration`.
</Note>
- ![OIDC general discovery config](../../../images/sso/general-oidc/discovery-oidc-form.png)
+ ![OIDC general discovery config](../../../../images/sso/general-oidc/discovery-oidc-form.png)
To configure OIDC via the custom endpoints, set the **Configuration Type** field to **Custom** and input the required endpoint fields.
- ![OIDC general custom config](../../../images/sso/general-oidc/custom-oidc-form.png)
+ ![OIDC general custom config](../../../../images/sso/general-oidc/custom-oidc-form.png)
2.3. Select the appropriate JWT signature algorithm for your IdP. Currently, the supported options are RS256, RS512, HS256, and EdDSA.
@@ -55,7 +56,7 @@ Prerequisites:
<Step title="Enable OIDC SSO in Infisical">
Enabling OIDC SSO allows members in your organization to log into Infisical via the configured Identity Provider
- ![OIDC general enable OIDC](../../../images/sso/general-oidc/org-oidc-enable.png)
+ ![OIDC general enable OIDC](../../../../images/sso/general-oidc/org-oidc-enable.png)
</Step>
<Step title="Enforce OIDC SSO in Infisical">
diff --git a/docs/documentation/platform/sso/google-saml.mdx b/docs/documentation/platform/sso/google-saml.mdx
index 87ffa8412e..99223c8150 100644
--- a/docs/documentation/platform/sso/google-saml.mdx
+++ b/docs/documentation/platform/sso/google-saml.mdx
@@ -12,7 +12,9 @@ description: "Learn how to configure Google SAML for Infisical SSO."
<Steps>
<Step title="Prepare the SAML SSO configuration in Infisical">
- In Infisical, head to Organization Settings > Security and click **Connect** for SAML under the Connect to an Identity Provider section. Select Google, then click **Connect** again.
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Click **Connect** for **SAML** under the Connect to an Identity Provider section. Select **Google**, then click **Connect** again.
+
+ ![SSO connect section](../../../images/sso/connect-saml.png)
Next, note the **ACS URL** and **SP Entity ID** to use when configuring the Google SAML application.
diff --git a/docs/documentation/platform/sso/jumpcloud.mdx b/docs/documentation/platform/sso/jumpcloud.mdx
index 6ca20c7528..0898c0715b 100644
--- a/docs/documentation/platform/sso/jumpcloud.mdx
+++ b/docs/documentation/platform/sso/jumpcloud.mdx
@@ -12,7 +12,9 @@ description: "Learn how to configure JumpCloud SAML for Infisical SSO."
<Steps>
<Step title="Prepare the SAML SSO configuration in Infisical">
- In Infisical, head to Organization Settings > Security and click **Connect** for SAML under the Connect to an Identity Provider section. Select JumpCloud, then click **Connect** again.
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Click **Connect** for **SAML** under the Connect to an Identity Provider section. Select **JumpCloud**, then click **Connect** again.
+
+ ![SSO connect section](../../../images/sso/connect-saml.png)
Next, copy the **ACS URL** and **SP Entity ID** to use when configuring the JumpCloud SAML application.
diff --git a/docs/documentation/platform/sso/keycloak-oidc/group-membership-mapping.mdx b/docs/documentation/platform/sso/keycloak-oidc/group-membership-mapping.mdx
index c423bac5a8..29bca5a8df 100644
--- a/docs/documentation/platform/sso/keycloak-oidc/group-membership-mapping.mdx
+++ b/docs/documentation/platform/sso/keycloak-oidc/group-membership-mapping.mdx
@@ -53,7 +53,7 @@ Infisical groups not present in their groups claim.
2.1. In Infisical, create any groups you would like to sync users to. Make sure the name of the Infisical group is an exact match of the Keycloak group name.
![OIDC keycloak infisical group](/images/sso/keycloak-oidc/group-membership-mapping/create-infisical-group.png)
- 2.2. Next, enable **OIDC Group Membership Mapping** in Organization Settings > Security.
+ 2.2. Next, enable **OIDC Group Membership Mapping** on the **Single Sign-On (SSO)** page under the **General** tab.
![OIDC keycloak enable group membership mapping](/images/sso/keycloak-oidc/group-membership-mapping/enable-group-membership-mapping.png)
2.3. The next time a user logs in they will be synced to their matching Keycloak groups.
diff --git a/docs/documentation/platform/sso/keycloak-oidc/overview.mdx b/docs/documentation/platform/sso/keycloak-oidc/overview.mdx
index 803818a0ee..06d8dfa438 100644
--- a/docs/documentation/platform/sso/keycloak-oidc/overview.mdx
+++ b/docs/documentation/platform/sso/keycloak-oidc/overview.mdx
@@ -66,8 +66,8 @@ description: "Learn how to configure Keycloak OIDC for Infisical SSO."
</Step>
<Step title="Finish configuring OIDC in Infisical">
- 3.1. Back in Infisical, in the Organization settings > Security > OIDC, click Connect.
- ![OIDC keycloak manage org Infisical](/images/sso/keycloak-oidc/manage-org-oidc.png)
+ 3.1. Back in Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Click **Connect** for **OIDC**.
+ ![OIDC SSO Connect](../../../../images/sso/connect-oidc.png)
3.2. For configuration type, select Discovery URL. Then, set the appropriate values for **Discovery Document URL**, **JWT Signature Algorithm**, **Client ID**, and **Client Secret**.
![OIDC keycloak paste values into Infisical](/images/sso/keycloak-oidc/create-oidc.png)
diff --git a/docs/documentation/platform/sso/keycloak-saml.mdx b/docs/documentation/platform/sso/keycloak-saml.mdx
index 7e40041229..ba6aa0c3ac 100644
--- a/docs/documentation/platform/sso/keycloak-saml.mdx
+++ b/docs/documentation/platform/sso/keycloak-saml.mdx
@@ -12,9 +12,9 @@ description: "Learn how to configure Keycloak SAML for Infisical SSO."
<Steps>
<Step title="Prepare the SAML SSO configuration in Infisical">
- In Infisical, head to Organization Settings > Security and click **Connect** for SAML under the Connect to an Identity Provider section. Select Keycloak, then click **Connect** again.
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Click **Connect** for **SAML** under the Connect to an Identity Provider section. Select **Keycloak**, then click **Connect** again.
- ![Keycloak SAML organization security section](../../../images/sso/keycloak/org-security-section.png)
+ ![SSO connect section](../../../images/sso/connect-saml.png)
Next, copy the **Valid redirect URI** and **SP Entity ID** to use when configuring the Keycloak SAML application.
diff --git a/docs/documentation/platform/sso/okta.mdx b/docs/documentation/platform/sso/okta.mdx
index 1abd03d6f3..2af689e4c4 100644
--- a/docs/documentation/platform/sso/okta.mdx
+++ b/docs/documentation/platform/sso/okta.mdx
@@ -12,8 +12,10 @@ description: "Learn how to configure Okta SAML 2.0 for Infisical SSO."
<Steps>
<Step title="Prepare the SAML SSO configuration in Infisical">
- In Infisical, head to Organization Settings > Security and click **Connect** for SAML under the Connect to an Identity Provider section. Select Okta, then click **Connect** again.
-
+ In Infisical, head to the **Single Sign-On (SSO)** page and select the **General** tab. Click **Connect** for **SAML** under the Connect to an Identity Provider section. Select **Okta**, then click **Connect** again.
+
+ ![SSO connect section](../../../images/sso/connect-saml.png)
+
Next, copy the **Single sign-on URL** and **Audience URI (SP Entity ID)** to use when configuring the Okta SAML 2.0 application.
![Okta SAML initial configuration](../../../images/sso/okta/init-config.png)
</Step>
diff --git a/docs/images/app-connections/oci/add-api-key.png b/docs/images/app-connections/oci/add-api-key.png
new file mode 100644
index 0000000000..049ea4c874
Binary files /dev/null and b/docs/images/app-connections/oci/add-api-key.png differ
diff --git a/docs/images/app-connections/oci/app-connection-created.png b/docs/images/app-connections/oci/app-connection-created.png
new file mode 100644
index 0000000000..73edfa441e
Binary files /dev/null and b/docs/images/app-connections/oci/app-connection-created.png differ
diff --git a/docs/images/app-connections/oci/app-connection-modal.png b/docs/images/app-connections/oci/app-connection-modal.png
new file mode 100644
index 0000000000..c4ca6c0fb7
Binary files /dev/null and b/docs/images/app-connections/oci/app-connection-modal.png differ
diff --git a/docs/images/app-connections/oci/app-connection-option.png b/docs/images/app-connections/oci/app-connection-option.png
new file mode 100644
index 0000000000..1651316c60
Binary files /dev/null and b/docs/images/app-connections/oci/app-connection-option.png differ
diff --git a/docs/images/app-connections/oci/click-create-policy.png b/docs/images/app-connections/oci/click-create-policy.png
new file mode 100644
index 0000000000..edc5a74e99
Binary files /dev/null and b/docs/images/app-connections/oci/click-create-policy.png differ
diff --git a/docs/images/app-connections/oci/click-create-user.png b/docs/images/app-connections/oci/click-create-user.png
new file mode 100644
index 0000000000..d4422b1a4c
Binary files /dev/null and b/docs/images/app-connections/oci/click-create-user.png differ
diff --git a/docs/images/app-connections/oci/create-group.png b/docs/images/app-connections/oci/create-group.png
new file mode 100644
index 0000000000..9063ed737c
Binary files /dev/null and b/docs/images/app-connections/oci/create-group.png differ
diff --git a/docs/images/app-connections/oci/create-policy.png b/docs/images/app-connections/oci/create-policy.png
new file mode 100644
index 0000000000..ea666e09e8
Binary files /dev/null and b/docs/images/app-connections/oci/create-policy.png differ
diff --git a/docs/images/app-connections/oci/create-user.png b/docs/images/app-connections/oci/create-user.png
new file mode 100644
index 0000000000..f104885445
Binary files /dev/null and b/docs/images/app-connections/oci/create-user.png differ
diff --git a/docs/images/app-connections/oci/search-domains.png b/docs/images/app-connections/oci/search-domains.png
new file mode 100644
index 0000000000..b56f853506
Binary files /dev/null and b/docs/images/app-connections/oci/search-domains.png differ
diff --git a/docs/images/app-connections/oci/search-policies.png b/docs/images/app-connections/oci/search-policies.png
new file mode 100644
index 0000000000..d541fdbbe9
Binary files /dev/null and b/docs/images/app-connections/oci/search-policies.png differ
diff --git a/docs/images/app-connections/oci/select-api-keys.png b/docs/images/app-connections/oci/select-api-keys.png
new file mode 100644
index 0000000000..7c63e09196
Binary files /dev/null and b/docs/images/app-connections/oci/select-api-keys.png differ
diff --git a/docs/images/app-connections/oci/select-domain.png b/docs/images/app-connections/oci/select-domain.png
new file mode 100644
index 0000000000..9190de8010
Binary files /dev/null and b/docs/images/app-connections/oci/select-domain.png differ
diff --git a/docs/images/app-connections/oci/select-groups.png b/docs/images/app-connections/oci/select-groups.png
new file mode 100644
index 0000000000..d958900a37
Binary files /dev/null and b/docs/images/app-connections/oci/select-groups.png differ
diff --git a/docs/images/app-connections/oci/select-users.png b/docs/images/app-connections/oci/select-users.png
new file mode 100644
index 0000000000..392fd7000b
Binary files /dev/null and b/docs/images/app-connections/oci/select-users.png differ
diff --git a/docs/images/app-connections/oci/user-info.png b/docs/images/app-connections/oci/user-info.png
new file mode 100644
index 0000000000..24688d084f
Binary files /dev/null and b/docs/images/app-connections/oci/user-info.png differ
diff --git a/docs/images/platform/external-syncs/github-org-sync-active.png b/docs/images/platform/external-syncs/github-org-sync-active.png
index bb5ce1ca37..1137d76019 100644
Binary files a/docs/images/platform/external-syncs/github-org-sync-active.png and b/docs/images/platform/external-syncs/github-org-sync-active.png differ
diff --git a/docs/images/platform/external-syncs/github-org-sync-config-modal.png b/docs/images/platform/external-syncs/github-org-sync-config-modal.png
index b856048e34..d02cd4589b 100644
Binary files a/docs/images/platform/external-syncs/github-org-sync-config-modal.png and b/docs/images/platform/external-syncs/github-org-sync-config-modal.png differ
diff --git a/docs/images/platform/external-syncs/github-org-sync-section.png b/docs/images/platform/external-syncs/github-org-sync-section.png
index dad1fa4258..870b9d055a 100644
Binary files a/docs/images/platform/external-syncs/github-org-sync-section.png and b/docs/images/platform/external-syncs/github-org-sync-section.png differ
diff --git a/docs/images/platform/identities/identities-org-create-oci-auth-method.png b/docs/images/platform/identities/identities-org-create-oci-auth-method.png
new file mode 100644
index 0000000000..6d08b4ee9f
Binary files /dev/null and b/docs/images/platform/identities/identities-org-create-oci-auth-method.png differ
diff --git a/docs/images/platform/identities/identities-org-create.png b/docs/images/platform/identities/identities-org-create.png
index 06a1ef496d..cf5b4c3a54 100644
Binary files a/docs/images/platform/identities/identities-org-create.png and b/docs/images/platform/identities/identities-org-create.png differ
diff --git a/docs/images/platform/identities/identities-org.png b/docs/images/platform/identities/identities-org.png
index ad75b3dd1d..8d396ca84d 100644
Binary files a/docs/images/platform/identities/identities-org.png and b/docs/images/platform/identities/identities-org.png differ
diff --git a/docs/images/platform/identities/identities-page-remove-default-auth.png b/docs/images/platform/identities/identities-page-remove-default-auth.png
index 5b8f22fa2c..55c2fbf808 100644
Binary files a/docs/images/platform/identities/identities-page-remove-default-auth.png and b/docs/images/platform/identities/identities-page-remove-default-auth.png differ
diff --git a/docs/images/platform/identities/identities-page.png b/docs/images/platform/identities/identities-page.png
index 35b8af658d..43692ea5d5 100644
Binary files a/docs/images/platform/identities/identities-page.png and b/docs/images/platform/identities/identities-page.png differ
diff --git a/docs/images/platform/identities/identities-press-cog.png b/docs/images/platform/identities/identities-press-cog.png
new file mode 100644
index 0000000000..08cd381af6
Binary files /dev/null and b/docs/images/platform/identities/identities-press-cog.png differ
diff --git a/docs/images/platform/identities/identities-project-create.png b/docs/images/platform/identities/identities-project-create.png
index d7a2cc5e18..49094fcac0 100644
Binary files a/docs/images/platform/identities/identities-project-create.png and b/docs/images/platform/identities/identities-project-create.png differ
diff --git a/docs/images/platform/identities/identities-project.png b/docs/images/platform/identities/identities-project.png
index b02b7cfca5..c561dc342c 100644
Binary files a/docs/images/platform/identities/identities-project.png and b/docs/images/platform/identities/identities-project.png differ
diff --git a/docs/images/platform/identities/ldap/identities-org-add-auth-method-modal.png b/docs/images/platform/identities/ldap/identities-org-add-auth-method-modal.png
new file mode 100644
index 0000000000..e9a5f276c7
Binary files /dev/null and b/docs/images/platform/identities/ldap/identities-org-add-auth-method-modal.png differ
diff --git a/docs/images/platform/identities/ldap/identities-org-add-auth-method.png b/docs/images/platform/identities/ldap/identities-org-add-auth-method.png
new file mode 100644
index 0000000000..95d301010d
Binary files /dev/null and b/docs/images/platform/identities/ldap/identities-org-add-auth-method.png differ
diff --git a/docs/images/platform/identities/ldap/identities-org-configure-ldap.png b/docs/images/platform/identities/ldap/identities-org-configure-ldap.png
new file mode 100644
index 0000000000..c9dfb4950e
Binary files /dev/null and b/docs/images/platform/identities/ldap/identities-org-configure-ldap.png differ
diff --git a/docs/images/platform/identities/ldap/identities-org-create-identity-modal.png b/docs/images/platform/identities/ldap/identities-org-create-identity-modal.png
new file mode 100644
index 0000000000..3ac6555e47
Binary files /dev/null and b/docs/images/platform/identities/ldap/identities-org-create-identity-modal.png differ
diff --git a/docs/images/platform/identities/ldap/identities-org-create-identity.png b/docs/images/platform/identities/ldap/identities-org-create-identity.png
new file mode 100644
index 0000000000..1086f65215
Binary files /dev/null and b/docs/images/platform/identities/ldap/identities-org-create-identity.png differ
diff --git a/docs/images/platform/identities/ldap/jumpcloud-users-management.png b/docs/images/platform/identities/ldap/jumpcloud-users-management.png
new file mode 100644
index 0000000000..cc5dc13ca9
Binary files /dev/null and b/docs/images/platform/identities/ldap/jumpcloud-users-management.png differ
diff --git a/docs/images/platform/kms/hsm/fortanix-hsm-setup.png b/docs/images/platform/kms/hsm/fortanix-hsm-setup.png
new file mode 100644
index 0000000000..7465e12966
Binary files /dev/null and b/docs/images/platform/kms/hsm/fortanix-hsm-setup.png differ
diff --git a/docs/images/platform/organization/organization-settings-general.png b/docs/images/platform/organization/organization-settings-general.png
index affcf32ff0..9467b6005a 100644
Binary files a/docs/images/platform/organization/organization-settings-general.png and b/docs/images/platform/organization/organization-settings-general.png differ
diff --git a/docs/images/platform/pki/subscriber/subscriber-ca-crl.png b/docs/images/platform/pki/subscriber/subscriber-ca-crl.png
new file mode 100644
index 0000000000..35f7dad654
Binary files /dev/null and b/docs/images/platform/pki/subscriber/subscriber-ca-crl.png differ
diff --git a/docs/images/platform/pki/subscriber/subscriber-create-2.png b/docs/images/platform/pki/subscriber/subscriber-create-2.png
new file mode 100644
index 0000000000..fdfa44d27c
Binary files /dev/null and b/docs/images/platform/pki/subscriber/subscriber-create-2.png differ
diff --git a/docs/images/platform/pki/subscriber/subscriber-create.png b/docs/images/platform/pki/subscriber/subscriber-create.png
new file mode 100644
index 0000000000..8a4709ea32
Binary files /dev/null and b/docs/images/platform/pki/subscriber/subscriber-create.png differ
diff --git a/docs/images/platform/pki/subscriber/subscriber-issue-cert-2.png b/docs/images/platform/pki/subscriber/subscriber-issue-cert-2.png
new file mode 100644
index 0000000000..916c5aab92
Binary files /dev/null and b/docs/images/platform/pki/subscriber/subscriber-issue-cert-2.png differ
diff --git a/docs/images/platform/pki/subscriber/subscriber-issue-cert.png b/docs/images/platform/pki/subscriber/subscriber-issue-cert.png
new file mode 100644
index 0000000000..f96c7db287
Binary files /dev/null and b/docs/images/platform/pki/subscriber/subscriber-issue-cert.png differ
diff --git a/docs/images/platform/pki/subscriber/subscriber-revoke-cert.png b/docs/images/platform/pki/subscriber/subscriber-revoke-cert.png
new file mode 100644
index 0000000000..4601991c8e
Binary files /dev/null and b/docs/images/platform/pki/subscriber/subscriber-revoke-cert.png differ
diff --git a/docs/images/platform/pr-workflows/create-change-policy.png b/docs/images/platform/pr-workflows/create-change-policy.png
index 4ff1ad884b..afe945b0a5 100644
Binary files a/docs/images/platform/pr-workflows/create-change-policy.png and b/docs/images/platform/pr-workflows/create-change-policy.png differ
diff --git a/docs/images/platform/project-templates/project-template-add-button.png b/docs/images/platform/project-templates/project-template-add-button.png
index 965de1e9a4..c71c5c938c 100644
Binary files a/docs/images/platform/project-templates/project-template-add-button.png and b/docs/images/platform/project-templates/project-template-add-button.png differ
diff --git a/docs/images/platform/project-templates/project-template-apply.png b/docs/images/platform/project-templates/project-template-apply.png
index 1ec49cb436..0ed2d320c7 100644
Binary files a/docs/images/platform/project-templates/project-template-apply.png and b/docs/images/platform/project-templates/project-template-apply.png differ
diff --git a/docs/images/platform/project-templates/project-template-create.png b/docs/images/platform/project-templates/project-template-create.png
index 6cd1090495..6c485b4cca 100644
Binary files a/docs/images/platform/project-templates/project-template-create.png and b/docs/images/platform/project-templates/project-template-create.png differ
diff --git a/docs/images/platform/project-templates/project-template-customized.png b/docs/images/platform/project-templates/project-template-customized.png
index f21717326e..182e669c2c 100644
Binary files a/docs/images/platform/project-templates/project-template-customized.png and b/docs/images/platform/project-templates/project-template-customized.png differ
diff --git a/docs/images/platform/project-templates/project-template-edit-form.png b/docs/images/platform/project-templates/project-template-edit-form.png
index c4e29297f1..72085468fe 100644
Binary files a/docs/images/platform/project-templates/project-template-edit-form.png and b/docs/images/platform/project-templates/project-template-edit-form.png differ
diff --git a/docs/images/platform/scim/scim-enable-provisioning.png b/docs/images/platform/scim/scim-enable-provisioning.png
index a4385244f6..37fc658b51 100644
Binary files a/docs/images/platform/scim/scim-enable-provisioning.png and b/docs/images/platform/scim/scim-enable-provisioning.png differ
diff --git a/docs/images/platform/scim/scim-group-mapping.png b/docs/images/platform/scim/scim-group-mapping.png
index 76baa8d8d4..37bfcf45ad 100644
Binary files a/docs/images/platform/scim/scim-group-mapping.png and b/docs/images/platform/scim/scim-group-mapping.png differ
diff --git a/docs/images/platform/secret-scanning/github-app-copy-app-id.png b/docs/images/platform/secret-scanning/github-app-copy-app-id.png
new file mode 100644
index 0000000000..a94cb5ece0
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-app-copy-app-id.png differ
diff --git a/docs/images/platform/secret-scanning/github-app-copy-slug.png b/docs/images/platform/secret-scanning/github-app-copy-slug.png
new file mode 100644
index 0000000000..c555dcd415
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-app-copy-slug.png differ
diff --git a/docs/images/platform/secret-scanning/github-app-create-private-key.png b/docs/images/platform/secret-scanning/github-app-create-private-key.png
new file mode 100644
index 0000000000..50f602a362
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-app-create-private-key.png differ
diff --git a/docs/images/platform/secret-scanning/github-configure-app.png b/docs/images/platform/secret-scanning/github-configure-app.png
new file mode 100644
index 0000000000..df64eeb188
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-configure-app.png differ
diff --git a/docs/images/platform/secret-scanning/github-create-app-button.png b/docs/images/platform/secret-scanning/github-create-app-button.png
new file mode 100644
index 0000000000..3ea4b2d383
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-create-app-button.png differ
diff --git a/docs/images/platform/secret-scanning/github-create-app.png b/docs/images/platform/secret-scanning/github-create-app.png
new file mode 100644
index 0000000000..f4d1cdb8c3
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-create-app.png differ
diff --git a/docs/images/platform/secret-scanning/github-register-app.png b/docs/images/platform/secret-scanning/github-register-app.png
new file mode 100644
index 0000000000..904c07bf23
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-register-app.png differ
diff --git a/docs/images/platform/secret-scanning/github-repo-permissions.png b/docs/images/platform/secret-scanning/github-repo-permissions.png
new file mode 100644
index 0000000000..53eae9a415
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-repo-permissions.png differ
diff --git a/docs/images/platform/secret-scanning/github-select-org-2.png b/docs/images/platform/secret-scanning/github-select-org-2.png
new file mode 100644
index 0000000000..55b945c186
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-select-org-2.png differ
diff --git a/docs/images/platform/secret-scanning/github-select-org.png b/docs/images/platform/secret-scanning/github-select-org.png
new file mode 100644
index 0000000000..7d6e5abc50
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-select-org.png differ
diff --git a/docs/images/platform/secret-scanning/github-select-repos.png b/docs/images/platform/secret-scanning/github-select-repos.png
new file mode 100644
index 0000000000..51a6648d21
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-select-repos.png differ
diff --git a/docs/images/platform/secret-scanning/github-subscribed-events.png b/docs/images/platform/secret-scanning/github-subscribed-events.png
new file mode 100644
index 0000000000..7aa6b431f1
Binary files /dev/null and b/docs/images/platform/secret-scanning/github-subscribed-events.png differ
diff --git a/docs/images/platform/secret-scanning/infisical-connect-secret-scanner.png b/docs/images/platform/secret-scanning/infisical-connect-secret-scanner.png
new file mode 100644
index 0000000000..11f24fd742
Binary files /dev/null and b/docs/images/platform/secret-scanning/infisical-connect-secret-scanner.png differ
diff --git a/docs/images/platform/ssh/v2/ssh-add-bootstrap-role-1.png b/docs/images/platform/ssh/v2/ssh-add-bootstrap-role-1.png
deleted file mode 100644
index 8acc1efe9c..0000000000
Binary files a/docs/images/platform/ssh/v2/ssh-add-bootstrap-role-1.png and /dev/null differ
diff --git a/docs/images/platform/ssh/v2/ssh-add-bootstrap-role-2.png b/docs/images/platform/ssh/v2/ssh-add-bootstrap-role-2.png
deleted file mode 100644
index 2ad9804d4b..0000000000
Binary files a/docs/images/platform/ssh/v2/ssh-add-bootstrap-role-2.png and /dev/null differ
diff --git a/docs/images/platform/ssh/v2/ssh-add-identity-to-project.png b/docs/images/platform/ssh/v2/ssh-add-identity-to-project.png
index 83bd3c9845..d921cc8d07 100644
Binary files a/docs/images/platform/ssh/v2/ssh-add-identity-to-project.png and b/docs/images/platform/ssh/v2/ssh-add-identity-to-project.png differ
diff --git a/docs/images/secret-syncs/aws-parameter-store/aws-parameter-store-options.png b/docs/images/secret-syncs/aws-parameter-store/aws-parameter-store-options.png
index 6a4a68f2c2..30a74eac01 100644
Binary files a/docs/images/secret-syncs/aws-parameter-store/aws-parameter-store-options.png and b/docs/images/secret-syncs/aws-parameter-store/aws-parameter-store-options.png differ
diff --git a/docs/images/secret-syncs/aws-secrets-manager/aws-secrets-manager-options.png b/docs/images/secret-syncs/aws-secrets-manager/aws-secrets-manager-options.png
index 89ec35e4d2..7e3cd5ea95 100644
Binary files a/docs/images/secret-syncs/aws-secrets-manager/aws-secrets-manager-options.png and b/docs/images/secret-syncs/aws-secrets-manager/aws-secrets-manager-options.png differ
diff --git a/docs/images/secret-syncs/oci-vault/configure-destination.png b/docs/images/secret-syncs/oci-vault/configure-destination.png
new file mode 100644
index 0000000000..5533806359
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/configure-destination.png differ
diff --git a/docs/images/secret-syncs/oci-vault/configure-details.png b/docs/images/secret-syncs/oci-vault/configure-details.png
new file mode 100644
index 0000000000..27cf890e84
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/configure-details.png differ
diff --git a/docs/images/secret-syncs/oci-vault/configure-source.png b/docs/images/secret-syncs/oci-vault/configure-source.png
new file mode 100644
index 0000000000..0953466fcd
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/configure-source.png differ
diff --git a/docs/images/secret-syncs/oci-vault/configure-sync-options.png b/docs/images/secret-syncs/oci-vault/configure-sync-options.png
new file mode 100644
index 0000000000..6f40e0dbbf
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/configure-sync-options.png differ
diff --git a/docs/images/secret-syncs/oci-vault/copy-compartment-ocid.png b/docs/images/secret-syncs/oci-vault/copy-compartment-ocid.png
new file mode 100644
index 0000000000..fb43558075
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/copy-compartment-ocid.png differ
diff --git a/docs/images/secret-syncs/oci-vault/review-configuration.png b/docs/images/secret-syncs/oci-vault/review-configuration.png
new file mode 100644
index 0000000000..2abe7820f5
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/review-configuration.png differ
diff --git a/docs/images/secret-syncs/oci-vault/search-compartment.png b/docs/images/secret-syncs/oci-vault/search-compartment.png
new file mode 100644
index 0000000000..005f06ecd1
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/search-compartment.png differ
diff --git a/docs/images/secret-syncs/oci-vault/select-compartment.png b/docs/images/secret-syncs/oci-vault/select-compartment.png
new file mode 100644
index 0000000000..3eae44c32b
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/select-compartment.png differ
diff --git a/docs/images/secret-syncs/oci-vault/select-option.png b/docs/images/secret-syncs/oci-vault/select-option.png
new file mode 100644
index 0000000000..49a61ccaea
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/select-option.png differ
diff --git a/docs/images/secret-syncs/oci-vault/sync-created.png b/docs/images/secret-syncs/oci-vault/sync-created.png
new file mode 100644
index 0000000000..c68fedc685
Binary files /dev/null and b/docs/images/secret-syncs/oci-vault/sync-created.png differ
diff --git a/docs/images/sso/auth0-oidc/org-oidc-overview.png b/docs/images/sso/auth0-oidc/org-oidc-overview.png
deleted file mode 100644
index f5778b97a7..0000000000
Binary files a/docs/images/sso/auth0-oidc/org-oidc-overview.png and /dev/null differ
diff --git a/docs/images/sso/connect-ldap.png b/docs/images/sso/connect-ldap.png
new file mode 100644
index 0000000000..419d6f8b7b
Binary files /dev/null and b/docs/images/sso/connect-ldap.png differ
diff --git a/docs/images/sso/connect-oidc.png b/docs/images/sso/connect-oidc.png
new file mode 100644
index 0000000000..43da1bb0a6
Binary files /dev/null and b/docs/images/sso/connect-oidc.png differ
diff --git a/docs/images/sso/connect-saml.png b/docs/images/sso/connect-saml.png
new file mode 100644
index 0000000000..40de3a0d20
Binary files /dev/null and b/docs/images/sso/connect-saml.png differ
diff --git a/docs/images/sso/general-oidc/org-oidc-manage.png b/docs/images/sso/general-oidc/org-oidc-manage.png
deleted file mode 100644
index f5778b97a7..0000000000
Binary files a/docs/images/sso/general-oidc/org-oidc-manage.png and /dev/null differ
diff --git a/docs/images/sso/keycloak-oidc/group-membership-mapping/enable-group-membership-mapping.png b/docs/images/sso/keycloak-oidc/group-membership-mapping/enable-group-membership-mapping.png
index 199a7432a6..d3b38c7627 100644
Binary files a/docs/images/sso/keycloak-oidc/group-membership-mapping/enable-group-membership-mapping.png and b/docs/images/sso/keycloak-oidc/group-membership-mapping/enable-group-membership-mapping.png differ
diff --git a/docs/images/sso/keycloak-oidc/manage-org-oidc.png b/docs/images/sso/keycloak-oidc/manage-org-oidc.png
deleted file mode 100644
index f5778b97a7..0000000000
Binary files a/docs/images/sso/keycloak-oidc/manage-org-oidc.png and /dev/null differ
diff --git a/docs/integrations/app-connections/oci.mdx b/docs/integrations/app-connections/oci.mdx
new file mode 100644
index 0000000000..ff51ce1d92
--- /dev/null
+++ b/docs/integrations/app-connections/oci.mdx
@@ -0,0 +1,189 @@
+---
+title: "OCI Connection"
+description: "Learn how to configure an Oracle Cloud Infrastructure Connection for Infisical."
+---
+
+Infisical supports the use of [API Signing Key Authentication](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm) to connect with OCI.
+
+## Create OCI User
+
+<Steps>
+ <Step title="Search for 'Domains' and click as shown">
+ ![Search Domains](/images/app-connections/oci/search-domains.png)
+ </Step>
+ <Step title="Select domain">
+ Select the domain in which you want to create the Infisical user account.
+
+ ![Select Domain](/images/app-connections/oci/select-domain.png)
+ </Step>
+ <Step title="Navigate to 'Users'">
+ ![Select Users](/images/app-connections/oci/select-users.png)
+ </Step>
+ <Step title="Click 'Create user'">
+ ![Click Create User](/images/app-connections/oci/click-create-user.png)
+ </Step>
+ <Step title="Create user">
+ The name, email, and username can be anything.
+
+ ![Create User](/images/app-connections/oci/create-user.png)
+ </Step>
+ <Step title="Navigate to 'API keys'">
+ After you've created a user, you'll be redirected to the user's page. Navigate to 'API keys'.
+
+ ![Select API Keys](/images/app-connections/oci/select-api-keys.png)
+ </Step>
+ <Step title="Add API key">
+ Click on 'Add API key' and then download or import the private key. After you've obtained the private key, click 'Add'.
+
+ ![Add API Key](/images/app-connections/oci/add-api-key.png)
+ </Step>
+ <Step title="Store configuration">
+ After creating the API key, you'll be shown a modal with relevant information. Save the highlighted values (and the private key) for later steps.
+
+ ![User Info](/images/app-connections/oci/user-info.png)
+ </Step>
+</Steps>
+
+## Create OCI Group
+
+<Steps>
+ <Step title="Search for 'Domains' and click as shown">
+ ![Search Domains](/images/app-connections/oci/search-domains.png)
+ </Step>
+ <Step title="Select domain">
+ Select the domain in which you want to create the Infisical user account.
+
+ ![Select Domain](/images/app-connections/oci/select-domain.png)
+ </Step>
+ <Step title="Navigate to 'Groups'">
+ ![Select Groups](/images/app-connections/oci/select-groups.png)
+ </Step>
+ <Step title="Create group">
+ The name and description can be anything. **Ensure that you assign the user created in earlier steps to this group**.
+
+ ![Create Group](/images/app-connections/oci/create-group.png)
+ </Step>
+ <Step title="Store group name">
+ After creating the group, take note of its name. It will be used in later steps.
+ </Step>
+</Steps>
+
+## Create OCI Policy
+
+<Steps>
+ <Step title="Search for 'Policies' and click as shown">
+ ![Search Policies](/images/app-connections/oci/search-policies.png)
+ </Step>
+ <Step title="Click 'Create Policy'">
+ ![Click Create Policy](/images/app-connections/oci/click-create-policy.png)
+ </Step>
+ <Step title="Create policy">
+ The name and description can be anything. Click 'Show manual editor' and paste in the policy rules relevant to your task:
+
+ <Tabs>
+ <Tab title="Secret Sync">
+ ```
+ Allow group <group name> to manage secret-family in compartment <compartment name>
+ Allow group <group name> to use keys in compartment <compartment name>
+ Allow group <group name> to use vaults in compartment <compartment name>
+ Allow group <group name> to inspect compartments in tenancy
+ ```
+
+ - **Group Name:** The name of the group you created in earlier steps.
+ - **Compartment Name:** The name of the compartment which has your secrets vault.
+
+ If you'd like to grant Infisical access to all compartments, replace instances of `compartment <compartment name>` with `tenancy`.
+ </Tab>
+ </Tabs>
+
+ ![Create Policy](/images/app-connections/oci/create-policy.png)
+
+ <Note>
+ **You must create this policy on the root compartment**, otherwise some functionality may not work.
+ </Note>
+ </Step>
+</Steps>
+
+## Create OCI Connection in Infisical
+
+<Tabs>
+ <Tab title="Infisical UI">
+ <Steps>
+ <Step title="Navigate to App Connections">
+ In your Infisical dashboard, go to **Organization Settings** and select the [**App Connections**](https://app.infisical.com/organization/app-connections) tab.
+
+ ![App Connections Tab](/images/app-connections/general/add-connection.png)
+ </Step>
+ <Step title="Select OCI Connection">
+ Click the **+ Add Connection** button and select the **OCI Connection** option from the available integrations.
+
+ ![Select OCI Connection](/images/app-connections/oci/app-connection-option.png)
+ </Step>
+ <Step title="Fill out the OCI Connection Modal">
+ Complete the OCI Connection form by entering:
+ - A descriptive name for the connection
+ - An optional description for future reference
+ - The User OCID from [earlier steps](https://infisical.com/docs/integrations/app-connections/oci#create-oci-user)
+ - The Tenancy OCID from [earlier steps](https://infisical.com/docs/integrations/app-connections/oci#create-oci-user)
+ - The Region from [earlier steps](https://infisical.com/docs/integrations/app-connections/oci#create-oci-user)
+ - The Fingerprint from [earlier steps](https://infisical.com/docs/integrations/app-connections/oci#create-oci-user)
+ - The Private Key PEM from [earlier steps](https://infisical.com/docs/integrations/app-connections/oci#create-oci-user)
+
+ ![OCI Connection Modal](/images/app-connections/oci/app-connection-modal.png)
+ </Step>
+ <Step title="Connection Created">
+ After clicking Create, your **OCI Connection** is established and ready to use with your Infisical projects.
+
+ ![OCI Connection Created](/images/app-connections/oci/app-connection-created.png)
+ </Step>
+ </Steps>
+ </Tab>
+ <Tab title="API">
+ To create an OCI Connection, make an API request to the [Create OCI Connection](/api-reference/endpoints/app-connections/oci/create) API endpoint.
+
+ ### Sample request
+
+ ```bash Request
+ curl --request POST \
+ --url https://app.infisical.com/api/v1/app-connections/oci \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "name": "my-oci-connection",
+ "method": "access-key",
+ "credentials": {
+ "userOcid": "ocid1.user.oc1..aaaaaaaagrp35tbkvvad4y2j7sug7xonua7dl2gfp4at2u5i5xj4ghnitg3a",
+ "tenancyOcid": "ocid1.tenancy.oc1..aaaaaaaaotfma465m4zumfe2ua64mj2m5dwmlw2llh4g4dnfttnakiifonta",
+ "region": "us-ashburn-1",
+ "fingerprint": "9c:f6:18:23:92:73:f8:e1:85:2c:6a:e3:2c:7d:ec:8f",
+ "privateKey": "[PRIVATE KEY PEM]"
+ }
+ }'
+ ```
+
+ ### Sample response
+
+ ```bash Response
+ {
+ "appConnection": {
+ "id": "e5d18aca-86f7-4026-a95e-efb8aeb0d8e6",
+ "name": "my-oci-connection",
+ "description": null,
+ "version": 1,
+ "orgId": "6f03caa1-a5de-43ce-b127-95a145d3464c",
+ "createdAt": "2025-04-23T19:46:34.831Z",
+ "updatedAt": "2025-04-23T19:46:34.831Z",
+ "isPlatformManagedCredentials": false,
+ "credentialsHash": "7c2d371dec195f82a6a0d5b41c970a229cfcaf88e894a5b6395e2dbd0280661f",
+ "app": "oci",
+ "method": "access-key",
+ "credentials": {
+ "userOcid": "ocid1.user.oc1..aaaaaaaagrp35tbkvvad4y2j7sug7xonua7dl2gfp4at2u5i5xj4ghnitg3a",
+ "tenancyOcid": "ocid1.tenancy.oc1..aaaaaaaaotfma465m4zumfe2ua64mj2m5dwmlw2llh4g4dnfttnakiifonta",
+ "region": "us-ashburn-1",
+ "fingerprint": "9c:f6:18:23:92:73:f8:e1:85:2c:6a:e3:2c:7d:ec:8f"
+ }
+ }
+ }
+ ```
+ </Tab>
+</Tabs>
diff --git a/docs/integrations/cloud/heroku.mdx b/docs/integrations/cloud/heroku.mdx
index a63c3f3819..75cf8c106f 100644
--- a/docs/integrations/cloud/heroku.mdx
+++ b/docs/integrations/cloud/heroku.mdx
@@ -22,11 +22,11 @@ description: "How to sync secrets from Infisical to Heroku"
</Step>
<Step title="Start integration">
Select which Infisical environment secrets you want to sync to which Heroku app and press create integration to start syncing secrets to Heroku.
-
+
![integrations heroku](../../images/integrations/heroku/integrations-heroku-create.png)
Here's some guidance on each field:
-
+
- Project Environment: The environment in the current Infisical project from which you want to sync secrets from.
- Secrets Path: The path in the current Infisical project from which you want to sync secrets from such as `/` (for secrets that do not reside in a folder) or `/foo/bar` (for secrets nested in a folder, in this case a folder called `bar` in another folder called `foo`).
- Heroku App: The application in Heroku that you want to sync secrets to.
@@ -34,7 +34,7 @@ description: "How to sync secrets from Infisical to Heroku"
- **No Import - Overwrite all values in Heroku**: Sync secrets and overwrite any existing secrets in Heroku.
- **Import - Prefer values from Infisical**: Import secrets from Heroku to Infisical; if a secret with the same name already exists in Infisical, do nothing. Afterwards, sync secrets to Heroku.
- **Import - Prefer values from Heroku**: Import secrets from Heroku to Infisical; if a secret with the same name already exists in Infisical, replace its value with the one from Heroku. Afterwards, sync secrets to Heroku.
-
+
![integrations heroku](../../images/integrations/heroku/integrations-heroku.png)
</Step>
</Steps>
@@ -46,27 +46,26 @@ description: "How to sync secrets from Infisical to Heroku"
<Step title="Create an API client in Heroku">
Navigate to your user Account settings > Applications to create a new API client.
- ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-settings.png)
- ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-applications.png)
- ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-new-app.png)
-
+ ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-settings.png)
+ ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-applications.png)
+ ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-new-app.png)
+
Create the API client. As part of the form, set the **OAuth callback URL** to `https://your-domain.com/integrations/heroku/oauth2/callback`.
- ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-new-app-form.png)
+ ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-new-app-form.png)
</Step>
<Step title="Add your Heroku API client credentials to Infisical">
Obtain the **Client ID** and **Client Secret** for your Heroku API client.
-
- ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-credentials.png)
-
+
+ ![integrations Heroku config](../../images/integrations/heroku/integrations-heroku-config-credentials.png)
+
Back in your Infisical instance, add two new environment variables for the credentials 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 integration.
</Step>
</Steps>
</Tab>
</Tabs>
-
diff --git a/docs/integrations/frameworks/pulumi.mdx b/docs/integrations/frameworks/pulumi.mdx
new file mode 100644
index 0000000000..11a8e0cb7d
--- /dev/null
+++ b/docs/integrations/frameworks/pulumi.mdx
@@ -0,0 +1,14 @@
+---
+title: "Pulumi"
+description: "Using Infisical with Pulumi via the Terraform Bridge"
+---
+
+Infisical can be integrated with Pulumi by leveraging Pulumi’s [Terraform Bridge](https://www.pulumi.com/blog/any-terraform-provider/),
+which allows Terraform providers to be used seamlessly within Pulumi projects. This enables infrastructure and platform teams to manage Infisical secrets and resources
+using Pulumi’s familiar programming languages (including TypeScript, Python, Go, and C#), without any change to existing workflows.
+
+The Terraform Bridge wraps the [Infisical Terraform provider](/integrations/frameworks/terraform) and exposes its resources (such as `infisical_secret`, `infisical_project`, and `infisical_service_token`)
+in a Pulumi-compatible interface. This makes it easy to integrate secret management directly into Pulumi-based IaC pipelines, ensuring secrets stay in sync with
+the rest of your cloud infrastructure. Authentication is handled through the same methods as Terraform: using environment variables such as `INFISICAL_TOKEN` and `INFISICAL_SITE_URL`.
+
+By bridging the Infisical provider, teams using Pulumi can adopt secure, centralized secrets management without compromising on their toolchain or language preferences.
\ No newline at end of file
diff --git a/docs/integrations/platforms/kubernetes/infisical-dynamic-secret-crd.mdx b/docs/integrations/platforms/kubernetes/infisical-dynamic-secret-crd.mdx
index 21f54994a1..5962e4c102 100644
--- a/docs/integrations/platforms/kubernetes/infisical-dynamic-secret-crd.mdx
+++ b/docs/integrations/platforms/kubernetes/infisical-dynamic-secret-crd.mdx
@@ -165,7 +165,7 @@ spec:
</Accordion>
<Accordion title="managedSecretReference.creationPolicy">
- Creation polices allow you to control whether or not owner references should be added to the managed Kubernetes secret that is generated by the Infisical operator.
+ Creation policies allow you to control whether or not owner references should be added to the managed Kubernetes secret that is generated by the Infisical operator.
This is useful for tools such as ArgoCD, where every resource requires an owner reference; otherwise, it will be pruned automatically.
#### Available options
diff --git a/docs/integrations/platforms/kubernetes/infisical-push-secret-crd.mdx b/docs/integrations/platforms/kubernetes/infisical-push-secret-crd.mdx
index 50f07bb76f..d87648bbf6 100644
--- a/docs/integrations/platforms/kubernetes/infisical-push-secret-crd.mdx
+++ b/docs/integrations/platforms/kubernetes/infisical-push-secret-crd.mdx
@@ -34,7 +34,7 @@ Before applying the InfisicalPushSecret CRD, you need to create a Kubernetes sec
metadata:
name: infisical-push-secret-demo
spec:
- resyncInterval: 1m
+ resyncInterval: 1m # Remove this field to disable automatic reconciliation of the InfisicalPushSecret CRD.
hostAPI: https://app.infisical.com/api
# Optional, defaults to no replacement.
@@ -124,7 +124,9 @@ After applying the InfisicalPushSecret CRD, you should notice that the secrets y
<Accordion title="resyncInterval">
- The `resyncInterval` is a string-formatted duration that defines the time between each resync.
+ The `resyncInterval` is a string-formatted duration that defines the time between each resync. The field is optional, and will default to no automatic resync if not defined.
+
+ If you don't want to automatically reconcile the InfisicalPushSecret CRD on an interval, you can remove the `resyncInterval` field entirely from your InfisicalPushSecret CRD.
The format of the field is `[duration][unit]` where `duration` is a number and `unit` is a string representing the unit of time.
@@ -239,7 +241,21 @@ After applying the InfisicalPushSecret CRD, you should notice that the secrets y
DATABASE_URL: postgres://127.0.0.1:5432
ENCRYPTION_KEY: fabcc12-a22-facbaa4-11aa568aab
```
+ </Accordion>
+ <Accordion title="generators[]">
+ The `generators[]` field is used to define the generators you want to use for your InfisicalPushSecret CRD.
+ You can follow the guide for [using generators to push secrets](#using-generators-to-push-secrets) for more information.
+
+ Example:
+ ```yaml
+ push:
+ generators:
+ - destinationSecretName: password-generator-test
+ generatorRef:
+ kind: Password
+ name: password-generator
+ ```
</Accordion>
</Accordion>
@@ -459,6 +475,148 @@ Using Go templates, you can format, combine, and create new key-value pairs of s
Please refer to the [templating functions documentation](/integrations/platforms/kubernetes/overview#available-helper-functions) for more information.
</Accordion>
+## Using generators to push secrets
+
+Generators allow secrets to be dynamically generated during each reconciliation cycle and then pushed to Infisical. They are useful for use cases where a new secret value is needed on every sync, such as ephemeral credentials or one-time-use tokens.
+
+A generator is defined as a custom resource (`ClusterGenerator`) within the cluster, which specifies the logic for generating secret values. Generators are stateless, each invocation triggers the creation of a new set of values, with no tracking or persistence of previously generated data.
+
+Because of this behavior, you may want to disable automatic syncing for the `InfisicalPushSecret` resource to avoid continuous regeneration of secrets. This can be done by omitting the `resyncInterval` field from the InfisicalPushSecret CRD.
+
+### Example usage
+```yaml
+ push:
+ secret:
+ secretName: push-secret-source-secret
+ secretNamespace: dev
+ generators:
+ - destinationSecretName: password-generator # Name of the secret that will be created in Infisical
+ generatorRef:
+ kind: Password # Kind of the resource, must match the generator kind.
+ name: custom-generator # Name of the generator resource
+```
+
+To use a generator, you must specify at least one generator in the `push.generators[]` field.
+
+
+<Accordion title="push.generators[]">
+ This field holds an array of the generators you want to use for your InfisicalPushSecret CRD.
+</Accordion>
+
+<Accordion title="push.generators[].destinationSecretName">
+ The name of the secret that will be created in Infisical.
+</Accordion>
+
+<Accordion title="push.generators[].generatorRef">
+ The reference to the generator resource.
+
+ Valid fields:
+ - `kind`: The kind of the generator resource, must match the generator kind.
+ - `name`: The name of the generator resource.
+</Accordion>
+
+<Accordion title="push.generators[].generatorRef.kind">
+ The kind of the generator resource, must match the generator kind.
+
+ Valid values:
+ - `Password`
+ - `UUID`
+</Accordion>
+
+<Accordion title="push.generators[].generatorRef.name">
+ The name of the generator resource.
+</Accordion>
+
+### Supported Generators
+Below are the currently supported generators for the InfisicalPushSecret CRD. Each generator is a `ClusterGenerator` custom resource that can be used to customize the generated secret.
+
+<Accordion title="Password Generator">
+ ### Password Generator
+
+ The Password generator is a custom resource that is installed on the cluster that defines the logic for generating a password.
+ - `kind`: The kind of the generator resource, must match the generator kind. For the Password generator, the kind is `Password`.
+ - `generator.passwordSpec`: The spec of the password generator.
+
+ <Accordion title="generator.kind">
+ The `generator.kind` field must match the kind of the generator resource. For the Password generator, the kind should always be set to `Password`.
+ </Accordion>
+ <Accordion title="generator.passwordSpec">
+ - `length`: The length of the password.
+ - `digits`: The number of digits in the password.
+ - `symbols`: The number of symbols in the password.
+ - `symbolCharacters`: The characters to use for the symbols in the password.
+ - `noUpper`: Whether to include uppercase letters in the password.
+ - `allowRepeat`: Whether to allow repeating characters in the password.
+ </Accordion>
+
+ ```yaml password-cluster-generator.yaml
+ apiVersion: secrets.infisical.com/v1alpha1
+ kind: ClusterGenerator
+ metadata:
+ name: password-generator
+ spec:
+ kind: Password
+ generator:
+ passwordSpec:
+ length: 10
+ digits: 5
+ symbols: 5
+ symbolCharacters: "-_$@"
+ noUpper: false
+ allowRepeat: true
+ ```
+
+ Example InfisicalPushSecret CRD using the Password generator:
+ ```yaml infisical-push-secret-crd.yaml
+ push:
+ generators:
+ - destinationSecretName: password-generator-test
+ generatorRef:
+ kind: Password
+ name: password-generator
+ ```
+</Accordion>
+<Accordion title="UUID Generator">
+ ### UUID Generator
+
+ The UUID generator is a custom resource that is installed on the cluster that defines the logic for generating a UUID.
+ - `kind`: The kind of the generator resource, must match the generator kind. For the UUID generator, the kind is `UUID`.
+ - `generator.uuidSpec`: The spec of the UUID generator. For UUID's, this can be left empty.
+
+ <Accordion title="generator.kind">
+ The `generator.kind` field must match the kind of the generator resource. For the UUID generator, the kind should always be set to `UUID`.
+ </Accordion>
+
+ <Accordion title="generator.uuidSpec">
+ The spec of the UUID generator. For UUID's, this can be left empty.
+ </Accordion>
+
+ ```yaml uuid-cluster-generator.yaml
+ apiVersion: secrets.infisical.com/v1alpha1
+ kind: ClusterGenerator
+ metadata:
+ name: uuid-generator
+ spec:
+ kind: UUID
+ generator:
+ uuidSpec:
+ ```
+
+ Example InfisicalPushSecret CRD using the UUID generator:
+
+ ```yaml infisical-push-secret-crd.yaml
+ push:
+ generators:
+ - destinationSecretName: uuid-generator-test
+ generatorRef:
+ kind: UUID
+ name: uuid-generator
+ ```
+</Accordion>
+
+
+
+
## Applying the InfisicalPushSecret CRD to your cluster
Once you have configured the `InfisicalPushSecret` CRD with the required fields, you can apply it to your cluster.
diff --git a/docs/integrations/platforms/kubernetes/infisical-secret-crd.mdx b/docs/integrations/platforms/kubernetes/infisical-secret-crd.mdx
index a79a8d0a53..145737e967 100644
--- a/docs/integrations/platforms/kubernetes/infisical-secret-crd.mdx
+++ b/docs/integrations/platforms/kubernetes/infisical-secret-crd.mdx
@@ -232,7 +232,7 @@ spec:
</Step>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -407,7 +407,7 @@ spec:
</Step>
<Step title="Creating an identity">
- To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**.
+ To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
![identities organization](/images/platform/identities/identities-org.png)
@@ -832,7 +832,7 @@ The namespace of the managed Kubernetes secret to be created.
Override the default Opaque type for managed secrets with this field. Useful for creating kubernetes.io/dockerconfigjson secrets.
</Accordion>
<Accordion title="managedKubeSecretReferences[].creationPolicy">
-Creation polices allow you to control whether or not owner references should be added to the managed Kubernetes secret that is generated by the Infisical operator.
+Creation policies allow you to control whether or not owner references should be added to the managed Kubernetes secret that is generated by the Infisical operator.
This is useful for tools such as ArgoCD, where every resource requires an owner reference; otherwise, it will be pruned automatically.
#### Available options
@@ -940,7 +940,7 @@ The Infisical operator will automatically create the Kubernetes config map in th
The namespace of the managed Kubernetes config map that your Infisical data will be stored in.
</Accordion>
<Accordion title="managedKubeConfigMapReferences[].creationPolicy">
- Creation polices allow you to control whether or not owner references should be added to the managed Kubernetes config map that is generated by the Infisical operator.
+ Creation policies allow you to control whether or not owner references should be added to the managed Kubernetes config map that is generated by the Infisical operator.
This is useful for tools such as ArgoCD, where every resource requires an owner reference; otherwise, it will be pruned automatically.
#### Available options
diff --git a/docs/integrations/secret-syncs/aws-parameter-store.mdx b/docs/integrations/secret-syncs/aws-parameter-store.mdx
index fad37265a4..11f0c94add 100644
--- a/docs/integrations/secret-syncs/aws-parameter-store.mdx
+++ b/docs/integrations/secret-syncs/aws-parameter-store.mdx
@@ -40,6 +40,10 @@ description: "Learn how to configure an AWS Parameter Store Sync for Infisical."
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over Parameter Store when keys conflict.
- **Import Secrets (Prioritize AWS Parameter Store)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Parameter Store over Infisical when keys conflict.
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **KMS Key**: The AWS KMS key ID or alias to encrypt parameters with.
- **Tags**: Optional resource tags to add to parameters synced by Infisical.
- **Sync Secret Metadata as Resource Tags**: If enabled, metadata attached to secrets will be added as resource tags to parameters synced by Infisical.
diff --git a/docs/integrations/secret-syncs/aws-secrets-manager.mdx b/docs/integrations/secret-syncs/aws-secrets-manager.mdx
index 8ed85be256..f7654eeaef 100644
--- a/docs/integrations/secret-syncs/aws-secrets-manager.mdx
+++ b/docs/integrations/secret-syncs/aws-secrets-manager.mdx
@@ -43,6 +43,10 @@ description: "Learn how to configure an AWS Secrets Manager Sync for Infisical."
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over Secrets Manager when keys conflict.
- **Import Secrets (Prioritize AWS Secrets Manager)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Secrets Manager over Infisical when keys conflict.
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **KMS Key**: The AWS KMS key ID or alias to encrypt secrets with.
- **Tags**: Optional tags to add to secrets synced by Infisical.
- **Sync Secret Metadata as Tags**: If enabled, metadata attached to secrets will be added as tags to secrets synced by Infisical.
diff --git a/docs/integrations/secret-syncs/azure-app-configuration.mdx b/docs/integrations/secret-syncs/azure-app-configuration.mdx
index 35a577872c..ee47504bc5 100644
--- a/docs/integrations/secret-syncs/azure-app-configuration.mdx
+++ b/docs/integrations/secret-syncs/azure-app-configuration.mdx
@@ -48,7 +48,10 @@ description: "Learn how to configure an Azure App Configuration Sync for Infisic
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over Secrets Manager when keys conflict.
- **Import Secrets (Prioritize Azure App Configuration)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Secrets Manager over Infisical when keys conflict.
-
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/azure-key-vault.mdx b/docs/integrations/secret-syncs/azure-key-vault.mdx
index 5f55a73ae7..609ba8b8d5 100644
--- a/docs/integrations/secret-syncs/azure-key-vault.mdx
+++ b/docs/integrations/secret-syncs/azure-key-vault.mdx
@@ -51,6 +51,10 @@ description: "Learn how to configure a Azure Key Vault Sync for Infisical."
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over Secrets Manager when keys conflict.
- **Import Secrets (Prioritize Azure Key Vault)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Secrets Manager over Infisical when keys conflict.
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/camunda.mdx b/docs/integrations/secret-syncs/camunda.mdx
index 5ed2cd9ae5..df57a5b7db 100644
--- a/docs/integrations/secret-syncs/camunda.mdx
+++ b/docs/integrations/secret-syncs/camunda.mdx
@@ -39,6 +39,10 @@ description: "Learn how to configure a Camunda Sync for Infisical."
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over Camunda when keys conflict.
- **Import Secrets (Prioritize Camunda)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Camunda over Infisical when keys conflict.
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/databricks.mdx b/docs/integrations/secret-syncs/databricks.mdx
index c9db5f88ad..225bad5b10 100644
--- a/docs/integrations/secret-syncs/databricks.mdx
+++ b/docs/integrations/secret-syncs/databricks.mdx
@@ -46,6 +46,10 @@ description: "Learn how to configure a Databricks Sync for Infisical."
<Note>
Databricks does not support importing secrets.
</Note>
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/gcp-secret-manager.mdx b/docs/integrations/secret-syncs/gcp-secret-manager.mdx
index 72c932116c..ace63787d0 100644
--- a/docs/integrations/secret-syncs/gcp-secret-manager.mdx
+++ b/docs/integrations/secret-syncs/gcp-secret-manager.mdx
@@ -42,6 +42,10 @@ description: "Learn how to configure a GCP Secret Manager Sync for Infisical."
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over GCP Secret Manager when keys conflict.
- **Import Secrets (Prioritize GCP Secret Manager)**: Imports secrets from the destination endpoint before syncing, prioritizing values from GCP Secret Manager over Infisical when keys conflict.
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/github.mdx b/docs/integrations/secret-syncs/github.mdx
index d55ec3d0b7..7786567ccc 100644
--- a/docs/integrations/secret-syncs/github.mdx
+++ b/docs/integrations/secret-syncs/github.mdx
@@ -62,6 +62,10 @@ description: "Learn how to configure a GitHub Sync for Infisical."
<Note>
GitHub does not support importing secrets.
</Note>
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/hashicorp-vault.mdx b/docs/integrations/secret-syncs/hashicorp-vault.mdx
index 0d6c0d6445..48e4d8dfda 100644
--- a/docs/integrations/secret-syncs/hashicorp-vault.mdx
+++ b/docs/integrations/secret-syncs/hashicorp-vault.mdx
@@ -54,6 +54,10 @@ description: "Learn how to configure a Hashicorp Vault Sync for Infisical."
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over Hashicorp Vault when keys conflict.
- **Import Secrets (Prioritize Hashicorp Vault)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Hashicorp Vault over Infisical when keys conflict.
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
</Step>
diff --git a/docs/integrations/secret-syncs/humanitec.mdx b/docs/integrations/secret-syncs/humanitec.mdx
index e8cd7eafc6..ec36bd4dad 100644
--- a/docs/integrations/secret-syncs/humanitec.mdx
+++ b/docs/integrations/secret-syncs/humanitec.mdx
@@ -55,6 +55,10 @@ description: "Learn how to configure a Humanitec Sync for Infisical."
<Note>
Humanitec does not support importing secrets.
</Note>
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/oci-vault.mdx b/docs/integrations/secret-syncs/oci-vault.mdx
new file mode 100644
index 0000000000..67a3426aa1
--- /dev/null
+++ b/docs/integrations/secret-syncs/oci-vault.mdx
@@ -0,0 +1,180 @@
+---
+title: "OCI Vault Sync"
+description: "Learn how to configure an Oracle Cloud Infrastructure Vault Sync for Infisical."
+---
+
+**Prerequisites:**
+- Create an [OCI Connection](/integrations/app-connections/oci) with the required **Secret Sync** permissions
+- [Create](https://docs.oracle.com/en-us/iaas/Content/Identity/compartments/To_create_a_compartment.htm) or use an existing OCI Compartment (which the OCI Connection is authorized to access)
+- [Create](https://docs.oracle.com/en-us/iaas/Content/KeyManagement/Tasks/managingvaults_topic-To_create_a_new_vault.htm#createnewvault) or use an existing OCI Vault
+
+<Tabs>
+ <Tab title="Infisical UI">
+ <Steps>
+ <Step title="Add Sync">
+ Navigate to **Project** > **Integrations** and select the **Secret Syncs** tab. Click on the **Add Sync** button.
+
+ ![Secret Syncs Tab](/images/secret-syncs/general/secret-sync-tab.png)
+ </Step>
+ <Step title="Select 'OCI Vault'">
+ ![Select OCI Vault](/images/secret-syncs/oci-vault/select-option.png)
+ </Step>
+ <Step title="Configure source">
+ Configure the **Source** from where secrets should be retrieved, then click **Next**.
+
+ ![Configure Source](/images/secret-syncs/oci-vault/configure-source.png)
+
+ - **Environment**: The project environment to retrieve secrets from.
+ - **Secret Path**: The folder path to retrieve secrets from.
+
+ <Tip>
+ If you need to sync secrets from multiple folder locations, check out [secret imports](/documentation/platform/secret-reference#secret-imports).
+ </Tip>
+ </Step>
+ <Step title="Configure destination">
+ Configure the **Destination** to where secrets should be deployed, then click **Next**.
+
+ ![Configure Destination](/images/secret-syncs/oci-vault/configure-destination.png)
+
+ - **OCI Connection**: The OCI Connection to authenticate with.
+ - **Compartment**: The compartment where the vault is located.
+ - **Vault**: The vault to sync secrets to.
+ - **Encryption Key**: The encryption key to use when creating secrets in the vault.
+ </Step>
+ <Step title="Configure sync options">
+ Configure the **Sync Options** to specify how secrets should be synced, then click **Next**.
+
+ ![Configure Sync Options](/images/secret-syncs/oci-vault/configure-sync-options.png)
+
+ - **Initial Sync Behavior**: Determines how Infisical should resolve the initial sync.
+ - **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
+ - **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over OCI Vault when keys conflict.
+ - **Import Secrets (Prioritize OCI Vault)**: Imports secrets from the destination endpoint before syncing, prioritizing values from OCI Vault over Infisical when keys conflict.
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
+ - **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
+ - **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
+ </Step>
+ <Step title="Configure details">
+ Configure the **Details** of your OCI Vault Sync, then click **Next**.
+
+ ![Configure Details](/images/secret-syncs/oci-vault/configure-details.png)
+
+ - **Name**: The name of your sync. Must be slug-friendly.
+ - **Description**: An optional description for your sync.
+ </Step>
+ <Step title="Review configuration">
+ Review your OCI Vault Sync configuration, then click **Create Sync**.
+
+ ![Review Configuration](/images/secret-syncs/oci-vault/review-configuration.png)
+ </Step>
+ <Step title="Sync created">
+ If enabled, your OCI Vault Sync will begin syncing your secrets to the destination endpoint.
+
+ ![Sync Created](/images/secret-syncs/oci-vault/sync-created.png)
+ </Step>
+ </Steps>
+ </Tab>
+ <Tab title="API">
+ To create an **OCI Vault Sync**, make an API request to the [Create OCI Vault Sync](/api-reference/endpoints/secret-syncs/oci-vault/create) API endpoint.
+
+ ### Sample request
+
+ ```bash Request
+ curl --request POST \
+ --url https://app.infisical.com/api/v1/secret-syncs/oci-vault \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "name": "my-oci-vault-sync",
+ "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "description": "an example sync",
+ "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "environment": "dev",
+ "secretPath": "/my-secrets",
+ "isEnabled": true,
+ "syncOptions": {
+ "initialSyncBehavior": "overwrite-destination"
+ },
+ "destinationConfig": {
+ "compartmentOcid": "...",
+ "vaultOcid": "...",
+ "keyOcid": "..."
+ }
+ }'
+ ```
+
+ ### Sample response
+
+ ```bash Response
+ {
+ "secretSync": {
+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "name": "my-oci-vault-sync",
+ "description": "an example sync",
+ "isEnabled": true,
+ "version": 1,
+ "folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "createdAt": "2023-11-07T05:31:56Z",
+ "updatedAt": "2023-11-07T05:31:56Z",
+ "syncStatus": "succeeded",
+ "lastSyncJobId": "123",
+ "lastSyncMessage": null,
+ "lastSyncedAt": "2023-11-07T05:31:56Z",
+ "importStatus": null,
+ "lastImportJobId": null,
+ "lastImportMessage": null,
+ "lastImportedAt": null,
+ "removeStatus": null,
+ "lastRemoveJobId": null,
+ "lastRemoveMessage": null,
+ "lastRemovedAt": null,
+ "syncOptions": {
+ "initialSyncBehavior": "overwrite-destination"
+ },
+ "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "connection": {
+ "app": "oci",
+ "name": "my-oci-connection",
+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
+ },
+ "environment": {
+ "slug": "dev",
+ "name": "Development",
+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
+ },
+ "folder": {
+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
+ "path": "/my-secrets"
+ },
+ "destination": "oci-vault",
+ "destinationConfig": {
+ "compartmentOcid": "...",
+ "vaultOcid": "...",
+ "keyOcid": "..."
+ }
+ }
+ }
+ ```
+ </Tab>
+</Tabs>
+
+## FAQ
+
+<AccordionGroup>
+ <Accordion title="How are non-active lifecycle states treated?">
+ When Infisical attempts to sync secrets, the sync will fail and attempt to re-sync if **any secret** has one of the following lifecycle states:
+ - SchedulingDeletion
+ - CancellingDeletion
+ - Deleting
+ - Creating
+ - Updating
+
+ We do this to prevent any desync issues.
+ </Accordion>
+ <Accordion title="What happens if I create / update a variable that's scheduled for deletion in OCI Vault?">
+ In the case that a variable is created or updated while it's scheduled for deletion in OCI Vault, we cancel the deletion and update the variable. This action may take up to a minute since Infisical must wait for OCI to completely cancel the deletion and then update the variable.
+ </Accordion>
+</AccordionGroup>
diff --git a/docs/integrations/secret-syncs/overview.mdx b/docs/integrations/secret-syncs/overview.mdx
index 0df04cbb7b..87527fd02f 100644
--- a/docs/integrations/secret-syncs/overview.mdx
+++ b/docs/integrations/secret-syncs/overview.mdx
@@ -93,4 +93,26 @@ via the UI or API for the third-party service you intend to sync secrets to.
<Note>
Infisical is continuously expanding it's Secret Sync third-party service support. If the service you need isn't available,
you can still use our Native Integrations in the interim, or contact us at [email protected] to make a request .
-</Note>
\ No newline at end of file
+</Note>
+
+## Key Schemas
+
+Key Schemas transform your secret keys by applying a prefix, suffix, or format pattern during sync to external destinations. This makes it clear which secrets are managed by Infisical and prevents accidental changes to unrelated secrets.
+
+**Example:**
+- Infisical key: `SECRET_1`
+- Schema: `INFISICAL_{{secretKey}}`
+- Synced key: `INFISICAL_SECRET_1`
+
+<div align="center">
+ ```mermaid
+ graph LR
+ A[Infisical: **SECRET_1**] -->|Apply Schema| B[Destination: **INFISICAL_SECRET_1**]
+ style B fill:#F4FFE6,stroke:#96D600,stroke-width:2px,color:black,rx:15px
+ style A fill:#E6F4FF,stroke:#0096D6,stroke-width:2px,color:black,rx:15px
+ ```
+</div>
+
+<Note>
+ When importing secrets from the destination into Infisical, the schema is stripped from imported secret keys.
+</Note>
diff --git a/docs/integrations/secret-syncs/teamcity.mdx b/docs/integrations/secret-syncs/teamcity.mdx
index af4c8d76a1..3482101ca0 100644
--- a/docs/integrations/secret-syncs/teamcity.mdx
+++ b/docs/integrations/secret-syncs/teamcity.mdx
@@ -48,7 +48,10 @@ description: "Learn how to configure a TeamCity Sync for Infisical."
<Note>
Infisical only syncs secrets from within the target scope; inherited secrets will not be imported.
</Note>
-
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/terraform-cloud.mdx b/docs/integrations/secret-syncs/terraform-cloud.mdx
index 80a087d2b6..d2f762ef17 100644
--- a/docs/integrations/secret-syncs/terraform-cloud.mdx
+++ b/docs/integrations/secret-syncs/terraform-cloud.mdx
@@ -56,6 +56,10 @@ description: "Learn how to configure a Terraform Cloud Sync for Infisical."
<Note>
Terraform Cloud does not support importing secrets.
</Note>
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/vercel.mdx b/docs/integrations/secret-syncs/vercel.mdx
index 593874dee7..c903d3faa4 100644
--- a/docs/integrations/secret-syncs/vercel.mdx
+++ b/docs/integrations/secret-syncs/vercel.mdx
@@ -43,6 +43,10 @@ description: "Learn how to configure a Vercel Sync for Infisical."
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over Vercel when keys conflict.
- **Import Secrets (Prioritize Vercel)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Vercel over Infisical when keys conflict.
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/integrations/secret-syncs/windmill.mdx b/docs/integrations/secret-syncs/windmill.mdx
index 90d35f8b89..e98a2c7b64 100644
--- a/docs/integrations/secret-syncs/windmill.mdx
+++ b/docs/integrations/secret-syncs/windmill.mdx
@@ -44,6 +44,10 @@ description: "Learn how to configure a Windmill Sync for Infisical."
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over Windmill when keys conflict.
- **Import Secrets (Prioritize Windmill)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Windmill over Infisical when keys conflict.
+ - **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name.
+ <Note>
+ We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
+ </Note>
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
diff --git a/docs/internals/bug-bounty.mdx b/docs/internals/bug-bounty.mdx
index b823e62468..e45de05bff 100644
--- a/docs/internals/bug-bounty.mdx
+++ b/docs/internals/bug-bounty.mdx
@@ -41,7 +41,7 @@ All final reward amounts are determined at Infisical's discretion based on impac
### Out of Scope
-- Social engineering or phishing
+- Social engineering or phishing (including email hyperlink injection without code execution)
- Rate limiting issues on non-sensitive endpoints
- Denial-of-service attacks that require authentication and don't impact core service availability
- Findings based on outdated or forked code not maintained by the Infisical team
@@ -57,4 +57,24 @@ We ask that researchers:
- Use testing accounts where possible
- Give us a reasonable window to investigate and patch before going public
-Researchers can also spin up our [self-hosted version of Infisical](/self-hosting/overview) to test for vulnerabilities locally.
\ No newline at end of file
+Researchers can also spin up our [self-hosted version of Infisical](/self-hosting/overview) to test for vulnerabilities locally.
+
+### Program Conduct and Enforcement
+
+We value professional and collaborative interaction with security researchers. To maintain the integrity of our bug bounty program, we expect all participants to adhere to the following guidelines:
+
+- Maintain professional communication in all interactions
+- Do not threaten public disclosure of vulnerabilities before we've had reasonable time to investigate and address the issue
+- Do not attempt to extort or coerce compensation through threats
+- Follow the responsible disclosure process outlined in this document
+- Do not use automated scanning tools without prior permission
+
+Violations of these guidelines may result in:
+
+1. **Warning**: For minor violations, we may issue a warning explaining the violation and requesting compliance with program guidelines.
+2. **Temporary Ban**: Repeated minor violations or more serious violations may result in a temporary suspension from the program.
+3. **Permanent Ban**: Severe violations such as threats, extortion attempts, or unauthorized public disclosure will result in permanent removal from the Infisical Bug Bounty Program.
+
+We reserve the right to reject reports, withhold bounties, and remove participants from the program at our discretion for conduct that undermines the collaborative spirit of security research.
+
+Infisical is committed to working respectfully with security researchers who follow these guidelines, and we strive to recognize and reward valuable contributions that help protect our platform and users.
diff --git a/docs/internals/permissions/organization-permissions.mdx b/docs/internals/permissions/organization-permissions.mdx
index c68d845e2a..6de3bd6fe7 100644
--- a/docs/internals/permissions/organization-permissions.mdx
+++ b/docs/internals/permissions/organization-permissions.mdx
@@ -218,3 +218,4 @@ Supports conditions and permission inversion
| `create-gateways` | Add new gateways to organization |
| `edit-gateways` | Modify existing gateway settings |
| `delete-gateways` | Remove gateways from organization |
+| `attach-gateways` | Attach gateways to resources |
diff --git a/docs/internals/permissions/project-permissions.mdx b/docs/internals/permissions/project-permissions.mdx
index 4e0c592cbf..acf95485b3 100644
--- a/docs/internals/permissions/project-permissions.mdx
+++ b/docs/internals/permissions/project-permissions.mdx
@@ -252,11 +252,12 @@ Supports conditions and permission inversion
#### Subject: `certificates`
-| Action | Description |
-| -------- | ----------------------------- |
-| `read` | View certificates |
-| `create` | Issue new certificates |
-| `delete` | Revoke or remove certificates |
+| Action | Description |
+| -------------------- | ----------------------------- |
+| `read` | View certificates |
+| `read-private-key` | Read certificate private key |
+| `create` | Issue new certificates |
+| `delete` | Revoke or remove certificates |
#### Subject: `certificate-templates`
diff --git a/docs/mint.json b/docs/mint.json
index a25a701248..5335c74239 100644
--- a/docs/mint.json
+++ b/docs/mint.json
@@ -112,6 +112,7 @@
"pages": [
"documentation/platform/pki/overview",
"documentation/platform/pki/private-ca",
+ "documentation/platform/pki/subscribers",
"documentation/platform/pki/certificates",
"documentation/platform/pki/pki-issuer",
"documentation/platform/pki/est",
@@ -247,68 +248,99 @@
{
"group": "Authentication Methods",
"pages": [
- "documentation/platform/auth-methods/email-password",
- "documentation/platform/token",
- "documentation/platform/identities/token-auth",
- "documentation/platform/identities/universal-auth",
- "documentation/platform/identities/kubernetes-auth",
- "documentation/platform/identities/gcp-auth",
- "documentation/platform/identities/azure-auth",
- "documentation/platform/identities/aws-auth",
- "documentation/platform/identities/jwt-auth",
{
- "group": "OIDC Auth",
+ "group": "User Authentication",
"pages": [
- "documentation/platform/identities/oidc-auth/general",
- "documentation/platform/identities/oidc-auth/github",
- "documentation/platform/identities/oidc-auth/circleci",
- "documentation/platform/identities/oidc-auth/gitlab",
- "documentation/platform/identities/oidc-auth/terraform-cloud"
- ]
- },
- "documentation/platform/mfa",
- {
- "group": "SSO",
- "pages": [
- "documentation/platform/sso/overview",
- "documentation/platform/sso/google",
- "documentation/platform/sso/github",
- "documentation/platform/sso/gitlab",
- "documentation/platform/sso/okta",
- "documentation/platform/sso/azure",
- "documentation/platform/sso/jumpcloud",
- "documentation/platform/sso/keycloak-saml",
- "documentation/platform/sso/google-saml",
- "documentation/platform/sso/auth0-saml",
+ "documentation/platform/auth-methods/email-password",
{
- "group": "Keycloak OIDC",
+ "group": "SSO",
"pages": [
- "documentation/platform/sso/keycloak-oidc/overview",
- "documentation/platform/sso/keycloak-oidc/group-membership-mapping"
+ "documentation/platform/sso/overview",
+ "documentation/platform/sso/google",
+ "documentation/platform/sso/github",
+ "documentation/platform/sso/gitlab",
+ "documentation/platform/sso/okta",
+ "documentation/platform/sso/azure",
+ "documentation/platform/sso/jumpcloud",
+ "documentation/platform/sso/keycloak-saml",
+ "documentation/platform/sso/google-saml",
+ "documentation/platform/sso/auth0-saml",
+ {
+ "group": "OIDC",
+ "pages": [
+ {
+ "group": "Keycloak OIDC",
+ "pages": [
+ "documentation/platform/sso/keycloak-oidc/overview",
+ "documentation/platform/sso/keycloak-oidc/group-membership-mapping"
+ ]
+ },
+ "documentation/platform/sso/auth0-oidc",
+ {
+ "group": "General OIDC",
+ "pages": [
+ "documentation/platform/sso/general-oidc/overview",
+ "documentation/platform/sso/general-oidc/group-membership-mapping"
+ ]
+ }
+ ]
+ }
]
},
- "documentation/platform/sso/auth0-oidc",
- "documentation/platform/sso/general-oidc"
- ]
- },
- {
- "group": "LDAP",
- "pages": [
- "documentation/platform/ldap/overview",
- "documentation/platform/ldap/jumpcloud",
- "documentation/platform/ldap/general"
+ {
+ "group": "LDAP",
+ "pages": [
+ "documentation/platform/ldap/overview",
+ "documentation/platform/ldap/jumpcloud",
+ "documentation/platform/ldap/general"
+ ]
+ },
+ {
+ "group": "SCIM",
+ "pages": [
+ "documentation/platform/scim/overview",
+ "documentation/platform/scim/okta",
+ "documentation/platform/scim/azure",
+ "documentation/platform/scim/jumpcloud",
+ "documentation/platform/scim/group-mappings"
+ ]
+ }
]
},
+
{
- "group": "SCIM",
+ "group": "Machine Identities",
"pages": [
- "documentation/platform/scim/overview",
- "documentation/platform/scim/okta",
- "documentation/platform/scim/azure",
- "documentation/platform/scim/jumpcloud",
- "documentation/platform/scim/group-mappings"
+ "documentation/platform/identities/aws-auth",
+ "documentation/platform/identities/azure-auth",
+ "documentation/platform/identities/gcp-auth",
+ "documentation/platform/identities/jwt-auth",
+ "documentation/platform/identities/kubernetes-auth",
+ "documentation/platform/identities/oci-auth",
+ "documentation/platform/identities/token-auth",
+ "documentation/platform/identities/universal-auth",
+ {
+ "group": "OIDC Auth",
+ "pages": [
+ "documentation/platform/identities/oidc-auth/general",
+ "documentation/platform/identities/oidc-auth/github",
+ "documentation/platform/identities/oidc-auth/circleci",
+ "documentation/platform/identities/oidc-auth/gitlab",
+ "documentation/platform/identities/oidc-auth/terraform-cloud"
+ ]
+ },
+
+ {
+ "group": "LDAP Auth",
+ "pages": [
+ "documentation/platform/identities/ldap-auth/general",
+ "documentation/platform/identities/ldap-auth/jumpcloud"
+ ]
+ }
]
},
+ "documentation/platform/token",
+ "documentation/platform/mfa",
"documentation/platform/github-org-sync"
]
},
@@ -329,7 +361,8 @@
"group": "Linux Package",
"pages": [
"self-hosting/deployment-options/native/linux-package/installation",
- "self-hosting/deployment-options/native/linux-package/commands-configuration"
+ "self-hosting/deployment-options/native/linux-package/commands-configuration",
+ "self-hosting/deployment-options/linux-upgrade"
]
},
"self-hosting/guides/upgrading-infisical",
@@ -424,6 +457,7 @@
]
},
"integrations/frameworks/terraform",
+ "integrations/frameworks/pulumi",
"integrations/platforms/ansible",
"integrations/platforms/apache-airflow"
]
@@ -448,6 +482,7 @@
"integrations/app-connections/humanitec",
"integrations/app-connections/ldap",
"integrations/app-connections/mssql",
+ "integrations/app-connections/oci",
"integrations/app-connections/postgres",
"integrations/app-connections/teamcity",
"integrations/app-connections/terraform-cloud",
@@ -474,6 +509,7 @@
"integrations/secret-syncs/github",
"integrations/secret-syncs/hashicorp-vault",
"integrations/secret-syncs/humanitec",
+ "integrations/secret-syncs/oci-vault",
"integrations/secret-syncs/teamcity",
"integrations/secret-syncs/terraform-cloud",
"integrations/secret-syncs/vercel",
@@ -675,6 +711,16 @@
"api-reference/endpoints/aws-auth/revoke"
]
},
+ {
+ "group": "OCI Auth",
+ "pages": [
+ "api-reference/endpoints/oci-auth/login",
+ "api-reference/endpoints/oci-auth/attach",
+ "api-reference/endpoints/oci-auth/retrieve",
+ "api-reference/endpoints/oci-auth/update",
+ "api-reference/endpoints/oci-auth/revoke"
+ ]
+ },
{
"group": "Azure Auth",
"pages": [
@@ -715,6 +761,16 @@
"api-reference/endpoints/jwt-auth/revoke"
]
},
+ {
+ "group": "LDAP Auth",
+ "pages": [
+ "api-reference/endpoints/ldap-auth/login",
+ "api-reference/endpoints/ldap-auth/attach",
+ "api-reference/endpoints/ldap-auth/retrieve",
+ "api-reference/endpoints/ldap-auth/update",
+ "api-reference/endpoints/ldap-auth/revoke"
+ ]
+ },
{
"group": "Groups",
"pages": [
@@ -1140,6 +1196,18 @@
"api-reference/endpoints/app-connections/mssql/delete"
]
},
+ {
+ "group": "OCI",
+ "pages": [
+ "api-reference/endpoints/app-connections/oci/list",
+ "api-reference/endpoints/app-connections/oci/available",
+ "api-reference/endpoints/app-connections/oci/get-by-id",
+ "api-reference/endpoints/app-connections/oci/get-by-name",
+ "api-reference/endpoints/app-connections/oci/create",
+ "api-reference/endpoints/app-connections/oci/update",
+ "api-reference/endpoints/app-connections/oci/delete"
+ ]
+ },
{
"group": "PostgreSQL",
"pages": [
@@ -1343,6 +1411,20 @@
"api-reference/endpoints/secret-syncs/humanitec/remove-secrets"
]
},
+ {
+ "group": "OCI",
+ "pages": [
+ "api-reference/endpoints/secret-syncs/oci-vault/list",
+ "api-reference/endpoints/secret-syncs/oci-vault/get-by-id",
+ "api-reference/endpoints/secret-syncs/oci-vault/get-by-name",
+ "api-reference/endpoints/secret-syncs/oci-vault/create",
+ "api-reference/endpoints/secret-syncs/oci-vault/update",
+ "api-reference/endpoints/secret-syncs/oci-vault/delete",
+ "api-reference/endpoints/secret-syncs/oci-vault/sync-secrets",
+ "api-reference/endpoints/secret-syncs/oci-vault/import-secrets",
+ "api-reference/endpoints/secret-syncs/oci-vault/remove-secrets"
+ ]
+ },
{
"group": "TeamCity",
"pages": [
@@ -1427,6 +1509,18 @@
{
"group": "Infisical PKI",
"pages": [
+ {
+ "group": "Subscribers",
+ "pages": [
+ "api-reference/endpoints/pki/subscribers/list-certs",
+ "api-reference/endpoints/pki/subscribers/create",
+ "api-reference/endpoints/pki/subscribers/read",
+ "api-reference/endpoints/pki/subscribers/update",
+ "api-reference/endpoints/pki/subscribers/delete",
+ "api-reference/endpoints/pki/subscribers/issue-cert",
+ "api-reference/endpoints/pki/subscribers/sign-cert"
+ ]
+ },
{
"group": "Certificate Authorities",
"pages": [
@@ -1454,6 +1548,8 @@
"api-reference/endpoints/certificates/revoke",
"api-reference/endpoints/certificates/delete",
"api-reference/endpoints/certificates/cert-body",
+ "api-reference/endpoints/certificates/bundle",
+ "api-reference/endpoints/certificates/private-key",
"api-reference/endpoints/certificates/issue-certificate",
"api-reference/endpoints/certificates/sign-certificate"
]
diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdx
index d9eef9cb0c..b63c58d3af 100644
--- a/docs/self-hosting/configuration/envars.mdx
+++ b/docs/self-hosting/configuration/envars.mdx
@@ -29,6 +29,19 @@ Used to configure platform-specific security and operational settings
Specifies the internal port on which the application listens.
</ParamField>
+<ParamField query="HOST" type="string" default="localhost" optional>
+ Specifies the network interface Infisical will bind to when accepting incoming connections.
+
+ By default, Infisical binds to `localhost`, which restricts access to connections from the same machine.
+
+ To make the application accessible externally (e.g., for self-hosted deployments), set this to `0.0.0.0`, which tells the server to listen on all network interfaces.
+
+ Example values:
+ - `localhost` (default, same as `127.0.0.1`)
+ - `0.0.0.0` (all interfaces, accessible externally)
+ - `192.168.1.100` (specific interface IP)
+</ParamField>
+
<ParamField query="TELEMETRY_ENABLED" type="string" default="true" optional>
Telemetry helps us improve Infisical but if you want to disable it you may set
this to `false`.
@@ -612,6 +625,26 @@ To help you sync secrets from Infisical to services such as Github and Gitlab, I
</ParamField>
</Accordion>
+## Secret Scanning
+
+<Accordion title="GitHub">
+ <ParamField query="SECRET_SCANNING_GIT_APP_ID" type="string" default="none" optional>
+ The App ID of your GitHub App.
+ </ParamField>
+
+ <ParamField query="SECRET_SCANNING_GIT_APP_SLUG" type="string" default="none" optional>
+ The slug of your GitHub App.
+ </ParamField>
+
+ <ParamField query="SECRET_SCANNING_PRIVATE_KEY" type="string" default="none" optional>
+ A private key for your GitHub App.
+ </ParamField>
+
+ <ParamField query="SECRET_SCANNING_WEBHOOK_SECRET" type="string" default="none" optional>
+ The webhook secret of your GitHub App.
+ </ParamField>
+</Accordion>
+
## Observability
You can configure Infisical to collect and expose telemetry data for analytics and monitoring.
diff --git a/docs/self-hosting/deployment-options/linux-upgrade.mdx b/docs/self-hosting/deployment-options/linux-upgrade.mdx
new file mode 100644
index 0000000000..6712626bd0
--- /dev/null
+++ b/docs/self-hosting/deployment-options/linux-upgrade.mdx
@@ -0,0 +1,390 @@
+---
+title: "Upgrading"
+description: "How to upgrade Infisical deployment using linux package"
+---
+
+This guide explains how to upgrade Infisical Linux package installations to newer versions.
+The Infisical Linux package includes only the Infisical service component itself, as PostgreSQL and Redis databases are managed separately.
+Upgrades for PostgreSQL and Redis are not covered in this guide as they depend on your specific database deployment method.
+
+## Upgrade Options
+
+There are two primary methods to upgrade Infisical:
+
+1. **Standard Upgrade (with brief downtime)**: The simplest approach that briefly takes Infisical offline during the upgrade.
+2. **Minimal-Downtime Upgrade**: For multi-node deployments where high availability is required.
+
+## Before You Begin
+
+### Checking Your Current Version
+
+Before upgrading, note your current Infisical version:
+
+```bash
+cat /opt/infisical-core/version-manifest.txt
+```
+
+Look for `infisical` component. This will be the version of Infisical currently installed.
+
+### Prerequisites
+
+- Verify that your PostgreSQL and Redis instances are up and running
+- Back up your PostgreSQL database before proceeding with any upgrade
+- Review release notes for the version you're upgrading to
+
+### Creating a Database Backup
+
+We strongly recommend backing up your database before upgrading.
+Your backup approach may look different depending on how you configured PostgreSQL and whether it's self-managed or using a managed service.
+Here is a sample of how you would perform a manual backup:
+
+```bash
+# Example PostgreSQL backup command (adjust parameters as needed)
+pg_dump -U <username> -h <db-host> -d <db-name> > infisical_backup.sql
+```
+
+### Database Migrations During Upgrade
+
+By default, Infisical runs database migrations automatically on startup.
+
+- It uses database locks to ensure only one instance runs migrations at a time
+- Other instances will wait for the lock to be released before continuing startup
+- This prevents race conditions and database conflicts
+
+## Standard Upgrade (with Downtime)
+
+This method is suitable for single-node deployments or situations where a brief downtime is acceptable.
+
+<Steps>
+ <Step title="Stop the Infisical service">
+ ```bash
+ infisical-ctl stop
+ ```
+ </Step>
+ <Step title="Upgrade the Infisical package">
+To upgrade to the latest version:
+
+<Tabs>
+ <Tab title="Debian/Ubuntu">
+ ```bash
+ sudo apt-get update && sudo apt-get install -y infisical-core
+ ```
+ </Tab>
+ <Tab title="RHEL/CentOS/Amazon Linux">
+ ```bash
+ sudo yum update infisical-core
+ ```
+ </Tab>
+</Tabs>
+
+To upgrade to a specific version:
+
+<Tabs>
+ <Tab title="Debian/Ubuntu">
+ ```bash
+ sudo apt-get install -y infisical-core=<version>
+ ```
+ </Tab>
+ <Tab title="RHEL/CentOS/Amazon Linux">
+ ```bash
+ sudo yum install infisical-core-<version>
+ ```
+ </Tab>
+</Tabs>
+
+ </Step>
+ <Step title="Apply configuration changes">
+ ```bash
+ infisical-ctl reconfigure
+ ```
+ </Step>
+
+ <Step title="Start Infisical">
+ ```bash
+ infisical-ctl start
+ ```
+ </Step>
+
+ <Step title="Verify the upgrade">
+ ```bash
+ infisical-ctl status
+ ```
+
+ Check the logs for any issues:
+ ```bash
+ infisical-ctl tail
+ ```
+ </Step>
+</Steps>
+
+## Minimal-Downtime Upgrade
+
+For multi-node setups where you need to maintain availability during upgrades, follow this procedure. This approach requires at least two Infisical nodes behind a load balancer.
+
+### Understanding Traffic Draining
+
+"Draining" a server means gracefully removing it from the pool of active servers without disrupting existing connections. When you drain a server:
+
+1. The load balancer stops sending new requests to the server
+2. Existing connections are allowed to complete naturally
+3. Once all connections finish, the server can be safely taken offline for maintenance
+
+This approach ensures users/machines do not experience sudden connection errors during the upgrade process.
+
+### Preparing for the Upgrade
+
+1. **Designate a deploy node**: Choose any single node that will run migrations. This node will be upgraded first.
+
+2. **Configure your load balancer**: Ensure your load balancer can perform health checks against Infisical's `api/status` endpoint.
+
+### Upgrade Process
+
+#### On the deploy node:
+
+<Steps>
+<Step title="Drain traffic from the node">
+
+Drain the traffic on this node gracefully. You can do this in a number of ways depending on the load balancer you have configured.
+Approaches for some common load balancers are provided below:
+
+<Tabs>
+ <Tab title="NGINX">
+ If using NGINX as a load balancer, you can remove the server from the upstream pool temporarily:
+ ```bash
+ # Edit your NGINX configuration to comment out or remove the server
+ sudo nano /path/to/your/nginx-config.conf
+
+ # Reload NGINX to apply changes
+ sudo nginx -s reload
+ ```
+ </Tab>
+ <Tab title="HAProxy">
+ If using HAProxy, you can put the server in maintenance mode:
+ ```bash
+ # Using the HAProxy socket command
+ echo "disable server infisical_backend/infisical-node1" | socat stdio /var/lib/haproxy/stats
+ ```
+ </Tab>
+ <Tab title="AWS ALB/ELB">
+ Deregister the instance from the load balancer using the AWS console or CLI
+ </Tab>
+ <Tab title="Other load balancers">
+ Follow your load balancer's documentation for instructions on draining procedure
+ </Tab>
+</Tabs>
+</Step>
+
+<Step title="Verify no new traffic is arriving">
+Verify no new traffic is arriving before proceeding with the upgrade.
+</Step>
+
+<Step title="Stop Infisical on this node">
+```bash
+infisical-ctl stop
+```
+</Step>
+
+<Step title="Upgrade the Infisical package">
+
+To upgrade to the latest version:
+
+<Tabs>
+ <Tab title="Debian/Ubuntu">
+ ```bash
+ sudo apt-get update && sudo apt-get install -y infisical-core
+ ```
+ </Tab>
+ <Tab title="RHEL/CentOS/Amazon Linux">
+ ```bash
+ sudo yum update infisical-core
+ ```
+ </Tab>
+</Tabs>
+
+To upgrade to a specific version:
+
+<Tabs>
+ <Tab title="Debian/Ubuntu">
+ ```bash
+ sudo apt-get install -y infisical-core=<version>
+ ```
+ </Tab>
+ <Tab title="RHEL/CentOS/Amazon Linux">
+ ```bash
+ sudo yum install infisical-core-<version>
+ ```
+ </Tab>
+</Tabs>
+</Step>
+
+<Step title="Apply configuration and start the service">
+```bash
+infisical-ctl reconfigure
+```
+</Step>
+
+<Step title="Verify the upgrade and migration success">
+```bash
+infisical-ctl tail
+```
+Look for successful migration messages in the logs.
+</Step>
+
+<Step title="Return this node to load balancer pool">
+Re-enable the server in your load balancer using the same method you used to remove it.
+</Step>
+</Steps>
+
+#### On all remaining nodes (one at a time):
+
+<Steps>
+<Step title="Drain traffic from the node">
+Follow the same draining procedure as described for the deploy node:
+
+- Remove the server from your load balancer's active pool
+- Wait for existing connections to complete
+- Verify the node is no longer receiving traffic
+</Step>
+
+<Step title="Stop Infisical on this node">
+```bash
+infisical-ctl stop
+```
+</Step>
+
+<Step title="Upgrade the Infisical package">
+To upgrade to the latest version:
+
+<Tabs>
+ <Tab title="Debian/Ubuntu">
+ ```bash
+ sudo apt-get update && sudo apt-get install -y infisical-core
+ ```
+ </Tab>
+ <Tab title="RHEL/CentOS/Amazon Linux">
+ ```bash
+ sudo yum update infisical-core
+ ```
+ </Tab>
+</Tabs>
+
+To upgrade to a specific version:
+
+<Tabs>
+ <Tab title="Debian/Ubuntu">
+ ```bash
+ sudo apt-get install -y infisical-core=<version>
+ ```
+ </Tab>
+ <Tab title="RHEL/CentOS/Amazon Linux">
+ ```bash
+ sudo yum install infisical-core-<version>
+ ```
+ </Tab>
+</Tabs>
+</Step>
+
+<Step title="Apply configuration and start the service">
+```bash
+infisical-ctl reconfigure
+```
+</Step>
+
+<Step title="Verify the upgrade success">
+```bash
+infisical-ctl status
+infisical-ctl tail
+```
+</Step>
+
+<Step title="Wait for service to be fully operational">
+- Check logs to ensure the service has started successfully
+- Verify it can connect to the database and Redis
+</Step>
+
+<Step title="Return the node to service">
+Re-enable the server in your load balancer using the same method you used to remove it.
+</Step>
+
+<Step title="Verify traffic is flowing correctly">
+Check logs and monitoring to ensure traffic is flowing correctly.
+</Step>
+
+<Step title="Repeat for each remaining node">
+Repeat steps 1-7 for each remaining node, one at a time.
+</Step>
+
+<Step title="Verify application functionality">
+After all nodes are upgraded, verify that the application is functioning correctly:
+- Test core functionality
+- Check logs for any errors
+</Step>
+</Steps>
+
+## Rolling Back
+
+If you need to roll back to a previous version of Infisical, follow steps below.
+
+<Steps>
+<Step title="Stop the Infisical service">
+```bash
+infisical-ctl stop
+```
+</Step>
+
+<Step title="Install the previous version">
+For Debian/Ubuntu:
+```bash
+sudo apt-get install -y infisical-core=<previous-version>
+```
+
+For RHEL/CentOS/Amazon Linux:
+```bash
+sudo yum downgrade infisical-core-<previous-version>
+```
+</Step>
+
+<Step title="Restore your database from backup">
+Restore your Postgres/Redis database from backup.
+</Step>
+
+<Step title="Start the service">
+```bash
+infisical-ctl reconfigure
+```
+</Step>
+
+<Step title="Verify the rollback">
+```bash
+infisical-ctl status
+```
+</Step>
+</Steps>
+
+## Troubleshooting
+
+<AccordionGroup>
+<Accordion title="Migration Issues">
+If you encounter database migration issues:
+
+1. Check the logs:
+ ```bash
+ infisical-ctl tail
+ ```
+
+2. Ensure the database user has sufficient privileges to create/modify tables.
+
+3. If migrations fail repeatedly, consider restoring from the backup you took prior to upgrading.
+
+</Accordion>
+
+<Accordion title="Service Won't Start After Upgrade">
+1. Check for configuration errors:
+ ```bash
+ infisical-ctl tail
+ infisical-ctl status
+ ```
+
+2. Verify all required environment variables are set in your `/etc/infisical/infisical.rb` file.
+</Accordion>
+</AccordionGroup>
\ No newline at end of file
diff --git a/docs/self-hosting/guides/custom-certificates.mdx b/docs/self-hosting/guides/custom-certificates.mdx
index 67b258d08a..41947a0d99 100644
--- a/docs/self-hosting/guides/custom-certificates.mdx
+++ b/docs/self-hosting/guides/custom-certificates.mdx
@@ -4,19 +4,19 @@ description: "Learn how to configure Infisical with custom certificates"
---
By default, the Infisical Docker image includes certificates from well-known public certificate authorities.
-However, some integrations with Infisical may need to communicate with your internal services that use private certificate authorities.
+However, some integrations with Infisical may need to communicate with your internal services that use private certificate authorities.
To configure trust for custom certificates, follow these steps. This is particularly useful for connecting Infisical with self-hosted services like GitLab.
## Prerequisites
- Docker
- Standalone [Infisical image](https://hub.docker.com/r/infisical/infisical)
-- Certificate public key `.pem` files
+- Certificate public key `.crt` files
## Setup
-1. Place all your public key `.pem` files into a single directory.
-2. Mount the directory containing the `.pem` files to the `usr/local/share/ca-certificates/` path in the Infisical container.
+1. Place all your public key `.crt` files into a single directory.
+2. Mount the directory containing the `.crt` files to the `/usr/local/share/ca-certificates/` path in the Infisical container.
3. Set the following environment variable on your Infisical container:
```
NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index e7f57e85c3..121dcd0946 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -78,7 +78,7 @@
"react-day-picker": "^9.4.3",
"react-dom": "^18.3.1",
"react-helmet": "^6.1.0",
- "react-hook-form": "^7.54.0",
+ "react-hook-form": "^7.56.3",
"react-i18next": "^15.2.0",
"react-icons": "^5.4.0",
"react-markdown": "^10.0.1",
@@ -11484,9 +11484,9 @@
}
},
"node_modules/react-hook-form": {
- "version": "7.54.0",
- "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.54.0.tgz",
- "integrity": "sha512-PS05+UQy/IdSbJNojBypxAo9wllhHgGmyr8/dyGQcPoiMf3e7Dfb9PWYVRco55bLbxH9S+1yDDJeTdlYCSxO3A==",
+ "version": "7.56.3",
+ "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.56.3.tgz",
+ "integrity": "sha512-IK18V6GVbab4TAo1/cz3kqajxbDPGofdF0w7VHdCo0Nt8PrPlOZcuuDq9YYIV1BtjcX78x0XsldbQRQnQXWXmw==",
"license": "MIT",
"engines": {
"node": ">=18.0.0"
diff --git a/frontend/package.json b/frontend/package.json
index 6225b78f03..7cd636343f 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -82,7 +82,7 @@
"react-day-picker": "^9.4.3",
"react-dom": "^18.3.1",
"react-helmet": "^6.1.0",
- "react-hook-form": "^7.54.0",
+ "react-hook-form": "^7.56.3",
"react-i18next": "^15.2.0",
"react-icons": "^5.4.0",
"react-markdown": "^10.0.1",
diff --git a/frontend/public/images/integrations/Oracle.png b/frontend/public/images/integrations/Oracle.png
new file mode 100644
index 0000000000..14845d2f22
Binary files /dev/null and b/frontend/public/images/integrations/Oracle.png differ
diff --git a/frontend/public/lotties/check.json b/frontend/public/lotties/check.json
new file mode 100644
index 0000000000..8d66090dc8
--- /dev/null
+++ b/frontend/public/lotties/check.json
@@ -0,0 +1 @@
+{"v":"5.12.1","fr":60,"ip":0,"op":60,"w":500,"h":500,"nm":"system-regular-31-check","ddd":0,"assets":[{"id":"comp_1","nm":"hover-check","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":".primary.design","cl":"primary design","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[253.419,260.347,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[149.956,-122.947],[-31.321,57.362],[-83.54,5.208]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":1,"s":[100]},{"t":20,"s":[100]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":1,"s":[28.5]},{"t":20,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[0.91,0.91,0.914,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-31-check').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":31.3,"ix":5},"lc":2,"lj":2,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":1,"op":60,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":".primary.design","cl":"primary design","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[253.419,260.347,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[149.956,-122.947],[-31.321,57.362],[-83.54,5.208]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.05],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":21,"s":[0]},{"t":60,"s":[100]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.05],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":21,"s":[0]},{"t":60,"s":[28.5]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[0.91,0.91,0.914,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-31-check').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":31.3,"ix":5},"lc":2,"lj":2,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":1,"op":60,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":".primary.design","cl":"primary design","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":-180,"ix":10},"p":{"a":0,"k":[250.004,250.003,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-2.572,-106.399],[106.399,-2.572],[2.572,106.399],[-106.399,2.572]],"o":[[2.572,106.399],[-106.399,2.572],[-2.572,-106.399],[106.399,-2.572]],"v":[[192.652,-4.656],[4.656,192.652],[-192.652,4.656],[-4.656,-192.652]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.91,0.91,0.914,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-31-check').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":31.3,"ix":5},"lc":2,"lj":2,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":1,"op":60,"st":1,"ct":1,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":".primary.design","cl":"primary design","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,249.974,0],"ix":2,"l":2},"a":{"a":0,"k":[250,249.999,0],"ix":1,"l":2},"s":{"a":0,"k":[2083,2083,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.57,-1.64],[2.27,-0.05],[1.65,1.56],[0.05,2.27],[-4.68,0.11],[-0.07,0],[-1.6,-1.52],[-0.05,-2.27]],"o":[[-1.57,1.64],[-2.28,0.06],[-1.65,-1.56],[-0.11,-4.69],[0.07,0],[2.19,0],[1.64,1.57],[0.06,2.26]],"v":[[6.15,5.861],[0.2,8.491],[-5.87,6.151],[-8.5,0.201],[-0.21,-8.499],[0,-8.499],[5.86,-6.149],[8.49,-0.199]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[2.67,-0.06],[-0.13,-5.51],[-1.93,-1.84],[-2.58,0],[-0.08,0],[-1.84,1.93],[0.06,2.67],[1.93,1.84]],"o":[[-5.51,0.14],[0.06,2.67],[1.88,1.79],[0.08,0],[2.67,-0.06],[1.84,-1.93],[-0.06,-2.67],[-1.94,-1.84]],"v":[[-0.24,-9.999],[-10,0.241],[-6.9,7.241],[-0.01,10.001],[0.24,10.001],[7.24,6.901],[10,-0.239],[6.9,-7.239]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.91,0.91,0.914,1],"ix":4,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-31-check').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Fill","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[250,249.999],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.3,-0.29],[0,0],[0,0],[0.29,-0.29],[-0.29,-0.29],[0,0],[-0.19,0],[-0.15,0.15],[0,0],[0.3,0.3]],"o":[[0,0],[0,0],[-0.29,-0.29],[-0.29,0.29],[0,0],[0.15,0.15],[0.19,0],[0,0],[0.3,-0.29],[-0.29,-0.29]],"v":[[3.476,-3.286],[-1.504,1.694],[-3.484,-0.276],[-4.544,-0.276],[-4.544,0.784],[-2.034,3.284],[-1.504,3.504],[-0.974,3.284],[4.536,-2.226],[4.536,-3.286]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.91,0.91,0.914,1],"ix":4,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-31-check').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Fill","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[250.164,250.496],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":60,"op":300,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":".primary.design","cl":"primary design","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,249.974,0],"ix":2,"l":2},"a":{"a":0,"k":[250,249.999,0],"ix":1,"l":2},"s":{"a":0,"k":[2083,2083,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.57,-1.64],[2.27,-0.05],[1.65,1.56],[0.05,2.27],[-4.68,0.11],[-0.07,0],[-1.6,-1.52],[-0.05,-2.27]],"o":[[-1.57,1.64],[-2.28,0.06],[-1.65,-1.56],[-0.11,-4.69],[0.07,0],[2.19,0],[1.64,1.57],[0.06,2.26]],"v":[[6.15,5.861],[0.2,8.491],[-5.87,6.151],[-8.5,0.201],[-0.21,-8.499],[0,-8.499],[5.86,-6.149],[8.49,-0.199]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[2.67,-0.06],[-0.13,-5.51],[-1.93,-1.84],[-2.58,0],[-0.08,0],[-1.84,1.93],[0.06,2.67],[1.93,1.84]],"o":[[-5.51,0.14],[0.06,2.67],[1.88,1.79],[0.08,0],[2.67,-0.06],[1.84,-1.93],[-0.06,-2.67],[-1.94,-1.84]],"v":[[-0.24,-9.999],[-10,0.241],[-6.9,7.241],[-0.01,10.001],[0.24,10.001],[7.24,6.901],[10,-0.239],[6.9,-7.239]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.91,0.91,0.914,1],"ix":4,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-31-check').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Fill","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[250,249.999],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.3,-0.29],[0,0],[0,0],[0.29,-0.29],[-0.29,-0.29],[0,0],[-0.19,0],[-0.15,0.15],[0,0],[0.3,0.3]],"o":[[0,0],[0,0],[-0.29,-0.29],[-0.29,0.29],[0,0],[0.15,0.15],[0.19,0],[0,0],[0.3,-0.29],[-0.29,-0.29]],"v":[[3.476,-3.286],[-1.504,1.694],[-3.484,-0.276],[-4.544,-0.276],[-4.544,0.784],[-2.034,3.284],[-1.504,3.504],[-0.974,3.284],[4.536,-2.226],[4.536,-3.286]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.91,0.91,0.914,1],"ix":4,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-31-check').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Fill","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[250.164,250.496],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":1,"st":0,"ct":1,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":3,"nm":"control","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ef":[{"ty":5,"nm":"primary","np":3,"mn":"ADBE Color Control","ix":1,"en":1,"ef":[{"ty":2,"nm":"Color","mn":"ADBE Color Control-0001","ix":1,"v":{"a":0,"k":[0.91,0.91,0.914],"ix":1}}]}],"ip":0,"op":302,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":0,"nm":"hover-check","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2,"l":2},"a":{"a":0,"k":[250,250,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":500,"h":500,"ip":0,"op":70,"st":0,"bm":0}],"markers":[{"tm":0,"cm":"default:hover-check","dr":60}],"props":{}}
\ No newline at end of file
diff --git a/frontend/public/lotties/pki-subscriber.json b/frontend/public/lotties/pki-subscriber.json
new file mode 100644
index 0000000000..f6e0ce16e1
--- /dev/null
+++ b/frontend/public/lotties/pki-subscriber.json
@@ -0,0 +1 @@
+{"v":"5.12.1","fr":60,"ip":0,"op":89,"w":430,"h":430,"nm":"wired-outline-88-document-user","ddd":0,"assets":[{"id":"comp_1","nm":"Content-12","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"outline 4","parent":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.41,"y":0},"t":6,"s":[0.044,-73.171,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":35,"s":[0.044,-117.966,0],"to":[0,0,0],"ti":[0,0,0]},{"t":50,"s":[0.044,-100.171,0]}],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,22.108],[22.108,0],[0,-22.108],[-22.108,0]],"o":[[0,-22.108],[-22.108,0],[0,22.108],[22.108,0]],"v":[[40.03,0],[0,-40.03],[-40.03,0],[0,40.03]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('wired-outline-88-document-user').layer('control').effect('secondary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":18,"ix":5,"x":"var $bm_rt;\n$bm_rt = $bm_mul($bm_div(value, 3), comp('wired-outline-88-document-user').layer('control').effect('stroke')('Menu'));"},"lc":2,"lj":2,"bm":0,"nm":".secondary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"secondary"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":844,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"outline 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.14,"y":1},"o":{"x":0.167,"y":0.167},"t":0,"s":[214.956,575.075,0],"to":[0,0,0],"ti":[0,0,0]},{"t":29,"s":[214.956,315.075,0]}],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[-30.376,0],[0,0],[0,-30.376]],"o":[[0,0],[0,0],[0,-30.376],[0,0],[30.376,0],[0,0]],"v":[[80.015,33.358],[-80.015,33.358],[-80.015,21.642],[-25.015,-33.358],[25.015,-33.358],[80.015,21.642]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('wired-outline-88-document-user').layer('control').effect('secondary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":18,"ix":5,"x":"var $bm_rt;\n$bm_rt = $bm_mul($bm_div(value, 3), comp('wired-outline-88-document-user').layer('control').effect('stroke')('Menu'));"},"lc":2,"lj":2,"bm":0,"nm":".secondary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"secondary"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":844,"st":0,"ct":1,"bm":0}]},{"id":"comp_3","nm":"Content-36","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"outline 4","parent":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.41,"y":0},"t":6,"s":[0.044,-73.171,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":35,"s":[0.044,-117.966,0],"to":[0,0,0],"ti":[0,0,0]},{"t":50,"s":[0.044,-100.171,0]}],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,22.108],[22.108,0],[0,-22.108],[-22.108,0]],"o":[[0,-22.108],[-22.108,0],[0,22.108],[22.108,0]],"v":[[40.03,0],[0,-40.03],[-40.03,0],[0,40.03]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('wired-outline-88-document-user').layer('control').effect('secondary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":18,"ix":5,"x":"var $bm_rt;\n$bm_rt = $bm_mul($bm_div(value, 3), comp('wired-outline-88-document-user').layer('control').effect('stroke')('Menu'));"},"lc":2,"lj":2,"bm":0,"nm":".secondary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"secondary"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":844,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"outline 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.14,"y":1},"o":{"x":0.167,"y":0.167},"t":0,"s":[214.956,575.075,0],"to":[0,0,0],"ti":[0,0,0]},{"t":29,"s":[214.956,315.075,0]}],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[-30.376,0],[0,0],[0,-30.376]],"o":[[0,0],[0,0],[0,-30.376],[0,0],[30.376,0],[0,0]],"v":[[80.015,33.358],[-80.015,33.358],[-80.015,21.642],[-25.015,-33.358],[25.015,-33.358],[80.015,21.642]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('wired-outline-88-document-user').layer('control').effect('secondary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":18,"ix":5,"x":"var $bm_rt;\n$bm_rt = $bm_mul($bm_div(value, 3), comp('wired-outline-88-document-user').layer('control').effect('stroke')('Menu'));"},"lc":2,"lj":2,"bm":0,"nm":".secondary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"secondary"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":844,"st":0,"ct":1,"bm":0}]},{"id":"comp_4","nm":"hover-swipe","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Page-corner","parent":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250.001,249.76,0],"ix":2,"l":2},"a":{"a":0,"k":[250.001,249.76,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.22,"y":1},"o":{"x":0.333,"y":0},"t":42,"s":[{"i":[[0,0],[-49.694,-50.431],[0,0]],"o":[[0,0],[50.313,51.06],[0,0]],"v":[[-53.373,-53.373],[-0.373,-0.627],[53.373,53.373]],"c":false}]},{"t":89,"s":[{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[-53.373,-53.373],[-53.373,53.373],[53.373,53.373]],"c":false}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('wired-outline-88-document-user').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":18,"ix":5,"x":"var $bm_rt;\n$bm_rt = $bm_mul($bm_div(value, 3), comp('wired-outline-88-document-user').layer('control').effect('stroke')('Menu'));"},"lc":2,"lj":2,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[330.06,116.567],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":844,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Page","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.243],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.326],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":20,"s":[9]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":47,"s":[-7]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":70,"s":[5]},{"t":89,"s":[0]}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0.243,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[317.001,368.76,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.326,"y":1},"o":{"x":0.333,"y":0},"t":20,"s":[351.001,381.76,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":42,"s":[291.751,356.51,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":65,"s":[321.001,369.26,0],"to":[0,0,0],"ti":[0,0,0]},{"t":80,"s":[317.001,368.76,0]}],"ix":2,"l":2},"a":{"a":0,"k":[352.001,403.76,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":1},"o":{"x":0.167,"y":0},"t":0,"s":[{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[-53.373,-53.373],[-53.373,53.373],[53.373,53.373]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":20,"s":[{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[-53.373,-53.373],[-53.373,53.373],[53.373,53.373]],"c":false}]},{"t":38,"s":[{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[-213.237,-53.373],[-213.237,319.57],[53.373,319.57]],"c":false}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('wired-outline-88-document-user').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":18,"ix":5,"x":"var $bm_rt;\n$bm_rt = $bm_mul($bm_div(value, 3), comp('wired-outline-88-document-user').layer('control').effect('stroke')('Menu'));"},"lc":2,"lj":2,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[330.06,116.567],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":1,"k":[{"t":20,"s":[100],"h":1},{"t":38,"s":[0],"h":1}],"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[26.69,-186.57],[-133.43,-186.57],[-133.43,186.57],[133.43,186.57],[133.43,-79.82]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('wired-outline-88-document-user').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":18,"ix":5,"x":"var $bm_rt;\n$bm_rt = $bm_mul($bm_div(value, 3), comp('wired-outline-88-document-user').layer('control').effect('stroke')('Menu'));"},"lc":2,"lj":2,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[250,249.76],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":844,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"mask","parent":2,"td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[249.001,249.76,0],"ix":2,"l":2},"a":{"a":0,"k":[250.001,249.76,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":20,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[26.69,-186.57],[26.75,-186.57],[26.75,-79.76],[133.43,-79.76],[133.43,-79.82]],"c":true}]},{"t":38,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[26.69,-186.57],[-133.43,-186.57],[-133.43,186.57],[133.43,186.57],[133.43,-79.82]],"c":true}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[250,249.76],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":51,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":4,"ty":0,"nm":"Content-12","parent":2,"tt":2,"tp":3,"refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2,"l":2},"a":{"a":0,"k":[215,215,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":430,"h":430,"ip":0,"op":51,"st":-50,"bm":0},{"ddd":0,"ind":5,"ty":0,"nm":"Content-12","parent":2,"refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2,"l":2},"a":{"a":0,"k":[215,215,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[348.631,28.403],[82.211,28.403],[82.211,401.557],[348.631,401.557]],"c":true},"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"Mask 1"}],"w":430,"h":430,"ip":37.5,"op":881.5,"st":37.5,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":3,"nm":"control","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ef":[{"ty":5,"nm":"stroke","np":3,"mn":"Pseudo/@@jxAy4KF1Sn6X4aYQ0vVH/w","ix":1,"en":1,"ef":[{"ty":7,"nm":"Menu","mn":"Pseudo/@@jxAy4KF1Sn6X4aYQ0vVH/w-0001","ix":1,"v":{"a":0,"k":3,"ix":1}}]},{"ty":5,"nm":"primary","np":3,"mn":"ADBE Color Control","ix":2,"en":1,"ef":[{"ty":2,"nm":"Color","mn":"ADBE Color Control-0001","ix":1,"v":{"a":0,"k":[1,1,1],"ix":1}}]},{"ty":5,"nm":"secondary","np":3,"mn":"ADBE Color Control","ix":3,"en":1,"ef":[{"ty":2,"nm":"Color","mn":"ADBE Color Control-0001","ix":1,"v":{"a":0,"k":[1,1,1],"ix":1}}]}],"ip":0,"op":360,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":0,"nm":"hover-swipe","refId":"comp_4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[215,215,0],"ix":2,"l":2},"a":{"a":0,"k":[215,215,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":430,"h":430,"ip":0,"op":99,"st":0,"bm":0}],"markers":[{"tm":0,"cm":"default:hover-swipe","dr":89}],"props":{}}
\ No newline at end of file
diff --git a/frontend/src/components/projects/NewProjectModal.tsx b/frontend/src/components/projects/NewProjectModal.tsx
index dcd3040d81..c98118a966 100644
--- a/frontend/src/components/projects/NewProjectModal.tsx
+++ b/frontend/src/components/projects/NewProjectModal.tsx
@@ -72,7 +72,7 @@ const NewProjectForm = ({ onOpenChange, projectType }: NewProjectFormProps) => {
OrgPermissionSubjects.ProjectTemplates
);
- const { data: projectTemplates = [] } = useListProjectTemplates({
+ const { data: projectTemplates = [] } = useListProjectTemplates(projectType, {
enabled: Boolean(canReadProjectTemplates && subscription?.projectTemplates)
});
diff --git a/frontend/src/components/projects/ProjectSettings/ProjectSettings.tsx b/frontend/src/components/projects/ProjectSettings/ProjectSettings.tsx
new file mode 100644
index 0000000000..3919ad86c0
--- /dev/null
+++ b/frontend/src/components/projects/ProjectSettings/ProjectSettings.tsx
@@ -0,0 +1,30 @@
+import { useState } from "react";
+
+import { Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+
+import { ProjectTemplatesTab } from "./components";
+
+const tabs = [
+ { name: "Project Templates", key: "project-templates", component: ProjectTemplatesTab }
+];
+
+export const ProjectSettings = () => {
+ const [selectedTab, setSelectedTab] = useState(tabs[0].key);
+
+ return (
+ <Tabs value={selectedTab} onValueChange={setSelectedTab}>
+ <TabList>
+ {tabs.map((tab) => (
+ <Tab value={tab.key} key={tab.key}>
+ {tab.name}
+ </Tab>
+ ))}
+ </TabList>
+ {tabs.map(({ key, component: Component }) => (
+ <TabPanel value={key} key={`tab-panel-${key}`}>
+ <Component />
+ </TabPanel>
+ ))}
+ </Tabs>
+ );
+};
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/ProjectTemplatesTab.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/ProjectTemplatesTab.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/ProjectTemplatesTab.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/ProjectTemplatesTab.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/DeleteProjectTemplateModal.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/DeleteProjectTemplateModal.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/DeleteProjectTemplateModal.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/DeleteProjectTemplateModal.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/EditProjectTemplateSection.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/EditProjectTemplateSection.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/EditProjectTemplateSection.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/EditProjectTemplateSection.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx
similarity index 92%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx
index 98a6759401..9b7164f80d 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx
+++ b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/EditProjectTemplate.tsx
@@ -7,6 +7,7 @@ import { Button, DeleteActionModal } from "@app/components/v2";
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
import { usePopUp } from "@app/hooks";
import { TProjectTemplate, useDeleteProjectTemplate } from "@app/hooks/api/projectTemplates";
+import { ProjectType } from "@app/hooks/api/workspace/types";
import { ProjectTemplateDetailsModal } from "../../ProjectTemplateDetailsModal";
import { ProjectTemplateEnvironmentsForm } from "./ProjectTemplateEnvironmentsForm";
@@ -24,7 +25,7 @@ export const EditProjectTemplate = ({ isInfisicalTemplate, projectTemplate, onBa
"editDetails"
] as const);
- const { id: templateId, name, description } = projectTemplate;
+ const { id: templateId, name, description, type } = projectTemplate;
const deleteProjectTemplate = useDeleteProjectTemplate();
@@ -94,10 +95,12 @@ export const EditProjectTemplate = ({ isInfisicalTemplate, projectTemplate, onBa
</div>
)}
</div>
- <ProjectTemplateEnvironmentsForm
- isInfisicalTemplate={isInfisicalTemplate}
- projectTemplate={projectTemplate}
- />
+ {type === ProjectType.SecretManager && (
+ <ProjectTemplateEnvironmentsForm
+ isInfisicalTemplate={isInfisicalTemplate}
+ projectTemplate={projectTemplate}
+ />
+ )}
<ProjectTemplateRolesSection
isInfisicalTemplate={isInfisicalTemplate}
projectTemplate={projectTemplate}
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx
similarity index 82%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx
index b1a639e897..a4bc3a73a4 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx
+++ b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEditRoleForm.tsx
@@ -1,19 +1,18 @@
import { Controller, FormProvider, useForm } from "react-hook-form";
-import { faChevronLeft, faPlus, faSave } from "@fortawesome/free-solid-svg-icons";
+import { faChevronLeft, faSave } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
import { twMerge } from "tailwind-merge";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, Input, Modal, ModalContent, ModalTrigger } from "@app/components/v2";
+import { Button, FormControl, Input } from "@app/components/v2";
import { ProjectPermissionSub } from "@app/context";
import { isCustomProjectRole } from "@app/helpers/roles";
-import { usePopUp } from "@app/hooks";
import { TProjectTemplate, useUpdateProjectTemplate } from "@app/hooks/api/projectTemplates";
import { slugSchema } from "@app/lib/schemas";
+import { AddPoliciesButton } from "@app/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton";
import { GeneralPermissionPolicies } from "@app/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies";
-import { NewPermissionRule } from "@app/pages/project/RoleDetailsBySlugPage/components/NewPermissionRule";
import { PermissionEmptyState } from "@app/pages/project/RoleDetailsBySlugPage/components/PermissionEmptyState";
import {
formRolePermission2API,
@@ -44,8 +43,6 @@ export const ProjectTemplateEditRoleForm = ({
role,
isDisabled
}: Props) => {
- const { popUp, handlePopUpToggle } = usePopUp(["createPolicy"] as const);
-
const formMethods = useForm<TFormSchema>({
values: role ? { ...role, permissions: rolePermission2Form(role.permissions) } : undefined,
resolver: zodResolver(formSchema)
@@ -119,34 +116,17 @@ export const ProjectTemplateEditRoleForm = ({
<Button
variant="outline_bg"
type="submit"
- className={twMerge("h-10 rounded-r-none", isDirty && "bg-primary text-black")}
+ className={twMerge(
+ "mr-4 h-10 border border-primary",
+ isDirty && "bg-primary text-black"
+ )}
isDisabled={isSubmitting || !isDirty || isDisabled}
isLoading={isSubmitting}
leftIcon={<FontAwesomeIcon icon={faSave} />}
>
Save
</Button>
- <Modal
- isOpen={popUp.createPolicy.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("createPolicy", isOpen)}
- >
- <ModalTrigger asChild>
- <Button
- className="h-10 rounded-l-none"
- variant="outline_bg"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- isDisabled={isDisabled}
- >
- New Policy
- </Button>
- </ModalTrigger>
- <ModalContent
- title="New Policy"
- subTitle="Policies grant additional permissions."
- >
- <NewPermissionRule onClose={() => handlePopUpToggle("createPolicy")} />
- </ModalContent>
- </Modal>
+ <AddPoliciesButton isDisabled={isDisabled} />
</div>
</div>
)}
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsx
similarity index 93%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsx
index b72d12c73e..ef2691d694 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsx
+++ b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateEnvironmentsForm.tsx
@@ -19,7 +19,7 @@ import {
THead,
Tr
} from "@app/components/v2";
-import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
+import { OrgPermissionActions, OrgPermissionSubjects, useSubscription } from "@app/context";
import { TProjectTemplate, useUpdateProjectTemplate } from "@app/hooks/api/projectTemplates";
import { slugSchema } from "@app/lib/schemas";
@@ -35,6 +35,7 @@ const formSchema = z.object({
slug: slugSchema({ min: 1, max: 32 })
})
.array()
+ .nullish()
});
type TFormSchema = z.infer<typeof formSchema>;
@@ -55,6 +56,8 @@ export const ProjectTemplateEnvironmentsForm = ({
resolver: zodResolver(formSchema)
});
+ const { subscription } = useSubscription();
+
const {
fields: environments,
move,
@@ -67,7 +70,7 @@ export const ProjectTemplateEnvironmentsForm = ({
const onFormSubmit = async (form: TFormSchema) => {
try {
const { environments: updatedEnvs } = await updateProjectTemplate.mutateAsync({
- environments: form.environments.map((env, index) => ({
+ environments: form.environments?.map((env, index) => ({
...env,
position: index + 1
})),
@@ -89,6 +92,9 @@ export const ProjectTemplateEnvironmentsForm = ({
}
};
+ const isEnvironmentLimitExceeded =
+ Boolean(subscription.environmentLimit) && environments.length >= subscription.environmentLimit;
+
return (
<form
onSubmit={handleSubmit(onFormSubmit)}
@@ -138,6 +144,8 @@ export const ProjectTemplateEnvironmentsForm = ({
<OrgPermissionCan
I={OrgPermissionActions.Edit}
a={OrgPermissionSubjects.ProjectTemplates}
+ renderTooltip={isEnvironmentLimitExceeded ? true : undefined}
+ allowedLabel={`Plan environment limit of ${subscription.environmentLimit} exceeded. Contact Infisical to increase limit.`}
>
{(isAllowed) => (
<Button
@@ -147,7 +155,7 @@ export const ProjectTemplateEnvironmentsForm = ({
variant="solid"
size="xs"
leftIcon={<FontAwesomeIcon icon={faPlus} />}
- isDisabled={!isAllowed}
+ isDisabled={!isAllowed || isEnvironmentLimitExceeded}
>
Add Environment
</Button>
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/index.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/index.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/index.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/components/index.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/index.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/index.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/EditProjectTemplateSection/index.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/EditProjectTemplateSection/index.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx
similarity index 91%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx
index e601e0319f..5b5728dac8 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx
+++ b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/ProjectTemplateDetailsModal.tsx
@@ -12,6 +12,7 @@ import {
ModalContent,
TextArea
} from "@app/components/v2";
+import { useGetProjectTypeFromRoute } from "@app/hooks";
import {
TProjectTemplate,
useCreateProjectTemplate,
@@ -41,6 +42,7 @@ type FormProps = {
const ProjectTemplateForm = ({ onComplete, projectTemplate }: FormProps) => {
const createProjectTemplate = useCreateProjectTemplate();
const updateProjectTemplate = useUpdateProjectTemplate();
+ const projectType = useGetProjectTypeFromRoute();
const {
handleSubmit,
@@ -55,9 +57,17 @@ const ProjectTemplateForm = ({ onComplete, projectTemplate }: FormProps) => {
});
const onFormSubmit = async (data: FormData) => {
+ if (!projectType) {
+ createNotification({
+ text: "Failed to determine project type",
+ type: "error"
+ });
+ return;
+ }
+
const mutation = projectTemplate
? updateProjectTemplate.mutateAsync({ templateId: projectTemplate.id, ...data })
- : createProjectTemplate.mutateAsync(data);
+ : createProjectTemplate.mutateAsync({ ...data, type: projectType });
try {
const template = await mutation;
createNotification({
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx
similarity index 98%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx
index d4a0769308..ec3f0aaff7 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx
+++ b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx
@@ -50,7 +50,7 @@ export const ProjectTemplatesSection = () => {
className="absolute min-h-[10rem] w-full"
>
<div>
- <p className="mb-6 text-bunker-300">
+ <p className="mb-6 font-inter text-bunker-300">
Create and configure templates with predefined roles and environments to streamline
project setup
</p>
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesTable.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/ProjectTemplatesTable.tsx
similarity index 73%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesTable.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/ProjectTemplatesTable.tsx
index b8dc00ab22..0465973e2b 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesTable.tsx
+++ b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/ProjectTemplatesTable.tsx
@@ -23,8 +23,9 @@ import {
Tr
} from "@app/components/v2";
import { OrgPermissionActions, OrgPermissionSubjects, useSubscription } from "@app/context";
-import { usePopUp } from "@app/hooks";
+import { useGetProjectTypeFromRoute, usePopUp } from "@app/hooks";
import { TProjectTemplate, useListProjectTemplates } from "@app/hooks/api/projectTemplates";
+import { ProjectType } from "@app/hooks/api/workspace/types";
import { DeleteProjectTemplateModal } from "./DeleteProjectTemplateModal";
@@ -35,9 +36,12 @@ type Props = {
export const ProjectTemplatesTable = ({ onEdit }: Props) => {
const { subscription } = useSubscription();
- const { isPending, data: projectTemplates = [] } = useListProjectTemplates({
- enabled: subscription?.projectTemplates
+ const projectType = useGetProjectTypeFromRoute();
+
+ const { isPending, data: projectTemplates = [] } = useListProjectTemplates(projectType, {
+ enabled: subscription?.projectTemplates && Boolean(projectType)
});
+
const [search, setSearch] = useState("");
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["deleteTemplate"] as const);
@@ -50,6 +54,10 @@ export const ProjectTemplatesTable = ({ onEdit }: Props) => {
[search, projectTemplates]
);
+ const isSecretManagerTemplates = projectType === ProjectType.SecretManager;
+
+ const colSpan = isSecretManagerTemplates ? 4 : 3;
+
return (
<div>
<Input
@@ -64,20 +72,20 @@ export const ProjectTemplatesTable = ({ onEdit }: Props) => {
<Tr>
<Th>Name</Th>
<Th>Roles</Th>
- <Th>Environments</Th>
+ {isSecretManagerTemplates && <Th>Environments</Th>}
<Th />
</Tr>
</THead>
<TBody>
- {isPending && (
+ {subscription?.projectTemplates && isPending && (
<TableSkeleton
innerKey="project-templates-table"
- columns={4}
+ columns={colSpan}
key="project-templates"
/>
)}
{filteredTemplates.map((template) => {
- const { id, name, roles, environments, description } = template;
+ const { id, name, roles, environments = [], description } = template;
return (
<Tr
onClick={() => onEdit(template)}
@@ -116,28 +124,30 @@ export const ProjectTemplatesTable = ({ onEdit }: Props) => {
</Tooltip>
)}
</Td>
- <Td className="pl-14">
- {environments.length}
- {environments.length > 0 && (
- <Tooltip
- content={
- <ul className="ml-2 list-disc">
- {environments
- .sort((a, b) => (a.position > b.position ? 1 : -1))
- .map((env) => (
- <li key={env.slug}>{env.name}</li>
- ))}
- </ul>
- }
- >
- <FontAwesomeIcon
- size="sm"
- className="ml-2 text-mineshaft-400"
- icon={faCircleInfo}
- />
- </Tooltip>
- )}
- </Td>
+ {isSecretManagerTemplates && environments && (
+ <Td className="pl-14">
+ {environments.length}
+ {environments.length > 0 && (
+ <Tooltip
+ content={
+ <ul className="ml-2 list-disc">
+ {environments
+ .sort((a, b) => (a.position > b.position ? 1 : -1))
+ .map((env) => (
+ <li key={env.slug}>{env.name}</li>
+ ))}
+ </ul>
+ }
+ >
+ <FontAwesomeIcon
+ size="sm"
+ className="ml-2 text-mineshaft-400"
+ icon={faCircleInfo}
+ />
+ </Tooltip>
+ )}
+ </Td>
+ )}
<Td className="w-5">
{name !== "default" && (
<OrgPermissionCan
@@ -164,9 +174,10 @@ export const ProjectTemplatesTable = ({ onEdit }: Props) => {
</Tr>
);
})}
- {!isPending && filteredTemplates?.length === 0 && (
+ {(!subscription?.projectTemplates ||
+ (!isPending && filteredTemplates?.length === 0)) && (
<Tr>
- <Td colSpan={5}>
+ <Td colSpan={colSpan}>
<EmptyState
title={
search.trim()
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/index.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/index.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/index.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/components/index.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/index.tsx b/frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/index.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/index.tsx
rename to frontend/src/components/projects/ProjectSettings/components/ProjectTemplatesTab/index.tsx
diff --git a/frontend/src/components/projects/ProjectSettings/components/index.tsx b/frontend/src/components/projects/ProjectSettings/components/index.tsx
new file mode 100644
index 0000000000..35ad65ee0e
--- /dev/null
+++ b/frontend/src/components/projects/ProjectSettings/components/index.tsx
@@ -0,0 +1 @@
+export * from "./ProjectTemplatesTab";
diff --git a/frontend/src/components/projects/ProjectSettings/index.tsx b/frontend/src/components/projects/ProjectSettings/index.tsx
new file mode 100644
index 0000000000..e2f0626f66
--- /dev/null
+++ b/frontend/src/components/projects/ProjectSettings/index.tsx
@@ -0,0 +1 @@
+export * from "./ProjectSettings";
diff --git a/frontend/src/components/secret-syncs/SecretSyncImportSecretsModal.tsx b/frontend/src/components/secret-syncs/SecretSyncImportSecretsModal.tsx
index 8b587c62f3..c1b21a7719 100644
--- a/frontend/src/components/secret-syncs/SecretSyncImportSecretsModal.tsx
+++ b/frontend/src/components/secret-syncs/SecretSyncImportSecretsModal.tsx
@@ -44,7 +44,9 @@ const Content = ({ secretSync, onComplete }: ContentProps) => {
handleSubmit,
control,
formState: { isSubmitting, isDirty }
- } = useForm<TFormData>({ resolver: zodResolver(FormSchema) });
+ } = useForm<TFormData>({
+ resolver: zodResolver(FormSchema)
+ });
const triggerImportSecrets = useTriggerSecretSyncImportSecrets();
diff --git a/frontend/src/components/secret-syncs/SecretSyncStatusBadge.tsx b/frontend/src/components/secret-syncs/SecretSyncStatusBadge.tsx
index dbf543f616..53b53d5c07 100644
--- a/frontend/src/components/secret-syncs/SecretSyncStatusBadge.tsx
+++ b/frontend/src/components/secret-syncs/SecretSyncStatusBadge.tsx
@@ -40,7 +40,14 @@ export const SecretSyncStatusBadge = ({ status }: Props) => {
return (
<Badge className="flex h-5 w-min items-center gap-1.5 whitespace-nowrap" variant={variant}>
- <FontAwesomeIcon icon={icon} />
+ <FontAwesomeIcon
+ icon={icon}
+ className={
+ [SecretSyncStatus.Pending, SecretSyncStatus.Running].includes(status)
+ ? "animate-spin"
+ : ""
+ }
+ />
<span>{text}</span>
</Badge>
);
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OCIVaultSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OCIVaultSyncFields.tsx
new file mode 100644
index 0000000000..26fa601f6c
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OCIVaultSyncFields.tsx
@@ -0,0 +1,175 @@
+import { Controller, useFormContext, useWatch } from "react-hook-form";
+import { SingleValue } from "react-select";
+import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
+import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
+import {
+ useOCIConnectionListCompartments,
+ useOCIConnectionListVaultKeys,
+ useOCIConnectionListVaults
+} from "@app/hooks/api/appConnections/oci";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+
+import { TSecretSyncForm } from "../schemas";
+
+export const OCIVaultSyncFields = () => {
+ const { control, setValue } = useFormContext<
+ TSecretSyncForm & { destination: SecretSync.OCIVault }
+ >();
+
+ const connectionId = useWatch({ name: "connection.id", control });
+
+ // Compartments
+ const { data: compartments, isLoading: isCompartmentsLoading } = useOCIConnectionListCompartments(
+ connectionId,
+ {
+ enabled: Boolean(connectionId)
+ }
+ );
+
+ // Vaults
+ const selectedCompartment = useWatch({ name: "destinationConfig.compartmentOcid", control });
+ const { data: vaults, isLoading: isVaultsLoading } = useOCIConnectionListVaults(
+ { connectionId, compartmentOcid: selectedCompartment },
+ {
+ enabled: Boolean(connectionId && selectedCompartment)
+ }
+ );
+
+ // Keys
+ const selectedVault = useWatch({ name: "destinationConfig.vaultOcid", control });
+ const { data: keys, isLoading: isKeysLoading } = useOCIConnectionListVaultKeys(
+ { connectionId, compartmentOcid: selectedCompartment, vaultOcid: selectedVault },
+ {
+ enabled: Boolean(connectionId && selectedCompartment && selectedVault)
+ }
+ );
+
+ return (
+ <>
+ <SecretSyncConnectionField
+ onChange={() => {
+ setValue("destinationConfig.compartmentOcid", "");
+ setValue("destinationConfig.vaultOcid", "");
+ setValue("destinationConfig.keyOcid", "");
+ }}
+ />
+
+ <Controller
+ name="destinationConfig.compartmentOcid"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Compartment"
+ helperText={
+ <Tooltip
+ className="max-w-md"
+ content="Ensure the compartment exists and that the connection has permission to view it."
+ >
+ <div>
+ <span>Don&#39;t see the compartment you&#39;re looking for?</span>{" "}
+ <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
+ </div>
+ </Tooltip>
+ }
+ >
+ <FilterableSelect
+ menuPlacement="top"
+ isLoading={isCompartmentsLoading && Boolean(connectionId)}
+ isDisabled={!connectionId}
+ value={compartments?.find((c) => c.id === value) ?? null}
+ onChange={(option) => {
+ onChange((option as SingleValue<{ id: string }>)?.id ?? null);
+ setValue("destinationConfig.vaultOcid", "");
+ setValue("destinationConfig.keyOcid", "");
+ }}
+ options={compartments}
+ placeholder="Select a compartment..."
+ getOptionLabel={(option) => option.name}
+ getOptionValue={(option) => option.id}
+ />
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ name="destinationConfig.vaultOcid"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Vault"
+ helperText={
+ <Tooltip
+ className="max-w-md"
+ content="Ensure the vault exists in the selected compartment and that the connection has permission to view it."
+ >
+ <div>
+ <span>Don&#39;t see the vault you&#39;re looking for?</span>{" "}
+ <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
+ </div>
+ </Tooltip>
+ }
+ >
+ <FilterableSelect
+ menuPlacement="top"
+ isLoading={isVaultsLoading && Boolean(connectionId)}
+ isDisabled={!connectionId || !selectedCompartment}
+ value={vaults?.find((v) => v.id === value) ?? null}
+ onChange={(option) => {
+ onChange((option as SingleValue<{ id: string }>)?.id ?? null);
+ setValue("destinationConfig.keyOcid", "");
+ }}
+ options={vaults}
+ placeholder="Select a vault..."
+ getOptionLabel={(option) => option.displayName}
+ getOptionValue={(option) => option.id}
+ />
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ name="destinationConfig.keyOcid"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Encryption Key"
+ helperText={
+ <Tooltip
+ className="max-w-md"
+ content="Ensure the key exists in the selected vault and that the connection has permission to view it."
+ >
+ <div>
+ <span>Don&#39;t see the key you&#39;re looking for?</span>{" "}
+ <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
+ </div>
+ </Tooltip>
+ }
+ >
+ <FilterableSelect
+ menuPlacement="top"
+ isLoading={isKeysLoading && Boolean(connectionId)}
+ isDisabled={!connectionId || !selectedCompartment || !selectedVault}
+ value={keys?.find((v) => v.id === value) ?? null}
+ onChange={(option) => {
+ onChange((option as SingleValue<{ id: string }>)?.id ?? null);
+ }}
+ options={keys}
+ placeholder="Select a key..."
+ getOptionLabel={(option) => option.displayName}
+ getOptionValue={(option) => option.id}
+ />
+ </FormControl>
+ )}
+ />
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
index 1d7a1dd550..2cac1ae20f 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
@@ -13,6 +13,7 @@ import { GcpSyncFields } from "./GcpSyncFields";
import { GitHubSyncFields } from "./GitHubSyncFields";
import { HCVaultSyncFields } from "./HCVaultSyncFields";
import { HumanitecSyncFields } from "./HumanitecSyncFields";
+import { OCIVaultSyncFields } from "./OCIVaultSyncFields";
import { TeamCitySyncFields } from "./TeamCitySyncFields";
import { TerraformCloudSyncFields } from "./TerraformCloudSyncFields";
import { VercelSyncFields } from "./VercelSyncFields";
@@ -52,6 +53,8 @@ export const SecretSyncDestinationFields = () => {
return <HCVaultSyncFields />;
case SecretSync.TeamCity:
return <TeamCitySyncFields />;
+ case SecretSync.OCIVault:
+ return <OCIVaultSyncFields />;
default:
throw new Error(`Unhandled Destination Config Field: ${destination}`);
}
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index e4aa4ad657..7c2b139363 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -1,9 +1,13 @@
import { ReactNode } from "react";
import { Controller, useFormContext } from "react-hook-form";
-import { faQuestionCircle, faTriangleExclamation } from "@fortawesome/free-solid-svg-icons";
+import {
+ faCircleInfo,
+ faQuestionCircle,
+ faTriangleExclamation
+} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { FormControl, Select, SelectItem, Switch, Tooltip } from "@app/components/v2";
+import { FormControl, Input, Select, SelectItem, Switch, Tooltip } from "@app/components/v2";
import { SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP, SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";
import { SecretSync, useSecretSyncOption } from "@app/hooks/api/secretSyncs";
@@ -45,6 +49,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
case SecretSync.Windmill:
case SecretSync.HCVault:
case SecretSync.TeamCity:
+ case SecretSync.OCIVault:
AdditionalSyncOptionsFieldsComponent = null;
break;
default:
@@ -121,6 +126,46 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
)}
</>
)}
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ tooltipClassName="max-w-md"
+ tooltipText="When a secret is synced, its key will be injected into the key schema before it reaches the destination. This is useful for organization."
+ isError={Boolean(error)}
+ isOptional
+ errorText={error?.message}
+ label="Key Schema"
+ helperText={
+ <Tooltip
+ className="max-w-md"
+ content={
+ <span>
+ We highly recommend using a{" "}
+ <a
+ href="https://infisical.com/docs/integrations/secret-syncs/overview#key-schemas"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Key Schema
+ </a>{" "}
+ to ensure that Infisical only manages the specific keys you intend, keeping
+ everything else untouched.
+ </span>
+ }
+ >
+ <div>
+ <span>Infisical strongly advises setting a Key Schema</span>{" "}
+ <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
+ </div>
+ </Tooltip>
+ }
+ >
+ <Input value={value} onChange={onChange} placeholder="INFISICAL_{{secretKey}}" />
+ </FormControl>
+ )}
+ control={control}
+ name="syncOptions.keySchema"
+ />
{AdditionalSyncOptionsFieldsComponent}
<Controller
control={control}
@@ -160,34 +205,6 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
);
}}
/>
- {/* <Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- isOptional
- errorText={error?.message}
- label="Prepend Prefix"
- >
- <Input className="uppercase" value={value} onChange={onChange} placeholder="INF_" />
- </FormControl>
- )}
- control={control}
- name="syncOptions.prependPrefix"
- />
- <Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- isOptional
- errorText={error?.message}
- label="Append Suffix"
- >
- <Input className="uppercase" value={value} onChange={onChange} placeholder="_INF" />
- </FormControl>
- )}
- control={control}
- name="syncOptions.appendSuffix"
- /> */}
</>
);
};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OCIVaultSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OCIVaultSyncReviewFields.tsx
new file mode 100644
index 0000000000..16166c88ce
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OCIVaultSyncReviewFields.tsx
@@ -0,0 +1,26 @@
+import { useFormContext } from "react-hook-form";
+
+import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
+import { GenericFieldLabel } from "@app/components/v2";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+
+export const OCIVaultSyncReviewFields = () => {
+ const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.OCIVault }>();
+ const compartmentOcid = watch("destinationConfig.compartmentOcid");
+ const vaultOcid = watch("destinationConfig.vaultOcid");
+ const keyOcid = watch("destinationConfig.keyOcid");
+
+ return (
+ <>
+ <GenericFieldLabel label="Compartment OCID" truncate>
+ {compartmentOcid}
+ </GenericFieldLabel>
+ <GenericFieldLabel label="Vault OCID" truncate>
+ {vaultOcid}
+ </GenericFieldLabel>
+ <GenericFieldLabel label="Key OCID" truncate>
+ {keyOcid}
+ </GenericFieldLabel>
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
index 62402e540c..144ccb2a8f 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
@@ -23,6 +23,7 @@ import { GcpSyncReviewFields } from "./GcpSyncReviewFields";
import { GitHubSyncReviewFields } from "./GitHubSyncReviewFields";
import { HCVaultSyncReviewFields } from "./HCVaultSyncReviewFields";
import { HumanitecSyncReviewFields } from "./HumanitecSyncReviewFields";
+import { OCIVaultSyncReviewFields } from "./OCIVaultSyncReviewFields";
import { TeamCitySyncReviewFields } from "./TeamCitySyncReviewFields";
import { TerraformCloudSyncReviewFields } from "./TerraformCloudSyncReviewFields";
import { VercelSyncReviewFields } from "./VercelSyncReviewFields";
@@ -40,11 +41,7 @@ export const SecretSyncReviewFields = () => {
connection,
environment,
secretPath,
- syncOptions: {
- // appendSuffix, prependPrefix,
- disableSecretDeletion,
- initialSyncBehavior
- },
+ syncOptions: { disableSecretDeletion, initialSyncBehavior, keySchema },
destination,
isAutoSyncEnabled
} = watch();
@@ -96,6 +93,9 @@ export const SecretSyncReviewFields = () => {
case SecretSync.TeamCity:
DestinationFieldsComponent = <TeamCitySyncReviewFields />;
break;
+ case SecretSync.OCIVault:
+ DestinationFieldsComponent = <OCIVaultSyncReviewFields />;
+ break;
default:
throw new Error(`Unhandled Destination Review Fields: ${destination}`);
}
@@ -133,8 +133,7 @@ export const SecretSyncReviewFields = () => {
<GenericFieldLabel label="Initial Sync Behavior">
{SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP[initialSyncBehavior](destinationName).name}
</GenericFieldLabel>
- {/* <SecretSyncLabel label="Prepend Prefix">{prependPrefix}</SecretSyncLabel>
- <SecretSyncLabel label="Append Suffix">{appendSuffix}</SecretSyncLabel> */}
+ <GenericFieldLabel label="Key Schema">{keySchema}</GenericFieldLabel>
{AdditionalSyncOptionsFieldsComponent}
{disableSecretDeletion && (
<GenericFieldLabel label="Secret Deletion">
diff --git a/frontend/src/components/secret-syncs/forms/schemas/base-secret-sync-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/base-secret-sync-schema.ts
index bf72321ce1..75a5b68c19 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/base-secret-sync-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/base-secret-sync-schema.ts
@@ -8,18 +8,18 @@ export const BaseSecretSyncSchema = <T extends AnyZodObject | undefined = undefi
) => {
const baseSyncOptionsSchema = z.object({
initialSyncBehavior: z.nativeEnum(SecretSyncInitialSyncBehavior),
- disableSecretDeletion: z.boolean().optional().default(false)
- // scott: removed temporarily for evaluation of template formatting
- // prependPrefix: z
- // .string()
- // .trim()
- // .transform((str) => str.toUpperCase())
- // .optional(),
- // appendSuffix: z
- // .string()
- // .trim()
- // .transform((str) => str.toUpperCase())
- // .optional()
+ disableSecretDeletion: z.boolean().optional().default(false),
+ keySchema: z
+ .string()
+ .optional()
+ .refine(
+ (val) =>
+ !val || /^(?:[a-zA-Z0-9_\-/]*)(?:\{\{secretKey\}\})(?:[a-zA-Z0-9_\-/]*)$/.test(val),
+ {
+ message:
+ "Key schema must include one {{secretKey}} and only contain letters, numbers, dashes, underscores, slashes, and the {{secretKey}} placeholder."
+ }
+ )
});
const syncOptionsSchema = additionalSyncOptions
diff --git a/frontend/src/components/secret-syncs/forms/schemas/oci-vault-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/oci-vault-sync-destination-schema.ts
new file mode 100644
index 0000000000..84eb6a362a
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/schemas/oci-vault-sync-destination-schema.ts
@@ -0,0 +1,33 @@
+import { z } from "zod";
+
+import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+
+export const OCIVaultSyncDestinationSchema = BaseSecretSyncSchema().merge(
+ z.object({
+ destination: z.literal(SecretSync.OCIVault),
+ destinationConfig: z.object({
+ compartmentOcid: z
+ .string()
+ .trim()
+ .min(1, "Compartment OCID required")
+ .regex(
+ /^ocid1\.(tenancy|compartment)\.oc1\..+$/,
+ "Invalid Compartment OCID format. Must start with ocid1.tenancy.oc1. or ocid1.compartment.oc1."
+ ),
+ vaultOcid: z
+ .string()
+ .trim()
+ .min(1, "Vault OCID required")
+ .regex(
+ /^ocid1\.vault\.oc1\..+$/,
+ "Invalid Vault OCID format. Must start with ocid1.vault.oc1."
+ ),
+ keyOcid: z
+ .string()
+ .trim()
+ .min(1, "Key OCID required")
+ .regex(/^ocid1\.key\.oc1\..+$/, "Invalid Key OCID format. Must start with ocid1.key.oc1.")
+ })
+ })
+);
diff --git a/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
index bc6184bc7d..232b8cedfa 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
@@ -10,6 +10,7 @@ import { GcpSyncDestinationSchema } from "./gcp-sync-destination-schema";
import { GitHubSyncDestinationSchema } from "./github-sync-destination-schema";
import { HCVaultSyncDestinationSchema } from "./hc-vault-sync-destination-schema";
import { HumanitecSyncDestinationSchema } from "./humanitec-sync-destination-schema";
+import { OCIVaultSyncDestinationSchema } from "./oci-vault-sync-destination-schema";
import { TeamCitySyncDestinationSchema } from "./teamcity-sync-destination-schema";
import { TerraformCloudSyncDestinationSchema } from "./terraform-cloud-destination-schema";
import { VercelSyncDestinationSchema } from "./vercel-sync-destination-schema";
@@ -29,7 +30,8 @@ const SecretSyncUnionSchema = z.discriminatedUnion("destination", [
VercelSyncDestinationSchema,
WindmillSyncDestinationSchema,
HCVaultSyncDestinationSchema,
- TeamCitySyncDestinationSchema
+ TeamCitySyncDestinationSchema,
+ OCIVaultSyncDestinationSchema
]);
export const SecretSyncFormSchema = SecretSyncUnionSchema;
diff --git a/frontend/src/components/v2/GenericFieldLabel/GenericFieldLabel.tsx b/frontend/src/components/v2/GenericFieldLabel/GenericFieldLabel.tsx
index 5200e18985..95eaf57451 100644
--- a/frontend/src/components/v2/GenericFieldLabel/GenericFieldLabel.tsx
+++ b/frontend/src/components/v2/GenericFieldLabel/GenericFieldLabel.tsx
@@ -6,14 +6,21 @@ type Props = {
children?: ReactNode;
className?: string;
labelClassName?: string;
+ truncate?: boolean;
};
-export const GenericFieldLabel = ({ label, children, className, labelClassName }: Props) => {
+export const GenericFieldLabel = ({
+ label,
+ children,
+ className,
+ labelClassName,
+ truncate
+}: Props) => {
return (
- <div className={className}>
+ <div className={twMerge("min-w-0", className)}>
<p className={twMerge("text-xs font-medium text-mineshaft-400", labelClassName)}>{label}</p>
{children ? (
- <p className="text-sm text-mineshaft-100">{children}</p>
+ <p className={twMerge("text-sm text-mineshaft-100", truncate && "truncate")}>{children}</p>
) : (
<p className="text-sm italic text-mineshaft-400/50">None</p>
)}
diff --git a/frontend/src/components/v2/NoticeBannerV2/NoticeBannerV2.tsx b/frontend/src/components/v2/NoticeBannerV2/NoticeBannerV2.tsx
index 2b41620bd1..bde5853e55 100644
--- a/frontend/src/components/v2/NoticeBannerV2/NoticeBannerV2.tsx
+++ b/frontend/src/components/v2/NoticeBannerV2/NoticeBannerV2.tsx
@@ -7,9 +7,10 @@ type Props = {
title: string;
children: ReactNode;
className?: string;
+ titleClassName?: string;
};
-export const NoticeBannerV2 = ({ title, children, className }: Props) => {
+export const NoticeBannerV2 = ({ title, children, className, titleClassName }: Props) => {
return (
<div
className={twMerge(
@@ -17,7 +18,7 @@ export const NoticeBannerV2 = ({ title, children, className }: Props) => {
className
)}
>
- <div className="mb-1 flex items-center text-sm">
+ <div className={twMerge("mb-1 flex items-center text-sm", titleClassName)}>
<FontAwesomeIcon icon={faInfoCircle} size="sm" className="mr-1.5 text-primary" />
{title}
</div>
diff --git a/frontend/src/components/v2/Select/Select.tsx b/frontend/src/components/v2/Select/Select.tsx
index e0dc901860..a35dc00d28 100644
--- a/frontend/src/components/v2/Select/Select.tsx
+++ b/frontend/src/components/v2/Select/Select.tsx
@@ -123,6 +123,7 @@ export const SelectItem = forwardRef<HTMLDivElement, SelectItemProps>(
return (
<SelectPrimitive.Item
{...props}
+ disabled={isDisabled}
className={twMerge(
"relative mb-0.5 cursor-pointer select-none items-center overflow-hidden truncate rounded-md py-2 pl-10 pr-4 text-sm outline-none transition-all hover:bg-mineshaft-500 data-[highlighted]:bg-mineshaft-700/80",
isSelected && "bg-primary",
diff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.ts
index 05781e1906..ebfe5e5cc5 100644
--- a/frontend/src/const/routes.ts
+++ b/frontend/src/const/routes.ts
@@ -23,6 +23,10 @@ export const ROUTE_PATHS = Object.freeze({
"/_authenticate/_inject-org-details/_org-layout/organization/settings/oauth/callback"
)
},
+ SsoPage: setRoute(
+ "/organization/sso",
+ "/_authenticate/_inject-org-details/_org-layout/organization/sso"
+ ),
SecretScanning: setRoute(
"/organization/secret-scanning",
"/_authenticate/_inject-org-details/_org-layout/organization/secret-scanning"
@@ -295,9 +299,13 @@ export const ROUTE_PATHS = Object.freeze({
"/cert-manager/$projectId/ca/$caId",
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId"
),
- OverviewPage: setRoute(
- "/cert-manager/$projectId/overview",
- "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/overview"
+ SubscribersPage: setRoute(
+ "/cert-manager/$projectId/subscribers",
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers"
+ ),
+ CertificatesPage: setRoute(
+ "/cert-manager/$projectId/certificates",
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificates"
),
CertificateAuthoritiesPage: setRoute(
"/cert-manager/$projectId/certificate-authorities",
@@ -310,6 +318,10 @@ export const ROUTE_PATHS = Object.freeze({
PkiCollectionDetailsByIDPage: setRoute(
"/cert-manager/$projectId/pki-collections/$collectionId",
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/pki-collections/$collectionId"
+ ),
+ PkiSubscriberDetailsByIDPage: setRoute(
+ "/cert-manager/$projectId/subscribers/$subscriberName",
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName"
)
},
Ssh: {
diff --git a/frontend/src/context/OrgPermissionContext/types.ts b/frontend/src/context/OrgPermissionContext/types.ts
index 2dbfaacb78..a4bd202bf7 100644
--- a/frontend/src/context/OrgPermissionContext/types.ts
+++ b/frontend/src/context/OrgPermissionContext/types.ts
@@ -12,7 +12,8 @@ export enum OrgGatewayPermissionActions {
CreateGateways = "create-gateways",
ListGateways = "list-gateways",
EditGateways = "edit-gateways",
- DeleteGateways = "delete-gateways"
+ DeleteGateways = "delete-gateways",
+ AttachGateways = "attach-gateways"
}
export enum OrgPermissionSubjects {
diff --git a/frontend/src/context/ProjectPermissionContext/index.tsx b/frontend/src/context/ProjectPermissionContext/index.tsx
index 5bc163817f..d7b7334ea8 100644
--- a/frontend/src/context/ProjectPermissionContext/index.tsx
+++ b/frontend/src/context/ProjectPermissionContext/index.tsx
@@ -2,11 +2,14 @@ export { useProjectPermission } from "./ProjectPermissionContext";
export type { ProjectPermissionSet, TProjectPermission } from "./types";
export {
ProjectPermissionActions,
+ ProjectPermissionCertificateActions,
ProjectPermissionCmekActions,
ProjectPermissionDynamicSecretActions,
ProjectPermissionGroupActions,
ProjectPermissionIdentityActions,
ProjectPermissionKmipActions,
ProjectPermissionMemberActions,
+ ProjectPermissionPkiSubscriberActions,
+ ProjectPermissionSshHostActions,
ProjectPermissionSub
} from "./types";
diff --git a/frontend/src/context/ProjectPermissionContext/types.ts b/frontend/src/context/ProjectPermissionContext/types.ts
index 639a3c72c2..70976d4bac 100644
--- a/frontend/src/context/ProjectPermissionContext/types.ts
+++ b/frontend/src/context/ProjectPermissionContext/types.ts
@@ -7,6 +7,14 @@ export enum ProjectPermissionActions {
Delete = "delete"
}
+export enum ProjectPermissionCertificateActions {
+ Read = "read",
+ Create = "create",
+ Edit = "edit",
+ Delete = "delete",
+ ReadPrivateKey = "read-private-key"
+}
+
export enum ProjectPermissionSecretActions {
DescribeAndReadValue = "read",
DescribeSecret = "describeSecret",
@@ -87,6 +95,15 @@ export enum ProjectPermissionSshHostActions {
IssueHostCert = "issue-host-cert"
}
+export enum ProjectPermissionPkiSubscriberActions {
+ Read = "read",
+ Create = "create",
+ Edit = "edit",
+ Delete = "delete",
+ IssueCert = "issue-cert",
+ ListCerts = "list-certs"
+}
+
export enum ProjectPermissionSecretRotationActions {
Read = "read",
ReadGeneratedCredentials = "read-generated-credentials",
@@ -183,6 +200,7 @@ export enum ProjectPermissionSub {
SshHostGroups = "ssh-host-groups",
PkiAlerts = "pki-alerts",
PkiCollections = "pki-collections",
+ PkiSubscribers = "pki-subscribers",
Kms = "kms",
Cmek = "cmek",
SecretSyncs = "secret-syncs",
@@ -218,6 +236,14 @@ export type SecretRotationSubjectFields = {
secretPath: string;
};
+export type SshHostSubjectFields = {
+ hostname: string;
+};
+
+export type PkiSubscriberSubjectFields = {
+ name: string;
+};
+
export type ProjectPermissionSet =
| [
ProjectPermissionSecretActions,
@@ -274,13 +300,26 @@ export type ProjectPermissionSet =
)
]
| [ProjectPermissionActions, ProjectPermissionSub.CertificateAuthorities]
- | [ProjectPermissionActions, ProjectPermissionSub.Certificates]
+ | [ProjectPermissionCertificateActions, ProjectPermissionSub.Certificates]
| [ProjectPermissionActions, ProjectPermissionSub.CertificateTemplates]
| [ProjectPermissionActions, ProjectPermissionSub.SshCertificateAuthorities]
| [ProjectPermissionActions, ProjectPermissionSub.SshCertificateTemplates]
| [ProjectPermissionActions, ProjectPermissionSub.SshCertificates]
| [ProjectPermissionActions, ProjectPermissionSub.SshHostGroups]
- | [ProjectPermissionSshHostActions, ProjectPermissionSub.SshHosts]
+ | [
+ ProjectPermissionSshHostActions,
+ (
+ | ProjectPermissionSub.SshHosts
+ | (ForcedSubject<ProjectPermissionSub.SshHosts> & SshHostSubjectFields)
+ )
+ ]
+ | [
+ ProjectPermissionPkiSubscriberActions,
+ (
+ | ProjectPermissionSub.PkiSubscribers
+ | (ForcedSubject<ProjectPermissionSub.PkiSubscribers> & PkiSubscriberSubjectFields)
+ )
+ ]
| [ProjectPermissionActions, ProjectPermissionSub.PkiAlerts]
| [ProjectPermissionActions, ProjectPermissionSub.PkiCollections]
| [ProjectPermissionSecretSyncActions, ProjectPermissionSub.SecretSyncs]
diff --git a/frontend/src/context/index.tsx b/frontend/src/context/index.tsx
index 51f2797d0a..91fcd90556 100644
--- a/frontend/src/context/index.tsx
+++ b/frontend/src/context/index.tsx
@@ -10,12 +10,15 @@ export {
export type { TProjectPermission } from "./ProjectPermissionContext";
export {
ProjectPermissionActions,
+ ProjectPermissionCertificateActions,
ProjectPermissionCmekActions,
ProjectPermissionDynamicSecretActions,
ProjectPermissionGroupActions,
ProjectPermissionIdentityActions,
ProjectPermissionKmipActions,
ProjectPermissionMemberActions,
+ ProjectPermissionPkiSubscriberActions,
+ ProjectPermissionSshHostActions,
ProjectPermissionSub,
useProjectPermission
} from "./ProjectPermissionContext";
diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts
index 68715f9a0b..8caa13a5b4 100644
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@ -30,6 +30,7 @@ import {
VercelConnectionMethod,
WindmillConnectionMethod
} from "@app/hooks/api/appConnections/types";
+import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-connection";
export const APP_CONNECTION_MAP: Record<
AppConnection,
@@ -61,7 +62,8 @@ export const APP_CONNECTION_MAP: Record<
[AppConnection.Auth0]: { name: "Auth0", image: "Auth0.png", size: 40 },
[AppConnection.HCVault]: { name: "Hashicorp Vault", image: "Vault.png", size: 65 },
[AppConnection.LDAP]: { name: "LDAP", image: "LDAP.png", size: 65 },
- [AppConnection.TeamCity]: { name: "TeamCity", image: "TeamCity.png" }
+ [AppConnection.TeamCity]: { name: "TeamCity", image: "TeamCity.png" },
+ [AppConnection.OCI]: { name: "OCI", image: "Oracle.png" }
};
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
@@ -74,6 +76,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
case GitHubConnectionMethod.OAuth:
return { name: "OAuth", icon: faPassport };
case AwsConnectionMethod.AccessKey:
+ case OCIConnectionMethod.AccessKey:
return { name: "Access Key", icon: faKey };
case AwsConnectionMethod.AssumeRole:
return { name: "Assume Role", icon: faUser };
diff --git a/frontend/src/helpers/project.ts b/frontend/src/helpers/project.ts
index cc5c6fa913..3e0d0f52e1 100644
--- a/frontend/src/helpers/project.ts
+++ b/frontend/src/helpers/project.ts
@@ -61,6 +61,9 @@ export const initProjectHelper = async ({ projectName }: { projectName: string }
return project;
};
export const getProjectHomePage = (workspace: Workspace) => {
+ if (workspace.type === ProjectType.CertificateManager) {
+ return `/${workspace.type}/$projectId/subscribers` as const;
+ }
return `/${workspace.type}/$projectId/overview` as const;
};
diff --git a/frontend/src/helpers/roles.ts b/frontend/src/helpers/roles.ts
index dcf80d452c..8d7f5e81ce 100644
--- a/frontend/src/helpers/roles.ts
+++ b/frontend/src/helpers/roles.ts
@@ -6,21 +6,9 @@ export enum OrgMembershipRole {
NoAccess = "no-access"
}
-enum ProjectMemberRole {
- Admin = "admin",
- Member = "member",
- Viewer = "viewer",
- NoAccess = "no-access"
-}
-
export const isCustomOrgRole = (slug: string) =>
!Object.values(OrgMembershipRole).includes(slug as OrgMembershipRole);
-export const formatProjectRoleName = (name: string) => {
- if (name === ProjectMemberRole.Member) return "developer";
- return name;
-};
-
export const isCustomProjectRole = (slug: string) =>
!Object.values(ProjectMembershipRole).includes(slug as ProjectMembershipRole);
@@ -28,3 +16,24 @@ export const findOrgMembershipRole = (roles: TOrgRole[], roleIdOrSlug: string) =
isCustomOrgRole(roleIdOrSlug)
? roles.find((r) => r.id === roleIdOrSlug)
: roles.find((r) => r.slug === roleIdOrSlug);
+
+export const formatProjectRoleName = (role: string, customRoleName?: string) => {
+ switch (role) {
+ case ProjectMembershipRole.Admin:
+ return "Admin";
+ case ProjectMembershipRole.Member:
+ return "Developer";
+ case ProjectMembershipRole.Viewer:
+ return "Viewer";
+ case ProjectMembershipRole.NoAccess:
+ return "No Access";
+ case ProjectMembershipRole.Custom:
+ return customRoleName ?? role;
+ case ProjectMembershipRole.SshHostBootstrapper:
+ return "SSH Host Bootstrapper";
+ case ProjectMembershipRole.KmsCryptographicOperator:
+ return "Cryptographic Operator";
+ default:
+ return role;
+ }
+};
diff --git a/frontend/src/helpers/secretSyncs.ts b/frontend/src/helpers/secretSyncs.ts
index 58d9f3e48e..80df92ac34 100644
--- a/frontend/src/helpers/secretSyncs.ts
+++ b/frontend/src/helpers/secretSyncs.ts
@@ -47,6 +47,10 @@ export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }
[SecretSync.TeamCity]: {
name: "TeamCity",
image: "TeamCity.png"
+ },
+ [SecretSync.OCIVault]: {
+ name: "OCI Vault",
+ image: "Oracle.png"
}
};
@@ -64,7 +68,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
[SecretSync.Vercel]: AppConnection.Vercel,
[SecretSync.Windmill]: AppConnection.Windmill,
[SecretSync.HCVault]: AppConnection.HCVault,
- [SecretSync.TeamCity]: AppConnection.TeamCity
+ [SecretSync.TeamCity]: AppConnection.TeamCity,
+ [SecretSync.OCIVault]: AppConnection.OCI
};
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
diff --git a/frontend/src/hooks/api/admin/index.ts b/frontend/src/hooks/api/admin/index.ts
index bc812e18e2..5bedf11589 100644
--- a/frontend/src/hooks/api/admin/index.ts
+++ b/frontend/src/hooks/api/admin/index.ts
@@ -3,6 +3,7 @@ export {
useAdminGrantServerAdminAccess,
useAdminRemoveIdentitySuperAdminAccess,
useCreateAdminUser,
+ useInvalidateCache,
useRemoveUserServerAdminAccess,
useUpdateServerConfig,
useUpdateServerEncryptionStrategy
diff --git a/frontend/src/hooks/api/admin/mutation.ts b/frontend/src/hooks/api/admin/mutation.ts
index 2c88d4fd88..f220573c9d 100644
--- a/frontend/src/hooks/api/admin/mutation.ts
+++ b/frontend/src/hooks/api/admin/mutation.ts
@@ -8,6 +8,7 @@ import { adminQueryKeys, adminStandaloneKeys } from "./queries";
import {
RootKeyEncryptionStrategy,
TCreateAdminUserDTO,
+ TInvalidateCacheDTO,
TServerConfig,
TUpdateServerConfigDTO
} from "./types";
@@ -126,3 +127,15 @@ export const useUpdateServerEncryptionStrategy = () => {
}
});
};
+
+export const useInvalidateCache = () => {
+ const queryClient = useQueryClient();
+ return useMutation<void, object, TInvalidateCacheDTO>({
+ mutationFn: async (dto) => {
+ await apiRequest.post("/api/v1/admin/invalidate-cache", dto);
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: adminQueryKeys.getInvalidateCache() });
+ }
+ });
+};
diff --git a/frontend/src/hooks/api/admin/queries.ts b/frontend/src/hooks/api/admin/queries.ts
index 1d44a93d05..85c6c153e3 100644
--- a/frontend/src/hooks/api/admin/queries.ts
+++ b/frontend/src/hooks/api/admin/queries.ts
@@ -8,6 +8,7 @@ import {
AdminGetIdentitiesFilters,
AdminGetUsersFilters,
AdminIntegrationsConfig,
+ TGetInvalidatingCacheStatus,
TGetServerRootKmsEncryptionDetails,
TServerConfig
} from "./types";
@@ -22,8 +23,10 @@ export const adminQueryKeys = {
getUsers: (filters: AdminGetUsersFilters) => [adminStandaloneKeys.getUsers, { filters }] as const,
getIdentities: (filters: AdminGetIdentitiesFilters) =>
[adminStandaloneKeys.getIdentities, { filters }] as const,
- getAdminIntegrationsConfig: () => ["admin-integrations-config"] as const,
- getServerEncryptionStrategies: () => ["server-encryption-strategies"] as const
+ getAdminSlackConfig: () => ["admin-slack-config"] as const,
+ getServerEncryptionStrategies: () => ["server-encryption-strategies"] as const,
+ getInvalidateCache: () => ["admin-invalidate-cache"] as const,
+ getAdminIntegrationsConfig: () => ["admin-integrations-config"] as const
};
export const fetchServerConfig = async () => {
@@ -118,3 +121,18 @@ export const useGetServerRootKmsEncryptionDetails = () => {
}
});
};
+
+export const useGetInvalidatingCacheStatus = (enabled = true) => {
+ return useQuery({
+ queryKey: adminQueryKeys.getInvalidateCache(),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TGetInvalidatingCacheStatus>(
+ "/api/v1/admin/invalidating-cache-status"
+ );
+
+ return data.invalidating;
+ },
+ enabled,
+ refetchInterval: (data) => (data ? 3000 : false)
+ });
+};
diff --git a/frontend/src/hooks/api/admin/types.ts b/frontend/src/hooks/api/admin/types.ts
index 4533b59632..8850b3375d 100644
--- a/frontend/src/hooks/api/admin/types.ts
+++ b/frontend/src/hooks/api/admin/types.ts
@@ -24,6 +24,7 @@ export type TServerConfig = {
enabledLoginMethods: LoginMethod[];
authConsentContent?: string;
pageFrameContent?: string;
+ invalidatingCache: boolean;
};
export type TUpdateServerConfigDTO = {
@@ -84,3 +85,16 @@ export enum RootKeyEncryptionStrategy {
Software = "SOFTWARE",
HSM = "HSM"
}
+
+export enum CacheType {
+ ALL = "all",
+ SECRETS = "secrets"
+}
+
+export type TInvalidateCacheDTO = {
+ type: CacheType;
+};
+
+export type TGetInvalidatingCacheStatus = {
+ invalidating: boolean;
+};
diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.ts
index 5e1f84cb43..06a5056afb 100644
--- a/frontend/src/hooks/api/appConnections/enums.ts
+++ b/frontend/src/hooks/api/appConnections/enums.ts
@@ -16,5 +16,6 @@ export enum AppConnection {
Auth0 = "auth0",
HCVault = "hashicorp-vault",
LDAP = "ldap",
- TeamCity = "teamcity"
+ TeamCity = "teamcity",
+ OCI = "oci"
}
diff --git a/frontend/src/hooks/api/appConnections/oci/index.ts b/frontend/src/hooks/api/appConnections/oci/index.ts
new file mode 100644
index 0000000000..2c1906d369
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/oci/index.ts
@@ -0,0 +1,2 @@
+export * from "./queries";
+export * from "./types";
diff --git a/frontend/src/hooks/api/appConnections/oci/queries.tsx b/frontend/src/hooks/api/appConnections/oci/queries.tsx
new file mode 100644
index 0000000000..f0e2659b79
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/oci/queries.tsx
@@ -0,0 +1,108 @@
+import { useQuery, UseQueryOptions } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import { appConnectionKeys } from "../queries";
+import {
+ TListOCIVaultKeys,
+ TListOCIVaults,
+ TOCICompartment,
+ TOCIVault,
+ TOCIVaultKey
+} from "./types";
+
+const ociConnectionKeys = {
+ all: [...appConnectionKeys.all, "oci"] as const,
+ listCompartments: (connectionId: string) =>
+ [...ociConnectionKeys.all, "compartments", connectionId] as const,
+ listVaults: (connectionId: string, compartmentOcid: string) =>
+ [...ociConnectionKeys.all, "vaults", connectionId, compartmentOcid] as const,
+ listVaultKeys: (connectionId: string, compartmentOcid: string, vaultOcid: string) =>
+ [...ociConnectionKeys.all, "keys", connectionId, compartmentOcid, vaultOcid] as const
+};
+
+export const useOCIConnectionListCompartments = (
+ connectionId: string,
+ options?: Omit<
+ UseQueryOptions<
+ TOCICompartment[],
+ unknown,
+ TOCICompartment[],
+ ReturnType<typeof ociConnectionKeys.listCompartments>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: ociConnectionKeys.listCompartments(connectionId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TOCICompartment[]>(
+ `/api/v1/app-connections/oci/${connectionId}/compartments`
+ );
+
+ return data;
+ },
+ ...options
+ });
+};
+
+export const useOCIConnectionListVaults = (
+ { connectionId, compartmentOcid }: TListOCIVaults,
+ options?: Omit<
+ UseQueryOptions<
+ TOCIVault[],
+ unknown,
+ TOCIVault[],
+ ReturnType<typeof ociConnectionKeys.listVaults>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: ociConnectionKeys.listVaults(connectionId, compartmentOcid),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TOCIVault[]>(
+ `/api/v1/app-connections/oci/${connectionId}/vaults`,
+ {
+ params: {
+ compartmentOcid
+ }
+ }
+ );
+
+ return data;
+ },
+ ...options
+ });
+};
+
+export const useOCIConnectionListVaultKeys = (
+ { connectionId, compartmentOcid, vaultOcid }: TListOCIVaultKeys,
+ options?: Omit<
+ UseQueryOptions<
+ TOCIVaultKey[],
+ unknown,
+ TOCIVaultKey[],
+ ReturnType<typeof ociConnectionKeys.listVaultKeys>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: ociConnectionKeys.listVaultKeys(connectionId, compartmentOcid, vaultOcid),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TOCIVaultKey[]>(
+ `/api/v1/app-connections/oci/${connectionId}/vault-keys`,
+ {
+ params: {
+ compartmentOcid,
+ vaultOcid
+ }
+ }
+ );
+
+ return data;
+ },
+ ...options
+ });
+};
diff --git a/frontend/src/hooks/api/appConnections/oci/types.ts b/frontend/src/hooks/api/appConnections/oci/types.ts
new file mode 100644
index 0000000000..da12116bdb
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/oci/types.ts
@@ -0,0 +1,27 @@
+// Response types
+export type TOCICompartment = {
+ id: string;
+ name: string;
+};
+
+export type TOCIVault = {
+ id: string;
+ displayName: string;
+};
+
+export type TOCIVaultKey = {
+ id: string;
+ displayName: string;
+};
+
+// Param types
+export type TListOCIVaults = {
+ connectionId: string;
+ compartmentOcid: string;
+};
+
+export type TListOCIVaultKeys = {
+ connectionId: string;
+ compartmentOcid: string;
+ vaultOcid: string;
+};
diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.ts
index 910716c028..79cbb81b9a 100644
--- a/frontend/src/hooks/api/appConnections/types/app-options.ts
+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts
@@ -84,6 +84,10 @@ export type TTeamCityConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.TeamCity;
};
+export type TOCIConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.OCI;
+};
+
export type TAppConnectionOption =
| TAwsConnectionOption
| TGitHubConnectionOption
@@ -101,7 +105,8 @@ export type TAppConnectionOption =
| TWindmillConnectionOption
| TAuth0ConnectionOption
| THCVaultConnectionOption
- | TTeamCityConnectionOption;
+ | TTeamCityConnectionOption
+ | TOCIConnectionOption;
export type TAppConnectionOptionMap = {
[AppConnection.AWS]: TAwsConnectionOption;
@@ -122,4 +127,5 @@ export type TAppConnectionOptionMap = {
[AppConnection.HCVault]: THCVaultConnectionOption;
[AppConnection.LDAP]: TLdapConnectionOption;
[AppConnection.TeamCity]: TTeamCityConnectionOption;
+ [AppConnection.OCI]: TOCIConnectionOption;
};
diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.ts
index 00c0c3f3ae..2b29c2cd46 100644
--- a/frontend/src/hooks/api/appConnections/types/index.ts
+++ b/frontend/src/hooks/api/appConnections/types/index.ts
@@ -13,6 +13,7 @@ import { THCVaultConnection } from "./hc-vault-connection";
import { THumanitecConnection } from "./humanitec-connection";
import { TLdapConnection } from "./ldap-connection";
import { TMsSqlConnection } from "./mssql-connection";
+import { TOCIConnection } from "./oci-connection";
import { TPostgresConnection } from "./postgres-connection";
import { TTeamCityConnection } from "./teamcity-connection";
import { TTerraformCloudConnection } from "./terraform-cloud-connection";
@@ -32,6 +33,7 @@ export * from "./hc-vault-connection";
export * from "./humanitec-connection";
export * from "./ldap-connection";
export * from "./mssql-connection";
+export * from "./oci-connection";
export * from "./postgres-connection";
export * from "./teamcity-connection";
export * from "./terraform-cloud-connection";
@@ -56,7 +58,8 @@ export type TAppConnection =
| TAuth0Connection
| THCVaultConnection
| TLdapConnection
- | TTeamCityConnection;
+ | TTeamCityConnection
+ | TOCIConnection;
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id">;
@@ -102,4 +105,5 @@ export type TAppConnectionMap = {
[AppConnection.HCVault]: THCVaultConnection;
[AppConnection.LDAP]: TLdapConnection;
[AppConnection.TeamCity]: TTeamCityConnection;
+ [AppConnection.OCI]: TOCIConnection;
};
diff --git a/frontend/src/hooks/api/appConnections/types/oci-connection.ts b/frontend/src/hooks/api/appConnections/types/oci-connection.ts
new file mode 100644
index 0000000000..f6b5c2cadd
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/types/oci-connection.ts
@@ -0,0 +1,17 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
+
+export enum OCIConnectionMethod {
+ AccessKey = "access-key"
+}
+
+export type TOCIConnection = TRootAppConnection & { app: AppConnection.OCI } & {
+ method: OCIConnectionMethod.AccessKey;
+ credentials: {
+ userOcid: string;
+ tenancyOcid: string;
+ region: string;
+ fingerprint: string;
+ privateKey: string;
+ };
+};
diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx
index 9de5c40859..f726566cd7 100644
--- a/frontend/src/hooks/api/auditLogs/constants.tsx
+++ b/frontend/src/hooks/api/auditLogs/constants.tsx
@@ -72,6 +72,8 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.DELETE_CERT]: "Delete certificate",
[EventType.REVOKE_CERT]: "Revoke certificate",
[EventType.GET_CERT_BODY]: "Get certificate body",
+ [EventType.GET_CERT_PRIVATE_KEY]: "Get certificate private key",
+ [EventType.GET_CERT_BUNDLE]: "Get certificate bundle",
[EventType.CREATE_PKI_ALERT]: "Create PKI alert",
[EventType.GET_PKI_ALERT]: "Get PKI alert",
[EventType.UPDATE_PKI_ALERT]: "Update PKI alert",
@@ -180,10 +182,17 @@ export const eventToNameMap: { [K in EventType]: string } = {
"Microsoft Teams Workflow Integration Check Installation Status",
[EventType.MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_GET_TEAMS]: "Get Microsoft Teams tenant teams",
[EventType.MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_GET]: "Get Microsoft Teams Workflow Integration",
- [EventType.MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_LIST]: "List Microsoft Teams Workflow Integration"
+ [EventType.MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_LIST]:
+ "List Microsoft Teams Workflow Integration",
+
+ [EventType.LOGIN_IDENTITY_LDAP_AUTH]: "Identity login via LDAP Auth",
+ [EventType.ADD_IDENTITY_LDAP_AUTH]: "Attached LDAP Auth to identity",
+ [EventType.UPDATE_IDENTITY_LDAP_AUTH]: "Updated LDAP Auth for identity",
+ [EventType.GET_IDENTITY_LDAP_AUTH]: "Retrieved LDAP Auth for identity",
+ [EventType.REVOKE_IDENTITY_LDAP_AUTH]: "Revoked LDAP Auth for identity"
};
-export const userAgentTTypeoNameMap: { [K in UserAgentType]: string } = {
+export const userAgentTypeToNameMap: { [K in UserAgentType]: string } = {
[UserAgentType.WEB]: "Web",
[UserAgentType.CLI]: "CLI",
[UserAgentType.K8_OPERATOR]: "K8s operator",
diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx
index 08f2559f61..b74969d6df 100644
--- a/frontend/src/hooks/api/auditLogs/enums.tsx
+++ b/frontend/src/hooks/api/auditLogs/enums.tsx
@@ -47,6 +47,13 @@ export enum EventType {
CREATE_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRET = "create-identity-universal-auth-client-secret",
REVOKE_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRET = "revoke-identity-universal-auth-client-secret",
GET_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRETS = "get-identity-universal-auth-client-secret",
+
+ LOGIN_IDENTITY_LDAP_AUTH = "login-identity-ldap-auth",
+ ADD_IDENTITY_LDAP_AUTH = "add-identity-ldap-auth",
+ UPDATE_IDENTITY_LDAP_AUTH = "update-identity-ldap-auth",
+ GET_IDENTITY_LDAP_AUTH = "get-identity-ldap-auth",
+ REVOKE_IDENTITY_LDAP_AUTH = "revoke-identity-ldap-auth",
+
CREATE_ENVIRONMENT = "create-environment",
UPDATE_ENVIRONMENT = "update-environment",
DELETE_ENVIRONMENT = "delete-environment",
@@ -78,6 +85,8 @@ export enum EventType {
DELETE_CERT = "delete-cert",
REVOKE_CERT = "revoke-cert",
GET_CERT_BODY = "get-cert-body",
+ GET_CERT_PRIVATE_KEY = "get-cert-private-key",
+ GET_CERT_BUNDLE = "get-cert-bundle",
CREATE_PKI_ALERT = "create-pki-alert",
GET_PKI_ALERT = "get-pki-alert",
UPDATE_PKI_ALERT = "update-pki-alert",
diff --git a/frontend/src/hooks/api/auditLogs/types.tsx b/frontend/src/hooks/api/auditLogs/types.tsx
index 440f25c3dc..745d0368f6 100644
--- a/frontend/src/hooks/api/auditLogs/types.tsx
+++ b/frontend/src/hooks/api/auditLogs/types.tsx
@@ -620,6 +620,24 @@ interface GetCertBody {
};
}
+interface GetCertPrivateKey {
+ type: EventType.GET_CERT_PRIVATE_KEY;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
+interface GetCertBundle {
+ type: EventType.GET_CERT_BUNDLE;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
interface CreatePkiAlert {
type: EventType.CREATE_PKI_ALERT;
metadata: {
@@ -881,6 +899,8 @@ export type Event =
| DeleteCert
| RevokeCert
| GetCertBody
+ | GetCertPrivateKey
+ | GetCertBundle
| CreatePkiAlert
| GetPkiAlert
| UpdatePkiAlert
diff --git a/frontend/src/hooks/api/certificates/mutations.tsx b/frontend/src/hooks/api/certificates/mutations.tsx
index 7e9cf4f91e..74d6b5cbbf 100644
--- a/frontend/src/hooks/api/certificates/mutations.tsx
+++ b/frontend/src/hooks/api/certificates/mutations.tsx
@@ -2,6 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
+import { pkiSubscriberKeys } from "../pkiSubscriber/queries";
import { workspaceKeys } from "../workspace";
import { TCertificate, TDeleteCertDTO, TRevokeCertDTO } from "./types";
@@ -42,6 +43,9 @@ export const useRevokeCert = () => {
queryClient.invalidateQueries({
queryKey: workspaceKeys.forWorkspaceCertificates(projectSlug)
});
+ queryClient.invalidateQueries({
+ queryKey: pkiSubscriberKeys.allPkiSubscriberCertificates()
+ });
}
});
};
diff --git a/frontend/src/hooks/api/certificates/queries.tsx b/frontend/src/hooks/api/certificates/queries.tsx
index 50c751c06d..50f2836edf 100644
--- a/frontend/src/hooks/api/certificates/queries.tsx
+++ b/frontend/src/hooks/api/certificates/queries.tsx
@@ -6,7 +6,8 @@ import { TCertificate } from "./types";
export const certKeys = {
getCertById: (serialNumber: string) => [{ serialNumber }, "cert"],
- getCertBody: (serialNumber: string) => [{ serialNumber }, "certBody"]
+ getCertBody: (serialNumber: string) => [{ serialNumber }, "certBody"],
+ getCertBundle: (serialNumber: string) => [{ serialNumber }, "certBundle"]
};
export const useGetCert = (serialNumber: string) => {
@@ -38,3 +39,19 @@ export const useGetCertBody = (serialNumber: string) => {
enabled: Boolean(serialNumber)
});
};
+
+export const useGetCertBundle = (serialNumber: string) => {
+ return useQuery({
+ queryKey: certKeys.getCertBundle(serialNumber),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{
+ certificate: string;
+ certificateChain: string;
+ serialNumber: string;
+ privateKey: string | null;
+ }>(`/api/v1/pki/certificates/${serialNumber}/bundle`);
+ return data;
+ },
+ enabled: Boolean(serialNumber)
+ });
+};
diff --git a/frontend/src/hooks/api/gateways/mutation.tsx b/frontend/src/hooks/api/gateways/mutation.tsx
index e93197fddd..ef292cb39b 100644
--- a/frontend/src/hooks/api/gateways/mutation.tsx
+++ b/frontend/src/hooks/api/gateways/mutation.tsx
@@ -20,8 +20,8 @@ export const useDeleteGatewayById = () => {
export const useUpdateGatewayById = () => {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: ({ id, name, projectIds }: TUpdateGatewayDTO) => {
- return apiRequest.patch(`/api/v1/gateways/${id}`, { name, projectIds });
+ mutationFn: ({ id, name }: TUpdateGatewayDTO) => {
+ return apiRequest.patch(`/api/v1/gateways/${id}`, { name });
},
onSuccess: () => {
queryClient.invalidateQueries(gatewaysQueryKeys.list());
diff --git a/frontend/src/hooks/api/gateways/queries.tsx b/frontend/src/hooks/api/gateways/queries.tsx
index 6ec374a6cc..bb05b17a46 100644
--- a/frontend/src/hooks/api/gateways/queries.tsx
+++ b/frontend/src/hooks/api/gateways/queries.tsx
@@ -2,7 +2,7 @@ import { queryOptions } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { TGateway, TListProjectGatewayDTO, TProjectGateway } from "./types";
+import { TGateway } from "./types";
export const gatewaysQueryKeys = {
allKey: () => ["gateways"],
@@ -14,20 +14,5 @@ export const gatewaysQueryKeys = {
const { data } = await apiRequest.get<{ gateways: TGateway[] }>("/api/v1/gateways");
return data.gateways;
}
- }),
- listProjectGatewayKey: ({ projectId }: TListProjectGatewayDTO) => [
- ...gatewaysQueryKeys.allKey(),
- "list",
- { projectId }
- ],
- listProjectGateways: ({ projectId }: TListProjectGatewayDTO) =>
- queryOptions({
- queryKey: gatewaysQueryKeys.listProjectGatewayKey({ projectId }),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ gateways: TProjectGateway[] }>(
- `/api/v1/gateways/projects/${projectId}`
- );
- return data.gateways;
- }
})
};
diff --git a/frontend/src/hooks/api/gateways/types.ts b/frontend/src/hooks/api/gateways/types.ts
index a522b6c48d..6a3f2d673d 100644
--- a/frontend/src/hooks/api/gateways/types.ts
+++ b/frontend/src/hooks/api/gateways/types.ts
@@ -11,39 +11,13 @@ export type TGateway = {
name: string;
id: string;
};
- projects: {
- name: string;
- id: string;
- slug: string;
- }[];
-};
-
-export type TProjectGateway = {
- id: string;
- identityId: string;
- name: string;
- createdAt: string;
- updatedAt: string;
- issuedAt: string;
- serialNumber: string;
- heartbeat: string;
- projectGatewayId: string;
- identity: {
- name: string;
- id: string;
- };
};
export type TUpdateGatewayDTO = {
id: string;
name?: string;
- projectIds?: string[];
};
export type TDeleteGatewayDTO = {
id: string;
};
-
-export type TListProjectGatewayDTO = {
- projectId: string;
-};
diff --git a/frontend/src/hooks/api/identities/constants.tsx b/frontend/src/hooks/api/identities/constants.tsx
index c11d7dc11b..71f70806ad 100644
--- a/frontend/src/hooks/api/identities/constants.tsx
+++ b/frontend/src/hooks/api/identities/constants.tsx
@@ -7,6 +7,8 @@ export const identityAuthToNameMap: { [I in IdentityAuthMethod]: string } = {
[IdentityAuthMethod.GCP_AUTH]: "GCP Auth",
[IdentityAuthMethod.AWS_AUTH]: "AWS Auth",
[IdentityAuthMethod.AZURE_AUTH]: "Azure Auth",
+ [IdentityAuthMethod.OCI_AUTH]: "OCI Auth",
[IdentityAuthMethod.OIDC_AUTH]: "OIDC Auth",
+ [IdentityAuthMethod.LDAP_AUTH]: "LDAP Auth",
[IdentityAuthMethod.JWT_AUTH]: "JWT Auth"
};
diff --git a/frontend/src/hooks/api/identities/enums.tsx b/frontend/src/hooks/api/identities/enums.tsx
index 415492e005..a9b6eb3e16 100644
--- a/frontend/src/hooks/api/identities/enums.tsx
+++ b/frontend/src/hooks/api/identities/enums.tsx
@@ -5,7 +5,9 @@ export enum IdentityAuthMethod {
GCP_AUTH = "gcp-auth",
AWS_AUTH = "aws-auth",
AZURE_AUTH = "azure-auth",
+ OCI_AUTH = "oci-auth",
OIDC_AUTH = "oidc-auth",
+ LDAP_AUTH = "ldap-auth",
JWT_AUTH = "jwt-auth"
}
diff --git a/frontend/src/hooks/api/identities/index.tsx b/frontend/src/hooks/api/identities/index.tsx
index f3b9fa0128..bf49387acb 100644
--- a/frontend/src/hooks/api/identities/index.tsx
+++ b/frontend/src/hooks/api/identities/index.tsx
@@ -1,51 +1,4 @@
export { identityAuthToNameMap } from "./constants";
export { IdentityAuthMethod } from "./enums";
-export {
- useAddIdentityAwsAuth,
- useAddIdentityAzureAuth,
- useAddIdentityGcpAuth,
- useAddIdentityJwtAuth,
- useAddIdentityKubernetesAuth,
- useAddIdentityOidcAuth,
- useAddIdentityTokenAuth,
- useAddIdentityUniversalAuth,
- useCreateIdentity,
- useCreateIdentityUniversalAuthClientSecret,
- useCreateTokenIdentityTokenAuth,
- useDeleteIdentity,
- useDeleteIdentityAwsAuth,
- useDeleteIdentityAzureAuth,
- useDeleteIdentityGcpAuth,
- useDeleteIdentityJwtAuth,
- useDeleteIdentityKubernetesAuth,
- useDeleteIdentityOidcAuth,
- useDeleteIdentityTokenAuth,
- useDeleteIdentityUniversalAuth,
- useRevokeIdentityTokenAuthToken,
- useRevokeIdentityUniversalAuthClientSecret,
- useUpdateIdentity,
- useUpdateIdentityAwsAuth,
- useUpdateIdentityAzureAuth,
- useUpdateIdentityGcpAuth,
- useUpdateIdentityJwtAuth,
- useUpdateIdentityKubernetesAuth,
- useUpdateIdentityOidcAuth,
- useUpdateIdentityTokenAuth,
- useUpdateIdentityTokenAuthToken,
- useUpdateIdentityUniversalAuth
-} from "./mutations";
-export {
- useGetIdentityAwsAuth,
- useGetIdentityAzureAuth,
- useGetIdentityById,
- useGetIdentityGcpAuth,
- useGetIdentityJwtAuth,
- useGetIdentityKubernetesAuth,
- useGetIdentityOidcAuth,
- useGetIdentityProjectMemberships,
- useGetIdentityTokenAuth,
- useGetIdentityTokensTokenAuth,
- useGetIdentityUniversalAuth,
- useGetIdentityUniversalAuthClientSecrets,
- useSearchIdentities
-} from "./queries";
+export * from "./mutations";
+export * from "./queries";
diff --git a/frontend/src/hooks/api/identities/mutations.tsx b/frontend/src/hooks/api/identities/mutations.tsx
index d68595ad5b..748745986c 100644
--- a/frontend/src/hooks/api/identities/mutations.tsx
+++ b/frontend/src/hooks/api/identities/mutations.tsx
@@ -10,6 +10,8 @@ import {
AddIdentityGcpAuthDTO,
AddIdentityJwtAuthDTO,
AddIdentityKubernetesAuthDTO,
+ AddIdentityLdapAuthDTO,
+ AddIdentityOciAuthDTO,
AddIdentityOidcAuthDTO,
AddIdentityTokenAuthDTO,
AddIdentityUniversalAuthDTO,
@@ -25,6 +27,8 @@ import {
DeleteIdentityGcpAuthDTO,
DeleteIdentityJwtAuthDTO,
DeleteIdentityKubernetesAuthDTO,
+ DeleteIdentityLdapAuthDTO,
+ DeleteIdentityOciAuthDTO,
DeleteIdentityOidcAuthDTO,
DeleteIdentityTokenAuthDTO,
DeleteIdentityUniversalAuthClientSecretDTO,
@@ -36,6 +40,8 @@ import {
IdentityGcpAuth,
IdentityJwtAuth,
IdentityKubernetesAuth,
+ IdentityLdapAuth,
+ IdentityOciAuth,
IdentityOidcAuth,
IdentityTokenAuth,
IdentityUniversalAuth,
@@ -47,6 +53,8 @@ import {
UpdateIdentityGcpAuthDTO,
UpdateIdentityJwtAuthDTO,
UpdateIdentityKubernetesAuthDTO,
+ UpdateIdentityLdapAuthDTO,
+ UpdateIdentityOciAuthDTO,
UpdateIdentityOidcAuthDTO,
UpdateIdentityTokenAuthDTO,
UpdateIdentityUniversalAuthDTO,
@@ -448,6 +456,101 @@ export const useDeleteIdentityAwsAuth = () => {
});
};
+export const useAddIdentityOciAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityOciAuth, object, AddIdentityOciAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ tenancyOcid,
+ allowedUsernames,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const {
+ data: { identityOciAuth }
+ } = await apiRequest.post<{ identityOciAuth: IdentityOciAuth }>(
+ `/api/v1/auth/oci-auth/identities/${identityId}`,
+ {
+ tenancyOcid,
+ allowedUsernames,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
+
+ return identityOciAuth;
+ },
+ onSuccess: (_, { identityId, organizationId }) => {
+ queryClient.invalidateQueries({
+ queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
+ });
+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityOciAuth(identityId) });
+ }
+ });
+};
+
+export const useUpdateIdentityOciAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityOciAuth, object, UpdateIdentityOciAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ tenancyOcid,
+ allowedUsernames,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const {
+ data: { identityOciAuth }
+ } = await apiRequest.patch<{ identityOciAuth: IdentityOciAuth }>(
+ `/api/v1/auth/oci-auth/identities/${identityId}`,
+ {
+ tenancyOcid,
+ allowedUsernames,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
+
+ return identityOciAuth;
+ },
+ onSuccess: (_, { identityId, organizationId }) => {
+ queryClient.invalidateQueries({
+ queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
+ });
+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityOciAuth(identityId) });
+ }
+ });
+};
+
+export const useDeleteIdentityOciAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityOciAuth, object, DeleteIdentityOciAuthDTO>({
+ mutationFn: async ({ identityId }) => {
+ const {
+ data: { identityOciAuth }
+ } = await apiRequest.delete(`/api/v1/auth/oci-auth/identities/${identityId}`);
+ return identityOciAuth;
+ },
+ onSuccess: (_, { organizationId, identityId }) => {
+ queryClient.invalidateQueries({
+ queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
+ });
+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityOciAuth(identityId) });
+ }
+ });
+};
+
export const useUpdateIdentityOidcAuth = () => {
const queryClient = useQueryClient();
return useMutation<IdentityOidcAuth, object, UpdateIdentityOidcAuthDTO>({
@@ -737,7 +840,8 @@ export const useAddIdentityKubernetesAuth = () => {
accessTokenTTL,
accessTokenMaxTTL,
accessTokenNumUsesLimit,
- accessTokenTrustedIps
+ accessTokenTrustedIps,
+ gatewayId
}) => {
const {
data: { identityKubernetesAuth }
@@ -753,7 +857,8 @@ export const useAddIdentityKubernetesAuth = () => {
accessTokenTTL,
accessTokenMaxTTL,
accessTokenNumUsesLimit,
- accessTokenTrustedIps
+ accessTokenTrustedIps,
+ gatewayId
}
);
@@ -842,7 +947,8 @@ export const useUpdateIdentityKubernetesAuth = () => {
accessTokenTTL,
accessTokenMaxTTL,
accessTokenNumUsesLimit,
- accessTokenTrustedIps
+ accessTokenTrustedIps,
+ gatewayId
}) => {
const {
data: { identityKubernetesAuth }
@@ -858,7 +964,8 @@ export const useUpdateIdentityKubernetesAuth = () => {
accessTokenTTL,
accessTokenMaxTTL,
accessTokenNumUsesLimit,
- accessTokenTrustedIps
+ accessTokenTrustedIps,
+ gatewayId
}
);
@@ -1049,3 +1156,116 @@ export const useRevokeIdentityTokenAuthToken = () => {
}
});
};
+
+export const useAddIdentityLdapAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityLdapAuth, object, AddIdentityLdapAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ url,
+ bindDN,
+ bindPass,
+ searchBase,
+ searchFilter,
+ ldapCaCertificate,
+ allowedFields,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const { data } = await apiRequest.post<{ identityLdapAuth: IdentityLdapAuth }>(
+ `/api/v1/auth/ldap-auth/identities/${identityId}`,
+ {
+ url,
+ bindDN,
+ bindPass,
+ searchBase,
+ searchFilter,
+ ldapCaCertificate,
+ allowedFields,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
+ return data.identityLdapAuth;
+ },
+ onSuccess: (_, { identityId, organizationId }) => {
+ queryClient.invalidateQueries({
+ queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
+ });
+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
+ queryClient.invalidateQueries({
+ queryKey: identitiesKeys.getIdentityLdapAuth(identityId)
+ });
+ }
+ });
+};
+
+export const useUpdateIdentityLdapAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityLdapAuth, object, UpdateIdentityLdapAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ url,
+ bindDN,
+ bindPass,
+ searchBase,
+ searchFilter,
+ ldapCaCertificate,
+ allowedFields,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const { data } = await apiRequest.patch<{ identityLdapAuth: IdentityLdapAuth }>(
+ `/api/v1/auth/ldap-auth/identities/${identityId}`,
+ {
+ url,
+ bindDN,
+ bindPass,
+ searchBase,
+ searchFilter,
+ ldapCaCertificate,
+ allowedFields,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
+ return data.identityLdapAuth;
+ },
+ onSuccess: (_, { identityId, organizationId }) => {
+ queryClient.invalidateQueries({
+ queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
+ });
+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
+ queryClient.invalidateQueries({
+ queryKey: identitiesKeys.getIdentityLdapAuth(identityId)
+ });
+ }
+ });
+};
+
+export const useDeleteIdentityLdapAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityLdapAuth, object, DeleteIdentityLdapAuthDTO>({
+ mutationFn: async ({ identityId }) => {
+ const { data } = await apiRequest.delete(`/api/v1/auth/ldap-auth/identities/${identityId}`);
+ return data.identityLdapAuth;
+ },
+ onSuccess: (_, { organizationId, identityId }) => {
+ queryClient.invalidateQueries({
+ queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
+ });
+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });
+ queryClient.invalidateQueries({
+ queryKey: identitiesKeys.getIdentityLdapAuth(identityId)
+ });
+ }
+ });
+};
diff --git a/frontend/src/hooks/api/identities/queries.tsx b/frontend/src/hooks/api/identities/queries.tsx
index 6b8a1d1ccb..adc18ed6f0 100644
--- a/frontend/src/hooks/api/identities/queries.tsx
+++ b/frontend/src/hooks/api/identities/queries.tsx
@@ -11,8 +11,10 @@ import {
IdentityGcpAuth,
IdentityJwtAuth,
IdentityKubernetesAuth,
+ IdentityLdapAuth,
IdentityMembership,
IdentityMembershipOrg,
+ IdentityOciAuth,
IdentityOidcAuth,
IdentityTokenAuth,
IdentityUniversalAuth,
@@ -31,9 +33,11 @@ export const identitiesKeys = {
getIdentityGcpAuth: (identityId: string) => [{ identityId }, "identity-gcp-auth"] as const,
getIdentityOidcAuth: (identityId: string) => [{ identityId }, "identity-oidc-auth"] as const,
getIdentityAwsAuth: (identityId: string) => [{ identityId }, "identity-aws-auth"] as const,
+ getIdentityOciAuth: (identityId: string) => [{ identityId }, "identity-oci-auth"] as const,
getIdentityAzureAuth: (identityId: string) => [{ identityId }, "identity-azure-auth"] as const,
getIdentityTokenAuth: (identityId: string) => [{ identityId }, "identity-token-auth"] as const,
getIdentityJwtAuth: (identityId: string) => [{ identityId }, "identity-jwt-auth"] as const,
+ getIdentityLdapAuth: (identityId: string) => [{ identityId }, "identity-ldap-auth"] as const,
getIdentityTokensTokenAuth: (identityId: string) =>
[{ identityId }, "identity-tokens-token-auth"] as const,
getIdentityProjectMemberships: (identityId: string) =>
@@ -168,6 +172,27 @@ export const useGetIdentityAwsAuth = (
});
};
+export const useGetIdentityOciAuth = (
+ identityId: string,
+ options?: TReactQueryOptions["options"]
+) => {
+ return useQuery({
+ queryKey: identitiesKeys.getIdentityOciAuth(identityId),
+ queryFn: async () => {
+ const {
+ data: { identityOciAuth }
+ } = await apiRequest.get<{ identityOciAuth: IdentityOciAuth }>(
+ `/api/v1/auth/oci-auth/identities/${identityId}`
+ );
+ return identityOciAuth;
+ },
+ staleTime: 0,
+ gcTime: 0,
+ ...options,
+ enabled: Boolean(identityId) && (options?.enabled ?? true)
+ });
+};
+
export const useGetIdentityAzureAuth = (
identityId: string,
options?: TReactQueryOptions["options"]
@@ -231,6 +256,27 @@ export const useGetIdentityTokenAuth = (
});
};
+export const useGetIdentityLdapAuth = (
+ identityId: string,
+ options?: TReactQueryOptions["options"]
+) => {
+ return useQuery({
+ queryKey: identitiesKeys.getIdentityLdapAuth(identityId),
+ queryFn: async () => {
+ const {
+ data: { identityLdapAuth }
+ } = await apiRequest.get<{ identityLdapAuth: IdentityLdapAuth }>(
+ `/api/v1/auth/ldap-auth/identities/${identityId}`
+ );
+ return identityLdapAuth;
+ },
+ staleTime: 0,
+ gcTime: 0,
+ ...options,
+ enabled: Boolean(identityId) && (options?.enabled ?? true)
+ });
+};
+
export const useGetIdentityTokensTokenAuth = (identityId: string) => {
return useQuery({
enabled: Boolean(identityId),
diff --git a/frontend/src/hooks/api/identities/types.ts b/frontend/src/hooks/api/identities/types.ts
index ca06219aa9..e31b39cbee 100644
--- a/frontend/src/hooks/api/identities/types.ts
+++ b/frontend/src/hooks/api/identities/types.ts
@@ -290,6 +290,48 @@ export type DeleteIdentityAwsAuthDTO = {
identityId: string;
};
+export type IdentityOciAuth = {
+ identityId: string;
+ type: "iam";
+ tenancyOcid: string;
+ allowedUsernames?: string | null;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: IdentityTrustedIp[];
+};
+
+export type AddIdentityOciAuthDTO = {
+ organizationId: string;
+ identityId: string;
+ tenancyOcid: string;
+ allowedUsernames?: string | null;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: {
+ ipAddress: string;
+ }[];
+};
+
+export type UpdateIdentityOciAuthDTO = {
+ organizationId: string;
+ identityId: string;
+ tenancyOcid?: string;
+ allowedUsernames?: string | null;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: {
+ ipAddress: string;
+ }[];
+};
+
+export type DeleteIdentityOciAuthDTO = {
+ organizationId: string;
+ identityId: string;
+};
+
export type IdentityAzureAuth = {
identityId: string;
tenantId: string;
@@ -346,6 +388,7 @@ export type IdentityKubernetesAuth = {
accessTokenMaxTTL: number;
accessTokenNumUsesLimit: number;
accessTokenTrustedIps: IdentityTrustedIp[];
+ gatewayId?: string | null;
};
export type AddIdentityKubernetesAuthDTO = {
@@ -356,6 +399,7 @@ export type AddIdentityKubernetesAuthDTO = {
allowedNamespaces: string;
allowedNames: string;
allowedAudience: string;
+ gatewayId?: string | null;
caCert: string;
accessTokenTTL: number;
accessTokenMaxTTL: number;
@@ -373,6 +417,7 @@ export type UpdateIdentityKubernetesAuthDTO = {
allowedNamespaces?: string;
allowedNames?: string;
allowedAudience?: string;
+ gatewayId?: string | null;
caCert?: string;
accessTokenTTL?: number;
accessTokenMaxTTL?: number;
@@ -425,6 +470,72 @@ export type IdentityTokenAuth = {
accessTokenTrustedIps: IdentityTrustedIp[];
};
+export type AddIdentityLdapAuthDTO = {
+ organizationId: string;
+ identityId: string;
+ url: string;
+ bindDN: string;
+ bindPass: string;
+ searchBase: string;
+ searchFilter: string;
+ ldapCaCertificate?: string;
+ allowedFields?: {
+ key: string;
+ value: string;
+ }[];
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: {
+ ipAddress: string;
+ }[];
+};
+
+export type UpdateIdentityLdapAuthDTO = {
+ identityId: string;
+ organizationId: string;
+ url?: string;
+ bindDN?: string;
+ bindPass?: string;
+ searchBase?: string;
+ searchFilter?: string;
+ ldapCaCertificate?: string;
+ allowedFields?: {
+ key: string;
+ value: string;
+ }[];
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: {
+ ipAddress: string;
+ }[];
+};
+
+export type DeleteIdentityLdapAuthDTO = {
+ organizationId: string;
+ identityId: string;
+};
+
+export type IdentityLdapAuth = {
+ url: string;
+ bindDN: string;
+ bindPass: string;
+ searchBase: string;
+ searchFilter: string;
+ ldapCaCertificate?: string;
+ allowedFields?: {
+ key: string;
+ value: string;
+ }[];
+
+ identityId: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: IdentityTrustedIp[];
+};
+
export type AddIdentityTokenAuthDTO = {
organizationId: string;
identityId: string;
diff --git a/frontend/src/hooks/api/index.tsx b/frontend/src/hooks/api/index.tsx
index 4bc06f7e36..4b4967f16a 100644
--- a/frontend/src/hooks/api/index.tsx
+++ b/frontend/src/hooks/api/index.tsx
@@ -27,6 +27,7 @@ export * from "./orgAdmin";
export * from "./organization";
export * from "./pkiAlerts";
export * from "./pkiCollections";
+export * from "./pkiSubscriber";
export * from "./projectUserAdditionalPrivilege";
export * from "./rateLimit";
export * from "./roles";
diff --git a/frontend/src/hooks/api/organization/queries.tsx b/frontend/src/hooks/api/organization/queries.tsx
index 06125b1d79..cd620bb641 100644
--- a/frontend/src/hooks/api/organization/queries.tsx
+++ b/frontend/src/hooks/api/organization/queries.tsx
@@ -112,7 +112,15 @@ export const useUpdateOrg = () => {
selectedMfaMethod,
allowSecretSharingOutsideOrganization,
bypassOrgAuthEnabled,
- userTokenExpiration
+ userTokenExpiration,
+ secretsProductEnabled,
+ pkiProductEnabled,
+ kmsProductEnabled,
+ sshProductEnabled,
+ scannerProductEnabled,
+ shareSecretsProductEnabled,
+ maxSharedSecretLifetime,
+ maxSharedSecretViewLimit
}) => {
return apiRequest.patch(`/api/v1/organization/${orgId}`, {
name,
@@ -124,7 +132,15 @@ export const useUpdateOrg = () => {
selectedMfaMethod,
allowSecretSharingOutsideOrganization,
bypassOrgAuthEnabled,
- userTokenExpiration
+ userTokenExpiration,
+ secretsProductEnabled,
+ pkiProductEnabled,
+ kmsProductEnabled,
+ sshProductEnabled,
+ scannerProductEnabled,
+ shareSecretsProductEnabled,
+ maxSharedSecretLifetime,
+ maxSharedSecretViewLimit
});
},
onSuccess: () => {
diff --git a/frontend/src/hooks/api/organization/types.ts b/frontend/src/hooks/api/organization/types.ts
index 6f63d003e9..068cfad6da 100644
--- a/frontend/src/hooks/api/organization/types.ts
+++ b/frontend/src/hooks/api/organization/types.ts
@@ -20,6 +20,14 @@ export type Organization = {
allowSecretSharingOutsideOrganization?: boolean;
userTokenExpiration?: string;
userRole: string;
+ secretsProductEnabled: boolean;
+ pkiProductEnabled: boolean;
+ kmsProductEnabled: boolean;
+ sshProductEnabled: boolean;
+ scannerProductEnabled: boolean;
+ shareSecretsProductEnabled: boolean;
+ maxSharedSecretLifetime: number;
+ maxSharedSecretViewLimit: number | null;
};
export type UpdateOrgDTO = {
@@ -34,6 +42,14 @@ export type UpdateOrgDTO = {
allowSecretSharingOutsideOrganization?: boolean;
bypassOrgAuthEnabled?: boolean;
userTokenExpiration?: string;
+ secretsProductEnabled?: boolean;
+ pkiProductEnabled?: boolean;
+ kmsProductEnabled?: boolean;
+ sshProductEnabled?: boolean;
+ scannerProductEnabled?: boolean;
+ shareSecretsProductEnabled?: boolean;
+ maxSharedSecretViewLimit?: number | null;
+ maxSharedSecretLifetime?: number;
};
export type BillingDetails = {
diff --git a/frontend/src/hooks/api/pkiSubscriber/constants.tsx b/frontend/src/hooks/api/pkiSubscriber/constants.tsx
new file mode 100644
index 0000000000..1de5e9ddbf
--- /dev/null
+++ b/frontend/src/hooks/api/pkiSubscriber/constants.tsx
@@ -0,0 +1,20 @@
+export enum PkiSubscriberStatus {
+ ACTIVE = "active",
+ DISABLED = "disabled"
+}
+
+export const pkiSubscriberStatusToNameMap: { [K in PkiSubscriberStatus]: string } = {
+ [PkiSubscriberStatus.ACTIVE]: "Active",
+ [PkiSubscriberStatus.DISABLED]: "Disabled"
+};
+
+export const getPkiSubscriberStatusBadgeVariant = (status: PkiSubscriberStatus) => {
+ switch (status) {
+ case PkiSubscriberStatus.ACTIVE:
+ return "success";
+ case PkiSubscriberStatus.DISABLED:
+ return "danger";
+ default:
+ return "primary";
+ }
+};
diff --git a/frontend/src/hooks/api/pkiSubscriber/index.tsx b/frontend/src/hooks/api/pkiSubscriber/index.tsx
new file mode 100644
index 0000000000..b086839dff
--- /dev/null
+++ b/frontend/src/hooks/api/pkiSubscriber/index.tsx
@@ -0,0 +1,7 @@
+export {
+ useCreatePkiSubscriber,
+ useDeletePkiSubscriber,
+ useIssuePkiSubscriberCert,
+ useUpdatePkiSubscriber
+} from "./mutations";
+export { useGetPkiSubscriber, useGetPkiSubscriberCertificates } from "./queries";
diff --git a/frontend/src/hooks/api/pkiSubscriber/mutations.tsx b/frontend/src/hooks/api/pkiSubscriber/mutations.tsx
new file mode 100644
index 0000000000..a7d0eef92b
--- /dev/null
+++ b/frontend/src/hooks/api/pkiSubscriber/mutations.tsx
@@ -0,0 +1,110 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import { TCreateCertificateResponse } from "../ca/types";
+import { workspaceKeys } from "../workspace/query-keys";
+import { pkiSubscriberKeys } from "./queries";
+import {
+ TCreatePkiSubscriberDTO,
+ TDeletePkiSubscriberDTO,
+ TIssuePkiSubscriberCertDTO,
+ TPkiSubscriber,
+ TUpdatePkiSubscriberDTO
+} from "./types";
+
+export const useCreatePkiSubscriber = () => {
+ const queryClient = useQueryClient();
+ return useMutation<TPkiSubscriber, object, TCreatePkiSubscriberDTO>({
+ mutationFn: async (body) => {
+ const { data: subscriber } = await apiRequest.post("/api/v1/pki/subscribers", body);
+ return subscriber;
+ },
+ onSuccess: ({ projectId, name }) => {
+ queryClient.invalidateQueries({
+ queryKey: workspaceKeys.getWorkspacePkiSubscribers(projectId)
+ });
+ queryClient.invalidateQueries({
+ queryKey: pkiSubscriberKeys.getPkiSubscriber({
+ subscriberName: name,
+ projectId
+ })
+ });
+ }
+ });
+};
+
+export const useUpdatePkiSubscriber = () => {
+ const queryClient = useQueryClient();
+ return useMutation<TPkiSubscriber, object, TUpdatePkiSubscriberDTO>({
+ mutationFn: async ({ subscriberName, ...body }) => {
+ const { data: subscriber } = await apiRequest.patch(
+ `/api/v1/pki/subscribers/${subscriberName}`,
+ body
+ );
+ return subscriber;
+ },
+ onSuccess: ({ projectId, name }) => {
+ queryClient.invalidateQueries({
+ queryKey: workspaceKeys.getWorkspacePkiSubscribers(projectId)
+ });
+ queryClient.invalidateQueries({
+ queryKey: pkiSubscriberKeys.getPkiSubscriber({
+ subscriberName: name,
+ projectId
+ })
+ });
+ }
+ });
+};
+
+export const useDeletePkiSubscriber = () => {
+ const queryClient = useQueryClient();
+ return useMutation<TPkiSubscriber, object, TDeletePkiSubscriberDTO>({
+ mutationFn: async ({ subscriberName, projectId }) => {
+ const { data: subscriber } = await apiRequest.delete(
+ `/api/v1/pki/subscribers/${subscriberName}`,
+ {
+ data: {
+ projectId
+ }
+ }
+ );
+ return subscriber;
+ },
+ onSuccess: ({ name, projectId }) => {
+ queryClient.invalidateQueries({
+ queryKey: workspaceKeys.getWorkspacePkiSubscribers(projectId)
+ });
+ queryClient.invalidateQueries({
+ queryKey: pkiSubscriberKeys.getPkiSubscriber({
+ subscriberName: name,
+ projectId
+ })
+ });
+ }
+ });
+};
+
+export const useIssuePkiSubscriberCert = () => {
+ const queryClient = useQueryClient();
+ return useMutation<TCreateCertificateResponse, object, TIssuePkiSubscriberCertDTO>({
+ mutationFn: async ({ subscriberName, projectId }) => {
+ const { data } = await apiRequest.post(
+ `/api/v1/pki/subscribers/${subscriberName}/issue-certificate`,
+ {
+ projectId
+ }
+ );
+ return data;
+ },
+ onSuccess: (_, { subscriberName, projectId }) => {
+ queryClient.invalidateQueries({
+ queryKey: pkiSubscriberKeys.forPkiSubscriberCertificates({
+ subscriberName,
+ projectId
+ })
+ });
+ }
+ });
+};
diff --git a/frontend/src/hooks/api/pkiSubscriber/queries.tsx b/frontend/src/hooks/api/pkiSubscriber/queries.tsx
new file mode 100644
index 0000000000..d9948ed5ca
--- /dev/null
+++ b/frontend/src/hooks/api/pkiSubscriber/queries.tsx
@@ -0,0 +1,102 @@
+import { useQuery } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import { TCertificate } from "../certificates/types";
+import { TPkiSubscriber } from "./types";
+
+export const pkiSubscriberKeys = {
+ getPkiSubscriber: ({
+ subscriberName,
+ projectId
+ }: {
+ subscriberName: string;
+ projectId: string;
+ }) => [{ subscriberName, projectId }, "pki-subscriber"] as const,
+ allPkiSubscriberCertificates: () => ["pki-subscriber-certificates"] as const,
+ forPkiSubscriberCertificates: ({
+ subscriberName,
+ projectId
+ }: {
+ subscriberName: string;
+ projectId: string;
+ }) => [...pkiSubscriberKeys.allPkiSubscriberCertificates(), subscriberName, projectId] as const,
+ specificPkiSubscriberCertificates: ({
+ subscriberName,
+ projectId,
+ offset,
+ limit
+ }: {
+ subscriberName: string;
+ projectId: string;
+ offset: number;
+ limit: number;
+ }) =>
+ [
+ ...pkiSubscriberKeys.forPkiSubscriberCertificates({ subscriberName, projectId }),
+ { offset, limit, projectId }
+ ] as const
+};
+
+export const useGetPkiSubscriber = ({
+ subscriberName,
+ projectId
+}: {
+ subscriberName: string;
+ projectId: string;
+}) => {
+ return useQuery({
+ queryKey: pkiSubscriberKeys.getPkiSubscriber({ subscriberName, projectId }),
+ queryFn: async () => {
+ const { data: pkiSubscriber } = await apiRequest.get<TPkiSubscriber>(
+ `/api/v1/pki/subscribers/${subscriberName}`,
+ {
+ params: {
+ projectId
+ }
+ }
+ );
+ return pkiSubscriber;
+ },
+ enabled: Boolean(subscriberName) && Boolean(projectId)
+ });
+};
+
+export const useGetPkiSubscriberCertificates = ({
+ subscriberName,
+ projectId,
+ offset,
+ limit
+}: {
+ subscriberName: string;
+ projectId: string;
+ offset: number;
+ limit: number;
+}) => {
+ return useQuery({
+ queryKey: pkiSubscriberKeys.specificPkiSubscriberCertificates({
+ subscriberName,
+ projectId,
+ offset,
+ limit
+ }),
+ queryFn: async () => {
+ const params = new URLSearchParams({
+ offset: String(offset),
+ limit: String(limit),
+ projectId
+ });
+
+ const {
+ data: { certificates, totalCount }
+ } = await apiRequest.get<{ certificates: TCertificate[]; totalCount: number }>(
+ `/api/v1/pki/subscribers/${subscriberName}/certificates`,
+ {
+ params
+ }
+ );
+ return { certificates, totalCount };
+ },
+ enabled: Boolean(subscriberName) && Boolean(projectId)
+ });
+};
diff --git a/frontend/src/hooks/api/pkiSubscriber/types.ts b/frontend/src/hooks/api/pkiSubscriber/types.ts
new file mode 100644
index 0000000000..e6050dd134
--- /dev/null
+++ b/frontend/src/hooks/api/pkiSubscriber/types.ts
@@ -0,0 +1,53 @@
+import { CertExtendedKeyUsage, CertKeyUsage } from "../certificates/enums";
+
+export enum PkiSubscriberStatus {
+ ACTIVE = "active",
+ DISABLED = "disabled"
+}
+
+export type TPkiSubscriber = {
+ id: string;
+ projectId: string;
+ caId: string;
+ name: string;
+ commonName: string;
+ status: PkiSubscriberStatus;
+ ttl: string;
+ subjectAlternativeNames: string[];
+ keyUsages: CertKeyUsage[];
+ extendedKeyUsages: CertExtendedKeyUsage[];
+};
+
+export type TCreatePkiSubscriberDTO = {
+ projectId: string;
+ caId: string;
+ name: string;
+ commonName: string;
+ ttl: string;
+ subjectAlternativeNames: string[];
+ keyUsages: CertKeyUsage[];
+ extendedKeyUsages: CertExtendedKeyUsage[];
+};
+
+export type TUpdatePkiSubscriberDTO = {
+ subscriberName: string;
+ projectId: string;
+ caId?: string;
+ name?: string;
+ commonName?: string;
+ status?: PkiSubscriberStatus;
+ ttl?: string;
+ subjectAlternativeNames?: string[];
+ keyUsages?: CertKeyUsage[];
+ extendedKeyUsages?: CertExtendedKeyUsage[];
+};
+
+export type TDeletePkiSubscriberDTO = {
+ subscriberName: string;
+ projectId: string;
+};
+
+export type TIssuePkiSubscriberCertDTO = {
+ subscriberName: string;
+ projectId: string;
+};
diff --git a/frontend/src/hooks/api/projectTemplates/queries.tsx b/frontend/src/hooks/api/projectTemplates/queries.tsx
index f5863915a5..89bc96715c 100644
--- a/frontend/src/hooks/api/projectTemplates/queries.tsx
+++ b/frontend/src/hooks/api/projectTemplates/queries.tsx
@@ -6,14 +6,17 @@ import {
TProjectTemplate,
TProjectTemplateResponse
} from "@app/hooks/api/projectTemplates/types";
+import { ProjectType } from "@app/hooks/api/workspace/types";
export const projectTemplateKeys = {
all: ["project-template"] as const,
- list: () => [...projectTemplateKeys.all, "list"] as const,
+ list: (projectType?: ProjectType) =>
+ [...projectTemplateKeys.all, "list", ...(projectType ? [projectType] : [])] as const,
byId: (templateId: string) => [...projectTemplateKeys.all, templateId] as const
};
export const useListProjectTemplates = (
+ type?: ProjectType,
options?: Omit<
UseQueryOptions<
TProjectTemplate[],
@@ -25,9 +28,11 @@ export const useListProjectTemplates = (
>
) => {
return useQuery({
- queryKey: projectTemplateKeys.list(),
+ queryKey: projectTemplateKeys.list(type),
queryFn: async () => {
- const { data } = await apiRequest.get<TListProjectTemplates>("/api/v1/project-templates");
+ const { data } = await apiRequest.get<TListProjectTemplates>("/api/v1/project-templates", {
+ params: { type }
+ });
return data.projectTemplates;
},
diff --git a/frontend/src/hooks/api/projectTemplates/types.ts b/frontend/src/hooks/api/projectTemplates/types.ts
index 37c6cc9024..9f6ea5ef3c 100644
--- a/frontend/src/hooks/api/projectTemplates/types.ts
+++ b/frontend/src/hooks/api/projectTemplates/types.ts
@@ -1,11 +1,13 @@
import { TProjectRole } from "@app/hooks/api/roles/types";
+import { ProjectType } from "@app/hooks/api/workspace/types";
export type TProjectTemplate = {
id: string;
name: string;
+ type: ProjectType;
description?: string;
roles: Pick<TProjectRole, "slug" | "name" | "permissions">[];
- environments: { name: string; slug: string; position: number }[];
+ environments?: { name: string; slug: string; position: number }[] | null;
createdAt: string;
updatedAt: string;
};
@@ -14,6 +16,7 @@ export type TListProjectTemplates = { projectTemplates: TProjectTemplate[] };
export type TProjectTemplateResponse = { projectTemplate: TProjectTemplate };
export type TCreateProjectTemplateDTO = {
+ type: ProjectType;
name: string;
description?: string;
};
diff --git a/frontend/src/hooks/api/roles/types.ts b/frontend/src/hooks/api/roles/types.ts
index 0a48c9f977..12286bf9be 100644
--- a/frontend/src/hooks/api/roles/types.ts
+++ b/frontend/src/hooks/api/roles/types.ts
@@ -3,7 +3,9 @@ export enum ProjectMembershipRole {
Member = "member",
Custom = "custom",
Viewer = "viewer",
- NoAccess = "no-access"
+ NoAccess = "no-access",
+ SshHostBootstrapper = "ssh-host-bootstrapper",
+ KmsCryptographicOperator = "cryptographic-operator"
}
export type TGetProjectRolesDTO = {
@@ -17,7 +19,7 @@ export type TProjectRole = {
id: string;
createdAt: string;
updatedAt: string;
- description?: string;
+ description?: string | null;
permissions: TProjectPermission[];
};
@@ -74,7 +76,7 @@ export type TDeleteOrgRoleDTO = {
export type TCreateProjectRoleDTO = {
projectId: string;
name: string;
- description?: string;
+ description?: string | null;
slug: string;
permissions: TProjectPermission[];
};
diff --git a/frontend/src/hooks/api/secretScanning/mutation.ts b/frontend/src/hooks/api/secretScanning/mutation.ts
index 7298b9af1a..5055da4aae 100644
--- a/frontend/src/hooks/api/secretScanning/mutation.ts
+++ b/frontend/src/hooks/api/secretScanning/mutation.ts
@@ -10,15 +10,17 @@ import {
} from "./types";
export const useCreateNewInstallationSession = () => {
- return useMutation<{ sessionId: string }, object, { organizationId: string }>({
- mutationFn: async (opt) => {
- const { data } = await apiRequest.post(
- "/api/v1/secret-scanning/create-installation-session/organization",
- opt
- );
- return data;
+ return useMutation<{ sessionId: string; gitAppSlug: string }, object, { organizationId: string }>(
+ {
+ mutationFn: async (opt) => {
+ const { data } = await apiRequest.post(
+ "/api/v1/secret-scanning/create-installation-session/organization",
+ opt
+ );
+ return data;
+ }
}
- });
+ );
};
export const useUpdateRiskStatus = () => {
diff --git a/frontend/src/hooks/api/secretSharing/queries.ts b/frontend/src/hooks/api/secretSharing/queries.ts
index ace45526a7..cfd505ff0e 100644
--- a/frontend/src/hooks/api/secretSharing/queries.ts
+++ b/frontend/src/hooks/api/secretSharing/queries.ts
@@ -11,10 +11,13 @@ export const secretSharingKeys = {
allSecretRequests: () => ["secretRequests"] as const,
specificSecretRequests: ({ offset, limit }: { offset: number; limit: number }) =>
[...secretSharingKeys.allSecretRequests(), { offset, limit }] as const,
- getSecretById: (arg: { id: string; hashedHex: string | null; password?: string }) => [
- "shared-secret",
- arg
- ],
+ getSecretById: (arg: {
+ id: string;
+ hashedHex: string | null;
+ password?: string;
+ email?: string;
+ hash?: string;
+ }) => ["shared-secret", arg],
getSecretRequestById: (arg: { id: string }) => ["secret-request", arg] as const
};
@@ -70,20 +73,34 @@ export const useGetSecretRequests = ({
export const useGetActiveSharedSecretById = ({
sharedSecretId,
hashedHex,
- password
+ password,
+ email,
+ hash
}: {
sharedSecretId: string;
hashedHex: string | null;
password?: string;
+
+ // For secrets shared to specific emails (optional)
+ email?: string;
+ hash?: string;
}) => {
return useQuery({
- queryKey: secretSharingKeys.getSecretById({ id: sharedSecretId, hashedHex, password }),
+ queryKey: secretSharingKeys.getSecretById({
+ id: sharedSecretId,
+ hashedHex,
+ password,
+ email,
+ hash
+ }),
queryFn: async () => {
const { data } = await apiRequest.post<TViewSharedSecretResponse>(
`/api/v1/secret-sharing/shared/public/${sharedSecretId}`,
{
...(hashedHex && { hashedHex }),
- password
+ password,
+ email,
+ hash
}
);
diff --git a/frontend/src/hooks/api/secretSharing/types.ts b/frontend/src/hooks/api/secretSharing/types.ts
index ab819cfb6b..c35228fab3 100644
--- a/frontend/src/hooks/api/secretSharing/types.ts
+++ b/frontend/src/hooks/api/secretSharing/types.ts
@@ -32,6 +32,7 @@ export type TCreateSharedSecretRequest = {
expiresAt: Date;
expiresAfterViews?: number;
accessType?: SecretSharingAccessType;
+ emails?: string[];
};
export type TCreateSecretRequestRequestDTO = {
diff --git a/frontend/src/hooks/api/secretSyncs/enums.ts b/frontend/src/hooks/api/secretSyncs/enums.ts
index d078765bc7..65a31e427d 100644
--- a/frontend/src/hooks/api/secretSyncs/enums.ts
+++ b/frontend/src/hooks/api/secretSyncs/enums.ts
@@ -12,7 +12,8 @@ export enum SecretSync {
Vercel = "vercel",
Windmill = "windmill",
HCVault = "hashicorp-vault",
- TeamCity = "teamcity"
+ TeamCity = "teamcity",
+ OCIVault = "oci-vault"
}
export enum SecretSyncStatus {
diff --git a/frontend/src/hooks/api/secretSyncs/types/index.ts b/frontend/src/hooks/api/secretSyncs/types/index.ts
index 2dba65649e..e3de6029a7 100644
--- a/frontend/src/hooks/api/secretSyncs/types/index.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/index.ts
@@ -11,6 +11,7 @@ import { TGcpSync } from "./gcp-sync";
import { TGitHubSync } from "./github-sync";
import { THCVaultSync } from "./hc-vault-sync";
import { THumanitecSync } from "./humanitec-sync";
+import { TOCIVaultSync } from "./oci-vault-sync";
import { TTeamCitySync } from "./teamcity-sync";
import { TTerraformCloudSync } from "./terraform-cloud-sync";
import { TVercelSync } from "./vercel-sync";
@@ -36,7 +37,8 @@ export type TSecretSync =
| TVercelSync
| TWindmillSync
| THCVaultSync
- | TTeamCitySync;
+ | TTeamCitySync
+ | TOCIVaultSync;
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
diff --git a/frontend/src/hooks/api/secretSyncs/types/oci-vault-sync.ts b/frontend/src/hooks/api/secretSyncs/types/oci-vault-sync.ts
new file mode 100644
index 0000000000..9dd0062f47
--- /dev/null
+++ b/frontend/src/hooks/api/secretSyncs/types/oci-vault-sync.ts
@@ -0,0 +1,17 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
+
+export type TOCIVaultSync = TRootSecretSync & {
+ destination: SecretSync.OCIVault;
+ destinationConfig: {
+ compartmentOcid: string;
+ vaultOcid: string;
+ keyOcid: string;
+ };
+ connection: {
+ app: AppConnection.OCI;
+ name: string;
+ id: string;
+ };
+};
diff --git a/frontend/src/hooks/api/secretSyncs/types/root-sync.ts b/frontend/src/hooks/api/secretSyncs/types/root-sync.ts
index dfbbcd063d..38c9efdf2b 100644
--- a/frontend/src/hooks/api/secretSyncs/types/root-sync.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/root-sync.ts
@@ -4,8 +4,7 @@ import { SecretSyncInitialSyncBehavior, SecretSyncStatus } from "@app/hooks/api/
export type RootSyncOptions = {
initialSyncBehavior: SecretSyncInitialSyncBehavior;
disableSecretDeletion?: boolean;
- // prependPrefix?: string;
- // appendSuffix?: string;
+ keySchema?: string;
};
export type TRootSecretSync = {
diff --git a/frontend/src/hooks/api/sshHost/types.ts b/frontend/src/hooks/api/sshHost/types.ts
index e92ddeaa8b..ba44bdde37 100644
--- a/frontend/src/hooks/api/sshHost/types.ts
+++ b/frontend/src/hooks/api/sshHost/types.ts
@@ -6,7 +6,8 @@ export enum LoginMappingSource {
export type TLoginMapping = {
loginUser: string;
allowedPrincipals: {
- usernames: string[];
+ usernames?: string[];
+ groups?: string[];
};
source: LoginMappingSource;
};
@@ -20,6 +21,7 @@ export type TSshHost = {
hostCertTtl: string;
loginMappings: TLoginMapping[];
};
+
export type TCreateSshHostDTO = {
projectId: string;
hostname: string;
diff --git a/frontend/src/hooks/api/workspace/index.tsx b/frontend/src/hooks/api/workspace/index.tsx
index b841f4bff6..df2d55dc3b 100644
--- a/frontend/src/hooks/api/workspace/index.tsx
+++ b/frontend/src/hooks/api/workspace/index.tsx
@@ -35,6 +35,7 @@ export {
useListWorkspaceGroups,
useListWorkspacePkiAlerts,
useListWorkspacePkiCollections,
+ useListWorkspacePkiSubscribers,
useListWorkspaceSshCas,
useListWorkspaceSshCertificates,
useListWorkspaceSshCertificateTemplates,
diff --git a/frontend/src/hooks/api/workspace/queries.tsx b/frontend/src/hooks/api/workspace/queries.tsx
index 441b9aefab..c040a12673 100644
--- a/frontend/src/hooks/api/workspace/queries.tsx
+++ b/frontend/src/hooks/api/workspace/queries.tsx
@@ -14,6 +14,7 @@ import { IntegrationAuth } from "../integrationAuth/types";
import { TIntegration } from "../integrations/types";
import { TPkiAlert } from "../pkiAlerts/types";
import { TPkiCollection } from "../pkiCollections/types";
+import { TPkiSubscriber } from "../pkiSubscriber/types";
import { EncryptedSecret } from "../secrets/types";
import { TSshCertificate, TSshCertificateAuthority } from "../sshCa/types";
import { TSshCertificateTemplate } from "../sshCertificateTemplates/types";
@@ -276,13 +277,20 @@ export const useUpdateProject = () => {
const queryClient = useQueryClient();
return useMutation<Workspace, object, UpdateProjectDTO>({
- mutationFn: async ({ projectID, newProjectName, newProjectDescription, newSlug }) => {
+ mutationFn: async ({
+ projectID,
+ newProjectName,
+ newProjectDescription,
+ newSlug,
+ secretSharing
+ }) => {
const { data } = await apiRequest.patch<{ workspace: Workspace }>(
`/api/v1/workspace/${projectID}`,
{
name: newProjectName,
description: newProjectDescription,
- slug: newSlug
+ slug: newSlug,
+ secretSharing
}
);
return data.workspace;
@@ -874,6 +882,21 @@ export const useListWorkspaceSshHosts = (projectId: string) => {
});
};
+export const useListWorkspacePkiSubscribers = (projectId: string) => {
+ return useQuery({
+ queryKey: workspaceKeys.getWorkspacePkiSubscribers(projectId),
+ queryFn: async () => {
+ const {
+ data: { subscribers }
+ } = await apiRequest.get<{ subscribers: TPkiSubscriber[] }>(
+ `/api/v2/workspace/${projectId}/pki-subscribers`
+ );
+ return subscribers;
+ },
+ enabled: Boolean(projectId)
+ });
+};
+
export const useListWorkspaceSshHostGroups = (projectId: string) => {
return useQuery({
queryKey: workspaceKeys.getWorkspaceSshHostGroups(projectId),
diff --git a/frontend/src/hooks/api/workspace/query-keys.tsx b/frontend/src/hooks/api/workspace/query-keys.tsx
index 91fe95a048..c10616b635 100644
--- a/frontend/src/hooks/api/workspace/query-keys.tsx
+++ b/frontend/src/hooks/api/workspace/query-keys.tsx
@@ -16,8 +16,11 @@ export const workspaceKeys = {
type ? ["workspaces", { type }] : (["workspaces"] as const),
getWorkspaceAuditLogs: (workspaceId: string) =>
[{ workspaceId }, "workspace-audit-logs"] as const,
- getWorkspaceUsers: (workspaceId: string, includeGroupMembers?: boolean, roles?: string[]) =>
- [{ workspaceId, includeGroupMembers, roles }, "workspace-users"] as const,
+ getWorkspaceUsers: (
+ workspaceId: string,
+ includeGroupMembers: boolean = false,
+ roles: string[] = []
+ ) => [{ workspaceId, includeGroupMembers, roles }, "workspace-users"] as const,
getWorkspaceUserDetails: (workspaceId: string, membershipId: string) =>
[{ workspaceId, membershipId }, "workspace-user-details"] as const,
getWorkspaceIdentityMemberships: (workspaceId: string) =>
@@ -51,6 +54,8 @@ export const workspaceKeys = {
}) => [...workspaceKeys.forWorkspaceCertificates(slug), { offset, limit }] as const,
getWorkspacePkiAlerts: (workspaceId: string) =>
[{ workspaceId }, "workspace-pki-alerts"] as const,
+ getWorkspacePkiSubscribers: (projectId: string) =>
+ [{ projectId }, "workspace-pki-subscribers"] as const,
getWorkspacePkiCollections: (workspaceId: string) =>
[{ workspaceId }, "workspace-pki-collections"] as const,
getWorkspaceCertificateTemplates: (workspaceId: string) =>
diff --git a/frontend/src/hooks/api/workspace/types.ts b/frontend/src/hooks/api/workspace/types.ts
index ddcf383fb0..382e4189cf 100644
--- a/frontend/src/hooks/api/workspace/types.ts
+++ b/frontend/src/hooks/api/workspace/types.ts
@@ -37,6 +37,7 @@ export type Workspace = {
createdAt: string;
roles?: TProjectRole[];
hasDeleteProtection: boolean;
+ secretSharing: boolean;
};
export type WorkspaceEnv = {
@@ -73,9 +74,10 @@ export type CreateWorkspaceDTO = {
export type UpdateProjectDTO = {
projectID: string;
- newProjectName: string;
+ newProjectName?: string;
newProjectDescription?: string;
newSlug?: string;
+ secretSharing?: boolean;
};
export type UpdatePitVersionLimitDTO = { projectSlug: string; pitVersionLimit: number };
diff --git a/frontend/src/hooks/index.ts b/frontend/src/hooks/index.ts
index eb4cdbdca9..9e5eff7137 100644
--- a/frontend/src/hooks/index.ts
+++ b/frontend/src/hooks/index.ts
@@ -1,4 +1,5 @@
export { useDebounce } from "./useDebounce";
+export * from "./useGetProjectTypeFromRoute";
export { usePagination } from "./usePagination";
export { usePersistentState } from "./usePersistentState";
export { usePopUp } from "./usePopUp";
diff --git a/frontend/src/hooks/useGetProjectTypeFromRoute.tsx b/frontend/src/hooks/useGetProjectTypeFromRoute.tsx
new file mode 100644
index 0000000000..b3b8f3d5e1
--- /dev/null
+++ b/frontend/src/hooks/useGetProjectTypeFromRoute.tsx
@@ -0,0 +1,22 @@
+import { useMemo } from "react";
+import { useRouterState } from "@tanstack/react-router";
+
+import { ProjectType } from "@app/hooks/api/workspace/types";
+
+export const useGetProjectTypeFromRoute = () => {
+ const { location } = useRouterState();
+
+ return useMemo(() => {
+ const segments = location.pathname.split("/");
+
+ let type: ProjectType | undefined;
+
+ // location of project type can vary in router path, so we need to check all possible values
+ segments.forEach((segment) => {
+ if (Object.values(ProjectType).includes(segment as ProjectType))
+ type = segment as ProjectType;
+ });
+
+ return type;
+ }, [location]);
+};
diff --git a/frontend/src/layouts/OrganizationLayout/OrganizationLayout.tsx b/frontend/src/layouts/OrganizationLayout/OrganizationLayout.tsx
index 7cfc21838a..6a23821916 100644
--- a/frontend/src/layouts/OrganizationLayout/OrganizationLayout.tsx
+++ b/frontend/src/layouts/OrganizationLayout/OrganizationLayout.tsx
@@ -11,11 +11,12 @@ import { BreadcrumbContainer, TBreadcrumbFormat } from "@app/components/v2";
import { OrgPermissionSubjects, useOrgPermission, useServerConfig } from "@app/context";
import { OrgPermissionSecretShareAction } from "@app/context/OrgPermissionContext/types";
import { usePopUp } from "@app/hooks";
+import { ProjectType } from "@app/hooks/api/workspace/types";
import { InsecureConnectionBanner } from "./components/InsecureConnectionBanner";
import { MinimizedOrgSidebar } from "./components/MinimizedOrgSidebar";
import { SidebarHeader } from "./components/SidebarHeader";
-import { DefaultSideBar, SecretSharingSideBar } from "./ProductsSideBar";
+import { DefaultSideBar, ProjectOverviewSideBar, SecretSharingSideBar } from "./ProductsSideBar";
export const OrganizationLayout = () => {
const matches = useRouterState({ select: (s) => s.matches.at(-1)?.context });
@@ -45,21 +46,38 @@ export const OrganizationLayout = () => {
] as string[]
).includes(location.pathname);
+ const isProjectOverviewOrSettingsPage = (
+ [
+ linkOptions({ to: "/organization/secret-manager/overview" }).to,
+ linkOptions({ to: "/organization/secret-manager/settings" }).to,
+ linkOptions({ to: "/organization/cert-manager/overview" }).to,
+ linkOptions({ to: "/organization/cert-manager/settings" }).to,
+ linkOptions({ to: "/organization/kms/overview" }).to,
+ linkOptions({ to: "/organization/kms/settings" }).to,
+ linkOptions({ to: "/organization/ssh/overview" }).to,
+ linkOptions({ to: "/organization/ssh/settings" }).to
+ ] as string[]
+ ).includes(location.pathname);
+
const shouldShowOrgSidebar =
location.pathname.startsWith("/organization") &&
(!isSecretSharingPage || shouldShowProductsSidebar) &&
- !(
- [
- linkOptions({ to: "/organization/secret-manager/overview" }).to,
- linkOptions({ to: "/organization/cert-manager/overview" }).to,
- linkOptions({ to: "/organization/ssh/overview" }).to,
- linkOptions({ to: "/organization/kms/overview" }).to,
- linkOptions({ to: "/organization/secret-scanning" }).to
- ] as string[]
- ).includes(location.pathname);
+ !([linkOptions({ to: "/organization/secret-scanning" }).to] as string[]).includes(
+ location.pathname
+ );
const containerHeight = config.pageFrameContent ? "h-[94vh]" : "h-screen";
+ let SideBarComponent = <DefaultSideBar />;
+
+ if (isSecretSharingPage) {
+ SideBarComponent = <SecretSharingSideBar />;
+ } else if (isProjectOverviewOrSettingsPage) {
+ SideBarComponent = (
+ <ProjectOverviewSideBar type={location.pathname.split("/")[2] as ProjectType} />
+ );
+ }
+
return (
<>
<Banner />
@@ -80,10 +98,12 @@ export const OrganizationLayout = () => {
className="dark w-60 overflow-hidden border-r border-mineshaft-600 bg-gradient-to-tr from-mineshaft-700 via-mineshaft-800 to-mineshaft-900"
>
<nav className="items-between flex h-full flex-col overflow-y-auto dark:[color-scheme:dark]">
- <div className="p-2 pt-3">
- <SidebarHeader />
- </div>
- {isSecretSharingPage ? <SecretSharingSideBar /> : <DefaultSideBar />}
+ {!isProjectOverviewOrSettingsPage && (
+ <div className="p-2 pt-3">
+ <SidebarHeader />
+ </div>
+ )}
+ {SideBarComponent}
</nav>
</motion.div>
)}
diff --git a/frontend/src/layouts/OrganizationLayout/ProductsSideBar/DefaultSideBar.tsx b/frontend/src/layouts/OrganizationLayout/ProductsSideBar/DefaultSideBar.tsx
index 054a873a33..4d55edb58f 100644
--- a/frontend/src/layouts/OrganizationLayout/ProductsSideBar/DefaultSideBar.tsx
+++ b/frontend/src/layouts/OrganizationLayout/ProductsSideBar/DefaultSideBar.tsx
@@ -5,22 +5,6 @@ import { Menu, MenuGroup, MenuItem } from "@app/components/v2";
export const DefaultSideBar = () => (
<Menu>
<MenuGroup title="Organization Control">
- <Link to="/organization/audit-logs">
- {({ isActive }) => (
- <MenuItem isSelected={isActive} icon="moving-block">
- Audit Logs
- </MenuItem>
- )}
- </Link>
- <Link to="/organization/billing">
- {({ isActive }) => (
- <MenuItem isSelected={isActive} icon="spinning-coin">
- Usage & Billing
- </MenuItem>
- )}
- </Link>
- </MenuGroup>
- <MenuGroup title="Other">
<Link to="/organization/access-management">
{({ isActive }) => (
<MenuItem isSelected={isActive} icon="groups">
@@ -42,6 +26,29 @@ export const DefaultSideBar = () => (
</MenuItem>
)}
</Link>
+ <Link to="/organization/sso">
+ {({ isActive }) => (
+ <MenuItem isSelected={isActive} icon="check">
+ Single Sign-On (SSO)
+ </MenuItem>
+ )}
+ </Link>
+ </MenuGroup>
+ <MenuGroup title="Other">
+ <Link to="/organization/audit-logs">
+ {({ isActive }) => (
+ <MenuItem isSelected={isActive} icon="moving-block">
+ Audit Logs
+ </MenuItem>
+ )}
+ </Link>
+ <Link to="/organization/billing">
+ {({ isActive }) => (
+ <MenuItem isSelected={isActive} icon="spinning-coin">
+ Usage & Billing
+ </MenuItem>
+ )}
+ </Link>
<Link to="/organization/settings">
{({ isActive }) => (
<MenuItem isSelected={isActive} icon="toggle-settings">
diff --git a/frontend/src/layouts/OrganizationLayout/ProductsSideBar/ProjectOverviewSideBar.tsx b/frontend/src/layouts/OrganizationLayout/ProductsSideBar/ProjectOverviewSideBar.tsx
new file mode 100644
index 0000000000..4b46cdd0a3
--- /dev/null
+++ b/frontend/src/layouts/OrganizationLayout/ProductsSideBar/ProjectOverviewSideBar.tsx
@@ -0,0 +1,94 @@
+import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { Link, useMatchRoute } from "@tanstack/react-router";
+
+import { Menu, MenuGroup, MenuItem } from "@app/components/v2";
+import { ProjectType } from "@app/hooks/api/workspace/types";
+
+type TProjectOverviewSideBarProps = {
+ type: ProjectType;
+};
+
+export const ProjectOverviewSideBar = ({ type }: TProjectOverviewSideBarProps) => {
+ const matchRoute = useMatchRoute();
+
+ const isOverviewActive = !!matchRoute({
+ to: `/organization/${type}/overview`,
+ fuzzy: false
+ });
+
+ let label: string;
+ let icon: string;
+ let link: string;
+
+ switch (type) {
+ case ProjectType.CertificateManager:
+ label = "Cert Management";
+ icon = "note";
+ link = "https://infisical.com/docs/documentation/platform/pki/overview";
+ break;
+ case ProjectType.SecretManager:
+ label = "Secret Management";
+ icon = "sliding-carousel";
+ link = "https://infisical.com/docs/documentation/getting-started/introduction";
+ break;
+ case ProjectType.KMS:
+ label = "KMS";
+ icon = "unlock";
+ link = "https://infisical.com/docs/documentation/platform/kms/overview";
+ break;
+ case ProjectType.SSH:
+ label = "SSH";
+ icon = "verified";
+ link = "https://infisical.com/docs/documentation/platform/ssh/overview";
+ break;
+ default:
+ throw new Error("Unknown project type");
+ }
+
+ return (
+ <>
+ <div className="p-2 pt-3">
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href={link}
+ className="flex w-full items-center rounded-md border border-mineshaft-600 p-2 pl-3 transition-all duration-150 hover:bg-mineshaft-700"
+ >
+ <div className="mr-2 flex h-6 w-6 items-center justify-center rounded-md bg-mineshaft-500 p-4">
+ <FontAwesomeIcon
+ icon={faArrowUpRightFromSquare}
+ className="h-3.5 w-3.5 text-mineshaft-300"
+ />
+ </div>
+ <div className="-mt-1 flex flex-grow flex-col text-white">
+ <div className="max-w-36 truncate text-ellipsis text-sm font-medium capitalize">
+ Infisical Docs
+ </div>
+ <div className="text-xs leading-[10px] text-mineshaft-400">
+ {type === ProjectType.SecretManager ? "Get Started" : `${label} Overview`}
+ </div>
+ </div>
+ </a>
+ </div>
+ <Menu>
+ <MenuGroup title="Overview">
+ <Link to={`/organization/${type}/overview`}>
+ <MenuItem isSelected={isOverviewActive} icon={icon}>
+ {label}
+ </MenuItem>
+ </Link>
+ </MenuGroup>
+ <MenuGroup title="Other">
+ <Link to={`/organization/${type}/settings`}>
+ {({ isActive }) => (
+ <MenuItem isSelected={isActive} icon="toggle-settings">
+ Settings
+ </MenuItem>
+ )}
+ </Link>
+ </MenuGroup>
+ </Menu>
+ </>
+ );
+};
diff --git a/frontend/src/layouts/OrganizationLayout/ProductsSideBar/index.ts b/frontend/src/layouts/OrganizationLayout/ProductsSideBar/index.ts
index b2c79d873c..057f5fe6b4 100644
--- a/frontend/src/layouts/OrganizationLayout/ProductsSideBar/index.ts
+++ b/frontend/src/layouts/OrganizationLayout/ProductsSideBar/index.ts
@@ -1,2 +1,3 @@
export * from "./DefaultSideBar";
+export * from "./ProjectOverviewSideBar";
export * from "./SecretSharingSideBar";
diff --git a/frontend/src/layouts/OrganizationLayout/components/MinimizedOrgSidebar/MinimizedOrgSidebar.tsx b/frontend/src/layouts/OrganizationLayout/components/MinimizedOrgSidebar/MinimizedOrgSidebar.tsx
index ba0b4f1946..61863e79ed 100644
--- a/frontend/src/layouts/OrganizationLayout/components/MinimizedOrgSidebar/MinimizedOrgSidebar.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/MinimizedOrgSidebar/MinimizedOrgSidebar.tsx
@@ -4,6 +4,7 @@ import {
faArrowUpRightFromSquare,
faBook,
faCheck,
+ faCheckCircle,
faCog,
faDoorClosed,
faEnvelope,
@@ -118,6 +119,9 @@ export const MinimizedOrgSidebar = () => {
[
linkOptions({ to: "/organization/access-management" }).to,
linkOptions({ to: "/organization/app-connections" }).to,
+ linkOptions({ to: "/organization/billing" }).to,
+ linkOptions({ to: "/organization/sso" }).to,
+ linkOptions({ to: "/organization/gateways" }).to,
linkOptions({ to: "/organization/settings" }).to,
linkOptions({ to: "/organization/audit-logs" }).to
] as string[]
@@ -264,71 +268,91 @@ export const MinimizedOrgSidebar = () => {
</DropdownMenu>
</div>
<div className="space-y-1">
- <Link to="/organization/secret-manager/overview">
- {({ isActive }) => (
- <MenuIconButton
- isSelected={
- isActive ||
- window.location.pathname.startsWith(`/${ProjectType.SecretManager}`)
- }
- icon="sliding-carousel"
- >
- Secrets
- </MenuIconButton>
- )}
- </Link>
- <Link to="/organization/cert-manager/overview">
- {({ isActive }) => (
- <MenuIconButton
- isSelected={
- isActive ||
- window.location.pathname.startsWith(`/${ProjectType.CertificateManager}`)
- }
- icon="note"
- >
- PKI
- </MenuIconButton>
- )}
- </Link>
- <Link to="/organization/kms/overview">
- {({ isActive }) => (
- <MenuIconButton
- isSelected={
- isActive || window.location.pathname.startsWith(`/${ProjectType.KMS}`)
- }
- icon="unlock"
- >
- KMS
- </MenuIconButton>
- )}
- </Link>
- <Link to="/organization/ssh/overview">
- {({ isActive }) => (
- <MenuIconButton
- isSelected={
- isActive || window.location.pathname.startsWith(`/${ProjectType.SSH}`)
- }
- icon="verified"
- >
- SSH
- </MenuIconButton>
- )}
- </Link>
- <div className="w-full bg-mineshaft-500" style={{ height: "1px" }} />
- <Link to="/organization/secret-scanning">
- {({ isActive }) => (
- <MenuIconButton isSelected={isActive} icon="secret-scan">
- Scanner
- </MenuIconButton>
- )}
- </Link>
- <Link to="/organization/secret-sharing">
- {({ isActive }) => (
- <MenuIconButton isSelected={isActive} icon="lock-closed">
- Share
- </MenuIconButton>
- )}
- </Link>
+ {currentOrg.secretsProductEnabled && (
+ <Link to="/organization/secret-manager/overview">
+ {({ isActive }) => (
+ <MenuIconButton
+ isSelected={
+ isActive ||
+ window.location.pathname.startsWith(
+ `/organization/${ProjectType.SecretManager}`
+ )
+ }
+ icon="sliding-carousel"
+ >
+ Secrets
+ </MenuIconButton>
+ )}
+ </Link>
+ )}
+ {currentOrg.pkiProductEnabled && (
+ <Link to="/organization/cert-manager/overview">
+ {({ isActive }) => (
+ <MenuIconButton
+ isSelected={
+ isActive ||
+ window.location.pathname.startsWith(
+ `/organization/${ProjectType.CertificateManager}`
+ )
+ }
+ icon="note"
+ >
+ PKI
+ </MenuIconButton>
+ )}
+ </Link>
+ )}
+ {currentOrg.kmsProductEnabled && (
+ <Link to="/organization/kms/overview">
+ {({ isActive }) => (
+ <MenuIconButton
+ isSelected={
+ isActive ||
+ window.location.pathname.startsWith(`/organization/${ProjectType.KMS}`)
+ }
+ icon="unlock"
+ >
+ KMS
+ </MenuIconButton>
+ )}
+ </Link>
+ )}
+ {currentOrg.sshProductEnabled && (
+ <Link to="/organization/ssh/overview">
+ {({ isActive }) => (
+ <MenuIconButton
+ isSelected={
+ isActive ||
+ window.location.pathname.startsWith(`/organization/${ProjectType.SSH}`)
+ }
+ icon="verified"
+ >
+ SSH
+ </MenuIconButton>
+ )}
+ </Link>
+ )}
+ {(currentOrg.scannerProductEnabled || currentOrg.shareSecretsProductEnabled) && (
+ <div className="w-full bg-mineshaft-500" style={{ height: "1px" }} />
+ )}
+ {currentOrg.scannerProductEnabled && (
+ <Link to="/organization/secret-scanning">
+ {({ isActive }) => (
+ <MenuIconButton isSelected={isActive} icon="secret-scan">
+ Scanner
+ </MenuIconButton>
+ )}
+ </Link>
+ )}
+ {currentOrg.shareSecretsProductEnabled && (
+ <Link to="/organization/secret-sharing">
+ {({ isActive }) => (
+ <MenuIconButton isSelected={isActive} icon="lock-closed">
+ Share
+ </MenuIconButton>
+ )}
+ </Link>
+ )}
<div className="my-1 w-full bg-mineshaft-500" style={{ height: "1px" }} />
<DropdownMenu open={open} onOpenChange={setOpen} modal={false}>
<DropdownMenuTrigger
@@ -381,6 +405,13 @@ export const MinimizedOrgSidebar = () => {
Audit Logs
</DropdownMenuItem>
</Link>
+ <Link to="/organization/sso">
+ <DropdownMenuItem
+ icon={<FontAwesomeIcon className="w-3" icon={faCheckCircle} />}
+ >
+ SSO Settings
+ </DropdownMenuItem>
+ </Link>
<Link to="/organization/settings">
<DropdownMenuItem icon={<FontAwesomeIcon className="w-3" icon={faCog} />}>
Organization Settings
diff --git a/frontend/src/layouts/ProjectLayout/ProjectLayout.tsx b/frontend/src/layouts/ProjectLayout/ProjectLayout.tsx
index 8533d70072..35534d4a28 100644
--- a/frontend/src/layouts/ProjectLayout/ProjectLayout.tsx
+++ b/frontend/src/layouts/ProjectLayout/ProjectLayout.tsx
@@ -104,7 +104,23 @@ export const ProjectLayout = () => {
{isCertManager && (
<>
<Link
- to={`/${ProjectType.CertificateManager}/$projectId/overview` as const}
+ to={
+ `/${ProjectType.CertificateManager}/$projectId/subscribers` as const
+ }
+ params={{
+ projectId: currentWorkspace.id
+ }}
+ >
+ {({ isActive }) => (
+ <MenuItem isSelected={isActive} icon="pki-subscriber">
+ Subscribers
+ </MenuItem>
+ )}
+ </Link>
+ <Link
+ to={
+ `/${ProjectType.CertificateManager}/$projectId/certificates` as const
+ }
params={{
projectId: currentWorkspace.id
}}
diff --git a/frontend/src/pages/admin/OverviewPage/OverviewPage.tsx b/frontend/src/pages/admin/OverviewPage/OverviewPage.tsx
index af93b3c2a7..790adff501 100644
--- a/frontend/src/pages/admin/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/admin/OverviewPage/OverviewPage.tsx
@@ -31,6 +31,7 @@ import {
import { IdentityPanel } from "@app/pages/admin/OverviewPage/components/IdentityPanel";
import { AuthPanel } from "./components/AuthPanel";
+import { CachingPanel } from "./components/CachingPanel";
import { EncryptionPanel } from "./components/EncryptionPanel";
import { IntegrationPanel } from "./components/IntegrationPanel";
import { UserPanel } from "./components/UserPanel";
@@ -42,7 +43,8 @@ enum TabSections {
Integrations = "integrations",
Users = "users",
Identities = "identities",
- Kmip = "kmip"
+ Kmip = "kmip",
+ Caching = "caching"
}
enum SignUpModes {
@@ -164,6 +166,7 @@ export const OverviewPage = () => {
<Tab value={TabSections.Integrations}>Integrations</Tab>
<Tab value={TabSections.Users}>User Identities</Tab>
<Tab value={TabSections.Identities}>Machine Identities</Tab>
+ <Tab value={TabSections.Caching}>Caching</Tab>
</div>
</TabList>
<TabPanel value={TabSections.Settings}>
@@ -408,6 +411,9 @@ export const OverviewPage = () => {
<TabPanel value={TabSections.Identities}>
<IdentityPanel />
</TabPanel>
+ <TabPanel value={TabSections.Caching}>
+ <CachingPanel />
+ </TabPanel>
</Tabs>
</div>
)}
diff --git a/frontend/src/pages/admin/OverviewPage/components/CachingPanel.tsx b/frontend/src/pages/admin/OverviewPage/components/CachingPanel.tsx
new file mode 100644
index 0000000000..170a85c0d5
--- /dev/null
+++ b/frontend/src/pages/admin/OverviewPage/components/CachingPanel.tsx
@@ -0,0 +1,101 @@
+import { useEffect, useState } from "react";
+import { faRotate } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { createNotification } from "@app/components/notifications";
+import { Badge, Button, DeleteActionModal } from "@app/components/v2";
+import { useUser } from "@app/context";
+import { usePopUp } from "@app/hooks";
+import { useInvalidateCache } from "@app/hooks/api";
+import { useGetInvalidatingCacheStatus } from "@app/hooks/api/admin/queries";
+import { CacheType } from "@app/hooks/api/admin/types";
+
+export const CachingPanel = () => {
+ const { mutateAsync: invalidateCache } = useInvalidateCache();
+ const { user } = useUser();
+
+ const [type, setType] = useState<CacheType | null>(null);
+ const [shouldPoll, setShouldPoll] = useState(false);
+
+ const {
+ data: invalidationStatus,
+ isFetching,
+ refetch
+ } = useGetInvalidatingCacheStatus(shouldPoll);
+ const isInvalidating = Boolean(shouldPoll && (isFetching || invalidationStatus));
+
+ const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
+ "invalidateCache"
+ ] as const);
+
+ const handleInvalidateCacheSubmit = async () => {
+ if (!type || isInvalidating) return;
+
+ try {
+ await invalidateCache({ type });
+ createNotification({ text: `Began invalidating ${type} cache`, type: "success" });
+ setShouldPoll(true);
+ handlePopUpClose("invalidateCache");
+ } catch (err) {
+ console.error(err);
+ createNotification({ text: `Failed to invalidate ${type} cache`, type: "error" });
+ }
+ };
+
+ useEffect(() => {
+ if (isInvalidating) return;
+
+ if (shouldPoll) {
+ setShouldPoll(false);
+ createNotification({ text: "Successfully invalidated cache", type: "success" });
+ }
+ }, [isInvalidating, shouldPoll]);
+
+ useEffect(() => {
+ refetch().then((v) => setShouldPoll(v.data || false));
+ }, []);
+
+ return (
+ <>
+ <div className="mb-6 flex flex-wrap items-end justify-between gap-4 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <div className="flex flex-col">
+ <div className="mb-2 flex items-center gap-3">
+ <span className="text-xl font-semibold text-mineshaft-100">Secrets Cache</span>
+ {isInvalidating && (
+ <Badge
+ variant="danger"
+ className="flex h-5 w-min items-center gap-1.5 whitespace-nowrap"
+ >
+ <FontAwesomeIcon icon={faRotate} className="animate-spin" />
+ Invalidating Cache
+ </Badge>
+ )}
+ </div>
+ <span className="max-w-xl text-sm text-mineshaft-400">
+ The encrypted secrets cache encompasses all secrets stored within the system and
+ provides a temporary, secure storage location for frequently accessed credentials.
+ </span>
+ </div>
+
+ <Button
+ colorSchema="danger"
+ onClick={() => {
+ setType(CacheType.SECRETS);
+ handlePopUpOpen("invalidateCache");
+ }}
+ isDisabled={!user.superAdmin || isInvalidating}
+ >
+ Invalidate Secrets Cache
+ </Button>
+ </div>
+ <DeleteActionModal
+ isOpen={popUp.invalidateCache.isOpen}
+ title={`Are you sure you want to invalidate ${type} cache?`}
+ subTitle="This action is permanent and irreversible. The cache invalidation process may take several minutes to complete."
+ onChange={(isOpen) => handlePopUpToggle("invalidateCache", isOpen)}
+ deleteKey="confirm"
+ onDeleteApproved={handleInvalidateCacheSubmit}
+ />
+ </>
+ );
+};
diff --git a/frontend/src/pages/admin/OverviewPage/components/MicrosoftTeamsIntegrationForm.tsx b/frontend/src/pages/admin/OverviewPage/components/MicrosoftTeamsIntegrationForm.tsx
index ecd8288f42..3e83879b16 100644
--- a/frontend/src/pages/admin/OverviewPage/components/MicrosoftTeamsIntegrationForm.tsx
+++ b/frontend/src/pages/admin/OverviewPage/components/MicrosoftTeamsIntegrationForm.tsx
@@ -52,7 +52,7 @@ export const MicrosoftTeamsIntegrationForm = ({ adminIntegrationsConfig }: Props
});
createNotification({
- text: "Updated admin Microsoft Teams configuration",
+ text: "Updated admin Microsoft Teams configuration. It can take up to 5 minutes to take effect.",
type: "success"
});
};
diff --git a/frontend/src/pages/auth/LoginPage/LoginPage.tsx b/frontend/src/pages/auth/LoginPage/LoginPage.tsx
index 97bb528c62..66a2661533 100644
--- a/frontend/src/pages/auth/LoginPage/LoginPage.tsx
+++ b/frontend/src/pages/auth/LoginPage/LoginPage.tsx
@@ -10,7 +10,7 @@ import { useNavigateToSelectOrganization } from "./Login.utils";
export const LoginPage = ({ isAdmin }: { isAdmin?: boolean }) => {
const { t } = useTranslation();
- const [step, setStep] = useState(0);
+ const [step, setStep] = useState<number | null>(null);
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const { navigateToSelectOrganization } = useNavigateToSelectOrganization();
@@ -36,6 +36,8 @@ export const LoginPage = ({ isAdmin }: { isAdmin?: boolean }) => {
if (isLoggedIn()) {
handleRedirects();
+ } else {
+ setStep(0);
}
}, []);
diff --git a/frontend/src/pages/cert-manager/AlertingPage/AlertingPage.tsx b/frontend/src/pages/cert-manager/AlertingPage/AlertingPage.tsx
index 40e3eb100c..97d50b9bf6 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/AlertingPage.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/AlertingPage.tsx
@@ -15,7 +15,10 @@ export const AlertingPage = () => {
<title>{t("common.head-title", { title: "Alerting" })}</title>
</Helmet>
<div className="mx-auto mb-6 w-full max-w-7xl">
- <PageHeader title="Alerting" />
+ <PageHeader
+ title="Alerting"
+ description="Configure alerts for expiring certificates and CAs to maintain security and compliance."
+ />
<ProjectPermissionCan
renderGuardBanner
I={ProjectPermissionActions.Read}
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx
index 9bb6c9096c..df56806686 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx
@@ -63,7 +63,7 @@ const Page = () => {
handlePopUpClose("deleteCa");
navigate({
- to: `/${ProjectType.CertificateManager}/$projectId/overview` as const,
+ to: `/${ProjectType.CertificateManager}/$projectId/certificates` as const,
params: {
projectId
}
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/CertificateAuthoritiesPage.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/CertificateAuthoritiesPage.tsx
index f74ececaf9..0efe2dbdcf 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/CertificateAuthoritiesPage.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/CertificateAuthoritiesPage.tsx
@@ -15,7 +15,10 @@ export const CertificateAuthoritiesPage = () => {
<title>{t("common.head-title", { title: "Certificate Authorities" })}</title>
</Helmet>
<div className="mx-auto mb-6 w-full max-w-7xl">
- <PageHeader title="Certificate Authorities" />
+ <PageHeader
+ title="Certificate Authorities"
+ description="Manage internal private certificate authorities for issuing and signing certificates, including root and intermediate CAs."
+ />
<ProjectPermissionCan
renderGuardBanner
I={ProjectPermissionActions.Read}
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/CertificatesPage.tsx b/frontend/src/pages/cert-manager/CertificatesPage/CertificatesPage.tsx
index c985f313fa..f4258a4d5e 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/CertificatesPage.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/CertificatesPage.tsx
@@ -3,7 +3,12 @@ import { useTranslation } from "react-i18next";
import { ProjectPermissionCan } from "@app/components/permissions";
import { PageHeader } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useProjectPermission } from "@app/context";
+import {
+ ProjectPermissionActions,
+ ProjectPermissionCertificateActions,
+ ProjectPermissionSub,
+ useProjectPermission
+} from "@app/context";
import { PkiCollectionSection } from "../AlertingPage/components";
import { CertificatesSection } from "./components";
@@ -17,7 +22,7 @@ export const CertificatesPage = () => {
ProjectPermissionSub.PkiCollections
);
const canAccessCerts = permission.can(
- ProjectPermissionActions.Read,
+ ProjectPermissionCertificateActions.Read,
ProjectPermissionSub.Certificates
);
@@ -27,7 +32,10 @@ export const CertificatesPage = () => {
<title>{t("common.head-title", { title: "Certificates" })}</title>
</Helmet>
<div className="mx-auto mb-6 w-full max-w-7xl">
- <PageHeader title="Certificates" />
+ <PageHeader
+ title="Certificates"
+ description="View and track issued certificates, monitor expiration dates, and manage certificate lifecycles."
+ />
{/* If both are false, the section does not render. This is to prevent duplicate banners. */}
{(canAccessCerts || canAccessPkiColl) && (
<ProjectPermissionCan
@@ -40,7 +48,7 @@ export const CertificatesPage = () => {
)}
<ProjectPermissionCan
renderGuardBanner
- I={ProjectPermissionActions.Read}
+ I={ProjectPermissionCertificateActions.Read}
a={ProjectPermissionSub.Certificates}
>
<CertificatesSection />
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateCertModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateCertModal.tsx
index 01c79589cf..281683d086 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateCertModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateCertModal.tsx
@@ -1,5 +1,11 @@
import { Modal, ModalContent } from "@app/components/v2";
+import {
+ ProjectPermissionCertificateActions,
+ ProjectPermissionSub,
+ useProjectPermission
+} from "@app/context";
import { useGetCertBody } from "@app/hooks/api";
+import { useGetCertBundle } from "@app/hooks/api/certificates/queries";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { CertificateContent } from "./CertificateContent";
@@ -10,10 +16,29 @@ type Props = {
};
export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
- const { data } = useGetCertBody(
- (popUp?.certificateCert?.data as { serialNumber: string })?.serialNumber || ""
+ const { permission } = useProjectPermission();
+
+ const serialNumber =
+ (popUp?.certificateCert?.data as { serialNumber: string })?.serialNumber || "";
+
+ const canReadPrivateKey = permission.can(
+ ProjectPermissionCertificateActions.ReadPrivateKey,
+ ProjectPermissionSub.Certificates
);
+ // useGetCertBundle fails unless user has the correct permissions
+ const { data: bundleData } = useGetCertBundle(serialNumber);
+ const { data: bodyData } = useGetCertBody(serialNumber);
+
+ const data:
+ | {
+ certificate: string;
+ certificateChain: string;
+ serialNumber: string;
+ privateKey?: string | null;
+ }
+ | undefined = canReadPrivateKey ? bundleData : bodyData;
+
return (
<Modal
isOpen={popUp?.certificateCert?.isOpen}
@@ -27,6 +52,7 @@ export const CertificateCertModal = ({ popUp, handlePopUpToggle }: Props) => {
serialNumber={data.serialNumber}
certificate={data.certificate}
certificateChain={data.certificateChain}
+ privateKey={data.privateKey || undefined}
/>
) : (
<div />
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
index d5f94e7b7a..ef8b09dac1 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
@@ -4,7 +4,11 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, DeleteActionModal } from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import {
+ ProjectPermissionCertificateActions,
+ ProjectPermissionSub,
+ useWorkspace
+} from "@app/context";
import { useDeleteCert } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -50,7 +54,7 @@ export const CertificatesSection = () => {
<div className="mb-4 flex justify-between">
<p className="text-xl font-semibold text-mineshaft-100">Certificates</p>
<ProjectPermissionCan
- I={ProjectPermissionActions.Create}
+ I={ProjectPermissionCertificateActions.Create}
a={ProjectPermissionSub.Certificates}
>
{(isAllowed) => (
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
index dcc832bfb3..acf5563673 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
@@ -30,7 +30,11 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import {
+ ProjectPermissionCertificateActions,
+ ProjectPermissionSub,
+ useWorkspace
+} from "@app/context";
import { useListWorkspaceCertificates } from "@app/hooks/api";
import { CertStatus } from "@app/hooks/api/certificates/enums";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -67,7 +71,7 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
<Table>
<THead>
<Tr>
- <Th>Friendly Name</Th>
+ <Th>Common Name</Th>
<Th>Status</Th>
<Th>Not Before</Th>
<Th>Not After</Th>
@@ -81,7 +85,7 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
const { variant, label } = getCertValidUntilBadgeDetails(certificate.notAfter);
return (
<Tr className="h-10" key={`certificate-${certificate.id}`}>
- <Td>{certificate.friendlyName}</Td>
+ <Td>{certificate.commonName}</Td>
<Td>
{certificate.status === CertStatus.REVOKED ? (
<Badge variant="danger">Revoked</Badge>
@@ -110,7 +114,7 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="p-1">
<ProjectPermissionCan
- I={ProjectPermissionActions.Read}
+ I={ProjectPermissionCertificateActions.Read}
a={ProjectPermissionSub.Certificates}
>
{(isAllowed) => (
@@ -131,7 +135,7 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
)}
</ProjectPermissionCan>
<ProjectPermissionCan
- I={ProjectPermissionActions.Read}
+ I={ProjectPermissionCertificateActions.Read}
a={ProjectPermissionSub.Certificates}
>
{(isAllowed) => (
@@ -152,7 +156,7 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
)}
</ProjectPermissionCan>
<ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
+ I={ProjectPermissionCertificateActions.Delete}
a={ProjectPermissionSub.Certificates}
>
{(isAllowed) => (
@@ -173,7 +177,7 @@ export const CertificatesTable = ({ handlePopUpOpen }: Props) => {
)}
</ProjectPermissionCan>
<ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
+ I={ProjectPermissionCertificateActions.Delete}
a={ProjectPermissionSub.Certificates}
>
{(isAllowed) => (
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/route.tsx b/frontend/src/pages/cert-manager/CertificatesPage/route.tsx
index 4318128862..0bb7e7a71f 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/route.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/route.tsx
@@ -3,7 +3,7 @@ import { createFileRoute } from "@tanstack/react-router";
import { CertificatesPage } from "./CertificatesPage";
export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/overview"
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificates"
)({
component: CertificatesPage
});
diff --git a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx
index 073cac6e81..e851e33d3f 100644
--- a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx
@@ -57,7 +57,7 @@ export const PkiCollectionPage = () => {
});
handlePopUpClose("deletePkiCollection");
navigate({
- to: `/${ProjectType.CertificateManager}/$projectId/overview` as const,
+ to: `/${ProjectType.CertificateManager}/$projectId/certificates` as const,
params: {
projectId
}
diff --git a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/routes.tsx b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/routes.tsx
index d59ebd265a..e1ff5c1e79 100644
--- a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/routes.tsx
+++ b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/routes.tsx
@@ -13,7 +13,7 @@ export const Route = createFileRoute(
{
label: "Certificate Collections",
link: linkOptions({
- to: "/cert-manager/$projectId/overview",
+ to: "/cert-manager/$projectId/certificates",
params: {
projectId: params.projectId
}
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx
new file mode 100644
index 0000000000..ad6e88adf5
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/PkiSubscriberDetailsByIDPage.tsx
@@ -0,0 +1,165 @@
+import { Helmet } from "react-helmet";
+import { useTranslation } from "react-i18next";
+import { useNavigate, useParams } from "@tanstack/react-router";
+import { twMerge } from "tailwind-merge";
+
+import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
+import {
+ Button,
+ DeleteActionModal,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ PageHeader,
+ Tooltip
+} from "@app/components/v2";
+import { ROUTE_PATHS } from "@app/const/routes";
+import {
+ ProjectPermissionPkiSubscriberActions,
+ ProjectPermissionSub,
+ useWorkspace
+} from "@app/context";
+import { useDeletePkiSubscriber, useGetPkiSubscriber } from "@app/hooks/api";
+import { ProjectType } from "@app/hooks/api/workspace/types";
+import { usePopUp } from "@app/hooks/usePopUp";
+
+import { PkiSubscriberModal } from "../PkiSubscribersPage/components/PkiSubscriberModal";
+import { PkiSubscriberCertificatesSection, PkiSubscriberDetailsSection } from "./components";
+
+const Page = () => {
+ const navigate = useNavigate();
+ const { currentWorkspace } = useWorkspace();
+ const projectId = currentWorkspace.id;
+ const subscriberName = useParams({
+ from: ROUTE_PATHS.CertManager.PkiSubscriberDetailsByIDPage.id,
+ select: (el) => el.subscriberName
+ });
+ const { data } = useGetPkiSubscriber({
+ subscriberName,
+ projectId
+ });
+
+ const { mutateAsync: deletePkiSubscriber } = useDeletePkiSubscriber();
+
+ const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
+ "pkiSubscriber",
+ "deletePkiSubscriber"
+ ] as const);
+
+ const onRemoveSubscriberSubmit = async (subscriberNameToDelete: string) => {
+ try {
+ if (!projectId) return;
+
+ await deletePkiSubscriber({ subscriberName: subscriberNameToDelete, projectId });
+
+ createNotification({
+ text: "Successfully deleted subscriber",
+ type: "success"
+ });
+
+ handlePopUpClose("deletePkiSubscriber");
+ navigate({
+ to: `/${ProjectType.CertificateManager}/$projectId/subscribers` as const,
+ params: {
+ projectId
+ }
+ });
+ } catch (err) {
+ console.error(err);
+ createNotification({
+ text: "Failed to delete subscriber",
+ type: "error"
+ });
+ }
+ };
+
+ return (
+ <div className="container mx-auto flex flex-col justify-between bg-bunker-800 text-white">
+ {data && (
+ <div className="mx-auto mb-6 w-full max-w-7xl">
+ <PageHeader title={data.name}>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild className="rounded-lg">
+ <div className="hover:text-primary-400 data-[state=open]:text-primary-400">
+ <Tooltip content="More options">
+ <Button variant="outline_bg">More</Button>
+ </Tooltip>
+ </div>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="p-1">
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSubscriberActions.Delete}
+ a={ProjectPermissionSub.PkiSubscribers}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ isAllowed
+ ? "hover:!bg-red-500 hover:!text-white"
+ : "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={() =>
+ handlePopUpOpen("deletePkiSubscriber", {
+ subscriberName: data.name
+ })
+ }
+ disabled={!isAllowed}
+ >
+ Delete PKI Subscriber
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </PageHeader>
+ <div className="flex">
+ <div className="mr-4 w-96">
+ <PkiSubscriberDetailsSection
+ subscriberName={data.name}
+ handlePopUpOpen={handlePopUpOpen}
+ />
+ </div>
+ <div className="w-full">
+ <PkiSubscriberCertificatesSection subscriberName={data.name} />
+ </div>
+ </div>
+ </div>
+ )}
+ <PkiSubscriberModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
+ <DeleteActionModal
+ isOpen={popUp.deletePkiSubscriber.isOpen}
+ title={`Are you sure you want to remove the PKI subscriber: ${
+ (popUp?.deletePkiSubscriber?.data as { name: string })?.name || ""
+ }?`}
+ onChange={(isOpen) => handlePopUpToggle("deletePkiSubscriber", isOpen)}
+ deleteKey="confirm"
+ onDeleteApproved={() =>
+ onRemoveSubscriberSubmit(
+ (popUp?.deletePkiSubscriber?.data as { subscriberName: string })?.subscriberName
+ )
+ }
+ />
+ </div>
+ );
+};
+
+export const PkiSubscriberDetailsByIDPage = () => {
+ const { t } = useTranslation();
+ return (
+ <>
+ <Helmet>
+ <title>{t("common.head-title", { title: "PKI Subscriber" })}</title>
+ </Helmet>
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSubscriberActions.Read}
+ a={ProjectPermissionSub.PkiSubscribers}
+ passThrough={false}
+ renderGuardBanner
+ >
+ <Page />
+ </ProjectPermissionCan>
+ </>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesSection.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesSection.tsx
new file mode 100644
index 0000000000..2e486cf853
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesSection.tsx
@@ -0,0 +1,27 @@
+import { usePopUp } from "@app/hooks";
+import { CertificateRevocationModal } from "@app/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal";
+
+import { PkiSubscriberCertificatesTable } from "./PkiSubscriberCertificatesTable";
+
+type Props = {
+ subscriberName: string;
+};
+
+export const PkiSubscriberCertificatesSection = ({ subscriberName }: Props) => {
+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["revokeCertificate"] as const);
+
+ return (
+ <div className="h-full rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <div className="flex items-center justify-between border-b border-mineshaft-400 pb-4">
+ <h3 className="text-lg font-semibold text-mineshaft-100">Certificates</h3>
+ </div>
+ <div className="py-4">
+ <PkiSubscriberCertificatesTable
+ subscriberName={subscriberName}
+ handlePopUpOpen={handlePopUpOpen}
+ />
+ </div>
+ <CertificateRevocationModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
+ </div>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx
new file mode 100644
index 0000000000..e6e49b758d
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx
@@ -0,0 +1,176 @@
+import { useState } from "react";
+import { subject } from "@casl/ability";
+import { faCertificate, faEllipsis, faTrash } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { format } from "date-fns";
+import { twMerge } from "tailwind-merge";
+
+import { ProjectPermissionCan } from "@app/components/permissions";
+import {
+ Badge,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ EmptyState,
+ Pagination,
+ Table,
+ TableContainer,
+ TableSkeleton,
+ TBody,
+ Td,
+ Th,
+ THead,
+ Tooltip,
+ Tr
+} from "@app/components/v2";
+import {
+ ProjectPermissionPkiSubscriberActions,
+ ProjectPermissionSub,
+ useProjectPermission,
+ useWorkspace
+} from "@app/context";
+import { useGetPkiSubscriberCertificates } from "@app/hooks/api";
+import { CertStatus } from "@app/hooks/api/certificates/enums";
+import { UsePopUpState } from "@app/hooks/usePopUp";
+
+type Props = {
+ subscriberName: string;
+ handlePopUpOpen?: (popUpName: keyof UsePopUpState<["revokeCertificate"]>, data?: object) => void;
+};
+
+const PER_PAGE_INIT = 25;
+
+export const PkiSubscriberCertificatesTable = ({ subscriberName, handlePopUpOpen }: Props) => {
+ const { currentWorkspace } = useWorkspace();
+ const projectId = currentWorkspace.id;
+ const { permission } = useProjectPermission();
+ const [page, setPage] = useState(1);
+ const [perPage, setPerPage] = useState(PER_PAGE_INIT);
+
+ const { data, isPending } = useGetPkiSubscriberCertificates({
+ subscriberName,
+ projectId,
+ offset: (page - 1) * perPage,
+ limit: perPage
+ });
+
+ const getCertStatusBadge = (status: string, notAfter: string) => {
+ if (status === CertStatus.REVOKED) {
+ return <Badge variant="danger">Revoked</Badge>;
+ }
+
+ const expiryDate = new Date(notAfter);
+ const now = new Date();
+ const daysUntilExpiry = Math.floor(
+ (expiryDate.getTime() - now.getTime()) / (1000 * 60 * 60 * 24)
+ );
+
+ if (daysUntilExpiry < 0) {
+ return <Badge variant="danger">Expired</Badge>;
+ }
+
+ if (daysUntilExpiry < 30) {
+ return <Badge variant="primary">Expiring Soon</Badge>;
+ }
+
+ return <Badge variant="success">Valid</Badge>;
+ };
+
+ const canListPkiSubscriberCerts = permission.can(
+ ProjectPermissionPkiSubscriberActions.ListCerts,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name: subscriberName
+ })
+ );
+
+ return (
+ <div>
+ <TableContainer>
+ <Table>
+ <THead>
+ <Tr>
+ <Th>Common Name</Th>
+ <Th>Status</Th>
+ <Th>Not Before</Th>
+ <Th>Not After</Th>
+ <Th />
+ </Tr>
+ </THead>
+ <TBody>
+ {isPending && <TableSkeleton columns={5} innerKey="pki-subscriber-certificates" />}
+ {!isPending &&
+ data?.certificates?.map((certificate) => {
+ return (
+ <Tr className="h-10" key={`certificate-${certificate.id}`}>
+ <Td>{certificate.commonName}</Td>
+ <Td>{getCertStatusBadge(certificate.status, certificate.notAfter)}</Td>
+ <Td>
+ {certificate.notBefore
+ ? format(new Date(certificate.notBefore), "yyyy-MM-dd")
+ : "-"}
+ </Td>
+ <Td>
+ {certificate.notAfter
+ ? format(new Date(certificate.notAfter), "yyyy-MM-dd")
+ : "-"}
+ </Td>
+ <Td className="flex justify-end">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild className="rounded-lg">
+ <div className="hover:text-primary-400 data-[state=open]:text-primary-400">
+ <Tooltip content="More options">
+ <FontAwesomeIcon size="lg" icon={faEllipsis} />
+ </Tooltip>
+ </div>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="p-1">
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSubscriberActions.Delete}
+ a={ProjectPermissionSub.PkiSubscribers}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={() =>
+ handlePopUpOpen &&
+ handlePopUpOpen("revokeCertificate", {
+ serialNumber: certificate.serialNumber
+ })
+ }
+ disabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faTrash} />}
+ >
+ Revoke Certificate
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </Td>
+ </Tr>
+ );
+ })}
+ </TBody>
+ </Table>
+ {!isPending && data?.totalCount !== undefined && data.totalCount >= PER_PAGE_INIT && (
+ <Pagination
+ count={data.totalCount}
+ page={page}
+ perPage={perPage}
+ onChangePage={(newPage) => setPage(newPage)}
+ onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
+ />
+ )}
+ {!isPending && !data?.certificates?.length && (
+ <EmptyState
+ title={`${canListPkiSubscriberCerts ? "No certificates have been issued for this subscriber" : "You do not have permission to view this subscriber's certificates"}`}
+ icon={faCertificate}
+ />
+ )}
+ </TableContainer>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx
new file mode 100644
index 0000000000..5899f5004f
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberDetailsSection.tsx
@@ -0,0 +1,190 @@
+import { useState } from "react";
+import { subject } from "@casl/ability";
+import { faCheck, faCopy, faPencil } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
+import { Button, IconButton, Modal, ModalContent, Tooltip } from "@app/components/v2";
+import {
+ ProjectPermissionPkiSubscriberActions,
+ ProjectPermissionSub,
+ useProjectPermission,
+ useWorkspace
+} from "@app/context";
+import { useTimedReset } from "@app/hooks";
+import { useGetPkiSubscriber, useIssuePkiSubscriberCert } from "@app/hooks/api";
+import { pkiSubscriberStatusToNameMap } from "@app/hooks/api/pkiSubscriber/constants";
+import { UsePopUpState } from "@app/hooks/usePopUp";
+
+import { CertificateContent } from "../../CertificatesPage/components/CertificateContent";
+
+type Props = {
+ subscriberName: string;
+ handlePopUpOpen: (popUpName: keyof UsePopUpState<["pkiSubscriber"]>, data?: object) => void;
+};
+
+type TCertificateDetails = {
+ serialNumber: string;
+ certificate: string;
+ certificateChain: string;
+ privateKey: string;
+};
+
+export const PkiSubscriberDetailsSection = ({ subscriberName, handlePopUpOpen }: Props) => {
+ const { currentWorkspace } = useWorkspace();
+ const projectId = currentWorkspace.id;
+ const { permission } = useProjectPermission();
+ const [certificateDetails, setCertificateDetails] = useState<TCertificateDetails | null>(null);
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [copyTextId, isCopyingId, setCopyTextId] = useTimedReset<string>({
+ initialState: "Copy ID to clipboard"
+ });
+
+ const { data: pkiSubscriber } = useGetPkiSubscriber({
+ subscriberName,
+ projectId
+ });
+
+ const { mutateAsync: issuePkiSubscriberCert, isPending: isIssuingCert } =
+ useIssuePkiSubscriberCert();
+
+ const onIssuePkiSubscriberCert = async () => {
+ try {
+ const response = await issuePkiSubscriberCert({ subscriberName, projectId });
+
+ setCertificateDetails({
+ serialNumber: response.serialNumber,
+ certificate: response.certificate,
+ certificateChain: response.certificateChain,
+ privateKey: response.privateKey
+ });
+
+ setIsModalOpen(true);
+
+ createNotification({
+ text: "Successfully issued certificate",
+ type: "success"
+ });
+ } catch (err) {
+ console.error(err);
+ createNotification({
+ text: "Failed to issue certificate",
+ type: "error"
+ });
+ }
+ };
+
+ const canIssuePkiSubscriberCert = permission.can(
+ ProjectPermissionPkiSubscriberActions.IssueCert,
+ subject(ProjectPermissionSub.PkiSubscribers, {
+ name: pkiSubscriber?.name ?? ""
+ })
+ );
+
+ return pkiSubscriber ? (
+ <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <div className="flex items-center justify-between border-b border-mineshaft-400 pb-4">
+ <h3 className="text-lg font-semibold text-mineshaft-100">PKI Subscriber Details</h3>
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSubscriberActions.Edit}
+ a={ProjectPermissionSub.PkiSubscribers}
+ >
+ {(isAllowed) => {
+ return (
+ <Tooltip content="Edit PKI Subscriber">
+ <IconButton
+ isDisabled={!isAllowed}
+ ariaLabel="edit icon"
+ variant="plain"
+ className="group relative"
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("pkiSubscriber", {
+ subscriberName: pkiSubscriber.name
+ });
+ }}
+ >
+ <FontAwesomeIcon icon={faPencil} />
+ </IconButton>
+ </Tooltip>
+ );
+ }}
+ </ProjectPermissionCan>
+ </div>
+ <div className="pt-4">
+ <div className="mb-4">
+ <p className="text-sm font-semibold text-mineshaft-300">PKI Subscriber ID</p>
+ <div className="group flex align-top">
+ <p className="text-sm text-mineshaft-300">{pkiSubscriber.id}</p>
+ <div className="opacity-0 transition-opacity duration-300 group-hover:opacity-100">
+ <Tooltip content={copyTextId}>
+ <IconButton
+ ariaLabel="copy icon"
+ variant="plain"
+ className="group relative ml-2"
+ onClick={() => {
+ navigator.clipboard.writeText(pkiSubscriber.id);
+ setCopyTextId("Copied");
+ }}
+ >
+ <FontAwesomeIcon icon={isCopyingId ? faCheck : faCopy} />
+ </IconButton>
+ </Tooltip>
+ </div>
+ </div>
+ </div>
+ <div className="mb-4">
+ <p className="text-sm font-semibold text-mineshaft-300">Name</p>
+ <p className="text-sm text-mineshaft-300">{pkiSubscriber.name}</p>
+ </div>
+ <div className="mb-4">
+ <p className="text-sm font-semibold text-mineshaft-300">Status</p>
+ <p className="text-sm text-mineshaft-300">
+ {pkiSubscriberStatusToNameMap[pkiSubscriber.status]}
+ </p>
+ </div>
+ <div className="mb-4">
+ <p className="text-sm font-semibold text-mineshaft-300">Common Name</p>
+ <p className="text-sm text-mineshaft-300">{pkiSubscriber.commonName}</p>
+ </div>
+ {canIssuePkiSubscriberCert && (
+ <Button
+ className="mt-4 w-full"
+ colorSchema="primary"
+ type="button"
+ isLoading={isIssuingCert}
+ onClick={() => {
+ onIssuePkiSubscriberCert();
+ }}
+ >
+ Issue Certificate
+ </Button>
+ )}
+ </div>
+
+ <Modal
+ isOpen={isModalOpen}
+ onOpenChange={(isOpen) => {
+ setIsModalOpen(isOpen);
+ if (!isOpen) {
+ setCertificateDetails(null);
+ }
+ }}
+ >
+ <ModalContent title="Certificate Details">
+ {certificateDetails && (
+ <CertificateContent
+ serialNumber={certificateDetails.serialNumber}
+ certificate={certificateDetails.certificate}
+ certificateChain={certificateDetails.certificateChain}
+ privateKey={certificateDetails.privateKey}
+ />
+ )}
+ </ModalContent>
+ </Modal>
+ </div>
+ ) : (
+ <div />
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/index.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/index.tsx
new file mode 100644
index 0000000000..4a671fdcd8
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/index.tsx
@@ -0,0 +1,2 @@
+export { PkiSubscriberCertificatesSection } from "./PkiSubscriberCertificatesSection";
+export { PkiSubscriberDetailsSection } from "./PkiSubscriberDetailsSection";
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/route.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/route.tsx
new file mode 100644
index 0000000000..bb902bc76a
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/route.tsx
@@ -0,0 +1,25 @@
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
+
+import { PkiSubscriberDetailsByIDPage } from "./PkiSubscriberDetailsByIDPage";
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName"
+)({
+ component: PkiSubscriberDetailsByIDPage,
+ beforeLoad: ({ context, params }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Subscribers",
+ link: linkOptions({
+ to: "/cert-manager/$projectId/subscribers",
+ params: {
+ projectId: params.projectId
+ }
+ })
+ }
+ ]
+ };
+ }
+});
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/PkiSubscribersPage.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/PkiSubscribersPage.tsx
new file mode 100644
index 0000000000..c95e9490e2
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/PkiSubscribersPage.tsx
@@ -0,0 +1,28 @@
+import { Helmet } from "react-helmet";
+import { useTranslation } from "react-i18next";
+
+import { PageHeader } from "@app/components/v2";
+
+import { PkiSubscriberSection } from "./components";
+
+export const PkiSubscribersPage = () => {
+ const { t } = useTranslation();
+ return (
+ <>
+ <Helmet>
+ <title>{t("common.head-title", { title: "PKI Subscribers" })}</title>
+ </Helmet>
+ <div className="h-full bg-bunker-800">
+ <div className="container mx-auto flex flex-col justify-between text-white">
+ <div className="mx-auto mb-6 w-full max-w-7xl">
+ <PageHeader
+ title="Subscribers"
+ description="Manage subscribers that request and receive certificates, including user devices, servers, and services."
+ />
+ <PkiSubscriberSection />
+ </div>
+ </div>
+ </div>
+ </>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx
new file mode 100644
index 0000000000..951d782253
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx
@@ -0,0 +1,428 @@
+import { useEffect } from "react";
+import { Controller, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import { createNotification } from "@app/components/notifications";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+ Button,
+ Checkbox,
+ FormControl,
+ Input,
+ Modal,
+ ModalContent,
+ Select,
+ SelectItem
+} from "@app/components/v2";
+import { useWorkspace } from "@app/context";
+import {
+ CaStatus,
+ useCreatePkiSubscriber,
+ useGetPkiSubscriber,
+ useListWorkspaceCas,
+ useListWorkspacePkiSubscribers,
+ useUpdatePkiSubscriber
+} from "@app/hooks/api";
+import {
+ EXTENDED_KEY_USAGES_OPTIONS,
+ KEY_USAGES_OPTIONS
+} from "@app/hooks/api/certificates/constants";
+import { CertExtendedKeyUsage, CertKeyUsage } from "@app/hooks/api/certificates/enums";
+import { UsePopUpState } from "@app/hooks/usePopUp";
+
+type Props = {
+ popUp: UsePopUpState<["pkiSubscriber"]>;
+ handlePopUpToggle: (popUpName: keyof UsePopUpState<["pkiSubscriber"]>, state?: boolean) => void;
+};
+
+const schema = z
+ .object({
+ name: z.string().trim().min(1, "Name is required"),
+ caId: z.string().min(1, "Issuing CA is required"),
+ commonName: z.string().trim().min(1, "Common Name is required"),
+ subjectAlternativeNames: z.string(),
+ ttl: z.string().trim(),
+ keyUsages: z.object({
+ [CertKeyUsage.DIGITAL_SIGNATURE]: z.boolean().optional(),
+ [CertKeyUsage.KEY_ENCIPHERMENT]: z.boolean().optional(),
+ [CertKeyUsage.NON_REPUDIATION]: z.boolean().optional(),
+ [CertKeyUsage.DATA_ENCIPHERMENT]: z.boolean().optional(),
+ [CertKeyUsage.KEY_AGREEMENT]: z.boolean().optional(),
+ [CertKeyUsage.KEY_CERT_SIGN]: z.boolean().optional(),
+ [CertKeyUsage.CRL_SIGN]: z.boolean().optional(),
+ [CertKeyUsage.ENCIPHER_ONLY]: z.boolean().optional(),
+ [CertKeyUsage.DECIPHER_ONLY]: z.boolean().optional()
+ }),
+ extendedKeyUsages: z.object({
+ [CertExtendedKeyUsage.CLIENT_AUTH]: z.boolean().optional(),
+ [CertExtendedKeyUsage.CODE_SIGNING]: z.boolean().optional(),
+ [CertExtendedKeyUsage.EMAIL_PROTECTION]: z.boolean().optional(),
+ [CertExtendedKeyUsage.OCSP_SIGNING]: z.boolean().optional(),
+ [CertExtendedKeyUsage.SERVER_AUTH]: z.boolean().optional(),
+ [CertExtendedKeyUsage.TIMESTAMPING]: z.boolean().optional()
+ })
+ })
+ .required();
+
+export type FormData = z.infer<typeof schema>;
+
+export const PkiSubscriberModal = ({ popUp, handlePopUpToggle }: Props) => {
+ const { currentWorkspace } = useWorkspace();
+ const projectId = currentWorkspace.id;
+ const { data: subscribers } = useListWorkspacePkiSubscribers(projectId);
+ const { data: cas } = useListWorkspaceCas({
+ projectSlug: currentWorkspace?.slug ?? "",
+ status: CaStatus.ACTIVE
+ });
+
+ const { data: pkiSubscriber } = useGetPkiSubscriber({
+ subscriberName:
+ (popUp?.pkiSubscriber?.data as { subscriberName: string })?.subscriberName || "",
+ projectId
+ });
+
+ const { mutateAsync: createMutateAsync } = useCreatePkiSubscriber();
+ const { mutateAsync: updateMutateAsync } = useUpdatePkiSubscriber();
+
+ const {
+ control,
+ handleSubmit,
+ reset,
+ setValue,
+ formState: { isSubmitting }
+ } = useForm<FormData>({
+ resolver: zodResolver(schema),
+ defaultValues: {
+ name: "",
+ caId: "",
+ commonName: "",
+ subjectAlternativeNames: "",
+ ttl: "",
+ keyUsages: {
+ [CertKeyUsage.DIGITAL_SIGNATURE]: true,
+ [CertKeyUsage.KEY_ENCIPHERMENT]: true
+ },
+ extendedKeyUsages: {}
+ }
+ });
+
+ useEffect(() => {
+ if (pkiSubscriber) {
+ reset({
+ name: pkiSubscriber.name,
+ caId: pkiSubscriber.caId || "",
+ commonName: pkiSubscriber.commonName,
+ subjectAlternativeNames: pkiSubscriber.subjectAlternativeNames.join(", ") || "",
+ ttl: pkiSubscriber.ttl || "",
+ keyUsages: Object.fromEntries((pkiSubscriber.keyUsages || []).map((name) => [name, true])),
+ extendedKeyUsages: Object.fromEntries(
+ (pkiSubscriber.extendedKeyUsages || []).map((name) => [name, true])
+ )
+ });
+ } else {
+ reset({
+ name: "",
+ caId: "",
+ commonName: "",
+ subjectAlternativeNames: "",
+ ttl: "",
+ keyUsages: {
+ [CertKeyUsage.DIGITAL_SIGNATURE]: true,
+ [CertKeyUsage.KEY_ENCIPHERMENT]: true
+ },
+ extendedKeyUsages: {}
+ });
+ }
+ }, [pkiSubscriber, reset]);
+
+ useEffect(() => {
+ if (cas?.length) {
+ setValue("caId", cas[0].id);
+ }
+ }, [cas, setValue]);
+
+ const onFormSubmit = async ({
+ name,
+ caId,
+ commonName,
+ subjectAlternativeNames,
+ ttl,
+ keyUsages,
+ extendedKeyUsages
+ }: FormData) => {
+ try {
+ if (!projectId) return;
+
+ if (!caId) {
+ createNotification({
+ text: "Please select an Issuing CA",
+ type: "error"
+ });
+ return;
+ }
+
+ // Check if there is already a different subscriber with the same name
+ const existingNames =
+ subscribers?.filter((s) => s.id !== pkiSubscriber?.id).map((s) => s.name) || [];
+
+ if (existingNames.includes(name.trim())) {
+ createNotification({
+ text: "A subscriber with this name already exists.",
+ type: "error"
+ });
+ return;
+ }
+
+ const keyUsagesList = Object.entries(keyUsages)
+ .filter(([, value]) => value)
+ .map(([key]) => key as CertKeyUsage);
+
+ const extendedKeyUsagesList = Object.entries(extendedKeyUsages)
+ .filter(([, value]) => value)
+ .map(([key]) => key as CertExtendedKeyUsage);
+
+ const subjectAlternativeNamesList = subjectAlternativeNames
+ .split(",")
+ .map((san) => san.trim())
+ .filter(Boolean);
+
+ if (pkiSubscriber) {
+ await updateMutateAsync({
+ subscriberName: pkiSubscriber.name,
+ projectId,
+ name,
+ caId,
+ commonName,
+ subjectAlternativeNames: subjectAlternativeNamesList,
+ ttl,
+ keyUsages: keyUsagesList,
+ extendedKeyUsages: extendedKeyUsagesList
+ });
+ } else {
+ await createMutateAsync({
+ projectId,
+ name,
+ caId,
+ commonName,
+ subjectAlternativeNames: subjectAlternativeNamesList,
+ ttl,
+ keyUsages: keyUsagesList,
+ extendedKeyUsages: extendedKeyUsagesList
+ });
+ }
+
+ reset();
+ handlePopUpToggle("pkiSubscriber", false);
+
+ createNotification({
+ text: `Successfully ${pkiSubscriber ? "updated" : "added"} PKI subscriber`,
+ type: "success"
+ });
+ } catch (err) {
+ console.error(err);
+ createNotification({
+ text: `Failed to ${pkiSubscriber ? "update" : "add"} PKI subscriber`,
+ type: "error"
+ });
+ }
+ };
+
+ return (
+ <Modal
+ isOpen={popUp?.pkiSubscriber?.isOpen}
+ onOpenChange={(isOpen) => {
+ reset();
+ handlePopUpToggle("pkiSubscriber", isOpen);
+ }}
+ >
+ <ModalContent title={`${pkiSubscriber ? "Update" : "Add"} PKI Subscriber`}>
+ <form onSubmit={handleSubmit(onFormSubmit)}>
+ {pkiSubscriber && (
+ <FormControl label="Subscriber ID">
+ <Input value={pkiSubscriber.id} isDisabled className="bg-white/[0.07]" />
+ </FormControl>
+ )}
+ <Controller
+ control={control}
+ name="name"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Subscriber Name"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ isRequired
+ >
+ <Input {...field} placeholder="web-service" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="caId"
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ <FormControl
+ label="Issuing CA"
+ errorText={error?.message}
+ isError={Boolean(error)}
+ isRequired
+ >
+ <Select
+ defaultValue={field.value}
+ {...field}
+ onValueChange={(e) => onChange(e)}
+ className="w-full"
+ >
+ {(cas || []).map(({ id, dn }) => (
+ <SelectItem value={id} key={`ca-${id}`}>
+ {dn}
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="commonName"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Common Name"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ isRequired
+ >
+ <Input {...field} placeholder="web.example.com" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="subjectAlternativeNames"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Subject Alternative Names (SANs)"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="app1.example.com, app2.example.com, ..." />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="ttl"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="TTL"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ isRequired
+ >
+ <Input {...field} placeholder="2 days, 1d, 2h, 1y, ..." />
+ </FormControl>
+ )}
+ />
+ <Accordion type="single" collapsible className="w-full">
+ <AccordionItem value="key-usages" className="data-[state=open]:border-none">
+ <AccordionTrigger className="h-fit flex-none pl-1 text-sm">
+ <div className="order-1 ml-3">Key Usage</div>
+ </AccordionTrigger>
+ <AccordionContent>
+ <Controller
+ control={control}
+ name="keyUsages"
+ render={({ field: { onChange, value }, fieldState: { error } }) => {
+ return (
+ <FormControl
+ label="Key Usage"
+ errorText={error?.message}
+ isError={Boolean(error)}
+ >
+ <div className="mb-7 mt-2 grid grid-cols-2 gap-2">
+ {KEY_USAGES_OPTIONS.map(({ label, value: optionValue }) => {
+ return (
+ <Checkbox
+ id={optionValue}
+ key={optionValue}
+ className="data-[state=checked]:bg-primary"
+ isChecked={value[optionValue]}
+ onCheckedChange={(state) => {
+ onChange({
+ ...value,
+ [optionValue]: state
+ });
+ }}
+ >
+ {label}
+ </Checkbox>
+ );
+ })}
+ </div>
+ </FormControl>
+ );
+ }}
+ />
+ <Controller
+ control={control}
+ name="extendedKeyUsages"
+ render={({ field: { onChange, value }, fieldState: { error } }) => {
+ return (
+ <FormControl
+ label="Extended Key Usage"
+ errorText={error?.message}
+ isError={Boolean(error)}
+ >
+ <div className="mb-7 mt-2 grid grid-cols-2 gap-2">
+ {EXTENDED_KEY_USAGES_OPTIONS.map(({ label, value: optionValue }) => {
+ return (
+ <Checkbox
+ id={optionValue}
+ key={optionValue}
+ className="data-[state=checked]:bg-primary"
+ isChecked={value[optionValue]}
+ onCheckedChange={(state) => {
+ onChange({
+ ...value,
+ [optionValue]: state
+ });
+ }}
+ >
+ {label}
+ </Checkbox>
+ );
+ })}
+ </div>
+ </FormControl>
+ );
+ }}
+ />
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
+ <div className="mt-4 flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting}
+ >
+ {pkiSubscriber ? "Update" : "Add"}
+ </Button>
+ <Button
+ colorSchema="secondary"
+ variant="plain"
+ onClick={() => handlePopUpToggle("pkiSubscriber", false)}
+ >
+ Cancel
+ </Button>
+ </div>
+ </form>
+ </ModalContent>
+ </Modal>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx
new file mode 100644
index 0000000000..f81636e491
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberSection.tsx
@@ -0,0 +1,151 @@
+import { faArrowUpRightFromSquare, faPlus } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
+import { Button, DeleteActionModal } from "@app/components/v2";
+import {
+ ProjectPermissionPkiSubscriberActions,
+ ProjectPermissionSub,
+ useWorkspace
+} from "@app/context";
+import { useDeletePkiSubscriber, useUpdatePkiSubscriber } from "@app/hooks/api";
+import { PkiSubscriberStatus } from "@app/hooks/api/pkiSubscriber/types";
+import { usePopUp } from "@app/hooks/usePopUp";
+
+import { PkiSubscriberModal } from "./PkiSubscriberModal";
+import { PkiSubscribersTable } from "./PkiSubscribersTable";
+
+export const PkiSubscriberSection = () => {
+ const { currentWorkspace } = useWorkspace();
+ const projectId = currentWorkspace.id;
+ const { mutateAsync: deletePkiSubscriber } = useDeletePkiSubscriber();
+ const { mutateAsync: updatePkiSubscriber } = useUpdatePkiSubscriber();
+
+ const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
+ "pkiSubscriber",
+ "pkiSubscriberStatus", // enable / disable
+ "deletePkiSubscriber"
+ ] as const);
+
+ const onRemovePkiSubscriberSubmit = async (subscriberName: string) => {
+ try {
+ const subscriber = await deletePkiSubscriber({ subscriberName, projectId });
+
+ createNotification({
+ text: `Successfully deleted PKI subscriber: ${subscriber.name}`,
+ type: "success"
+ });
+
+ handlePopUpClose("deletePkiSubscriber");
+ } catch (err) {
+ console.error(err);
+ createNotification({
+ text: "Failed to delete PKI subscriber",
+ type: "error"
+ });
+ }
+ };
+
+ const onUpdatePkiSubscriberStatus = async ({
+ subscriberName,
+ status
+ }: {
+ subscriberName: string;
+ status: PkiSubscriberStatus;
+ }) => {
+ try {
+ if (!currentWorkspace?.slug) return;
+
+ await updatePkiSubscriber({ subscriberName, projectId, status });
+
+ createNotification({
+ text: `Successfully ${status === PkiSubscriberStatus.ACTIVE ? "enabled" : "disabled"} subscriber`,
+ type: "success"
+ });
+
+ handlePopUpClose("pkiSubscriberStatus");
+ } catch (err) {
+ console.error(err);
+ createNotification({
+ text: `Failed to ${status === PkiSubscriberStatus.ACTIVE ? "enable" : "disable"} subscriber`,
+ type: "error"
+ });
+ }
+ };
+
+ const subscriberStatusData = popUp?.pkiSubscriberStatus?.data as {
+ status: PkiSubscriberStatus;
+ subscriberName: string;
+ };
+
+ const isEnabling = subscriberStatusData?.status === PkiSubscriberStatus.ACTIVE;
+ const subscriberName = subscriberStatusData?.subscriberName || "";
+
+ return (
+ <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <div className="mb-4 flex justify-between">
+ <p className="text-xl font-semibold text-mineshaft-100">Subscribers</p>
+ <div className="flex w-full justify-end">
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href="https://infisical.com/docs/documentation/platform/pki/subscribers"
+ >
+ <span className="flex w-max cursor-pointer items-center rounded-md border border-mineshaft-500 bg-mineshaft-600 px-4 py-2 text-mineshaft-200 duration-200 hover:border-primary/40 hover:bg-primary/10 hover:text-white">
+ Documentation{" "}
+ <FontAwesomeIcon
+ icon={faArrowUpRightFromSquare}
+ className="mb-[0.06rem] ml-1 text-xs"
+ />
+ </span>
+ </a>
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSubscriberActions.Create}
+ a={ProjectPermissionSub.PkiSubscribers}
+ >
+ {(isAllowed) => (
+ <Button
+ colorSchema="primary"
+ type="submit"
+ leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ onClick={() => handlePopUpOpen("pkiSubscriber")}
+ isDisabled={!isAllowed}
+ className="ml-4"
+ >
+ Add Subscriber
+ </Button>
+ )}
+ </ProjectPermissionCan>
+ </div>
+ </div>
+ <PkiSubscribersTable handlePopUpOpen={handlePopUpOpen} />
+ <PkiSubscriberModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
+ <DeleteActionModal
+ isOpen={popUp.pkiSubscriberStatus.isOpen}
+ title={`Are you sure you want to ${isEnabling ? "enable" : "disable"} the subscriber ${subscriberName}?`}
+ subTitle={
+ isEnabling
+ ? "This action will allow issuing certificates for this subscriber again."
+ : "This action will prevent issuing certificates for this subscriber."
+ }
+ onChange={(isOpen) => handlePopUpToggle("pkiSubscriberStatus", isOpen)}
+ deleteKey="confirm"
+ buttonColorSchema={isEnabling ? "primary" : "danger"}
+ buttonText={isEnabling ? "Enable" : "Disable"}
+ onDeleteApproved={() => onUpdatePkiSubscriberStatus(subscriberStatusData)}
+ />
+ <DeleteActionModal
+ isOpen={popUp.deletePkiSubscriber.isOpen}
+ title="Are you sure you want to remove the PKI subscriber?"
+ onChange={(isOpen) => handlePopUpToggle("deletePkiSubscriber", isOpen)}
+ deleteKey="confirm"
+ onDeleteApproved={() =>
+ onRemovePkiSubscriberSubmit(
+ (popUp?.deletePkiSubscriber?.data as { subscriberName: string })?.subscriberName
+ )
+ }
+ />
+ </div>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx
new file mode 100644
index 0000000000..3ba4739853
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx
@@ -0,0 +1,188 @@
+import {
+ faBan,
+ faEllipsis,
+ faPencil,
+ faTrash,
+ faUserShield
+} from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useNavigate } from "@tanstack/react-router";
+import { twMerge } from "tailwind-merge";
+
+import { ProjectPermissionCan } from "@app/components/permissions";
+import {
+ Badge,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ EmptyState,
+ Table,
+ TableContainer,
+ TableSkeleton,
+ TBody,
+ Td,
+ Th,
+ THead,
+ Tooltip,
+ Tr
+} from "@app/components/v2";
+import {
+ ProjectPermissionPkiSubscriberActions,
+ ProjectPermissionSub,
+ useWorkspace
+} from "@app/context";
+import { useListWorkspacePkiSubscribers } from "@app/hooks/api";
+import {
+ getPkiSubscriberStatusBadgeVariant,
+ PkiSubscriberStatus,
+ pkiSubscriberStatusToNameMap
+} from "@app/hooks/api/pkiSubscriber/constants";
+import { ProjectType } from "@app/hooks/api/workspace/types";
+import { UsePopUpState } from "@app/hooks/usePopUp";
+
+type Props = {
+ handlePopUpOpen: (
+ popUpName: keyof UsePopUpState<["deletePkiSubscriber", "pkiSubscriber", "pkiSubscriberStatus"]>,
+ data?: object
+ ) => void;
+};
+
+export const PkiSubscribersTable = ({ handlePopUpOpen }: Props) => {
+ const navigate = useNavigate();
+ const { currentWorkspace } = useWorkspace();
+ const { data, isPending } = useListWorkspacePkiSubscribers(currentWorkspace?.id || "");
+ return (
+ <div>
+ <TableContainer>
+ <Table className="w-full table-fixed">
+ <THead>
+ <Tr>
+ <Th>Name</Th>
+ <Th>Status</Th>
+ <Th>Common Name</Th>
+ <Th />
+ </Tr>
+ </THead>
+ <TBody>
+ {isPending && <TableSkeleton columns={4} innerKey="pki-subscribers" />}
+ {!isPending &&
+ data &&
+ data.length > 0 &&
+ data.map((subscriber) => {
+ return (
+ <Tr
+ className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
+ key={`pki-subscriber-${subscriber.id}`}
+ onClick={() =>
+ navigate({
+ to: `/${ProjectType.CertificateManager}/$projectId/subscribers/$subscriberName` as const,
+ params: {
+ projectId: currentWorkspace.id,
+ subscriberName: subscriber.name
+ }
+ })
+ }
+ >
+ <Td>{subscriber.name}</Td>
+ <Td>
+ <Badge variant={getPkiSubscriberStatusBadgeVariant(subscriber.status)}>
+ {pkiSubscriberStatusToNameMap[subscriber.status]}
+ </Badge>
+ </Td>
+ <Td>{subscriber.commonName}</Td>
+ <Td className="text-right align-middle">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild className="rounded-lg">
+ <div className="hover:text-primary-400 data-[state=open]:text-primary-400">
+ <Tooltip content="More options">
+ <FontAwesomeIcon size="lg" icon={faEllipsis} />
+ </Tooltip>
+ </div>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="p-1">
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSubscriberActions.Edit}
+ a={ProjectPermissionSub.PkiSubscribers}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("pkiSubscriber", {
+ subscriberName: subscriber.name
+ });
+ }}
+ disabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faPencil} />}
+ >
+ Edit Subscriber
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSubscriberActions.Edit}
+ a={ProjectPermissionSub.PkiSubscribers}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("pkiSubscriberStatus", {
+ subscriberName: subscriber.name,
+ status:
+ subscriber.status === PkiSubscriberStatus.ACTIVE
+ ? PkiSubscriberStatus.DISABLED
+ : PkiSubscriberStatus.ACTIVE
+ });
+ }}
+ disabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faBan} />}
+ >
+ {`${subscriber.status === PkiSubscriberStatus.ACTIVE ? "Disable" : "Enable"} Subscriber`}
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionPkiSubscriberActions.Delete}
+ a={ProjectPermissionSub.PkiSubscribers}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("deletePkiSubscriber", {
+ subscriberName: subscriber.name
+ });
+ }}
+ disabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faTrash} />}
+ >
+ Delete Subscriber
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </Td>
+ </Tr>
+ );
+ })}
+ </TBody>
+ </Table>
+ {!isPending && data?.length === 0 && (
+ <EmptyState title="No PKI subscribers have been added" icon={faUserShield} />
+ )}
+ </TableContainer>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/index.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/index.tsx
new file mode 100644
index 0000000000..4c9b892345
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/index.tsx
@@ -0,0 +1 @@
+export { PkiSubscriberSection } from "./PkiSubscriberSection";
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/route.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/route.tsx
new file mode 100644
index 0000000000..d8d9fbadd1
--- /dev/null
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/route.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from "@tanstack/react-router";
+
+import { PkiSubscribersPage } from "./PkiSubscribersPage";
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/"
+)({
+ component: PkiSubscribersPage
+});
diff --git a/frontend/src/pages/cert-manager/layout.tsx b/frontend/src/pages/cert-manager/layout.tsx
index 54a9b06d3e..1b52793f86 100644
--- a/frontend/src/pages/cert-manager/layout.tsx
+++ b/frontend/src/pages/cert-manager/layout.tsx
@@ -31,7 +31,7 @@ export const Route = createFileRoute(
{
label: project.name,
link: linkOptions({
- to: "/cert-manager/$projectId/overview",
+ to: "/cert-manager/$projectId/subscribers",
params: { projectId: project.id }
})
}
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx
index 1380ebb390..8f619029d6 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx
@@ -13,6 +13,8 @@ import { IdentityAzureAuthForm } from "./IdentityAzureAuthForm";
import { IdentityGcpAuthForm } from "./IdentityGcpAuthForm";
import { IdentityJwtAuthForm } from "./IdentityJwtAuthForm";
import { IdentityKubernetesAuthForm } from "./IdentityKubernetesAuthForm";
+import { IdentityLdapAuthForm } from "./IdentityLdapAuthForm";
+import { IdentityOciAuthForm } from "./IdentityOciAuthForm";
import { IdentityOidcAuthForm } from "./IdentityOidcAuthForm";
import { IdentityTokenAuthForm } from "./IdentityTokenAuthForm";
import { IdentityUniversalAuthForm } from "./IdentityUniversalAuthForm";
@@ -45,7 +47,9 @@ const identityAuthMethods = [
{ label: "GCP Auth", value: IdentityAuthMethod.GCP_AUTH },
{ label: "AWS Auth", value: IdentityAuthMethod.AWS_AUTH },
{ label: "Azure Auth", value: IdentityAuthMethod.AZURE_AUTH },
+ { label: "OCI Auth", value: IdentityAuthMethod.OCI_AUTH },
{ label: "OIDC Auth", value: IdentityAuthMethod.OIDC_AUTH },
+ { label: "LDAP Auth", value: IdentityAuthMethod.LDAP_AUTH },
{
label: "JWT Auth",
value: IdentityAuthMethod.JWT_AUTH
@@ -178,6 +182,16 @@ export const IdentityAuthMethodModalContent = ({
)
},
+ [IdentityAuthMethod.OCI_AUTH]: {
+ render: () => (
+ <IdentityOciAuthForm
+ identityId={identityAuthMethodData.identityId}
+ handlePopUpOpen={handlePopUpOpen}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ )
+ },
+
[IdentityAuthMethod.JWT_AUTH]: {
render: () => (
<IdentityJwtAuthForm
@@ -186,6 +200,16 @@ export const IdentityAuthMethodModalContent = ({
handlePopUpToggle={handlePopUpToggle}
/>
)
+ },
+
+ [IdentityAuthMethod.LDAP_AUTH]: {
+ render: () => (
+ <IdentityLdapAuthForm
+ identityId={identityAuthMethodData.identityId}
+ handlePopUpOpen={handlePopUpOpen}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ )
}
};
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx
index 87dc7dbfdb..369977a046 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx
@@ -3,22 +3,32 @@ import { Controller, useFieldArray, useForm } from "react-hook-form";
import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
+import { useQuery } from "@tanstack/react-query";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
+import { OrgPermissionCan } from "@app/components/permissions";
import {
Button,
FormControl,
IconButton,
Input,
+ Select,
+ SelectItem,
Tab,
TabList,
TabPanel,
Tabs,
- TextArea
+ TextArea,
+ Tooltip
} from "@app/components/v2";
import { useOrganization, useSubscription } from "@app/context";
import {
+ OrgGatewayPermissionActions,
+ OrgPermissionSubjects
+} from "@app/context/OrgPermissionContext/types";
+import {
+ gatewaysQueryKeys,
useAddIdentityKubernetesAuth,
useGetIdentityKubernetesAuth,
useUpdateIdentityKubernetesAuth
@@ -32,6 +42,7 @@ const schema = z
.object({
kubernetesHost: z.string().min(1),
tokenReviewerJwt: z.string().optional(),
+ gatewayId: z.string().optional().nullable(),
allowedNames: z.string(),
allowedNamespaces: z.string(),
allowedAudience: z.string(),
@@ -79,6 +90,8 @@ export const IdentityKubernetesAuthForm = ({
const { mutateAsync: updateMutateAsync } = useUpdateIdentityKubernetesAuth();
const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);
+ const { data: gateways, isPending: isGatewayLoading } = useQuery(gatewaysQueryKeys.list());
+
const { data } = useGetIdentityKubernetesAuth(identityId ?? "", {
enabled: isUpdate
});
@@ -96,6 +109,7 @@ export const IdentityKubernetesAuthForm = ({
tokenReviewerJwt: "",
allowedNames: "",
allowedNamespaces: "",
+ gatewayId: "",
allowedAudience: "",
caCert: "",
accessTokenTTL: "2592000",
@@ -120,6 +134,7 @@ export const IdentityKubernetesAuthForm = ({
allowedNamespaces: data.allowedNamespaces,
allowedAudience: data.allowedAudience,
caCert: data.caCert,
+ gatewayId: data.gatewayId || null,
accessTokenTTL: String(data.accessTokenTTL),
accessTokenMaxTTL: String(data.accessTokenMaxTTL),
accessTokenNumUsesLimit: String(data.accessTokenNumUsesLimit),
@@ -157,6 +172,7 @@ export const IdentityKubernetesAuthForm = ({
accessTokenTTL,
accessTokenMaxTTL,
accessTokenNumUsesLimit,
+ gatewayId,
accessTokenTrustedIps
}: FormData) => {
try {
@@ -172,6 +188,7 @@ export const IdentityKubernetesAuthForm = ({
allowedAudience,
caCert,
identityId,
+ gatewayId: gatewayId || null,
accessTokenTTL: Number(accessTokenTTL),
accessTokenMaxTTL: Number(accessTokenMaxTTL),
accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
@@ -186,6 +203,7 @@ export const IdentityKubernetesAuthForm = ({
allowedNames: allowedNames || "",
allowedNamespaces: allowedNamespaces || "",
allowedAudience: allowedAudience || "",
+ gatewayId: gatewayId || null,
caCert: caCert || "",
accessTokenTTL: Number(accessTokenTTL),
accessTokenMaxTTL: Number(accessTokenMaxTTL),
@@ -217,6 +235,7 @@ export const IdentityKubernetesAuthForm = ({
[
"kubernetesHost",
"tokenReviewerJwt",
+ "gatewayId",
"accessTokenTTL",
"accessTokenMaxTTL",
"accessTokenNumUsesLimit",
@@ -280,6 +299,62 @@ export const IdentityKubernetesAuthForm = ({
</FormControl>
)}
/>
+
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.AttachGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <Controller
+ control={control}
+ name="gatewayId"
+ defaultValue=""
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Gateway"
+ isOptional
+ >
+ <Tooltip
+ isDisabled={isAllowed}
+ content="Restricted access. You don't have permission to attach gateways to resources."
+ >
+ <div>
+ <Select
+ isDisabled={!isAllowed}
+ value={value as string}
+ onValueChange={(v) => {
+ if (v !== "") {
+ onChange(v);
+ }
+ }}
+ className="w-full border border-mineshaft-500"
+ dropdownContainerClassName="max-w-none"
+ isLoading={isGatewayLoading}
+ placeholder="Default: Internet Gateway"
+ position="popper"
+ >
+ <SelectItem
+ value={null as unknown as string}
+ onClick={() => onChange(null)}
+ >
+ Internet Gateway
+ </SelectItem>
+ {gateways?.map((el) => (
+ <SelectItem value={el.id} key={el.id}>
+ {el.name}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ </Tooltip>
+ </FormControl>
+ )}
+ />
+ )}
+ </OrgPermissionCan>
+
<Controller
control={control}
name="allowedNames"
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx
new file mode 100644
index 0000000000..62080bfd10
--- /dev/null
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx
@@ -0,0 +1,608 @@
+import { useEffect, useState } from "react";
+import { Controller, useFieldArray, useForm } from "react-hook-form";
+import { faPlus, faQuestionCircle, faXmark } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import { createNotification } from "@app/components/notifications";
+import {
+ Button,
+ FormControl,
+ IconButton,
+ Input,
+ Tab,
+ TabList,
+ TabPanel,
+ Tabs,
+ TextArea,
+ Tooltip
+} from "@app/components/v2";
+import { useOrganization, useSubscription } from "@app/context";
+import {
+ useAddIdentityLdapAuth,
+ useGetIdentityLdapAuth,
+ useUpdateIdentityLdapAuth
+} from "@app/hooks/api";
+import { IdentityTrustedIp } from "@app/hooks/api/identities/types";
+import { UsePopUpState } from "@app/hooks/usePopUp";
+
+import { IdentityFormTab } from "./types";
+
+const schema = z
+ .object({
+ url: z.string().min(1),
+ bindDN: z.string(),
+ bindPass: z.string(),
+ searchBase: z.string(),
+ searchFilter: z.string(), // defaults to (uid={{username}})
+ ldapCaCertificate: z
+ .string()
+ .optional()
+ .transform((val) => val || undefined),
+ allowedFields: z
+ .object({
+ key: z.string().trim(),
+ value: z
+ .string()
+ .trim()
+ .transform((val) => val.replace(/\s/g, ""))
+ })
+ .array()
+ .optional(),
+
+ accessTokenTTL: z.string().refine((val) => Number(val) <= 315360000, {
+ message: "Access Token TTL cannot be greater than 315360000"
+ }),
+ accessTokenMaxTTL: z.string().refine((val) => Number(val) <= 315360000, {
+ message: "Access Token Max TTL cannot be greater than 315360000"
+ }),
+ accessTokenNumUsesLimit: z.string(),
+ accessTokenTrustedIps: z
+ .array(
+ z.object({
+ ipAddress: z.string().max(50)
+ })
+ )
+ .min(1)
+ })
+ .required();
+
+export type FormData = z.infer<typeof schema>;
+
+type Props = {
+ handlePopUpOpen: (popUpName: keyof UsePopUpState<["upgradePlan"]>) => void;
+ handlePopUpToggle: (
+ popUpName: keyof UsePopUpState<["identityAuthMethod"]>,
+ state?: boolean
+ ) => void;
+ identityId?: string;
+ isUpdate?: boolean;
+};
+
+export const IdentityLdapAuthForm = ({
+ handlePopUpOpen,
+ handlePopUpToggle,
+ identityId,
+ isUpdate
+}: Props) => {
+ const { currentOrg } = useOrganization();
+ const orgId = currentOrg?.id || "";
+ const { subscription } = useSubscription();
+
+ const { mutateAsync: addMutateAsync } = useAddIdentityLdapAuth();
+ const { mutateAsync: updateMutateAsync } = useUpdateIdentityLdapAuth();
+ const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);
+
+ const { data } = useGetIdentityLdapAuth(identityId ?? "", {
+ enabled: isUpdate
+ });
+
+ const {
+ control,
+ handleSubmit,
+ reset,
+
+ formState: { isSubmitting }
+ } = useForm<FormData>({
+ resolver: zodResolver(schema),
+ defaultValues: {
+ url: "",
+ bindDN: "",
+ bindPass: "",
+ searchBase: "",
+ searchFilter: "(uid={{username}})",
+ accessTokenTTL: "2592000",
+ accessTokenMaxTTL: "2592000",
+ accessTokenNumUsesLimit: "0",
+ accessTokenTrustedIps: [{ ipAddress: "0.0.0.0/0" }, { ipAddress: "::/0" }]
+ }
+ });
+
+ const {
+ fields: accessTokenTrustedIpsFields,
+ append: appendAccessTokenTrustedIp,
+ remove: removeAccessTokenTrustedIp
+ } = useFieldArray({ control, name: "accessTokenTrustedIps" });
+
+ const {
+ fields: allowedFieldsFields,
+ append: appendAllowedField,
+ remove: removeAllowedField
+ } = useFieldArray({ control, name: "allowedFields" });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ url: data.url,
+ bindDN: data.bindDN,
+ bindPass: data.bindPass,
+ searchBase: data.searchBase,
+ searchFilter: data.searchFilter,
+ ldapCaCertificate: data.ldapCaCertificate || undefined,
+ allowedFields: data.allowedFields,
+ accessTokenTTL: String(data.accessTokenTTL),
+ accessTokenMaxTTL: String(data.accessTokenMaxTTL),
+ accessTokenNumUsesLimit: String(data.accessTokenNumUsesLimit),
+ accessTokenTrustedIps: data.accessTokenTrustedIps.map(
+ ({ ipAddress, prefix }: IdentityTrustedIp) => {
+ return {
+ ipAddress: `${ipAddress}${prefix !== undefined ? `/${prefix}` : ""}`
+ };
+ }
+ )
+ });
+ } else {
+ reset({
+ url: "",
+ bindDN: "",
+ bindPass: "",
+ searchBase: "",
+ searchFilter: "(uid={{username}})",
+ ldapCaCertificate: undefined,
+ allowedFields: [],
+ accessTokenTTL: "2592000",
+ accessTokenMaxTTL: "2592000",
+ accessTokenNumUsesLimit: "0",
+ accessTokenTrustedIps: [{ ipAddress: "0.0.0.0/0" }, { ipAddress: "::/0" }]
+ });
+ }
+ }, [data]);
+
+ useEffect(() => {
+ if (!subscription?.ldap) {
+ handlePopUpOpen("upgradePlan");
+ handlePopUpToggle("identityAuthMethod", false);
+ }
+ }, [subscription]);
+
+ const onFormSubmit = async ({
+ url,
+ bindDN,
+ bindPass,
+ searchBase,
+ searchFilter,
+ ldapCaCertificate,
+ allowedFields,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }: FormData) => {
+ try {
+ if (!identityId) return;
+
+ if (data) {
+ await updateMutateAsync({
+ organizationId: orgId,
+ identityId,
+ url,
+ bindDN,
+ bindPass,
+ searchBase,
+ searchFilter,
+ ldapCaCertificate,
+ allowedFields,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps
+ });
+ } else {
+ await addMutateAsync({
+ organizationId: orgId,
+ identityId,
+ url,
+ bindDN,
+ bindPass,
+ searchBase,
+ searchFilter,
+ ldapCaCertificate,
+ allowedFields,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps
+ });
+ }
+
+ handlePopUpToggle("identityAuthMethod", false);
+
+ createNotification({
+ text: `Successfully ${isUpdate ? "updated" : "configured"} auth method`,
+ type: "success"
+ });
+
+ reset();
+ } catch {
+ createNotification({
+ text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
+ type: "error"
+ });
+ }
+ };
+
+ return (
+ <form
+ onSubmit={handleSubmit(onFormSubmit, (fields) => {
+ setTabValue(
+ [
+ "url",
+ "bindDN",
+ "bindPass",
+ "searchBase",
+ "searchFilter",
+ "accessTokenTTL",
+ "allowedFields",
+ "accessTokenMaxTTL",
+ "accessTokenNumUsesLimit"
+ ].includes(Object.keys(fields)[0])
+ ? IdentityFormTab.Configuration
+ : IdentityFormTab.Advanced
+ );
+ })}
+ >
+ <Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>
+ <TabList>
+ <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>
+ <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>
+ </TabList>
+ <TabPanel value={IdentityFormTab.Configuration}>
+ <Controller
+ control={control}
+ defaultValue="2592000"
+ name="url"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="LDAP URL"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ isRequired
+ >
+ <Input {...field} placeholder="ldaps://domain-or-ip:636" type="text" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="bindDN"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isRequired
+ label="Bind DN"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="cn=infisical,ou=Users,dc=example,dc=com" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue=""
+ name="bindPass"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isRequired
+ label="Bind Pass"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="********" type="password" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="searchBase"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isRequired
+ label="Search Base / DN"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="ou=machines,dc=acme,dc=com" />
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ control={control}
+ name="searchFilter"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isRequired
+ label="Search Filter"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="(uid={{username}})" />
+ </FormControl>
+ )}
+ />
+
+ {allowedFieldsFields.map(({ id }, index) => (
+ <div className="mb-3 flex items-end space-x-2" key={id}>
+ <Controller
+ control={control}
+ name={`allowedFields.${index}.key`}
+ render={({ field, fieldState: { error } }) => {
+ const isFirstField = index === 0;
+
+ return (
+ <FormControl
+ className="mb-0 flex-grow"
+ label={isFirstField ? "Required Attributes" : undefined}
+ icon={
+ isFirstField ? (
+ <Tooltip
+ className="max-w-[420px]"
+ content={
+ <div className="max-h-[300px] space-y-4 overflow-y-auto text-sm">
+ <p>
+ Specify the fields that the user must contain in their LDAP entry
+ in order to authenticate with this identity. If nothing is
+ specified, all users in the configured LDAP directory will be able
+ to authenticate.
+ <p className="mt-2">
+ You can specify multiple required attributes by separating them
+ with a comma.
+ </p>
+ </p>
+ <div className="space-y-2">
+ <p>Example:</p>
+ <p className="text-xs text-gray-400">
+ &apos;uid&apos; → &apos;user1,user2,user3&apos;
+ <br />
+ &apos;mail&apos; → &apos;[email protected]&apos;
+ </p>
+ </div>
+
+ <p>
+ The above example would allow users with the UID user1, user2, or
+ user3 to authenticate but only if their emails also match
+ </p>
+ </div>
+ }
+ >
+ <FontAwesomeIcon icon={faQuestionCircle} size="sm" />
+ </Tooltip>
+ ) : undefined
+ }
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input
+ value={field.value}
+ onChange={(e) => field.onChange(e)}
+ placeholder="uid"
+ />
+ </FormControl>
+ );
+ }}
+ />
+ <Controller
+ control={control}
+ name={`allowedFields.${index}.value`}
+ render={({ field, fieldState: { error } }) => {
+ return (
+ <FormControl
+ className="mb-0 flex-grow"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input
+ value={field.value}
+ onChange={(e) => field.onChange(e)}
+ placeholder="userid1,userid2,userid3"
+ />
+ </FormControl>
+ );
+ }}
+ />
+ <IconButton
+ onClick={() => removeAllowedField(index)}
+ size="lg"
+ colorSchema="danger"
+ variant="plain"
+ ariaLabel="update"
+ className="p-3"
+ >
+ <FontAwesomeIcon icon={faXmark} />
+ </IconButton>
+ </div>
+ ))}
+ <div className="my-4 ml-1">
+ <Button
+ variant="outline_bg"
+ onClick={() =>
+ appendAllowedField({
+ key: "",
+ value: ""
+ })
+ }
+ leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ size="xs"
+ >
+ Add Required Attribute
+ </Button>
+ </div>
+
+ <Controller
+ control={control}
+ defaultValue="2592000"
+ name="accessTokenTTL"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Access Token TTL (seconds)"
+ tooltipText="The lifetime for an acccess token in seconds. This value will be referenced at renewal time."
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="2592000" type="number" min="0" step="1" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue="2592000"
+ name="accessTokenMaxTTL"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Access Token Max TTL (seconds)"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ tooltipText="The maximum lifetime for an access token in seconds. This value will be referenced at renewal time."
+ >
+ <Input {...field} placeholder="2592000" type="number" min="0" step="1" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue="0"
+ name="accessTokenNumUsesLimit"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Access Token Max Number of Uses"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ tooltipText="The maximum number of times that an access token can be used; a value of 0 implies infinite number of uses."
+ >
+ <Input {...field} placeholder="0" type="number" min="0" step="1" />
+ </FormControl>
+ )}
+ />
+ </TabPanel>
+ <TabPanel value={IdentityFormTab.Advanced}>
+ <Controller
+ control={control}
+ name="ldapCaCertificate"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="CA Certificate"
+ isOptional
+ errorText={error?.message}
+ isError={Boolean(error)}
+ tooltipText="An optional PEM-encoded CA cert for the LDAP server. This is used by the TLS client for secure communication with the LDAP server."
+ >
+ <TextArea {...field} placeholder="-----BEGIN CERTIFICATE----- ..." />
+ </FormControl>
+ )}
+ />
+
+ {accessTokenTrustedIpsFields.map(({ id }, index) => (
+ <div className="mb-3 flex items-end space-x-2" key={id}>
+ <Controller
+ control={control}
+ name={`accessTokenTrustedIps.${index}.ipAddress`}
+ defaultValue="0.0.0.0/0"
+ render={({ field, fieldState: { error } }) => {
+ return (
+ <FormControl
+ className="mb-0 flex-grow"
+ label={index === 0 ? "Access Token Trusted IPs" : undefined}
+ isError={Boolean(error)}
+ errorText={error?.message}
+ tooltipText="The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the 0.0.0.0/0, allowing usage from any network address."
+ >
+ <Input
+ value={field.value}
+ onChange={(e) => {
+ if (subscription?.ipAllowlisting) {
+ field.onChange(e);
+ return;
+ }
+
+ handlePopUpOpen("upgradePlan");
+ }}
+ placeholder="123.456.789.0"
+ />
+ </FormControl>
+ );
+ }}
+ />
+ <IconButton
+ onClick={() => {
+ if (subscription?.ipAllowlisting) {
+ removeAccessTokenTrustedIp(index);
+ return;
+ }
+
+ handlePopUpOpen("upgradePlan");
+ }}
+ size="lg"
+ colorSchema="danger"
+ variant="plain"
+ ariaLabel="update"
+ className="p-3"
+ >
+ <FontAwesomeIcon icon={faXmark} />
+ </IconButton>
+ </div>
+ ))}
+ <div className="my-4 ml-1">
+ <Button
+ variant="outline_bg"
+ onClick={() => {
+ if (subscription?.ipAllowlisting) {
+ appendAccessTokenTrustedIp({
+ ipAddress: "0.0.0.0/0"
+ });
+ return;
+ }
+
+ handlePopUpOpen("upgradePlan");
+ }}
+ leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ size="xs"
+ >
+ Add IP Address
+ </Button>
+ </div>
+ </TabPanel>
+ </Tabs>
+ <div className="flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting}
+ >
+ {isUpdate ? "Update" : "Add"}
+ </Button>
+
+ <Button
+ colorSchema="secondary"
+ variant="plain"
+ onClick={() => handlePopUpToggle("identityAuthMethod", false)}
+ >
+ Cancel
+ </Button>
+ </div>
+ </form>
+ );
+};
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOciAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOciAuthForm.tsx
new file mode 100644
index 0000000000..b03576eeb9
--- /dev/null
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOciAuthForm.tsx
@@ -0,0 +1,369 @@
+import { useEffect, useState } from "react";
+import { Controller, useFieldArray, useForm } from "react-hook-form";
+import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import { createNotification } from "@app/components/notifications";
+import {
+ Button,
+ FormControl,
+ IconButton,
+ Input,
+ Tab,
+ TabList,
+ TabPanel,
+ Tabs
+} from "@app/components/v2";
+import { useOrganization, useSubscription } from "@app/context";
+import {
+ useAddIdentityOciAuth,
+ useGetIdentityOciAuth,
+ useUpdateIdentityOciAuth
+} from "@app/hooks/api";
+import { IdentityTrustedIp } from "@app/hooks/api/identities/types";
+import { UsePopUpState } from "@app/hooks/usePopUp";
+
+import { IdentityFormTab } from "./types";
+
+const schema = z
+ .object({
+ tenancyOcid: z
+ .string()
+ .trim()
+ .min(1, "Tenancy OCID cannot be empty.")
+ .refine(
+ (val) => /^ocid1\.tenancy\.oc1\..+$/.test(val),
+ "Invalid Tenancy OCID format. Must start with ocid1.tenancy.oc1."
+ ),
+ allowedUsernames: z.string().optional(),
+ accessTokenTTL: z
+ .string()
+ .refine(
+ (value) => Number(value) <= 315360000,
+ "Access Token TTL cannot be greater than 315360000"
+ ),
+ accessTokenMaxTTL: z
+ .string()
+ .refine(
+ (value) => Number(value) <= 315360000,
+ "Access Token Max TTL cannot be greater than 315360000"
+ ),
+ accessTokenNumUsesLimit: z.string(),
+ accessTokenTrustedIps: z
+ .object({
+ ipAddress: z.string().max(50)
+ })
+ .array()
+ .min(1)
+ })
+ .required();
+
+export type FormData = z.infer<typeof schema>;
+
+type Props = {
+ handlePopUpOpen: (popUpName: keyof UsePopUpState<["upgradePlan"]>) => void;
+ handlePopUpToggle: (
+ popUpName: keyof UsePopUpState<["identityAuthMethod"]>,
+ state?: boolean
+ ) => void;
+ identityId?: string;
+ isUpdate?: boolean;
+};
+
+export const IdentityOciAuthForm = ({
+ handlePopUpOpen,
+ handlePopUpToggle,
+ identityId,
+ isUpdate
+}: Props) => {
+ const { currentOrg } = useOrganization();
+ const orgId = currentOrg?.id || "";
+ const { subscription } = useSubscription();
+
+ const { mutateAsync: addMutateAsync } = useAddIdentityOciAuth();
+ const { mutateAsync: updateMutateAsync } = useUpdateIdentityOciAuth();
+ const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);
+
+ const { data } = useGetIdentityOciAuth(identityId ?? "", {
+ enabled: isUpdate
+ });
+
+ const {
+ control,
+ handleSubmit,
+ reset,
+ formState: { isSubmitting }
+ } = useForm<FormData>({
+ resolver: zodResolver(schema),
+ defaultValues: {
+ tenancyOcid: "",
+ allowedUsernames: "",
+ accessTokenTTL: "2592000",
+ accessTokenMaxTTL: "2592000",
+ accessTokenNumUsesLimit: "0",
+ accessTokenTrustedIps: [{ ipAddress: "0.0.0.0/0" }, { ipAddress: "::/0" }]
+ }
+ });
+
+ const {
+ fields: accessTokenTrustedIpsFields,
+ append: appendAccessTokenTrustedIp,
+ remove: removeAccessTokenTrustedIp
+ } = useFieldArray({ control, name: "accessTokenTrustedIps" });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ tenancyOcid: data.tenancyOcid,
+ allowedUsernames: data.allowedUsernames || undefined,
+ accessTokenTTL: String(data.accessTokenTTL),
+ accessTokenMaxTTL: String(data.accessTokenMaxTTL),
+ accessTokenNumUsesLimit: String(data.accessTokenNumUsesLimit),
+ accessTokenTrustedIps: data.accessTokenTrustedIps.map(
+ ({ ipAddress, prefix }: IdentityTrustedIp) => {
+ return {
+ ipAddress: `${ipAddress}${prefix !== undefined ? `/${prefix}` : ""}`
+ };
+ }
+ )
+ });
+ } else {
+ reset({
+ tenancyOcid: "",
+ allowedUsernames: undefined,
+ accessTokenTTL: "2592000",
+ accessTokenMaxTTL: "2592000",
+ accessTokenNumUsesLimit: "0",
+ accessTokenTrustedIps: [{ ipAddress: "0.0.0.0/0" }, { ipAddress: "::/0" }]
+ });
+ }
+ }, [data]);
+
+ const onFormSubmit = async ({
+ tenancyOcid,
+ allowedUsernames,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }: FormData) => {
+ try {
+ if (!identityId) return;
+
+ if (data) {
+ await updateMutateAsync({
+ organizationId: orgId,
+ tenancyOcid,
+ allowedUsernames,
+ identityId,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps
+ });
+ } else {
+ await addMutateAsync({
+ organizationId: orgId,
+ identityId,
+ tenancyOcid,
+ allowedUsernames: allowedUsernames || undefined,
+ accessTokenTTL: Number(accessTokenTTL),
+ accessTokenMaxTTL: Number(accessTokenMaxTTL),
+ accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit),
+ accessTokenTrustedIps
+ });
+ }
+
+ handlePopUpToggle("identityAuthMethod", false);
+
+ createNotification({
+ text: `Successfully ${isUpdate ? "updated" : "configured"} auth method`,
+ type: "success"
+ });
+
+ reset();
+ } catch {
+ createNotification({
+ text: `Failed to ${isUpdate ? "update" : "configure"} identity`,
+ type: "error"
+ });
+ }
+ };
+
+ return (
+ <form
+ onSubmit={handleSubmit(onFormSubmit, (fields) => {
+ setTabValue(
+ ["accessTokenTrustedIps"].includes(Object.keys(fields)[0])
+ ? IdentityFormTab.Advanced
+ : IdentityFormTab.Configuration
+ );
+ })}
+ >
+ <Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>
+ <TabList>
+ <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>
+ <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>
+ </TabList>
+ <TabPanel value={IdentityFormTab.Configuration}>
+ <Controller
+ control={control}
+ name="tenancyOcid"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl label="Tenancy OCID" isError={Boolean(error)} errorText={error?.message}>
+ <Input {...field} placeholder="ocid1.tenancy.oc1..example" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="allowedUsernames"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Allowed Usernames"
+ isOptional
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="user1, user2, ..." />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue="2592000"
+ name="accessTokenTTL"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Access Token TTL (seconds)"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="2592000" type="number" min="0" step="1" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue="2592000"
+ name="accessTokenMaxTTL"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Access Token Max TTL (seconds)"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="2592000" type="number" min="0" step="1" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue="0"
+ name="accessTokenNumUsesLimit"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Access Token Max Number of Uses"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="0" type="number" min="0" step="1" />
+ </FormControl>
+ )}
+ />
+ </TabPanel>
+ <TabPanel value={IdentityFormTab.Advanced}>
+ {accessTokenTrustedIpsFields.map(({ id }, index) => (
+ <div className="mb-3 flex items-end space-x-2" key={id}>
+ <Controller
+ control={control}
+ name={`accessTokenTrustedIps.${index}.ipAddress`}
+ defaultValue="0.0.0.0/0"
+ render={({ field, fieldState: { error } }) => {
+ return (
+ <FormControl
+ className="mb-0 flex-grow"
+ label={index === 0 ? "Access Token Trusted IPs" : undefined}
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input
+ value={field.value}
+ onChange={(e) => {
+ if (subscription?.ipAllowlisting) {
+ field.onChange(e);
+ return;
+ }
+
+ handlePopUpOpen("upgradePlan");
+ }}
+ placeholder="123.456.789.0"
+ />
+ </FormControl>
+ );
+ }}
+ />
+ <IconButton
+ onClick={() => {
+ if (subscription?.ipAllowlisting) {
+ removeAccessTokenTrustedIp(index);
+ return;
+ }
+
+ handlePopUpOpen("upgradePlan");
+ }}
+ size="lg"
+ colorSchema="danger"
+ variant="plain"
+ ariaLabel="update"
+ className="p-3"
+ >
+ <FontAwesomeIcon icon={faXmark} />
+ </IconButton>
+ </div>
+ ))}
+ <div className="my-4 ml-1">
+ <Button
+ variant="outline_bg"
+ onClick={() => {
+ if (subscription?.ipAllowlisting) {
+ appendAccessTokenTrustedIp({
+ ipAddress: "0.0.0.0/0"
+ });
+ return;
+ }
+
+ handlePopUpOpen("upgradePlan");
+ }}
+ leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ size="xs"
+ >
+ Add IP Address
+ </Button>
+ </div>
+ </TabPanel>
+ </Tabs>
+ <div className="flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting}
+ >
+ {isUpdate ? "Update" : "Add"}
+ </Button>
+
+ <Button
+ colorSchema="secondary"
+ variant="plain"
+ onClick={() => handlePopUpToggle("identityAuthMethod", false)}
+ >
+ Cancel
+ </Button>
+ </div>
+ </form>
+ );
+};
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx
index e4c7aca98b..508e385dff 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx
@@ -34,6 +34,7 @@ import { isCustomOrgRole } from "@app/helpers/roles";
import { usePopUp } from "@app/hooks";
import { useDeleteOrgRole, useGetOrgRoles, useUpdateOrg } from "@app/hooks/api";
import { TOrgRole } from "@app/hooks/api/roles/types";
+import { DuplicateOrgRoleModal } from "@app/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal";
import { RoleModal } from "@app/pages/organization/RoleByIDPage/components/RoleModal";
export const OrgRoleTable = () => {
@@ -44,6 +45,7 @@ export const OrgRoleTable = () => {
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"role",
"deleteRole",
+ "duplicateRole",
"upgradePlan"
] as const);
@@ -192,6 +194,25 @@ export const OrgRoleTable = () => {
</DropdownMenuItem>
)}
</OrgPermissionCan>
+ <OrgPermissionCan
+ I={OrgPermissionActions.Create}
+ a={OrgPermissionSubjects.Role}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("duplicateRole", role);
+ }}
+ disabled={!isAllowed}
+ >
+ Duplicate Role
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
{!isDefaultOrgRole && (
<OrgPermissionCan
I={OrgPermissionActions.Edit}
@@ -272,6 +293,11 @@ export const OrgRoleTable = () => {
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
text={(popUp.upgradePlan?.data as { description: string })?.description}
/>
+ <DuplicateOrgRoleModal
+ isOpen={popUp.duplicateRole.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("duplicateRole", isOpen)}
+ roleId={(popUp?.duplicateRole?.data as TOrgRole)?.id}
+ />
</div>
);
};
diff --git a/frontend/src/pages/organization/AccessManagementPage/route.tsx b/frontend/src/pages/organization/AccessManagementPage/route.tsx
index 1401f57c1f..68e6a77421 100644
--- a/frontend/src/pages/organization/AccessManagementPage/route.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/route.tsx
@@ -30,7 +30,7 @@ export const Route = createFileRoute(
link: linkOptions({ to: "/" })
},
{
- label: "access control"
+ label: "Access Control"
}
]
})
diff --git a/frontend/src/pages/organization/AdminPage/components/OrgAdminProjects/OrgAdminProjects.tsx b/frontend/src/pages/organization/AdminPage/components/OrgAdminProjects/OrgAdminProjects.tsx
index 4e33e5688c..75b21b7423 100644
--- a/frontend/src/pages/organization/AdminPage/components/OrgAdminProjects/OrgAdminProjects.tsx
+++ b/frontend/src/pages/organization/AdminPage/components/OrgAdminProjects/OrgAdminProjects.tsx
@@ -58,6 +58,15 @@ export const OrgAdminProjects = withPermission(
await orgAdminAccessProject.mutateAsync({
projectId
});
+ if (type === ProjectType.CertificateManager) {
+ await navigate({
+ to: "/cert-manager/$projectId/subscribers" as const,
+ params: {
+ projectId
+ }
+ });
+ return;
+ }
await navigate({
to: `/${type}/$projectId/overview` as const,
params: {
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
index 5c004ce96c..238dc4e04f 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@ -22,6 +22,7 @@ import { HCVaultConnectionForm } from "./HCVaultConnectionForm";
import { HumanitecConnectionForm } from "./HumanitecConnectionForm";
import { LdapConnectionForm } from "./LdapConnectionForm";
import { MsSqlConnectionForm } from "./MsSqlConnectionForm";
+import { OCIConnectionForm } from "./OCIConnectionForm";
import { PostgresConnectionForm } from "./PostgresConnectionForm";
import { TeamCityConnectionForm } from "./TeamCityConnectionForm";
import { TerraformCloudConnectionForm } from "./TerraformCloudConnectionForm";
@@ -101,6 +102,8 @@ const CreateForm = ({ app, onComplete }: CreateFormProps) => {
return <LdapConnectionForm onSubmit={onSubmit} />;
case AppConnection.TeamCity:
return <TeamCityConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.OCI:
+ return <OCIConnectionForm onSubmit={onSubmit} />;
default:
throw new Error(`Unhandled App ${app}`);
}
@@ -173,6 +176,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
return <LdapConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.TeamCity:
return <TeamCityConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.OCI:
+ return <OCIConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
default:
throw new Error(`Unhandled App ${(appConnection as TAppConnection).app}`);
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OCIConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OCIConnectionForm.tsx
new file mode 100644
index 0000000000..6ea355dd2f
--- /dev/null
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OCIConnectionForm.tsx
@@ -0,0 +1,215 @@
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import {
+ Button,
+ FormControl,
+ Input,
+ ModalClose,
+ SecretInput,
+ Select,
+ SelectItem
+} from "@app/components/v2";
+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";
+import { OCIConnectionMethod, TOCIConnection } from "@app/hooks/api/appConnections";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+
+import {
+ genericAppConnectionFieldsSchema,
+ GenericAppConnectionsFields
+} from "./GenericAppConnectionFields";
+
+type Props = {
+ appConnection?: TOCIConnection;
+ onSubmit: (formData: FormData) => void;
+};
+
+const rootSchema = genericAppConnectionFieldsSchema.extend({
+ app: z.literal(AppConnection.OCI)
+});
+
+const formSchema = z.discriminatedUnion("method", [
+ rootSchema.extend({
+ method: z.literal(OCIConnectionMethod.AccessKey),
+ credentials: z.object({
+ userOcid: z
+ .string()
+ .trim()
+ .min(1, "User OCID required")
+ .regex(/^ocid1\.user\.oc1\.\..+$/, "Invalid User OCID format"),
+ tenancyOcid: z
+ .string()
+ .trim()
+ .min(1, "Tenancy OCID required")
+ .regex(/^ocid1\.tenancy\.oc1\.\..+$/, "Invalid Tenancy OCID format"),
+ region: z.string().trim().min(1, "Region required"),
+ fingerprint: z.string().trim().min(1, "Fingerprint required"),
+ privateKey: z.string().trim().min(1, "Private Key required")
+ })
+ })
+]);
+
+type FormData = z.infer<typeof formSchema>;
+
+export const OCIConnectionForm = ({ appConnection, onSubmit }: Props) => {
+ const isUpdate = Boolean(appConnection);
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: appConnection ?? {
+ app: AppConnection.OCI,
+ method: OCIConnectionMethod.AccessKey
+ }
+ });
+
+ const {
+ handleSubmit,
+ control,
+ formState: { isSubmitting, isDirty }
+ } = form;
+
+ return (
+ <FormProvider {...form}>
+ <form onSubmit={handleSubmit(onSubmit)}>
+ {!isUpdate && <GenericAppConnectionsFields />}
+ <Controller
+ name="method"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ tooltipText={`The method you would like to use to connect with ${
+ APP_CONNECTION_MAP[AppConnection.OCI].name
+ }. This field cannot be changed after creation.`}
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Method"
+ >
+ <Select
+ isDisabled={isUpdate}
+ value={value}
+ onValueChange={(val) => onChange(val)}
+ className="w-full border border-mineshaft-500"
+ position="popper"
+ dropdownContainerClassName="max-w-none"
+ >
+ {Object.values(OCIConnectionMethod).map((method) => {
+ return (
+ <SelectItem value={method} key={method}>
+ {getAppConnectionMethodDetails(method).name}{" "}
+ </SelectItem>
+ );
+ })}
+ </Select>
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.userOcid"
+ control={control}
+ shouldUnregister
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="User OCID"
+ tooltipClassName="max-w-sm"
+ tooltipText="The unique identifier (OCID) associated with your OCI user account. You can find this in your OCI console under Identity > Domains > [domain] > Users > [user]."
+ >
+ <Input
+ {...field}
+ placeholder="ocid1.user.oc1..************************************************************"
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.tenancyOcid"
+ control={control}
+ shouldUnregister
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Tenancy OCID"
+ tooltipClassName="max-w-sm"
+ tooltipText="The unique identifier (OCID) for your tenancy in Oracle Cloud. You can find this in your OCI console under Administration > Tenancy Details."
+ >
+ <Input
+ {...field}
+ placeholder="ocid1.tenancy.oc1..************************************************************"
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.region"
+ control={control}
+ shouldUnregister
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Region"
+ tooltipClassName="max-w-sm"
+ tooltipText="The OCI region where your resources are located (e.g., us-ashburn-1, eu-frankfurt-1)."
+ >
+ <Input {...field} placeholder="us-ashburn-1" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.fingerprint"
+ control={control}
+ shouldUnregister
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Fingerprint"
+ tooltipClassName="max-w-sm"
+ tooltipText="The fingerprint of the public key associated with your OCI API key. This is generated when you create an API key in your OCI user settings."
+ >
+ <Input {...field} placeholder="00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.privateKey"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Private Key PEM"
+ >
+ <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"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ </FormControl>
+ )}
+ />
+ <div className="mt-8 flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ colorSchema="secondary"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting || !isDirty}
+ >
+ {isUpdate ? "Update Credentials" : "Connect to OCI"}
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </form>
+ </FormProvider>
+ );
+};
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx
index 59440c8149..b015e0679c 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx
@@ -38,7 +38,7 @@ import { useGetUserWorkspaces } from "@app/hooks/api";
import {
eventToNameMap,
secretEvents,
- userAgentTTypeoNameMap
+ userAgentTypeToNameMap
} from "@app/hooks/api/auditLogs/constants";
import { EventType } from "@app/hooks/api/auditLogs/enums";
import { UserAgentType } from "@app/hooks/api/auth/types";
@@ -47,7 +47,7 @@ import { LogFilterItem } from "./LogFilterItem";
import { AuditLogFilterFormData, Presets } from "./types";
const eventTypes = Object.entries(eventToNameMap).map(([value, label]) => ({ label, value }));
-const userAgentTypes = Object.entries(userAgentTTypeoNameMap).map(([value, label]) => ({
+const userAgentTypes = Object.entries(userAgentTypeToNameMap).map(([value, label]) => ({
label,
value
}));
diff --git a/frontend/src/pages/organization/CertManagerSettingsPage/CertManagerSettingsPage.tsx b/frontend/src/pages/organization/CertManagerSettingsPage/CertManagerSettingsPage.tsx
new file mode 100644
index 0000000000..c178aca220
--- /dev/null
+++ b/frontend/src/pages/organization/CertManagerSettingsPage/CertManagerSettingsPage.tsx
@@ -0,0 +1,20 @@
+import { Helmet } from "react-helmet";
+
+import { ProjectSettings } from "@app/components/projects/ProjectSettings";
+import { PageHeader } from "@app/components/v2";
+
+export const CertManagerSettingsPage = () => {
+ return (
+ <>
+ <Helmet>
+ <title>Cert Management Settings</title>
+ </Helmet>
+ <div className="flex w-full justify-center bg-bunker-800 text-white">
+ <div className="w-full max-w-7xl">
+ <PageHeader title="Cert Management Settings" />
+ <ProjectSettings />
+ </div>
+ </div>
+ </>
+ );
+};
diff --git a/frontend/src/pages/organization/CertManagerSettingsPage/route.tsx b/frontend/src/pages/organization/CertManagerSettingsPage/route.tsx
new file mode 100644
index 0000000000..aaccee4bf9
--- /dev/null
+++ b/frontend/src/pages/organization/CertManagerSettingsPage/route.tsx
@@ -0,0 +1,26 @@
+import { faHome } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
+
+import { CertManagerSettingsPage } from "./CertManagerSettingsPage";
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/settings"
+)({
+ component: CertManagerSettingsPage,
+ context: () => ({
+ breadcrumbs: [
+ {
+ label: "Products",
+ icon: () => <FontAwesomeIcon icon={faHome} />
+ },
+ {
+ label: "Cert Management",
+ link: linkOptions({ to: "/organization/cert-manager/overview" })
+ },
+ {
+ label: "Settings"
+ }
+ ]
+ })
+});
diff --git a/frontend/src/pages/organization/Gateways/GatewayListPage/GatewayListPage.tsx b/frontend/src/pages/organization/Gateways/GatewayListPage/GatewayListPage.tsx
index 85ec823341..632008eeb0 100644
--- a/frontend/src/pages/organization/Gateways/GatewayListPage/GatewayListPage.tsx
+++ b/frontend/src/pages/organization/Gateways/GatewayListPage/GatewayListPage.tsx
@@ -32,7 +32,6 @@ import {
Table,
TableContainer,
TableSkeleton,
- Tag,
TBody,
Td,
Th,
@@ -128,7 +127,6 @@ export const GatewayListPage = withPermission(
<Tr>
<Th className="w-1/3">Name</Th>
<Th>Cert Issued At</Th>
- <Th>Projects</Th>
<Th>Identity</Th>
<Th>
Health Check
@@ -151,13 +149,6 @@ export const GatewayListPage = withPermission(
<Tr key={el.id}>
<Td>{el.name}</Td>
<Td>{format(new Date(el.issuedAt), "yyyy-MM-dd hh:mm:ss aaa")}</Td>
- <Td>
- {el.projects.map((projectDetails) => (
- <Tag key={projectDetails.id} size="xs">
- {projectDetails.name}
- </Tag>
- ))}
- </Td>
<Td>{el.identity.name}</Td>
<Td>
{el.heartbeat
diff --git a/frontend/src/pages/organization/Gateways/GatewayListPage/components/EditGatewayDetailsModal.tsx b/frontend/src/pages/organization/Gateways/GatewayListPage/components/EditGatewayDetailsModal.tsx
index d41fd54899..1a0d41b4c6 100644
--- a/frontend/src/pages/organization/Gateways/GatewayListPage/components/EditGatewayDetailsModal.tsx
+++ b/frontend/src/pages/organization/Gateways/GatewayListPage/components/EditGatewayDetailsModal.tsx
@@ -3,10 +3,10 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Button, FilterableSelect, FormControl, Input } from "@app/components/v2";
-import { useGetUserWorkspaces, useUpdateGatewayById } from "@app/hooks/api";
+import { Button, FormControl, Input } from "@app/components/v2";
+import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";
+import { useUpdateGatewayById } from "@app/hooks/api";
import { TGateway } from "@app/hooks/api/gateways/types";
-import { ProjectType } from "@app/hooks/api/workspace/types";
type Props = {
gatewayDetails: TGateway;
@@ -14,13 +14,7 @@ type Props = {
};
const schema = z.object({
- name: z.string(),
- projects: z
- .object({
- id: z.string(),
- name: z.string()
- })
- .array()
+ name: z.string()
});
export type FormData = z.infer<typeof schema>;
@@ -38,20 +32,13 @@ export const EditGatewayDetailsModal = ({ gatewayDetails, onClose }: Props) => {
});
const updateGatewayById = useUpdateGatewayById();
- // when gateway goes to other products switch to all
- const { data: secretManagerWorkspaces, isLoading: isSecretManagerLoading } = useGetUserWorkspaces(
- {
- type: ProjectType.SecretManager
- }
- );
- const onFormSubmit = ({ name, projects }: FormData) => {
+ const onFormSubmit = ({ name }: FormData) => {
if (isSubmitting) return;
updateGatewayById.mutate(
{
id: gatewayDetails.id,
- name,
- projectIds: projects.map((el) => el.id)
+ name
},
{
onSuccess: () => {
@@ -67,6 +54,16 @@ export const EditGatewayDetailsModal = ({ gatewayDetails, onClose }: Props) => {
return (
<form onSubmit={handleSubmit(onFormSubmit)}>
+ <NoticeBannerV2 className="mx-auto mb-4" title="Project Linking">
+ <p className="mt-1 text-xs text-mineshaft-300">
+ Since the 15th May 2025, all gateways are automatically available for use in all projects
+ and you no longer need to link them.
+ <br />
+ Organization members with the &quot;Attach Gateways&quot; permission can use gateways
+ anywhere within the organization.
+ </p>
+ </NoticeBannerV2>
+
<Controller
control={control}
name="name"
@@ -76,30 +73,6 @@ export const EditGatewayDetailsModal = ({ gatewayDetails, onClose }: Props) => {
</FormControl>
)}
/>
- <Controller
- control={control}
- name="projects"
- render={({ field: { onChange, value }, fieldState: { error } }) => (
- <FormControl
- className="w-full"
- label="Projects"
- tooltipText="Select the project(s) that you'd like to add this gateway to"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <FilterableSelect
- options={secretManagerWorkspaces}
- placeholder="Select projects..."
- value={value}
- onChange={onChange}
- isMulti
- isLoading={isSecretManagerLoading}
- getOptionValue={(option) => option.id}
- getOptionLabel={(option) => option.name}
- />
- </FormControl>
- )}
- />
<div className="mt-4 flex items-center">
<Button className="mr-4" size="sm" type="submit" isLoading={isSubmitting}>
Update
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectRow.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectRow.tsx
index 30861a98b8..da89d47d80 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectRow.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityProjectsSection/IdentityProjectRow.tsx
@@ -6,9 +6,9 @@ import { format } from "date-fns";
import { createNotification } from "@app/components/notifications";
import { IconButton, Tag, Td, Tooltip, Tr } from "@app/components/v2";
+import { formatProjectRoleName } from "@app/helpers/roles";
import { useGetUserWorkspaces } from "@app/hooks/api";
import { IdentityMembership } from "@app/hooks/api/identities/types";
-import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
export enum TabSections {
@@ -26,15 +26,6 @@ type Props = {
) => void;
};
-const formatRoleName = (role: string, customRoleName?: string) => {
- if (role === ProjectMembershipRole.Custom) return customRoleName;
- if (role === ProjectMembershipRole.Admin) return "Admin";
- if (role === ProjectMembershipRole.Member) return "Developer";
- if (role === ProjectMembershipRole.Viewer) return "Viewer";
- if (role === ProjectMembershipRole.NoAccess) return "No Access";
- return role;
-};
-
export const IdentityProjectRow = ({
membership: { id, createdAt, identity, project, roles },
handlePopUpOpen
@@ -80,7 +71,7 @@ export const IdentityProjectRow = ({
<Td>
<Tag size="xs">{project.type}</Tag>
</Td>
- <Td>{`${formatRoleName(roles[0].role, roles[0].customRoleName)}${
+ <Td>{`${formatProjectRoleName(roles[0].role, roles[0].customRoleName)}${
roles.length > 1 ? ` (+${roles.length - 1})` : ""
}`}</Td>
<Td>{format(new Date(createdAt), "yyyy-MM-dd")}</Td>
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAuthModal.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAuthModal.tsx
index 84082272c5..71830d3981 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAuthModal.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAuthModal.tsx
@@ -11,6 +11,8 @@ import {
useDeleteIdentityGcpAuth,
useDeleteIdentityJwtAuth,
useDeleteIdentityKubernetesAuth,
+ useDeleteIdentityLdapAuth,
+ useDeleteIdentityOciAuth,
useDeleteIdentityOidcAuth,
useDeleteIdentityTokenAuth,
useDeleteIdentityUniversalAuth
@@ -22,6 +24,8 @@ import { ViewIdentityAzureAuthContent } from "./ViewIdentityAzureAuthContent";
import { ViewIdentityGcpAuthContent } from "./ViewIdentityGcpAuthContent";
import { ViewIdentityJwtAuthContent } from "./ViewIdentityJwtAuthContent";
import { ViewIdentityKubernetesAuthContent } from "./ViewIdentityKubernetesAuthContent";
+import { ViewIdentityLdapAuthContent } from "./ViewIdentityLdapAuthContent";
+import { ViewIdentityOciAuthContent } from "./ViewIdentityOciAuthContent";
import { ViewIdentityOidcAuthContent } from "./ViewIdentityOidcAuthContent";
import { ViewIdentityTokenAuthContent } from "./ViewIdentityTokenAuthContent";
import { ViewIdentityUniversalAuthContent } from "./ViewIdentityUniversalAuthContent";
@@ -59,8 +63,10 @@ export const Content = ({
const { mutateAsync: revokeGcpAuth } = useDeleteIdentityGcpAuth();
const { mutateAsync: revokeAwsAuth } = useDeleteIdentityAwsAuth();
const { mutateAsync: revokeAzureAuth } = useDeleteIdentityAzureAuth();
+ const { mutateAsync: revokeOciAuth } = useDeleteIdentityOciAuth();
const { mutateAsync: revokeOidcAuth } = useDeleteIdentityOidcAuth();
const { mutateAsync: revokeJwtAuth } = useDeleteIdentityJwtAuth();
+ const { mutateAsync: revokeLdapAuth } = useDeleteIdentityLdapAuth();
let Component: (props: ViewAuthMethodProps) => JSX.Element;
let revokeMethod: (revokeOptions: TRevokeOptions) => Promise<any>;
@@ -92,6 +98,10 @@ export const Content = ({
revokeMethod = revokeAzureAuth;
Component = ViewIdentityAzureAuthContent;
break;
+ case IdentityAuthMethod.OCI_AUTH:
+ revokeMethod = revokeOciAuth;
+ Component = ViewIdentityOciAuthContent;
+ break;
case IdentityAuthMethod.OIDC_AUTH:
revokeMethod = revokeOidcAuth;
Component = ViewIdentityOidcAuthContent;
@@ -100,6 +110,10 @@ export const Content = ({
revokeMethod = revokeJwtAuth;
Component = ViewIdentityJwtAuthContent;
break;
+ case IdentityAuthMethod.LDAP_AUTH:
+ revokeMethod = revokeLdapAuth;
+ Component = ViewIdentityLdapAuthContent;
+ break;
default:
throw new Error(`Unhandled Auth Method: ${authMethod}`);
}
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAwsAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAwsAuthContent.tsx
index 64eea9cf67..e7130d8a2a 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAwsAuthContent.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAwsAuthContent.tsx
@@ -47,10 +47,10 @@ export const ViewIdentityAwsAuthContent = ({
onEdit={() => handlePopUpOpen("identityAuthMethod")}
onDelete={onDelete}
>
- <IdentityAuthFieldDisplay label="Access Token TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
{data.accessTokenTTL}
</IdentityAuthFieldDisplay>
- <IdentityAuthFieldDisplay label="Access Token Max TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
{data.accessTokenMaxTTL}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAzureAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAzureAuthContent.tsx
index fa146e4cae..ea9ee09eac 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAzureAuthContent.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityAzureAuthContent.tsx
@@ -47,10 +47,10 @@ export const ViewIdentityAzureAuthContent = ({
onEdit={() => handlePopUpOpen("identityAuthMethod")}
onDelete={onDelete}
>
- <IdentityAuthFieldDisplay label="Access Token TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
{data.accessTokenTTL}
</IdentityAuthFieldDisplay>
- <IdentityAuthFieldDisplay label="Access Token Max TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
{data.accessTokenMaxTTL}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityGcpAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityGcpAuthContent.tsx
index 9eefe96fd2..4008850e91 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityGcpAuthContent.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityGcpAuthContent.tsx
@@ -47,10 +47,10 @@ export const ViewIdentityGcpAuthContent = ({
onEdit={() => handlePopUpOpen("identityAuthMethod")}
onDelete={onDelete}
>
- <IdentityAuthFieldDisplay label="Access Token TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
{data.accessTokenTTL}
</IdentityAuthFieldDisplay>
- <IdentityAuthFieldDisplay label="Access Token Max TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
{data.accessTokenMaxTTL}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityJwtAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityJwtAuthContent.tsx
index d16635937b..b0e50278e8 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityJwtAuthContent.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityJwtAuthContent.tsx
@@ -49,10 +49,10 @@ export const ViewIdentityJwtAuthContent = ({
onEdit={() => handlePopUpOpen("identityAuthMethod")}
onDelete={onDelete}
>
- <IdentityAuthFieldDisplay label="Access Token TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
{data.accessTokenTTL}
</IdentityAuthFieldDisplay>
- <IdentityAuthFieldDisplay label="Access Token Max TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
{data.accessTokenMaxTTL}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityKubernetesAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityKubernetesAuthContent.tsx
index da0455160e..838e130c54 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityKubernetesAuthContent.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityKubernetesAuthContent.tsx
@@ -1,8 +1,10 @@
+import { useMemo } from "react";
import { faBan, faEye } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useQuery } from "@tanstack/react-query";
import { Badge, EmptyState, Spinner, Tooltip } from "@app/components/v2";
-import { useGetIdentityKubernetesAuth } from "@app/hooks/api";
+import { gatewaysQueryKeys, useGetIdentityKubernetesAuth } from "@app/hooks/api";
import { IdentityKubernetesAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm";
import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";
@@ -16,8 +18,14 @@ export const ViewIdentityKubernetesAuthContent = ({
onDelete,
popUp
}: ViewAuthMethodProps) => {
+ const { data: gateways } = useQuery(gatewaysQueryKeys.list());
+
const { data, isPending } = useGetIdentityKubernetesAuth(identityId);
+ const selectedGateway = useMemo(() => {
+ return gateways?.find((gateway) => gateway.id === data?.gatewayId) || null;
+ }, [gateways, data?.gatewayId]);
+
if (isPending) {
return (
<div className="flex w-full items-center justify-center">
@@ -51,10 +59,10 @@ export const ViewIdentityKubernetesAuthContent = ({
onEdit={() => handlePopUpOpen("identityAuthMethod")}
onDelete={onDelete}
>
- <IdentityAuthFieldDisplay label="Access Token TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
{data.accessTokenTTL}
</IdentityAuthFieldDisplay>
- <IdentityAuthFieldDisplay label="Access Token Max TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
{data.accessTokenMaxTTL}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
@@ -69,6 +77,7 @@ export const ViewIdentityKubernetesAuthContent = ({
>
{data.kubernetesHost}
</IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Gateway">{selectedGateway?.name}</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay className="col-span-2" label="Token Reviewer JWT">
{data.tokenReviewerJwt ? (
<Tooltip
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityLdapAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityLdapAuthContent.tsx
new file mode 100644
index 0000000000..f732fd5ed0
--- /dev/null
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityLdapAuthContent.tsx
@@ -0,0 +1,103 @@
+import { faBan, faEye } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { Badge, EmptyState, Spinner, Tooltip } from "@app/components/v2";
+import { useGetIdentityLdapAuth } from "@app/hooks/api";
+import { IdentityLdapAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm";
+import { ViewIdentityContentWrapper } from "@app/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityContentWrapper";
+
+import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";
+import { ViewAuthMethodProps } from "./types";
+
+export const ViewIdentityLdapAuthContent = ({
+ identityId,
+ handlePopUpToggle,
+ handlePopUpOpen,
+ onDelete,
+ popUp
+}: ViewAuthMethodProps) => {
+ const { data, isPending } = useGetIdentityLdapAuth(identityId);
+
+ if (isPending) {
+ return (
+ <div className="flex w-full items-center justify-center">
+ <Spinner className="text-mineshaft-400" />
+ </div>
+ );
+ }
+
+ if (!data) {
+ return (
+ <EmptyState icon={faBan} title="Could not find LDAP Auth associated with this Identity." />
+ );
+ }
+
+ if (popUp.identityAuthMethod.isOpen) {
+ return (
+ <IdentityLdapAuthForm
+ identityId={identityId}
+ isUpdate
+ handlePopUpOpen={handlePopUpOpen}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ );
+ }
+
+ return (
+ <ViewIdentityContentWrapper
+ onEdit={() => handlePopUpOpen("identityAuthMethod")}
+ onDelete={onDelete}
+ >
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
+ {data.accessTokenTTL}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
+ {data.accessTokenMaxTTL}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
+ {data.accessTokenNumUsesLimit}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Access Token Trusted IPs">
+ {data.accessTokenTrustedIps.map((ip) => ip.ipAddress).join(", ")}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="LDAP URL">{data.url}</IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Bind DN">{data.bindDN}</IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Bind Pass">
+ <Tooltip
+ side="right"
+ className="max-w-xl p-2"
+ content={<p className="break-words rounded bg-mineshaft-600 p-2">{data.bindPass}</p>}
+ >
+ <div className="w-min">
+ <Badge className="flex h-5 w-min items-center gap-1.5 whitespace-nowrap bg-mineshaft-400/50 text-bunker-300">
+ <FontAwesomeIcon icon={faEye} />
+ <span>Reveal</span>
+ </Badge>
+ </div>
+ </Tooltip>
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Search Base / DN">
+ {data.searchBase}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Search Filter">{data.searchFilter}</IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="CA Certificate">
+ {data.ldapCaCertificate && (
+ <Tooltip
+ side="right"
+ className="max-w-xl p-2"
+ content={
+ <p className="break-words rounded bg-mineshaft-600 p-2">{data.ldapCaCertificate}</p>
+ }
+ >
+ <div className="w-min">
+ <Badge className="flex h-5 w-min items-center gap-1.5 whitespace-nowrap bg-mineshaft-400/50 text-bunker-300">
+ <FontAwesomeIcon icon={faEye} />
+ <span>Reveal</span>
+ </Badge>
+ </div>
+ </Tooltip>
+ )}
+ </IdentityAuthFieldDisplay>
+ </ViewIdentityContentWrapper>
+ );
+};
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityOciAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityOciAuthContent.tsx
new file mode 100644
index 0000000000..fb3bd4fa82
--- /dev/null
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityOciAuthContent.tsx
@@ -0,0 +1,73 @@
+import { faBan } from "@fortawesome/free-solid-svg-icons";
+
+import { EmptyState, Spinner } from "@app/components/v2";
+import { useGetIdentityOciAuth } from "@app/hooks/api";
+import { IdentityOciAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOciAuthForm";
+
+import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";
+import { ViewAuthMethodProps } from "./types";
+import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";
+
+export const ViewIdentityOciAuthContent = ({
+ identityId,
+ handlePopUpToggle,
+ handlePopUpOpen,
+ onDelete,
+ popUp
+}: ViewAuthMethodProps) => {
+ const { data, isPending } = useGetIdentityOciAuth(identityId);
+
+ if (isPending) {
+ return (
+ <div className="flex w-full items-center justify-center">
+ <Spinner className="text-mineshaft-400" />
+ </div>
+ );
+ }
+
+ if (!data) {
+ return (
+ <EmptyState icon={faBan} title="Could not find OCI Auth associated with this Identity." />
+ );
+ }
+
+ if (popUp.identityAuthMethod.isOpen) {
+ return (
+ <IdentityOciAuthForm
+ identityId={identityId}
+ isUpdate
+ handlePopUpOpen={handlePopUpOpen}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ );
+ }
+
+ return (
+ <ViewIdentityContentWrapper
+ onEdit={() => handlePopUpOpen("identityAuthMethod")}
+ onDelete={onDelete}
+ >
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
+ {data.accessTokenTTL}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
+ {data.accessTokenMaxTTL}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
+ {data.accessTokenNumUsesLimit}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay label="Access Token Trusted IPs">
+ {data.accessTokenTrustedIps.map((ip) => ip.ipAddress).join(", ")}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay className="col-span-2" label="Tenancy OCID">
+ {data.tenancyOcid}
+ </IdentityAuthFieldDisplay>
+ <IdentityAuthFieldDisplay className="col-span-2" label="Allowed Usernames">
+ {data.allowedUsernames
+ ?.split(",")
+ .map((u) => u.trim())
+ .join(", ")}
+ </IdentityAuthFieldDisplay>
+ </ViewIdentityContentWrapper>
+ );
+};
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityOidcAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityOidcAuthContent.tsx
index 116ecfd386..a326fda455 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityOidcAuthContent.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityOidcAuthContent.tsx
@@ -48,10 +48,10 @@ export const ViewIdentityOidcAuthContent = ({
onEdit={() => handlePopUpOpen("identityAuthMethod")}
onDelete={onDelete}
>
- <IdentityAuthFieldDisplay label="Access Token TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
{data.accessTokenTTL}
</IdentityAuthFieldDisplay>
- <IdentityAuthFieldDisplay label="Access Token Max TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
{data.accessTokenMaxTTL}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityTokenAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityTokenAuthContent.tsx
index 0e28516fa0..516289f748 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityTokenAuthContent.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityTokenAuthContent.tsx
@@ -50,10 +50,10 @@ export const ViewIdentityTokenAuthContent = ({
onEdit={() => handlePopUpOpen("identityAuthMethod")}
onDelete={onDelete}
>
- <IdentityAuthFieldDisplay label="Access Token TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
{data.accessTokenTTL}
</IdentityAuthFieldDisplay>
- <IdentityAuthFieldDisplay label="Access Token Max TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
{data.accessTokenMaxTTL}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityUniversalAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityUniversalAuthContent.tsx
index ca1c30eed7..3a794ce608 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityUniversalAuthContent.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuthModal/ViewIdentityUniversalAuthContent.tsx
@@ -62,10 +62,10 @@ export const ViewIdentityUniversalAuthContent = ({
onEdit={() => handlePopUpOpen("identityAuthMethod")}
onDelete={onDelete}
>
- <IdentityAuthFieldDisplay label="Access Token TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">
{data.accessTokenTTL}
</IdentityAuthFieldDisplay>
- <IdentityAuthFieldDisplay label="Access Token Max TLL (seconds)">
+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">
{data.accessTokenMaxTTL}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay label="Access Token Max Number of Uses">
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/route.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/route.tsx
index 20edc25c19..fd4a862604 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/route.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/route.tsx
@@ -20,7 +20,7 @@ export const Route = createFileRoute(
link: linkOptions({ to: "/organization/access-management" })
},
{
- label: "identities"
+ label: "Identities"
}
]
})
diff --git a/frontend/src/pages/organization/KmsSettingsPage/KmsSettingsPage.tsx b/frontend/src/pages/organization/KmsSettingsPage/KmsSettingsPage.tsx
new file mode 100644
index 0000000000..26305fd3db
--- /dev/null
+++ b/frontend/src/pages/organization/KmsSettingsPage/KmsSettingsPage.tsx
@@ -0,0 +1,20 @@
+import { Helmet } from "react-helmet";
+
+import { ProjectSettings } from "@app/components/projects/ProjectSettings";
+import { PageHeader } from "@app/components/v2";
+
+export const KmsSettingsPage = () => {
+ return (
+ <>
+ <Helmet>
+ <title>KMS Settings</title>
+ </Helmet>
+ <div className="flex w-full justify-center bg-bunker-800 text-white">
+ <div className="w-full max-w-7xl">
+ <PageHeader title="KMS Settings" />
+ <ProjectSettings />
+ </div>
+ </div>
+ </>
+ );
+};
diff --git a/frontend/src/pages/organization/KmsSettingsPage/route.tsx b/frontend/src/pages/organization/KmsSettingsPage/route.tsx
new file mode 100644
index 0000000000..17b0d6687d
--- /dev/null
+++ b/frontend/src/pages/organization/KmsSettingsPage/route.tsx
@@ -0,0 +1,26 @@
+import { faHome } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
+
+import { KmsSettingsPage } from "./KmsSettingsPage";
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/organization/kms/settings"
+)({
+ component: KmsSettingsPage,
+ context: () => ({
+ breadcrumbs: [
+ {
+ label: "Products",
+ icon: () => <FontAwesomeIcon icon={faHome} />
+ },
+ {
+ label: "KMS",
+ link: linkOptions({ to: "/organization/kms/overview" })
+ },
+ {
+ label: "Settings"
+ }
+ ]
+ })
+});
diff --git a/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx b/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx
index a3165709a1..7acc468f89 100644
--- a/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx
@@ -19,6 +19,7 @@ import { ROUTE_PATHS } from "@app/const/routes";
import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";
import { useDeleteOrgRole, useGetOrgRole } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
+import { DuplicateOrgRoleModal } from "@app/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal";
import { OrgAccessControlTabSections } from "@app/types/org";
import { RoleDetailsSection, RoleModal, RolePermissionsSection } from "./components";
@@ -36,7 +37,8 @@ export const Page = () => {
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"role",
- "deleteOrgRole"
+ "deleteOrgRole",
+ "duplicateRole"
] as const);
const onDeleteOrgRoleSubmit = async () => {
@@ -106,6 +108,21 @@ export const Page = () => {
</DropdownMenuItem>
)}
</OrgPermissionCan>
+ <OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Role}>
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={() => {
+ handlePopUpOpen("duplicateRole");
+ }}
+ disabled={!isAllowed}
+ >
+ Duplicate Role
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
<OrgPermissionCan I={OrgPermissionActions.Delete} a={OrgPermissionSubjects.Role}>
{(isAllowed) => (
<DropdownMenuItem
@@ -143,6 +160,11 @@ export const Page = () => {
deleteKey="confirm"
onDeleteApproved={() => onDeleteOrgRoleSubmit()}
/>
+ <DuplicateOrgRoleModal
+ isOpen={popUp.duplicateRole.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("duplicateRole", isOpen)}
+ roleId={data?.id}
+ />
</div>
);
};
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx b/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx
new file mode 100644
index 0000000000..8995c03b3a
--- /dev/null
+++ b/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx
@@ -0,0 +1,150 @@
+import { Controller, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { useNavigate } from "@tanstack/react-router";
+import { z } from "zod";
+
+import { createNotification } from "@app/components/notifications";
+import { Button, FormControl, Input, Modal, ModalContent, Spinner } from "@app/components/v2";
+import { useOrganization } from "@app/context";
+import { useCreateOrgRole, useGetOrgRole } from "@app/hooks/api";
+import { TOrgRole } from "@app/hooks/api/roles/types";
+import { slugSchema } from "@app/lib/schemas";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ roleId?: string;
+};
+
+const schema = z
+ .object({
+ name: z.string().min(1, "Name required"),
+ description: z.string(),
+ slug: slugSchema({ min: 1 })
+ })
+ .required();
+
+export type FormData = z.infer<typeof schema>;
+
+type ContentProps = {
+ role: TOrgRole;
+ onClose: () => void;
+};
+
+const Content = ({ role, onClose }: ContentProps) => {
+ const {
+ control,
+ handleSubmit,
+ formState: { isSubmitting }
+ } = useForm<FormData>({
+ defaultValues: {
+ name: `${role.name} Duplicate`
+ },
+ resolver: zodResolver(schema)
+ });
+
+ const createRole = useCreateOrgRole();
+ const navigate = useNavigate();
+
+ const handleDuplicateRole = async (form: FormData) => {
+ const newRole = await createRole.mutateAsync({
+ orgId: role.orgId,
+ permissions: role.permissions,
+ ...form
+ });
+
+ createNotification({
+ type: "success",
+ text: "Role duplicated successfully"
+ });
+
+ navigate({
+ to: "/organization/roles/$roleId",
+ params: {
+ roleId: newRole.id
+ }
+ });
+
+ onClose();
+ };
+
+ return (
+ <form onSubmit={handleSubmit(handleDuplicateRole)}>
+ <Controller
+ control={control}
+ defaultValue=""
+ name="name"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl label="Name" isError={Boolean(error)} errorText={error?.message} isRequired>
+ <Input {...field} placeholder="Billing Team" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue=""
+ name="slug"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl label="Slug" isError={Boolean(error)} errorText={error?.message} isRequired>
+ <Input {...field} placeholder="billing" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue=""
+ name="description"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl label="Description" isError={Boolean(error)} errorText={error?.message}>
+ <Input {...field} placeholder="To manage billing" />
+ </FormControl>
+ )}
+ />
+ <div className="flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting}
+ >
+ Duplicate Role
+ </Button>
+ <Button colorSchema="secondary" variant="plain" onClick={onClose}>
+ Cancel
+ </Button>
+ </div>
+ </form>
+ );
+};
+
+export const DuplicateOrgRoleModal = ({ isOpen, onOpenChange, roleId }: Props) => {
+ const { currentOrg } = useOrganization();
+
+ const { data: role, isPending } = useGetOrgRole(currentOrg.id, roleId ?? "");
+
+ if (!roleId) return null;
+
+ return (
+ <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
+ <ModalContent
+ title="Duplicate Role"
+ subTitle="Duplicate this role to create a new role with the same permissions."
+ >
+ {/* eslint-disable-next-line no-nested-ternary */}
+ {isPending ? (
+ <div className="flex h-full flex-col items-center justify-center py-2.5">
+ <Spinner size="lg" className="text-mineshaft-500" />
+ <p className="mt-4 text-sm text-mineshaft-400">Loading Role...</p>
+ </div>
+ ) : role ? (
+ <Content role={role!} onClose={() => onOpenChange(false)} />
+ ) : (
+ <p className="w-full text-center text-red">
+ Error: could not find role with slug &#34;{roleId}&#34;
+ </p>
+ )}
+ </ModalContent>
+ </Modal>
+ );
+};
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
index 72ebc29871..b0336c465c 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
+++ b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
@@ -69,7 +69,8 @@ const orgGatewayPermissionSchema = z
[OrgGatewayPermissionActions.ListGateways]: z.boolean().optional(),
[OrgGatewayPermissionActions.EditGateways]: z.boolean().optional(),
[OrgGatewayPermissionActions.DeleteGateways]: z.boolean().optional(),
- [OrgGatewayPermissionActions.CreateGateways]: z.boolean().optional()
+ [OrgGatewayPermissionActions.CreateGateways]: z.boolean().optional(),
+ [OrgGatewayPermissionActions.AttachGateways]: z.boolean().optional()
})
.optional();
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx b/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx
index 50e3a60aa3..88f568c4a7 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx
@@ -13,7 +13,7 @@ import { slugSchema } from "@app/lib/schemas";
const schema = z
.object({
- name: z.string(),
+ name: z.string().min(1, "Name required"),
description: z.string(),
slug: slugSchema({ min: 1 })
})
@@ -71,12 +71,6 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
const onFormSubmit = async ({ name, description, slug }: FormData) => {
try {
- console.log("onFormSubmit args: ", {
- name,
- description,
- slug
- });
-
if (!orgId) return;
if (role) {
@@ -117,12 +111,8 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
});
reset();
- } catch (err) {
- console.error(err);
- const error = err as any;
- const text =
- error?.response?.data?.message ??
- `Failed to ${popUp?.role?.data ? "update" : "create"} role`;
+ } catch {
+ const text = `Failed to ${popUp?.role?.data ? "update" : "create"} role`;
createNotification({
text,
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionGatewayRow.tsx b/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionGatewayRow.tsx
index 46e88653ab..2ffd726c21 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionGatewayRow.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionGatewayRow.tsx
@@ -27,7 +27,8 @@ const PERMISSION_ACTIONS = [
{ action: OrgGatewayPermissionActions.ListGateways, label: "List Gateways" },
{ action: OrgGatewayPermissionActions.CreateGateways, label: "Create Gateways" },
{ action: OrgGatewayPermissionActions.EditGateways, label: "Edit Gateways" },
- { action: OrgGatewayPermissionActions.DeleteGateways, label: "Delete Gateways" }
+ { action: OrgGatewayPermissionActions.DeleteGateways, label: "Delete Gateways" },
+ { action: OrgGatewayPermissionActions.AttachGateways, label: "Attach Gateways" }
] as const;
export const OrgGatewayPermissionRow = ({ isEditable, control, setValue }: Props) => {
diff --git a/frontend/src/pages/organization/SecretManagerOverviewPage/components/ProjectListToggle.tsx b/frontend/src/pages/organization/SecretManagerOverviewPage/components/ProjectListToggle.tsx
index f91d8f578f..27b8f4c5bc 100644
--- a/frontend/src/pages/organization/SecretManagerOverviewPage/components/ProjectListToggle.tsx
+++ b/frontend/src/pages/organization/SecretManagerOverviewPage/components/ProjectListToggle.tsx
@@ -27,6 +27,7 @@ export const ProjectListToggle = ({ value, onChange }: Props) => {
value={value}
onValueChange={onChange}
className="absolute left-0 top-0 h-full w-full cursor-pointer opacity-0"
+ dropdownContainerClassName="mt-10 ml-5"
>
<SelectItem value={ProjectListView.MyProjects}>My Projects</SelectItem>
<SelectItem value={ProjectListView.AllProjects}>All Projects</SelectItem>
diff --git a/frontend/src/pages/organization/SecretManagerSettingsPage/SecretManagerSettingsPage.tsx b/frontend/src/pages/organization/SecretManagerSettingsPage/SecretManagerSettingsPage.tsx
new file mode 100644
index 0000000000..7db975f4ff
--- /dev/null
+++ b/frontend/src/pages/organization/SecretManagerSettingsPage/SecretManagerSettingsPage.tsx
@@ -0,0 +1,20 @@
+import { Helmet } from "react-helmet";
+
+import { ProjectSettings } from "@app/components/projects/ProjectSettings";
+import { PageHeader } from "@app/components/v2";
+
+export const SecretManagerSettingsPage = () => {
+ return (
+ <>
+ <Helmet>
+ <title>Secret Management Settings</title>
+ </Helmet>
+ <div className="flex w-full justify-center bg-bunker-800 text-white">
+ <div className="w-full max-w-7xl">
+ <PageHeader title="Secret Management Settings" />
+ <ProjectSettings />
+ </div>
+ </div>
+ </>
+ );
+};
diff --git a/frontend/src/pages/organization/SecretManagerSettingsPage/route.tsx b/frontend/src/pages/organization/SecretManagerSettingsPage/route.tsx
new file mode 100644
index 0000000000..8e4d6851a1
--- /dev/null
+++ b/frontend/src/pages/organization/SecretManagerSettingsPage/route.tsx
@@ -0,0 +1,26 @@
+import { faHome } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
+
+import { SecretManagerSettingsPage } from "./SecretManagerSettingsPage";
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/settings"
+)({
+ component: SecretManagerSettingsPage,
+ context: () => ({
+ breadcrumbs: [
+ {
+ label: "Products",
+ icon: () => <FontAwesomeIcon icon={faHome} />
+ },
+ {
+ label: "Secret Management",
+ link: linkOptions({ to: "/organization/secret-manager/overview" })
+ },
+ {
+ label: "Settings"
+ }
+ ]
+ })
+});
diff --git a/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx b/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx
index ba919cdd39..23cdcf8002 100644
--- a/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx
+++ b/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx
@@ -108,7 +108,7 @@ export const SecretScanningPage = withPermission(
const generateNewIntegrationSession = async () => {
const session = await createNewIntegrationSession({ organizationId });
- window.location.href = `https://github.com/apps/infisical-radar/installations/new?state=${session.sessionId}`;
+ window.location.href = `https://github.com/apps/${session.gitAppSlug}/installations/new?state=${session.sessionId}`;
};
return (
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx
index 45b974755e..a9450993fc 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx
@@ -30,6 +30,8 @@ export const AddShareSecretModal = ({ popUp, handlePopUpToggle }: Props) => {
allowSecretSharingOutsideOrganization={
currentOrg?.allowSecretSharingOutsideOrganization ?? true
}
+ maxSharedSecretLifetime={currentOrg?.maxSharedSecretLifetime}
+ maxSharedSecretViewLimit={currentOrg?.maxSharedSecretViewLimit}
/>
</ModalContent>
</Modal>
diff --git a/frontend/src/pages/organization/SecretSharingSettingsPage/SecretSharingSettingsPage.tsx b/frontend/src/pages/organization/SecretSharingSettingsPage/SecretSharingSettingsPage.tsx
index 8ee37f6317..ae1aa3772c 100644
--- a/frontend/src/pages/organization/SecretSharingSettingsPage/SecretSharingSettingsPage.tsx
+++ b/frontend/src/pages/organization/SecretSharingSettingsPage/SecretSharingSettingsPage.tsx
@@ -17,11 +17,11 @@ export const SecretSharingSettingsPage = withPermission(
return (
<>
<Helmet>
- <title>{t("common.head-title", { title: t("settings.org.title") })}</title>
+ <title>{t("common.head-title", { title: "Secret Share Settings" })}</title>
</Helmet>
<div className="flex w-full justify-center bg-bunker-800 text-white">
<div className="w-full max-w-7xl">
- <PageHeader title={t("settings.org.title")} />
+ <PageHeader title="Secret Share Settings" />
<SecretSharingSettingsTabGroup />
</div>
</div>
diff --git a/frontend/src/pages/organization/SecretSharingSettingsPage/components/OrgSecretShareLimitSection/OrgSecretShareLimitSection.tsx b/frontend/src/pages/organization/SecretSharingSettingsPage/components/OrgSecretShareLimitSection/OrgSecretShareLimitSection.tsx
new file mode 100644
index 0000000000..e0d88a082e
--- /dev/null
+++ b/frontend/src/pages/organization/SecretSharingSettingsPage/components/OrgSecretShareLimitSection/OrgSecretShareLimitSection.tsx
@@ -0,0 +1,294 @@
+import { Controller, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+import { useEffect } from "react";
+
+import { createNotification } from "@app/components/notifications";
+import { OrgPermissionCan } from "@app/components/permissions";
+import { Button, FormControl, Input, Select, SelectItem } from "@app/components/v2";
+import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";
+import { useUpdateOrg } from "@app/hooks/api";
+
+const MAX_SHARED_SECRET_LIFETIME_SECONDS = 30 * 24 * 60 * 60; // 30 days in seconds
+const MIN_SHARED_SECRET_LIFETIME_SECONDS = 5 * 60; // 5 minutes in seconds
+
+// Helper function to convert duration to seconds
+const durationToSeconds = (value: number, unit: "m" | "h" | "d"): number => {
+ switch (unit) {
+ case "m":
+ return value * 60;
+ case "h":
+ return value * 60 * 60;
+ case "d":
+ return value * 60 * 60 * 24;
+ default:
+ return 0;
+ }
+};
+
+// Helper function to convert seconds to form lifetime value and unit
+const getFormLifetimeFromSeconds = (
+ totalSeconds: number | null | undefined
+): { maxLifetimeValue: number; maxLifetimeUnit: "m" | "h" | "d" } => {
+ const DEFAULT_LIFETIME_VALUE = 30;
+ const DEFAULT_LIFETIME_UNIT = "d" as "m" | "h" | "d";
+
+ if (totalSeconds == null || totalSeconds <= 0) {
+ return {
+ maxLifetimeValue: DEFAULT_LIFETIME_VALUE,
+ maxLifetimeUnit: DEFAULT_LIFETIME_UNIT
+ };
+ }
+
+ const secondsInDay = 24 * 60 * 60;
+ const secondsInHour = 60 * 60;
+ const secondsInMinute = 60;
+
+ if (totalSeconds % secondsInDay === 0) {
+ const value = totalSeconds / secondsInDay;
+ if (value >= 1) return { maxLifetimeValue: value, maxLifetimeUnit: "d" };
+ }
+
+ if (totalSeconds % secondsInHour === 0) {
+ const value = totalSeconds / secondsInHour;
+ if (value >= 1) return { maxLifetimeValue: value, maxLifetimeUnit: "h" };
+ }
+
+ if (totalSeconds % secondsInMinute === 0) {
+ const value = totalSeconds / secondsInMinute;
+ if (value >= 1) return { maxLifetimeValue: value, maxLifetimeUnit: "m" };
+ }
+
+ return {
+ maxLifetimeValue: DEFAULT_LIFETIME_VALUE,
+ maxLifetimeUnit: DEFAULT_LIFETIME_UNIT
+ };
+};
+
+const formSchema = z
+ .object({
+ maxLifetimeValue: z.number().min(1, "Value must be at least 1"),
+ maxLifetimeUnit: z.enum(["m", "h", "d"], {
+ invalid_type_error: "Please select a valid time unit"
+ }),
+ maxViewLimit: z.string()
+ })
+ .superRefine((data, ctx) => {
+ const { maxLifetimeValue, maxLifetimeUnit } = data;
+
+ const durationInSeconds = durationToSeconds(maxLifetimeValue, maxLifetimeUnit);
+
+ // Check max limit
+ if (durationInSeconds > MAX_SHARED_SECRET_LIFETIME_SECONDS) {
+ let message = "Duration exceeds maximum allowed limit";
+
+ if (maxLifetimeUnit === "m") {
+ message = `Maximum allowed minutes is ${MAX_SHARED_SECRET_LIFETIME_SECONDS / 60} (30 days)`;
+ } else if (maxLifetimeUnit === "h") {
+ message = `Maximum allowed hours is ${MAX_SHARED_SECRET_LIFETIME_SECONDS / (60 * 60)} (30 days)`;
+ } else if (maxLifetimeUnit === "d") {
+ message = `Maximum allowed days is ${MAX_SHARED_SECRET_LIFETIME_SECONDS / (24 * 60 * 60)}`;
+ }
+
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message,
+ path: ["maxLifetimeValue"]
+ });
+ }
+
+ // Check min limit
+ if (durationInSeconds < MIN_SHARED_SECRET_LIFETIME_SECONDS) {
+ const message = `Duration must be at least ${MIN_SHARED_SECRET_LIFETIME_SECONDS / 60} minutes`; // 5 minutes
+
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message,
+ path: ["maxLifetimeValue"]
+ });
+ }
+ });
+
+type TForm = z.infer<typeof formSchema>;
+
+const viewLimitOptions = [
+ { label: "1", value: 1 },
+ { label: "Unlimited", value: -1 }
+];
+
+export const OrgSecretShareLimitSection = () => {
+ const { mutateAsync } = useUpdateOrg();
+ const { currentOrg } = useOrganization();
+
+ const getDefaultFormValues = () => {
+ const initialLifetime = getFormLifetimeFromSeconds(currentOrg?.maxSharedSecretLifetime);
+ return {
+ maxLifetimeValue: initialLifetime.maxLifetimeValue,
+ maxLifetimeUnit: initialLifetime.maxLifetimeUnit,
+ maxViewLimit: currentOrg?.maxSharedSecretViewLimit?.toString() || "-1"
+ };
+ };
+
+ const {
+ control,
+ formState: { isSubmitting, isDirty },
+ handleSubmit,
+ reset
+ } = useForm<TForm>({
+ resolver: zodResolver(formSchema),
+ defaultValues: getDefaultFormValues()
+ });
+
+ useEffect(() => {
+ if (currentOrg) {
+ reset(getDefaultFormValues());
+ }
+ }, [currentOrg, reset]);
+
+ const handleFormSubmit = async (formData: TForm) => {
+ try {
+ const maxSharedSecretLifetimeSeconds = durationToSeconds(
+ formData.maxLifetimeValue,
+ formData.maxLifetimeUnit
+ );
+
+ await mutateAsync({
+ orgId: currentOrg.id,
+ maxSharedSecretViewLimit:
+ formData.maxViewLimit === "-1" ? null : Number(formData.maxViewLimit),
+ maxSharedSecretLifetime: maxSharedSecretLifetimeSeconds
+ });
+
+ createNotification({
+ text: "Successfully updated secret share limits",
+ type: "success"
+ });
+
+ reset(formData);
+ } catch {
+ createNotification({
+ text: "Failed to update secret share limits",
+ type: "error"
+ });
+ }
+ };
+
+ // Units for the dropdown with readable labels
+ const timeUnits = [
+ { value: "m", label: "Minutes" },
+ { value: "h", label: "Hours" },
+ { value: "d", label: "Days" }
+ ];
+
+ return (
+ <div className="mb-4 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <div className="flex w-full items-center justify-between">
+ <p className="text-xl font-semibold">Secret Share Limits</p>
+ </div>
+ <p className="mb-4 mt-2 text-sm text-gray-400">
+ These settings establish the maximum limits for all Shared Secret parameters within this
+ organization. Shared secrets cannot be created with values exceeding these limits.
+ </p>
+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Settings}>
+ {(isAllowed) => (
+ <form onSubmit={handleSubmit(handleFormSubmit)} autoComplete="off">
+ <div className="flex max-w-sm gap-4">
+ <Controller
+ control={control}
+ name="maxLifetimeValue"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ tooltipText="The max amount of time that can be set before the secret share link expires."
+ label="Max Lifetime"
+ className="w-full"
+ >
+ <Input
+ {...field}
+ type="number"
+ min={1}
+ step={1}
+ value={field.value}
+ onChange={(e) => {
+ const val = e.target.value;
+ field.onChange(val === "" ? "" : parseInt(val, 10));
+ }}
+ disabled={!isAllowed}
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="maxLifetimeUnit"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Time unit"
+ >
+ <Select
+ value={field.value}
+ className="pr-2"
+ onValueChange={field.onChange}
+ placeholder="Select time unit"
+ isDisabled={!isAllowed}
+ >
+ {timeUnits.map(({ value, label }) => (
+ <SelectItem
+ key={value}
+ value={value}
+ className="relative py-2 pl-6 pr-8 text-sm hover:bg-mineshaft-700"
+ >
+ <div className="ml-3 font-medium">{label}</div>
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
+ </div>
+ <div className="flex max-w-sm">
+ <Controller
+ control={control}
+ name="maxViewLimit"
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ <FormControl
+ label="Max Views"
+ errorText={error?.message}
+ isError={Boolean(error)}
+ className="w-full"
+ >
+ <Select
+ defaultValue={field.value}
+ {...field}
+ onValueChange={(e) => onChange(e)}
+ className="w-full"
+ isDisabled={!isAllowed}
+ >
+ {viewLimitOptions.map(({ label, value: viewLimitValue }) => (
+ <SelectItem value={String(viewLimitValue || "")} key={label}>
+ {label}
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
+ </div>
+ <Button
+ colorSchema="secondary"
+ type="submit"
+ isLoading={isSubmitting}
+ disabled={!isDirty || !isAllowed}
+ className="mt-4"
+ >
+ Save
+ </Button>
+ </form>
+ )}
+ </OrgPermissionCan>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/organization/SecretSharingSettingsPage/components/OrgSecretShareLimitSection/index.tsx b/frontend/src/pages/organization/SecretSharingSettingsPage/components/OrgSecretShareLimitSection/index.tsx
new file mode 100644
index 0000000000..1e83c4be8c
--- /dev/null
+++ b/frontend/src/pages/organization/SecretSharingSettingsPage/components/OrgSecretShareLimitSection/index.tsx
@@ -0,0 +1 @@
+export { OrgSecretShareLimitSection } from "./OrgSecretShareLimitSection";
diff --git a/frontend/src/pages/organization/SecretSharingSettingsPage/components/SecretSharingSettingsGeneralTab/SecretSharingSettingsGeneralTab.tsx b/frontend/src/pages/organization/SecretSharingSettingsPage/components/SecretSharingSettingsGeneralTab/SecretSharingSettingsGeneralTab.tsx
index ede3d9fc82..ba849507d8 100644
--- a/frontend/src/pages/organization/SecretSharingSettingsPage/components/SecretSharingSettingsGeneralTab/SecretSharingSettingsGeneralTab.tsx
+++ b/frontend/src/pages/organization/SecretSharingSettingsPage/components/SecretSharingSettingsGeneralTab/SecretSharingSettingsGeneralTab.tsx
@@ -1,9 +1,11 @@
+import { OrgSecretShareLimitSection } from "../OrgSecretShareLimitSection";
import { SecretSharingAllowShareToAnyone } from "../SecretSharingAllowShareToAnyone";
export const SecretSharingSettingsGeneralTab = () => {
return (
<div className="w-full">
<SecretSharingAllowShareToAnyone />
+ <OrgSecretShareLimitSection />
</div>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgAuthTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgAuthTab.tsx
deleted file mode 100644
index 05d1051927..0000000000
--- a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgAuthTab.tsx
+++ /dev/null
@@ -1,201 +0,0 @@
-import { twMerge } from "tailwind-merge";
-
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
-import { Button, ContentLoader } from "@app/components/v2";
-import {
- OrgPermissionActions,
- OrgPermissionSubjects,
- useOrganization,
- useServerConfig,
- useSubscription
-} from "@app/context";
-import { withPermission } from "@app/hoc";
-import { usePopUp } from "@app/hooks";
-import { useGetLDAPConfig, useGetOIDCConfig, useGetSSOConfig } from "@app/hooks/api";
-import { LoginMethod } from "@app/hooks/api/admin/types";
-
-import { LDAPModal } from "./LDAPModal";
-import { OIDCModal } from "./OIDCModal";
-import { OrgGeneralAuthSection } from "./OrgGeneralAuthSection";
-import { OrgGenericAuthSection } from "./OrgGenericAuthSection";
-import { OrgGithubSyncSection } from "./OrgGithubSyncSection";
-import { OrgLDAPSection } from "./OrgLDAPSection";
-import { OrgOIDCSection } from "./OrgOIDCSection";
-import { OrgScimSection } from "./OrgSCIMSection";
-import { OrgSSOSection } from "./OrgSSOSection";
-import { OrgUserAccessTokenLimitSection } from "./OrgUserAccessTokenLimitSection";
-import { SSOModal } from "./SSOModal";
-
-export const OrgAuthTab = withPermission(
- () => {
- const {
- config: { enabledLoginMethods }
- } = useServerConfig();
- const { currentOrg } = useOrganization();
- const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
- "addLDAP",
- "addSSO",
- "addOIDC",
- "upgradePlan"
- ] as const);
-
- const { subscription } = useSubscription();
-
- const { data: oidcConfig, isPending: isLoadingOidcConfig } = useGetOIDCConfig(
- currentOrg?.slug ?? ""
- );
- const { data: samlConfig, isPending: isLoadingSamlConfig } = useGetSSOConfig(
- currentOrg?.id ?? ""
- );
-
- const { data: ldapConfig, isPending: isLoadingLdapConfig } = useGetLDAPConfig(
- currentOrg?.id ?? ""
- );
- const areConfigsLoading = isLoadingOidcConfig || isLoadingSamlConfig || isLoadingLdapConfig;
-
- const shouldDisplaySection = (method: LoginMethod) =>
- !enabledLoginMethods || enabledLoginMethods.includes(method);
-
- const isOidcConfigured = oidcConfig && (oidcConfig.discoveryURL || oidcConfig.issuer);
- const isSamlConfigured =
- samlConfig && (samlConfig.entryPoint || samlConfig.issuer || samlConfig.cert);
- const isLdapConfigured = ldapConfig && ldapConfig.url;
-
- const shouldShowCreateIdentityProviderView =
- !isOidcConfigured && !isSamlConfigured && !isLdapConfigured;
-
- const createIdentityProviderView = (shouldDisplaySection(LoginMethod.SAML) ||
- shouldDisplaySection(LoginMethod.OIDC) ||
- shouldDisplaySection(LoginMethod.LDAP)) && (
- <>
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
- <p className="text-xl font-semibold text-gray-200">Connect an Identity Provider</p>
- <p className="mb-2 mt-1 text-gray-400">
- Connect your identity provider to simplify user management
- </p>
- {shouldDisplaySection(LoginMethod.SAML) && (
- <div
- className={twMerge(
- "mt-4 flex items-center justify-between",
- (shouldDisplaySection(LoginMethod.OIDC) ||
- shouldDisplaySection(LoginMethod.LDAP)) &&
- "border-b border-mineshaft-500 pb-4"
- )}
- >
- <p className="text-lg text-gray-200">SAML</p>
- <Button
- colorSchema="secondary"
- onClick={() => {
- if (!subscription?.samlSSO) {
- handlePopUpOpen("upgradePlan", { feature: "SAML SSO", plan: "Pro" });
- return;
- }
-
- handlePopUpOpen("addSSO");
- }}
- >
- Connect
- </Button>
- </div>
- )}
- {shouldDisplaySection(LoginMethod.OIDC) && (
- <div
- className={twMerge(
- "mt-4 flex items-center justify-between",
- shouldDisplaySection(LoginMethod.LDAP) && "border-b border-mineshaft-500 pb-4"
- )}
- >
- <p className="text-lg text-gray-200">OIDC</p>
- <Button
- colorSchema="secondary"
- onClick={() => {
- if (!subscription?.oidcSSO) {
- handlePopUpOpen("upgradePlan", { feature: "OIDC SSO", plan: "Pro" });
- return;
- }
-
- handlePopUpOpen("addOIDC");
- }}
- >
- Connect
- </Button>
- </div>
- )}
- {shouldDisplaySection(LoginMethod.LDAP) && (
- <div className="mt-4 flex items-center justify-between">
- <p className="text-lg text-gray-200">LDAP</p>
- <Button
- colorSchema="secondary"
- onClick={() => {
- if (!subscription?.ldap) {
- handlePopUpOpen("upgradePlan", { feature: "LDAP", plan: "Enterprise" });
- return;
- }
-
- handlePopUpOpen("addLDAP");
- }}
- >
- Connect
- </Button>
- </div>
- )}
- </div>
- <SSOModal
- hideDelete
- popUp={popUp}
- handlePopUpClose={handlePopUpClose}
- handlePopUpToggle={handlePopUpToggle}
- />
- <OIDCModal
- hideDelete
- popUp={popUp}
- handlePopUpClose={handlePopUpClose}
- handlePopUpToggle={handlePopUpToggle}
- />
- <LDAPModal
- hideDelete
- popUp={popUp}
- handlePopUpClose={handlePopUpClose}
- handlePopUpToggle={handlePopUpToggle}
- />
- </>
- );
-
- if (areConfigsLoading) {
- return <ContentLoader />;
- }
-
- return (
- <>
- <OrgGenericAuthSection />
- <OrgUserAccessTokenLimitSection />
- {shouldShowCreateIdentityProviderView ? (
- createIdentityProviderView
- ) : (
- <>
- {isSamlConfigured && shouldDisplaySection(LoginMethod.SAML) && (
- <div className="mb-4 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
- <OrgGeneralAuthSection />
- <OrgSSOSection />
- </div>
- )}
- {isOidcConfigured && shouldDisplaySection(LoginMethod.OIDC) && <OrgOIDCSection />}
- {isLdapConfigured && shouldDisplaySection(LoginMethod.LDAP) && <OrgLDAPSection />}
- </>
- )}
- <OrgScimSection />
- <OrgGithubSyncSection />
- <UpgradePlanModal
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={`You can use ${
- (popUp.upgradePlan.data as { feature: string })?.feature
- } if you switch to Infisical's ${
- (popUp.upgradePlan.data as { plan: string })?.plan
- } plan.`}
- />
- </>
- );
- },
- { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.Sso }
-);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/index.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/index.tsx
deleted file mode 100644
index 537be98310..0000000000
--- a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { OrgAuthTab } from "./OrgAuthTab";
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx
index 9cd59c0adc..bb2e9ea4da 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx
@@ -4,8 +4,8 @@ import { createNotification } from "@app/components/notifications";
import { Button, DeleteActionModal } from "@app/components/v2";
import { useOrganization, useOrgPermission } from "@app/context";
import { useDeleteOrgById } from "@app/hooks/api";
+import { clearSession } from "@app/hooks/api/users/queries";
import { usePopUp } from "@app/hooks/usePopUp";
-import { navigateUserToOrg } from "@app/pages/auth/LoginPage/Login.utils";
export const OrgDeleteSection = () => {
const navigate = useNavigate();
@@ -13,9 +13,7 @@ export const OrgDeleteSection = () => {
const { membership } = useOrgPermission();
- const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
- "deleteOrg"
- ] as const);
+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["deleteOrg"] as const);
const { mutateAsync, isPending } = useDeleteOrgById();
@@ -32,9 +30,8 @@ export const OrgDeleteSection = () => {
type: "success"
});
- await navigateUserToOrg(navigate);
-
- handlePopUpClose("deleteOrg");
+ clearSession();
+ navigate({ to: "/login" });
} catch (err) {
console.error(err);
createNotification({
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgGeneralTab/OrgGeneralTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgGeneralTab/OrgGeneralTab.tsx
index 917d08be96..977201a440 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgGeneralTab/OrgGeneralTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgGeneralTab/OrgGeneralTab.tsx
@@ -3,14 +3,18 @@ import { useOrgPermission } from "@app/context";
import { OrgDeleteSection } from "../OrgDeleteSection";
import { OrgIncidentContactsSection } from "../OrgIncidentContactsSection";
import { OrgNameChangeSection } from "../OrgNameChangeSection";
+import { OrgProductSelectSection } from "../OrgProductSelectSection";
export const OrgGeneralTab = () => {
const { membership } = useOrgPermission();
return (
- <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
- <OrgNameChangeSection />
- <OrgIncidentContactsSection />
- {membership && membership.role === "admin" && <OrgDeleteSection />}
- </div>
+ <>
+ <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
+ <OrgNameChangeSection />
+ <OrgIncidentContactsSection />
+ {membership && membership.role === "admin" && <OrgDeleteSection />}
+ </div>
+ {membership && membership.role === "admin" && <OrgProductSelectSection />}
+ </>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/OrgProductSelectSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/OrgProductSelectSection.tsx
new file mode 100644
index 0000000000..e9267d8974
--- /dev/null
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/OrgProductSelectSection.tsx
@@ -0,0 +1,105 @@
+import { useEffect, useState } from "react";
+import axios from "axios";
+
+import { createNotification } from "@app/components/notifications";
+import { Switch } from "@app/components/v2";
+import { useOrganization } from "@app/context";
+import { useUpdateOrg } from "@app/hooks/api";
+
+export const OrgProductSelectSection = () => {
+ const [toggledProducts, setToggledProducts] = useState<{
+ [key: string]: { name: string; enabled: boolean };
+ }>({
+ secretsProductEnabled: {
+ name: "Secret Management",
+ enabled: true
+ },
+ pkiProductEnabled: {
+ name: "Certificate Management",
+ enabled: true
+ },
+ kmsProductEnabled: {
+ name: "KMS",
+ enabled: true
+ },
+ sshProductEnabled: {
+ name: "SSH",
+ enabled: true
+ },
+ scannerProductEnabled: {
+ name: "Scanner",
+ enabled: true
+ },
+ shareSecretsProductEnabled: {
+ name: "Share Secrets",
+ enabled: true
+ }
+ });
+
+ const [isLoading, setIsLoading] = useState(false);
+
+ const { currentOrg } = useOrganization();
+ const { mutateAsync } = useUpdateOrg();
+
+ useEffect(() => {
+ Object.entries(currentOrg).forEach(([key, value]) => {
+ if (key in toggledProducts && typeof value === "boolean") {
+ setToggledProducts((products) => ({
+ ...products,
+ [key]: { ...products[key], enabled: value }
+ }));
+ }
+ });
+ }, [currentOrg]);
+
+ const onProductToggle = async (value: boolean, key: string) => {
+ setIsLoading(true);
+
+ setToggledProducts((products) => ({
+ ...products,
+ [key]: { ...products[key], enabled: value }
+ }));
+
+ try {
+ await mutateAsync({
+ orgId: currentOrg.id,
+ [key]: value
+ });
+ } catch (e) {
+ if (axios.isAxiosError(e)) {
+ const { message = "Something went wrong" } = e.response?.data as { message: string };
+ createNotification({
+ type: "error",
+ text: message
+ });
+ }
+ }
+
+ setIsLoading(false);
+ };
+
+ return (
+ <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-6 py-5">
+ <h2 className="text-xl font-semibold text-mineshaft-100">Enabled Products</h2>
+ <p className="mb-4 text-gray-400">
+ Select which products are available for your organization.
+ </p>
+
+ <div className="grid grid-cols-2 gap-3">
+ {Object.entries(toggledProducts).map(([key, product]) => (
+ <Switch
+ key={key}
+ id={`enable-${key}`}
+ isDisabled={isLoading}
+ onCheckedChange={(value) => onProductToggle(value, key)}
+ isChecked={product.enabled}
+ className="ml-0"
+ containerClassName="flex-row-reverse gap-3 w-fit"
+ >
+ {product.name}
+ </Switch>
+ ))}
+ </div>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/index.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/index.tsx
new file mode 100644
index 0000000000..fb1bdbb29e
--- /dev/null
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProductSelectSection/index.tsx
@@ -0,0 +1 @@
+export { OrgProductSelectSection } from "./OrgProductSelectSection";
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGenericAuthSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgGenericAuthSection.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGenericAuthSection.tsx
rename to frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgGenericAuthSection.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgSecurityTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgSecurityTab.tsx
new file mode 100644
index 0000000000..981681b7da
--- /dev/null
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgSecurityTab.tsx
@@ -0,0 +1,35 @@
+import { Link } from "@tanstack/react-router";
+
+import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";
+import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
+import { withPermission } from "@app/hoc";
+
+import { OrgGenericAuthSection } from "./OrgGenericAuthSection";
+import { OrgUserAccessTokenLimitSection } from "./OrgUserAccessTokenLimitSection";
+
+export const OrgSecurityTab = withPermission(
+ () => {
+ return (
+ <>
+ <NoticeBannerV2
+ className="mx-auto mb-4"
+ titleClassName="text-base"
+ title="Single Sign-On (SSO) Settings"
+ >
+ <p className="mt-1 text-mineshaft-300">
+ SSO Settings have been relocated:{" "}
+ <Link
+ className="text-mineshaft-200 underline underline-offset-2"
+ to="/organization/sso"
+ >
+ Click here to view SSO Settings
+ </Link>
+ </p>
+ </NoticeBannerV2>
+ <OrgGenericAuthSection />
+ <OrgUserAccessTokenLimitSection />
+ </>
+ );
+ },
+ { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.Sso }
+);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgUserAccessTokenLimitSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgUserAccessTokenLimitSection.tsx
similarity index 58%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgUserAccessTokenLimitSection.tsx
rename to frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgUserAccessTokenLimitSection.tsx
index 43e72bd419..58a91e90e7 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgUserAccessTokenLimitSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgUserAccessTokenLimitSection.tsx
@@ -86,72 +86,69 @@ export const OrgUserAccessTokenLimitSection = () => {
];
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <div className="mb-4 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
<div className="flex w-full items-center justify-between">
- <p className="text-xl font-semibold">User Token Expiration</p>
+ <p className="text-xl font-semibold">Session Length</p>
</div>
<p className="mb-4 mt-2 text-sm text-gray-400">
- This defines the maximum time a user token will be valid. After this time, the user will
- need to re-authenticate.
+ Specify the duration of each login session for users in this organization.
</p>
<OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Settings}>
{(isAllowed) => (
<form onSubmit={handleSubmit(handleUserTokenExpirationSubmit)} autoComplete="off">
- <div className="flex max-w-md gap-4">
- <div className="flex-1">
- <Controller
- control={control}
- name="expirationValue"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Expiration value"
- >
- <Input
- {...field}
- type="number"
- min={1}
- step={1}
- value={field.value}
- onChange={(e) => field.onChange(parseInt(e.target.value, 10))}
- disabled={!isAllowed}
- />
- </FormControl>
- )}
- />
- </div>
- <div className="flex-1">
- <Controller
- control={control}
- name="expirationUnit"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Time unit"
+ <div className="flex max-w-sm gap-4">
+ <Controller
+ control={control}
+ name="expirationValue"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Expiration value"
+ className="w-full"
+ >
+ <Input
+ {...field}
+ type="number"
+ min={1}
+ step={1}
+ value={field.value}
+ onChange={(e) => field.onChange(parseInt(e.target.value, 10))}
+ disabled={!isAllowed}
+ />
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ control={control}
+ name="expirationUnit"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Time unit"
+ >
+ <Select
+ value={field.value}
+ className="pr-2"
+ onValueChange={field.onChange}
+ placeholder="Select time unit"
+ isDisabled={!isAllowed}
>
- <Select
- value={field.value}
- className="pr-2"
- onValueChange={field.onChange}
- placeholder="Select time unit"
- isDisabled={!isAllowed}
- >
- {timeUnits.map(({ value, label }) => (
- <SelectItem
- key={value}
- value={value}
- className="relative py-2 pl-6 pr-8 text-sm hover:bg-mineshaft-700"
- >
- <div className="ml-3 font-medium">{label}</div>
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- </div>
+ {timeUnits.map(({ value, label }) => (
+ <SelectItem
+ key={value}
+ value={value}
+ className="relative py-2 pl-6 pr-8 text-sm hover:bg-mineshaft-700"
+ >
+ <div className="ml-3 font-medium">{label}</div>
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
</div>
<Button
colorSchema="secondary"
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/index.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/index.tsx
new file mode 100644
index 0000000000..565772a72e
--- /dev/null
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/index.tsx
@@ -0,0 +1 @@
+export * from "./OrgSecurityTab";
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx
index 31f8efb0c1..e5532838c4 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx
@@ -1,17 +1,19 @@
import { useState } from "react";
-import { useSearch } from "@tanstack/react-router";
+import { DotLottieReact } from "@lottiefiles/dotlottie-react";
+import { Link, useSearch } from "@tanstack/react-router";
import { Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";
import { ROUTE_PATHS } from "@app/const/routes";
+import { ProjectType } from "@app/hooks/api/workspace/types";
import { AuditLogStreamsTab } from "../AuditLogStreamTab";
import { ImportTab } from "../ImportTab";
import { KmipTab } from "../KmipTab/OrgKmipTab";
-import { OrgAuthTab } from "../OrgAuthTab";
import { OrgEncryptionTab } from "../OrgEncryptionTab";
import { OrgGeneralTab } from "../OrgGeneralTab";
+import { OrgSecurityTab } from "../OrgSecurityTab";
import { OrgWorkflowIntegrationTab } from "../OrgWorkflowIntegrationTab/OrgWorkflowIntegrationTab";
-import { ProjectTemplatesTab } from "../ProjectTemplatesTab";
export const OrgTabGroup = () => {
const search = useSearch({
@@ -19,7 +21,7 @@ export const OrgTabGroup = () => {
});
const tabs = [
{ name: "General", key: "tab-org-general", component: OrgGeneralTab },
- { name: "Security", key: "tab-org-security", component: OrgAuthTab },
+ { name: "Security", key: "tab-org-security", component: OrgSecurityTab },
{ name: "Encryption", key: "tab-org-encryption", component: OrgEncryptionTab },
{
name: "Workflow Integrations",
@@ -28,7 +30,64 @@ export const OrgTabGroup = () => {
},
{ name: "Audit Log Streams", key: "tag-audit-log-streams", component: AuditLogStreamsTab },
{ name: "Import", key: "tab-import", component: ImportTab },
- { name: "Project Templates", key: "project-templates", component: ProjectTemplatesTab },
+ {
+ name: "Project Templates",
+ key: "project-templates",
+ // scott: temporary, remove once users have adjusted
+ // eslint-disable-next-line react/no-unstable-nested-components
+ component: () => (
+ <div>
+ <NoticeBannerV2
+ className="mx-auto"
+ titleClassName="text-base"
+ title="Project Templates Relocated"
+ >
+ <p className="mt-1 text-mineshaft-300">
+ Project templates have been relocated and are now product specific:
+ </p>
+ <ul className="mb-1 flex gap-x-4 text-mineshaft-200">
+ {[
+ {
+ type: ProjectType.SecretManager,
+ label: "Secret Management",
+ icon: "sliding-carousel"
+ },
+ {
+ type: ProjectType.CertificateManager,
+ label: "Certificate Management",
+ icon: "note"
+ },
+ {
+ type: ProjectType.KMS,
+ label: "KMS",
+ icon: "unlock"
+ },
+ {
+ type: ProjectType.SSH,
+ label: "SSH",
+ icon: "verified"
+ }
+ ].map(({ label, type, icon }, index) => (
+ <li key={`project-template-${type}`}>
+ <Link
+ to={`/organization/${type}/settings`}
+ className="mt-1 flex items-center gap-x-2 hover:text-mineshaft-100"
+ >
+ {index !== 0 && <span className="text-mineshaft-300">•</span>}
+ <DotLottieReact
+ src={`/lotties/${icon}.json`}
+ loop
+ className="mt-0.5 h-5 w-5"
+ />{" "}
+ <span className="underline underline-offset-2">{label}</span>
+ </Link>
+ </li>
+ ))}
+ </ul>
+ </NoticeBannerV2>
+ </div>
+ )
+ },
{ name: "KMIP", key: "kmip", component: KmipTab }
];
diff --git a/frontend/src/pages/organization/SshSettingsPage/SshSettingsPage.tsx b/frontend/src/pages/organization/SshSettingsPage/SshSettingsPage.tsx
new file mode 100644
index 0000000000..c720ee0873
--- /dev/null
+++ b/frontend/src/pages/organization/SshSettingsPage/SshSettingsPage.tsx
@@ -0,0 +1,20 @@
+import { Helmet } from "react-helmet";
+
+import { ProjectSettings } from "@app/components/projects/ProjectSettings";
+import { PageHeader } from "@app/components/v2";
+
+export const SshSettingsPage = () => {
+ return (
+ <>
+ <Helmet>
+ <title>SSH Settings</title>
+ </Helmet>
+ <div className="flex w-full justify-center bg-bunker-800 text-white">
+ <div className="w-full max-w-7xl">
+ <PageHeader title="SSH Settings" />
+ <ProjectSettings />
+ </div>
+ </div>
+ </>
+ );
+};
diff --git a/frontend/src/pages/organization/SshSettingsPage/route.tsx b/frontend/src/pages/organization/SshSettingsPage/route.tsx
new file mode 100644
index 0000000000..c6c65293d2
--- /dev/null
+++ b/frontend/src/pages/organization/SshSettingsPage/route.tsx
@@ -0,0 +1,26 @@
+import { faHome } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
+
+import { SshSettingsPage } from "./SshSettingsPage";
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/organization/ssh/settings"
+)({
+ component: SshSettingsPage,
+ context: () => ({
+ breadcrumbs: [
+ {
+ label: "Products",
+ icon: () => <FontAwesomeIcon icon={faHome} />
+ },
+ {
+ label: "SSH",
+ link: linkOptions({ to: "/organization/ssh/overview" })
+ },
+ {
+ label: "Settings"
+ }
+ ]
+ })
+});
diff --git a/frontend/src/pages/organization/SsoPage/SsoPage.tsx b/frontend/src/pages/organization/SsoPage/SsoPage.tsx
new file mode 100644
index 0000000000..2ee19a56c3
--- /dev/null
+++ b/frontend/src/pages/organization/SsoPage/SsoPage.tsx
@@ -0,0 +1,21 @@
+import { Helmet } from "react-helmet";
+
+import { PageHeader } from "@app/components/v2";
+
+import { SsoTabGroup } from "./components/SsoTabGroup";
+
+export const SsoPage = () => {
+ return (
+ <>
+ <Helmet>
+ <title>Single Sign-On (SSO)</title>
+ </Helmet>
+ <div className="flex w-full justify-center bg-bunker-800 text-white">
+ <div className="w-full max-w-7xl">
+ <PageHeader title="Single Sign-On (SSO)" />
+ <SsoTabGroup />
+ </div>
+ </div>
+ </>
+ );
+};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/ExternalGroupOrgRoleMappings.tsx b/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/ExternalGroupOrgRoleMappings.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/ExternalGroupOrgRoleMappings.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/ExternalGroupOrgRoleMappings.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/GithubOrgSyncConfigModal.tsx b/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/GithubOrgSyncConfigModal.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/GithubOrgSyncConfigModal.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/GithubOrgSyncConfigModal.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGithubSyncSection.tsx b/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/OrgGithubSyncSection.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGithubSyncSection.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/OrgGithubSyncSection.tsx
diff --git a/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/OrgProvisioningTab.tsx b/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/OrgProvisioningTab.tsx
new file mode 100644
index 0000000000..43822aaff6
--- /dev/null
+++ b/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/OrgProvisioningTab.tsx
@@ -0,0 +1,17 @@
+import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
+import { withPermission } from "@app/hoc";
+
+import { OrgGithubSyncSection } from "./OrgGithubSyncSection";
+import { OrgScimSection } from "./OrgSCIMSection";
+
+export const OrgProvisioningTab = withPermission(
+ () => {
+ return (
+ <>
+ <OrgScimSection />
+ <OrgGithubSyncSection />
+ </>
+ );
+ },
+ { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.Sso }
+);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgSCIMSection.tsx b/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/OrgSCIMSection.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgSCIMSection.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/OrgSCIMSection.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/ScimTokenModal.tsx b/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/ScimTokenModal.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/ScimTokenModal.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/ScimTokenModal.tsx
diff --git a/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/index.tsx b/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/index.tsx
new file mode 100644
index 0000000000..c39b77b6ac
--- /dev/null
+++ b/frontend/src/pages/organization/SsoPage/components/OrgProvisioningTab/index.tsx
@@ -0,0 +1 @@
+export * from "./OrgProvisioningTab";
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/LDAPGroupMapModal.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/LDAPGroupMapModal.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/LDAPGroupMapModal.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgSsoTab/LDAPGroupMapModal.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/LDAPModal.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/LDAPModal.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/LDAPModal.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgSsoTab/LDAPModal.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OIDCModal.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OIDCModal.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OIDCModal.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OIDCModal.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgLDAPSection.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgLDAPSection.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgLDAPSection.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgLDAPSection.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgOIDCSection.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgOIDCSection.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgOIDCSection.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgOIDCSection.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgSSOSection.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgSSOSection.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgSSOSection.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgSSOSection.tsx
diff --git a/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgSsoTab.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgSsoTab.tsx
new file mode 100644
index 0000000000..ca27b75173
--- /dev/null
+++ b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/OrgSsoTab.tsx
@@ -0,0 +1,199 @@
+import { twMerge } from "tailwind-merge";
+
+import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { Button, ContentLoader, EmptyState } from "@app/components/v2";
+import {
+ OrgPermissionActions,
+ OrgPermissionSubjects,
+ useOrganization,
+ useServerConfig,
+ useSubscription
+} from "@app/context";
+import { withPermission } from "@app/hoc";
+import { usePopUp } from "@app/hooks";
+import { useGetLDAPConfig, useGetOIDCConfig, useGetSSOConfig } from "@app/hooks/api";
+import { LoginMethod } from "@app/hooks/api/admin/types";
+
+import { LDAPModal } from "./LDAPModal";
+import { OIDCModal } from "./OIDCModal";
+import { OrgGeneralAuthSection } from "./OrgGeneralAuthSection";
+import { OrgLDAPSection } from "./OrgLDAPSection";
+import { OrgOIDCSection } from "./OrgOIDCSection";
+import { OrgSSOSection } from "./OrgSSOSection";
+import { SSOModal } from "./SSOModal";
+
+export const OrgSsoTab = withPermission(
+ () => {
+ const {
+ config: { enabledLoginMethods }
+ } = useServerConfig();
+ const { currentOrg } = useOrganization();
+ const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
+ "addLDAP",
+ "addSSO",
+ "addOIDC",
+ "upgradePlan"
+ ] as const);
+
+ const { subscription } = useSubscription();
+
+ const { data: oidcConfig, isPending: isLoadingOidcConfig } = useGetOIDCConfig(
+ currentOrg?.slug ?? ""
+ );
+ const { data: samlConfig, isPending: isLoadingSamlConfig } = useGetSSOConfig(
+ currentOrg?.id ?? ""
+ );
+
+ const { data: ldapConfig, isPending: isLoadingLdapConfig } = useGetLDAPConfig(
+ currentOrg?.id ?? ""
+ );
+ const areConfigsLoading = isLoadingOidcConfig || isLoadingSamlConfig || isLoadingLdapConfig;
+
+ const shouldDisplaySection = (method: LoginMethod) =>
+ !enabledLoginMethods || enabledLoginMethods.includes(method);
+
+ const isOidcConfigured = oidcConfig && (oidcConfig.discoveryURL || oidcConfig.issuer);
+ const isSamlConfigured =
+ samlConfig && (samlConfig.entryPoint || samlConfig.issuer || samlConfig.cert);
+ const isLdapConfigured = ldapConfig && ldapConfig.url;
+
+ const shouldShowCreateIdentityProviderView =
+ !isOidcConfigured && !isSamlConfigured && !isLdapConfigured;
+
+ const createIdentityProviderView =
+ shouldDisplaySection(LoginMethod.SAML) ||
+ shouldDisplaySection(LoginMethod.OIDC) ||
+ shouldDisplaySection(LoginMethod.LDAP) ? (
+ <>
+ <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
+ <p className="text-xl font-semibold text-gray-200">Connect an Identity Provider</p>
+ <p className="mb-2 mt-1 text-gray-400">
+ Connect your identity provider to simplify user management
+ </p>
+ {shouldDisplaySection(LoginMethod.SAML) && (
+ <div
+ className={twMerge(
+ "mt-4 flex items-center justify-between",
+ (shouldDisplaySection(LoginMethod.OIDC) ||
+ shouldDisplaySection(LoginMethod.LDAP)) &&
+ "border-b border-mineshaft-500 pb-4"
+ )}
+ >
+ <p className="text-lg text-gray-200">SAML</p>
+ <Button
+ colorSchema="secondary"
+ onClick={() => {
+ if (!subscription?.samlSSO) {
+ handlePopUpOpen("upgradePlan", { feature: "SAML SSO", plan: "Pro" });
+ return;
+ }
+
+ handlePopUpOpen("addSSO");
+ }}
+ >
+ Connect
+ </Button>
+ </div>
+ )}
+ {shouldDisplaySection(LoginMethod.OIDC) && (
+ <div
+ className={twMerge(
+ "mt-4 flex items-center justify-between",
+ shouldDisplaySection(LoginMethod.LDAP) && "border-b border-mineshaft-500 pb-4"
+ )}
+ >
+ <p className="text-lg text-gray-200">OIDC</p>
+ <Button
+ colorSchema="secondary"
+ onClick={() => {
+ if (!subscription?.oidcSSO) {
+ handlePopUpOpen("upgradePlan", { feature: "OIDC SSO", plan: "Pro" });
+ return;
+ }
+
+ handlePopUpOpen("addOIDC");
+ }}
+ >
+ Connect
+ </Button>
+ </div>
+ )}
+ {shouldDisplaySection(LoginMethod.LDAP) && (
+ <div className="mt-4 flex items-center justify-between">
+ <p className="text-lg text-gray-200">LDAP</p>
+ <Button
+ colorSchema="secondary"
+ onClick={() => {
+ if (!subscription?.ldap) {
+ handlePopUpOpen("upgradePlan", { feature: "LDAP", plan: "Enterprise" });
+ return;
+ }
+
+ handlePopUpOpen("addLDAP");
+ }}
+ >
+ Connect
+ </Button>
+ </div>
+ )}
+ </div>
+ <SSOModal
+ hideDelete
+ popUp={popUp}
+ handlePopUpClose={handlePopUpClose}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ <OIDCModal
+ hideDelete
+ popUp={popUp}
+ handlePopUpClose={handlePopUpClose}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ <LDAPModal
+ hideDelete
+ popUp={popUp}
+ handlePopUpClose={handlePopUpClose}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ </>
+ ) : (
+ <EmptyState title="" iconSize="2x" className="!pb-10 pt-14">
+ <p className="text-center text-lg">Single Sign-On (SSO) has been disabled</p>
+ <p className="text-center">Contact your server administrator</p>
+ </EmptyState>
+ );
+
+ if (areConfigsLoading) {
+ return <ContentLoader />;
+ }
+
+ return (
+ <>
+ {shouldShowCreateIdentityProviderView ? (
+ createIdentityProviderView
+ ) : (
+ <>
+ {isSamlConfigured && shouldDisplaySection(LoginMethod.SAML) && (
+ <div className="mb-4 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
+ <OrgGeneralAuthSection />
+ <OrgSSOSection />
+ </div>
+ )}
+ {isOidcConfigured && shouldDisplaySection(LoginMethod.OIDC) && <OrgOIDCSection />}
+ {isLdapConfigured && shouldDisplaySection(LoginMethod.LDAP) && <OrgLDAPSection />}
+ </>
+ )}
+ <UpgradePlanModal
+ isOpen={popUp.upgradePlan.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
+ text={`You can use ${
+ (popUp.upgradePlan.data as { feature: string })?.feature
+ } if you switch to Infisical's ${
+ (popUp.upgradePlan.data as { plan: string })?.plan
+ } plan.`}
+ />
+ </>
+ );
+ },
+ { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.Sso }
+);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/SSOModal.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/SSOModal.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/SSOModal.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgSsoTab/SSOModal.tsx
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/SSOModalHeader.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/SSOModalHeader.tsx
similarity index 100%
rename from frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/SSOModalHeader.tsx
rename to frontend/src/pages/organization/SsoPage/components/OrgSsoTab/SSOModalHeader.tsx
diff --git a/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/index.tsx b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/index.tsx
new file mode 100644
index 0000000000..fd02ae3e36
--- /dev/null
+++ b/frontend/src/pages/organization/SsoPage/components/OrgSsoTab/index.tsx
@@ -0,0 +1 @@
+export { OrgSsoTab } from "./OrgSsoTab";
diff --git a/frontend/src/pages/organization/SsoPage/components/SsoTabGroup/SsoTabGroup.tsx b/frontend/src/pages/organization/SsoPage/components/SsoTabGroup/SsoTabGroup.tsx
new file mode 100644
index 0000000000..273265285e
--- /dev/null
+++ b/frontend/src/pages/organization/SsoPage/components/SsoTabGroup/SsoTabGroup.tsx
@@ -0,0 +1,37 @@
+import { useState } from "react";
+import { useSearch } from "@tanstack/react-router";
+
+import { Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+import { ROUTE_PATHS } from "@app/const/routes";
+
+import { OrgProvisioningTab } from "../OrgProvisioningTab";
+import { OrgSsoTab } from "../OrgSsoTab";
+
+export const SsoTabGroup = () => {
+ const search = useSearch({
+ from: ROUTE_PATHS.Organization.SsoPage.id
+ });
+ const tabs = [
+ { name: "General", key: "tab-sso-auth", component: OrgSsoTab },
+ { name: "Provisioning", key: "tab-sso-identity", component: OrgProvisioningTab }
+ ];
+
+ const [selectedTab, setSelectedTab] = useState(search.selectedTab || tabs[0].key);
+
+ return (
+ <Tabs value={selectedTab} onValueChange={setSelectedTab}>
+ <TabList>
+ {tabs.map((tab) => (
+ <Tab value={tab.key} key={tab.key}>
+ {tab.name}
+ </Tab>
+ ))}
+ </TabList>
+ {tabs.map(({ key, component: Component }) => (
+ <TabPanel value={key} key={`tab-panel-${key}`}>
+ <Component />
+ </TabPanel>
+ ))}
+ </Tabs>
+ );
+};
diff --git a/frontend/src/pages/organization/SsoPage/components/SsoTabGroup/index.tsx b/frontend/src/pages/organization/SsoPage/components/SsoTabGroup/index.tsx
new file mode 100644
index 0000000000..0aca705c8f
--- /dev/null
+++ b/frontend/src/pages/organization/SsoPage/components/SsoTabGroup/index.tsx
@@ -0,0 +1 @@
+export { SsoTabGroup } from "./SsoTabGroup";
diff --git a/frontend/src/pages/organization/SsoPage/route.tsx b/frontend/src/pages/organization/SsoPage/route.tsx
new file mode 100644
index 0000000000..c3b1445731
--- /dev/null
+++ b/frontend/src/pages/organization/SsoPage/route.tsx
@@ -0,0 +1,33 @@
+import { faHome } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { createFileRoute, linkOptions, stripSearchParams } from "@tanstack/react-router";
+import { zodValidator } from "@tanstack/zod-adapter";
+import { z } from "zod";
+
+import { SsoPage } from "./SsoPage";
+
+const SettingsPageQueryParams = z.object({
+ selectedTab: z.string().catch("")
+});
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/organization/sso"
+)({
+ component: SsoPage,
+ validateSearch: zodValidator(SettingsPageQueryParams),
+ search: {
+ middlewares: [stripSearchParams({ selectedTab: "" })]
+ },
+ context: () => ({
+ breadcrumbs: [
+ {
+ label: "Home",
+ icon: () => <FontAwesomeIcon icon={faHome} />,
+ link: linkOptions({ to: "/" })
+ },
+ {
+ label: "Single Sign-On (SSO)"
+ }
+ ]
+ })
+});
diff --git a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectRow.tsx b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectRow.tsx
index 0fbf4d2168..b3581183c9 100644
--- a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectRow.tsx
+++ b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectRow.tsx
@@ -5,8 +5,8 @@ import { useNavigate } from "@tanstack/react-router";
import { createNotification } from "@app/components/notifications";
import { IconButton, Tag, Td, Tooltip, Tr } from "@app/components/v2";
+import { formatProjectRoleName } from "@app/helpers/roles";
import { useGetUserWorkspaces } from "@app/hooks/api";
-import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { TWorkspaceUser } from "@app/hooks/api/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { OrgAccessControlTabSections } from "@app/types/org";
@@ -19,15 +19,6 @@ type Props = {
) => void;
};
-const formatRoleName = (role: string, customRoleName?: string) => {
- if (role === ProjectMembershipRole.Custom) return customRoleName;
- if (role === ProjectMembershipRole.Admin) return "Admin";
- if (role === ProjectMembershipRole.Member) return "Developer";
- if (role === ProjectMembershipRole.Viewer) return "Viewer";
- if (role === ProjectMembershipRole.NoAccess) return "No Access";
- return role;
-};
-
export const UserProjectRow = ({
membership: { id, project, user, roles },
handlePopUpOpen
@@ -73,7 +64,7 @@ export const UserProjectRow = ({
<Td>
<Tag size="xs">{project.type}</Tag>
</Td>
- <Td>{`${formatRoleName(roles[0].role, roles[0].customRoleName)}${
+ <Td>{`${formatProjectRoleName(roles[0].role, roles[0].customRoleName)}${
roles.length > 1 ? ` (+${roles.length - 1})` : ""
}`}</Td>
<Td>
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
index 0af5746769..08a17148e8 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
@@ -24,10 +24,10 @@ import {
Tooltip
} from "@app/components/v2";
import { useWorkspace } from "@app/context";
+import { formatProjectRoleName } from "@app/helpers/roles";
import { usePopUp } from "@app/hooks";
import { useGetProjectRoles, useUpdateGroupWorkspaceRole } from "@app/hooks/api";
import { TGroupMembership } from "@app/hooks/api/groups/types";
-import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { ProjectUserMembershipTemporaryMode } from "@app/hooks/api/workspace/types";
import { groupBy } from "@app/lib/fn/array";
@@ -260,12 +260,6 @@ export const GroupRoles = ({ roles = [], disableEdit = false, groupId }: TMember
}
};
- const formatRoleName = (role: string, customRoleName?: string) => {
- if (role === ProjectMembershipRole.Custom) return customRoleName;
- if (role === ProjectMembershipRole.Member) return "Developer";
- return role;
- };
-
return (
<div className="flex items-center space-x-2">
{roles
@@ -275,7 +269,7 @@ export const GroupRoles = ({ roles = [], disableEdit = false, groupId }: TMember
return (
<Tag key={id} className="capitalize">
<div className="flex items-center space-x-2">
- <div>{formatRoleName(role, customRoleName)}</div>
+ <div>{formatProjectRoleName(role, customRoleName)}</div>
{isTemporary && (
<div>
<Tooltip content={isExpired ? "Expired Temporary Access" : "Temporary Access"}>
@@ -303,7 +297,7 @@ export const GroupRoles = ({ roles = [], disableEdit = false, groupId }: TMember
return (
<Tag key={id} className="capitalize">
<div className="flex items-center space-x-2">
- <div>{formatRoleName(role, customRoleName)}</div>
+ <div>{formatProjectRoleName(role, customRoleName)}</div>
{isTemporary && (
<div>
<Tooltip
diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
index d977afd0a4..c9e5630655 100644
--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
@@ -41,11 +41,11 @@ import {
Tr
} from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { formatProjectRoleName } from "@app/helpers/roles";
import { withProjectPermission } from "@app/hoc";
import { usePagination, useResetPageHelper } from "@app/hooks";
import { useDeleteIdentityFromWorkspace, useGetWorkspaceIdentityMemberships } from "@app/hooks/api";
import { OrderByDirection } from "@app/hooks/api/generic/types";
-import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { ProjectIdentityOrderBy } from "@app/hooks/api/workspace/types";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -53,12 +53,6 @@ import { IdentityModal } from "./components/IdentityModal";
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
-const formatRoleName = (role: string, customRoleName?: string) => {
- if (role === ProjectMembershipRole.Custom) return customRoleName;
- if (role === ProjectMembershipRole.Member) return "Developer";
- if (role === ProjectMembershipRole.NoAccess) return "No access";
- return role;
-};
export const IdentityTab = withProjectPermission(
() => {
const { currentWorkspace } = useWorkspace();
@@ -286,7 +280,7 @@ export const IdentityTab = withProjectPermission(
<Tag key={roleId}>
<div className="flex items-center space-x-2">
<div className="capitalize">
- {formatRoleName(role, customRoleName)}
+ {formatProjectRoleName(role, customRoleName)}
</div>
{isTemporary && (
<div>
@@ -331,7 +325,9 @@ export const IdentityTab = withProjectPermission(
return (
<Tag key={roleId} className="capitalize">
<div className="flex items-center space-x-2">
- <div>{formatRoleName(role, customRoleName)}</div>
+ <div>
+ {formatProjectRoleName(role, customRoleName)}
+ </div>
{isTemporary && (
<div>
<Tooltip
diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx
index fd303f653c..c03f7f793e 100644
--- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MembersTable.tsx
@@ -50,19 +50,13 @@ import {
useUser,
useWorkspace
} from "@app/context";
+import { formatProjectRoleName } from "@app/helpers/roles";
import { usePagination, useResetPageHelper } from "@app/hooks";
import { useGetProjectRoles, useGetWorkspaceUsers } from "@app/hooks/api";
import { OrderByDirection } from "@app/hooks/api/generic/types";
-import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
-const formatRoleName = (role: string, customRoleName?: string) => {
- if (role === ProjectMembershipRole.Custom) return customRoleName;
- if (role === ProjectMembershipRole.Member) return "Developer";
- if (role === ProjectMembershipRole.NoAccess) return "No access";
- return role;
-};
type Props = {
handlePopUpOpen: (
@@ -343,7 +337,7 @@ export const MembersTable = ({ handlePopUpOpen }: Props) => {
<Tag key={id}>
<div className="flex items-center space-x-2">
<div className="capitalize">
- {formatRoleName(role, customRoleName)}
+ {formatProjectRoleName(role, customRoleName)}
</div>
{isTemporary && (
<div>
@@ -386,7 +380,7 @@ export const MembersTable = ({ handlePopUpOpen }: Props) => {
return (
<Tag key={id} className="capitalize">
<div className="flex items-center space-x-2">
- <div>{formatRoleName(role, customRoleName)}</div>
+ <div>{formatProjectRoleName(role, customRoleName)}</div>
{isTemporary && (
<div>
<Tooltip
diff --git a/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx b/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx
index f4bcb771a9..9f04ff7221 100644
--- a/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/ProjectRoleListTab/components/ProjectRoleList/ProjectRoleList.tsx
@@ -24,14 +24,16 @@ import {
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
import { usePopUp } from "@app/hooks";
import { useDeleteProjectRole, useGetProjectRoles } from "@app/hooks/api";
-import { TProjectRole } from "@app/hooks/api/roles/types";
+import { ProjectMembershipRole, TProjectRole } from "@app/hooks/api/roles/types";
+import { DuplicateProjectRoleModal } from "@app/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal";
import { RoleModal } from "@app/pages/project/RoleDetailsBySlugPage/components/RoleModal";
export const ProjectRoleList = () => {
const navigate = useNavigate();
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"role",
- "deleteRole"
+ "deleteRole",
+ "duplicateRole"
] as const);
const { currentWorkspace } = useWorkspace();
const projectId = currentWorkspace?.id || "";
@@ -86,7 +88,9 @@ export const ProjectRoleList = () => {
{isRolesLoading && <TableSkeleton columns={4} innerKey="org-roles" />}
{roles?.map((role) => {
const { id, name, slug } = role;
- const isNonMutatable = ["admin", "member", "viewer", "no-access"].includes(slug);
+ const isNonMutatable = Object.values(ProjectMembershipRole).includes(
+ slug as ProjectMembershipRole
+ );
return (
<Tr
@@ -137,6 +141,25 @@ export const ProjectRoleList = () => {
</DropdownMenuItem>
)}
</ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Create}
+ a={ProjectPermissionSub.Role}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("duplicateRole", role);
+ }}
+ disabled={!isAllowed}
+ >
+ Duplicate Role
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
{!isNonMutatable && (
<ProjectPermissionCan
I={ProjectPermissionActions.Delete}
@@ -179,6 +202,11 @@ export const ProjectRoleList = () => {
onClose={() => handlePopUpClose("deleteRole")}
onDeleteApproved={handleRoleDelete}
/>
+ <DuplicateProjectRoleModal
+ isOpen={popUp.duplicateRole.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("duplicateRole", isOpen)}
+ roleSlug={(popUp?.duplicateRole?.data as TProjectRole)?.slug}
+ />
</div>
);
};
diff --git a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx
index fa9500a535..d10f7be253 100644
--- a/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/ServiceTokenTab/components/ServiceTokenSection/AddServiceTokenModal.tsx
@@ -10,10 +10,6 @@ import { AxiosError } from "axios";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import {
- decryptAssymmetric,
- encryptSymmetric
-} from "@app/components/utilities/cryptography/crypto";
import {
Button,
Checkbox,
@@ -28,7 +24,7 @@ import {
} from "@app/components/v2";
import { useWorkspace } from "@app/context";
import { useToggle } from "@app/hooks";
-import { useCreateServiceToken, useGetUserWsKey } from "@app/hooks/api";
+import { useCreateServiceToken } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
const apiTokenExpiry = [
@@ -97,7 +93,6 @@ export const AddServiceTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
const [newToken, setToken] = useState("");
const [isTokenCopied, setIsTokenCopied] = useToggle(false);
- const { data: latestFileKey } = useGetUserWsKey(currentWorkspace?.id ?? "");
const createServiceToken = useCreateServiceToken();
const hasServiceToken = Boolean(newToken);
@@ -118,26 +113,13 @@ export const AddServiceTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
const onFormSubmit = async ({ name, scopes, expiresIn, permissions }: FormData) => {
try {
if (!currentWorkspace?.id) return;
- if (!latestFileKey) return;
-
- const key = decryptAssymmetric({
- ciphertext: latestFileKey.encryptedKey,
- nonce: latestFileKey.nonce,
- publicKey: latestFileKey.sender.publicKey,
- privateKey: localStorage.getItem("PRIVATE_KEY") as string
- });
const randomBytes = crypto.randomBytes(16).toString("hex");
- const { ciphertext, iv, tag } = encryptSymmetric({
- plaintext: key,
- key: randomBytes
- });
-
const { serviceToken } = await createServiceToken.mutateAsync({
- encryptedKey: ciphertext,
- iv,
- tag,
+ encryptedKey: "",
+ iv: "",
+ tag: "",
scopes,
expiresIn: Number(expiresIn),
name,
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
index 8557519c9a..14eac860dc 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityProjectAdditionalPrivilegeSection/IdentityProjectAdditionalPrivilegeModifySection.tsx
@@ -1,12 +1,6 @@
import { Controller, FormProvider, useForm } from "react-hook-form";
import { subject } from "@casl/ability";
-import {
- faCaretDown,
- faChevronLeft,
- faClock,
- faPlus,
- faSave
-} from "@fortawesome/free-solid-svg-icons";
+import { faCaretDown, faChevronLeft, faClock, faSave } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
import { format, formatDistance } from "date-fns";
@@ -18,10 +12,6 @@ import { TtlFormLabel } from "@app/components/features";
import { createNotification } from "@app/components/notifications";
import {
Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
FormControl,
FormLabel,
Input,
@@ -43,11 +33,11 @@ import {
useUpdateIdentityProjectAdditionalPrivilege
} from "@app/hooks/api";
import { IdentityProjectAdditionalPrivilegeTemporaryMode } from "@app/hooks/api/identityProjectAdditionalPrivilege/types";
+import { AddPoliciesButton } from "@app/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton";
import { GeneralPermissionPolicies } from "@app/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies";
import { PermissionEmptyState } from "@app/pages/project/RoleDetailsBySlugPage/components/PermissionEmptyState";
import {
formRolePermission2API,
- isConditionalSubjects,
PROJECT_PERMISSION_OBJECT,
projectRoleFormSchema,
rolePermission2Form
@@ -194,30 +184,6 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
}
}
- const onNewPolicy = (selectedSubject: ProjectPermissionSub) => {
- const rootPolicyValue = form.getValues(`permissions.${selectedSubject}`);
- if (rootPolicyValue && isConditionalSubjects(selectedSubject)) {
- form.setValue(
- `permissions.${selectedSubject}`,
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore-error akhilmhdh: this is because of ts collision with both
- [...rootPolicyValue, {}],
- { shouldDirty: true, shouldTouch: true }
- );
- } else {
- form.setValue(
- `permissions.${selectedSubject}`,
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore-error akhilmhdh: this is because of ts collision with both
- [{}],
- {
- shouldDirty: true,
- shouldTouch: true
- }
- );
- }
- };
-
return (
<form
onSubmit={handleSubmit(onSubmit)}
@@ -249,46 +215,17 @@ export const IdentityProjectAdditionalPrivilegeModifySection = ({
<Button
variant="outline_bg"
type="submit"
- className={twMerge("h-10 rounded-r-none", isDirty && "bg-primary text-black")}
+ className={twMerge(
+ "mr-4 h-10 border border-primary",
+ isDirty && "bg-primary text-black"
+ )}
isDisabled={isSubmitting || !isDirty || isDisabled}
isLoading={isSubmitting}
leftIcon={<FontAwesomeIcon icon={faSave} />}
>
Save
</Button>
- <DropdownMenu>
- <DropdownMenuTrigger>
- <Button
- isDisabled={isDisabled}
- className="h-10 rounded-l-none"
- variant="outline_bg"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- >
- New policy
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent className="thin-scrollbar max-h-96" align="end">
- {Object.keys(PROJECT_PERMISSION_OBJECT)
- .sort((a, b) =>
- PROJECT_PERMISSION_OBJECT[a as keyof typeof PROJECT_PERMISSION_OBJECT].title
- .toLowerCase()
- .localeCompare(
- PROJECT_PERMISSION_OBJECT[
- b as keyof typeof PROJECT_PERMISSION_OBJECT
- ].title.toLowerCase()
- )
- )
- .map((permissionSubject) => (
- <DropdownMenuItem
- key={`permission-create-${permissionSubject}`}
- className="py-3"
- onClick={() => onNewPolicy(permissionSubject as ProjectPermissionSub)}
- >
- {PROJECT_PERMISSION_OBJECT[permissionSubject as ProjectPermissionSub].title}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
+ <AddPoliciesButton isDisabled={isDisabled} />
</div>
</div>
</div>
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
index 2cf1e55674..fb12f83815 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/components/MemberProjectAdditionalPrivilegeSection/MembershipProjectAdditionalPrivilegeModifySection.tsx
@@ -1,11 +1,5 @@
import { Controller, FormProvider, useForm } from "react-hook-form";
-import {
- faCaretDown,
- faChevronLeft,
- faClock,
- faPlus,
- faSave
-} from "@fortawesome/free-solid-svg-icons";
+import { faCaretDown, faChevronLeft, faClock, faSave } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
import { format, formatDistance } from "date-fns";
@@ -17,10 +11,6 @@ import { TtlFormLabel } from "@app/components/features";
import { createNotification } from "@app/components/notifications";
import {
Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
FormControl,
FormLabel,
Input,
@@ -42,11 +32,11 @@ import {
useUpdateProjectUserAdditionalPrivilege
} from "@app/hooks/api";
import { ProjectUserAdditionalPrivilegeTemporaryMode } from "@app/hooks/api/projectUserAdditionalPrivilege/types";
+import { AddPoliciesButton } from "@app/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton";
import { GeneralPermissionPolicies } from "@app/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies";
import { PermissionEmptyState } from "@app/pages/project/RoleDetailsBySlugPage/components/PermissionEmptyState";
import {
formRolePermission2API,
- isConditionalSubjects,
PROJECT_PERMISSION_OBJECT,
projectRoleFormSchema,
rolePermission2Form
@@ -166,30 +156,6 @@ export const MembershipProjectAdditionalPrivilegeModifySection = ({
}
};
- const onNewPolicy = (selectedSubject: ProjectPermissionSub) => {
- const rootPolicyValue = form.getValues(`permissions.${selectedSubject}`);
- if (rootPolicyValue && isConditionalSubjects(selectedSubject)) {
- form.setValue(
- `permissions.${selectedSubject}`,
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore-error akhilmhdh: this is because of ts collision with both
- [...rootPolicyValue, {}],
- { shouldDirty: true, shouldTouch: true }
- );
- } else {
- form.setValue(
- `permissions.${selectedSubject}`,
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore-error akhilmhdh: this is because of ts collision with both
- [{}],
- {
- shouldDirty: true,
- shouldTouch: true
- }
- );
- }
- };
-
const privilegeTemporaryAccess = form.watch("temporaryAccess");
const isTemporary = privilegeTemporaryAccess?.isTemporary;
const isExpired =
@@ -245,46 +211,17 @@ export const MembershipProjectAdditionalPrivilegeModifySection = ({
<Button
variant="outline_bg"
type="submit"
- className={twMerge("h-10 rounded-r-none", isDirty && "bg-primary text-black")}
+ className={twMerge(
+ "mr-4 h-10 border border-primary",
+ isDirty && "bg-primary text-black"
+ )}
isDisabled={isSubmitting || !isDirty || isDisabled}
isLoading={isSubmitting}
leftIcon={<FontAwesomeIcon icon={faSave} />}
>
Save
</Button>
- <DropdownMenu>
- <DropdownMenuTrigger>
- <Button
- isDisabled={isDisabled}
- className="h-10 rounded-l-none"
- variant="outline_bg"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- >
- New policy
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent className="thin-scrollbar max-h-96" align="end">
- {Object.keys(PROJECT_PERMISSION_OBJECT)
- .sort((a, b) =>
- PROJECT_PERMISSION_OBJECT[a as keyof typeof PROJECT_PERMISSION_OBJECT].title
- .toLowerCase()
- .localeCompare(
- PROJECT_PERMISSION_OBJECT[
- b as keyof typeof PROJECT_PERMISSION_OBJECT
- ].title.toLowerCase()
- )
- )
- .map((subject) => (
- <DropdownMenuItem
- key={`permission-create-${subject}`}
- className="py-3"
- onClick={() => onNewPolicy(subject as ProjectPermissionSub)}
- >
- {PROJECT_PERMISSION_OBJECT[subject as ProjectPermissionSub].title}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
+ <AddPoliciesButton isDisabled={isDisabled} />
</div>
</div>
</div>
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/RoleDetailsBySlugPage.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/RoleDetailsBySlugPage.tsx
index cca278230e..3f5de1ca7f 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/RoleDetailsBySlugPage.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/RoleDetailsBySlugPage.tsx
@@ -17,7 +17,9 @@ import {
} from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
import { useDeleteProjectRole, useGetProjectRoleBySlug } from "@app/hooks/api";
+import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { usePopUp } from "@app/hooks/usePopUp";
+import { DuplicateProjectRoleModal } from "@app/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal";
import { ProjectAccessControlTabs } from "@app/types/project";
import { RoleDetailsSection } from "./components/RoleDetailsSection";
@@ -39,7 +41,8 @@ const Page = () => {
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"role",
- "deleteRole"
+ "deleteRole",
+ "duplicateRole"
] as const);
const onDeleteRoleSubmit = async () => {
@@ -77,7 +80,9 @@ const Page = () => {
}
};
- const isCustomRole = !["admin", "member", "viewer", "no-access"].includes(data?.slug ?? "");
+ const isCustomRole = !Object.values(ProjectMembershipRole).includes(
+ (data?.slug ?? "") as ProjectMembershipRole
+ );
return (
<div className="container mx-auto flex flex-col justify-between bg-bunker-800 text-white">
@@ -114,6 +119,24 @@ const Page = () => {
</DropdownMenuItem>
)}
</ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Create}
+ a={ProjectPermissionSub.Role}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={() => {
+ handlePopUpOpen("duplicateRole");
+ }}
+ disabled={!isAllowed}
+ >
+ Duplicate Role
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
<ProjectPermissionCan
I={ProjectPermissionActions.Delete}
a={ProjectPermissionSub.Role}
@@ -152,6 +175,11 @@ const Page = () => {
deleteKey="confirm"
onDeleteApproved={() => onDeleteRoleSubmit()}
/>
+ <DuplicateProjectRoleModal
+ isOpen={popUp.duplicateRole.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("duplicateRole", isOpen)}
+ roleSlug={roleSlug}
+ />
</div>
);
};
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx
new file mode 100644
index 0000000000..f438f50e83
--- /dev/null
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/AddPoliciesButton.tsx
@@ -0,0 +1,78 @@
+import { faAngleDown, faLayerGroup, faPlus } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuTrigger,
+ IconButton
+} from "@app/components/v2";
+import { usePopUp } from "@app/hooks";
+import { PolicySelectionModal } from "@app/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal";
+import { PolicyTemplateModal } from "@app/pages/project/RoleDetailsBySlugPage/components/PolicyTemplateModal";
+
+type Props = {
+ isDisabled?: boolean;
+};
+
+export const AddPoliciesButton = ({ isDisabled }: Props) => {
+ const { popUp, handlePopUpToggle, handlePopUpOpen, handlePopUpClose } = usePopUp([
+ "addPolicy",
+ "addPolicyOptions",
+ "applyTemplate"
+ ] as const);
+
+ return (
+ <>
+ <Button
+ className="h-10 rounded-r-none"
+ variant="outline_bg"
+ leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ isDisabled={isDisabled}
+ onClick={() => handlePopUpToggle("addPolicy")}
+ >
+ Add Policies
+ </Button>
+ <DropdownMenu
+ open={popUp.addPolicyOptions.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("addPolicyOptions", isOpen)}
+ >
+ <DropdownMenuTrigger asChild>
+ <IconButton
+ ariaLabel="Open policy template options"
+ variant="outline_bg"
+ className="rounded-l-none bg-mineshaft-600 p-3"
+ >
+ <FontAwesomeIcon icon={faAngleDown} />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent sideOffset={2} align="end">
+ <div className="flex flex-col space-y-1 p-1.5">
+ <Button
+ leftIcon={<FontAwesomeIcon icon={faLayerGroup} className="pr-2" />}
+ onClick={() => {
+ handlePopUpOpen("applyTemplate");
+ handlePopUpClose("addPolicyOptions");
+ }}
+ isDisabled={isDisabled}
+ variant="outline_bg"
+ className="h-10 text-left"
+ isFullWidth
+ >
+ Add From Template
+ </Button>
+ </div>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ <PolicySelectionModal
+ isOpen={popUp.addPolicy.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("addPolicy", isOpen)}
+ />
+ <PolicyTemplateModal
+ isOpen={popUp.applyTemplate.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("applyTemplate", isOpen)}
+ />
+ </>
+ );
+};
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx
new file mode 100644
index 0000000000..4ac54e9730
--- /dev/null
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx
@@ -0,0 +1,153 @@
+import { Controller, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { useNavigate } from "@tanstack/react-router";
+import { z } from "zod";
+
+import { createNotification } from "@app/components/notifications";
+import { Button, FormControl, Input, Modal, ModalContent, Spinner } from "@app/components/v2";
+import { useWorkspace } from "@app/context";
+import { useCreateProjectRole, useGetProjectRoleBySlug } from "@app/hooks/api";
+import { TProjectRole } from "@app/hooks/api/roles/types";
+import { slugSchema } from "@app/lib/schemas";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ roleSlug?: string;
+};
+
+const schema = z
+ .object({
+ name: z.string().min(1, "Name required"),
+ description: z.string(),
+ slug: slugSchema({ min: 1 })
+ })
+ .required();
+
+export type FormData = z.infer<typeof schema>;
+
+type ContentProps = {
+ role: TProjectRole;
+ onClose: () => void;
+};
+
+const Content = ({ role, onClose }: ContentProps) => {
+ const {
+ control,
+ handleSubmit,
+ formState: { isSubmitting }
+ } = useForm<FormData>({
+ defaultValues: {
+ name: `${role.name} Duplicate`
+ },
+ resolver: zodResolver(schema)
+ });
+
+ const { currentWorkspace } = useWorkspace();
+
+ const createRole = useCreateProjectRole();
+ const navigate = useNavigate();
+
+ const handleDuplicateRole = async (form: FormData) => {
+ const newRole = await createRole.mutateAsync({
+ projectId: currentWorkspace.id,
+ permissions: role.permissions,
+ ...form
+ });
+
+ createNotification({
+ type: "success",
+ text: "Role duplicated successfully"
+ });
+
+ navigate({
+ to: `/${currentWorkspace.type}/$projectId/roles/$roleSlug` as const,
+ params: {
+ roleSlug: newRole.slug,
+ projectId: currentWorkspace.id
+ }
+ });
+
+ onClose();
+ };
+
+ return (
+ <form onSubmit={handleSubmit(handleDuplicateRole)}>
+ <Controller
+ control={control}
+ defaultValue=""
+ name="name"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl label="Name" isError={Boolean(error)} errorText={error?.message} isRequired>
+ <Input {...field} placeholder="Billing Team" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue=""
+ name="slug"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl label="Slug" isError={Boolean(error)} errorText={error?.message} isRequired>
+ <Input {...field} placeholder="billing" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ defaultValue=""
+ name="description"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl label="Description" isError={Boolean(error)} errorText={error?.message}>
+ <Input {...field} placeholder="To manage billing" />
+ </FormControl>
+ )}
+ />
+ <div className="flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting}
+ >
+ Duplicate Role
+ </Button>
+ <Button colorSchema="secondary" variant="plain" onClick={onClose}>
+ Cancel
+ </Button>
+ </div>
+ </form>
+ );
+};
+
+export const DuplicateProjectRoleModal = ({ isOpen, onOpenChange, roleSlug }: Props) => {
+ const { currentWorkspace } = useWorkspace();
+
+ const { data: role, isPending } = useGetProjectRoleBySlug(currentWorkspace.id, roleSlug ?? "");
+
+ if (!roleSlug) return null;
+
+ return (
+ <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
+ <ModalContent
+ title="Duplicate Role"
+ subTitle="Duplicate this role to create a new role with the same permissions."
+ >
+ {/* eslint-disable-next-line no-nested-ternary */}
+ {isPending ? (
+ <div className="flex h-full flex-col items-center justify-center py-2.5">
+ <Spinner size="lg" className="text-mineshaft-500" />
+ <p className="mt-4 text-sm text-mineshaft-400">Loading Role...</p>
+ </div>
+ ) : role ? (
+ <Content role={role!} onClose={() => onOpenChange(false)} />
+ ) : (
+ <p className="w-full text-center text-red">
+ Error: could not find role with slug &#34;{roleSlug}&#34;
+ </p>
+ )}
+ </ModalContent>
+ </Modal>
+ );
+};
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx
index f0388a2f41..50b43e1016 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/GeneralPermissionPolicies.tsx
@@ -1,5 +1,5 @@
-import { cloneElement, useState } from "react";
-import { Controller, useFieldArray, useFormContext } from "react-hook-form";
+import { cloneElement, ReactNode, useState } from "react";
+import { Control, Controller, useFieldArray, useFormContext, useWatch } from "react-hook-form";
import {
faChevronDown,
faChevronRight,
@@ -29,6 +29,43 @@ type Props<T extends ProjectPermissionSub> = {
isDisabled?: boolean;
};
+type ActionProps = {
+ value: string;
+ subject: ProjectPermissionSub;
+ rootIndex: number;
+ label: ReactNode;
+ isDisabled?: boolean;
+ control: Control<TFormSchema>;
+};
+
+const ActionCheckbox = ({ value, subject, isDisabled, rootIndex, label, control }: ActionProps) => {
+ // scott: using Controller caused discrepancy between field value and actual value, this is a hacky fix
+ const fieldValue = useWatch({
+ control,
+ name: `permissions.${subject}.${rootIndex}.${value}` as any
+ });
+ const { setValue } = useFormContext();
+
+ return (
+ <div className="flex items-center justify-center">
+ <Checkbox
+ isDisabled={isDisabled}
+ isChecked={Boolean(fieldValue)}
+ onCheckedChange={(isChecked) =>
+ setValue(`permissions.${subject}.${rootIndex}.${value}`, isChecked, {
+ shouldDirty: true,
+ shouldTouch: true,
+ shouldValidate: true
+ })
+ }
+ id={`permissions.${subject}.${rootIndex}.${String(value)}`}
+ >
+ {label}
+ </Checkbox>
+ </div>
+ );
+};
+
export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchema["permissions"]>>({
subject,
actions,
@@ -41,11 +78,18 @@ export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchem
control,
name: `permissions.${subject}`
});
+
+ // scott: this is a hacky work-around to resolve bug of fields not updating UI when removed
+ const watchFields = useWatch<TFormSchema>({
+ control,
+ name: `permissions.${subject}`
+ });
+
const [isOpen, setIsOpen] = useToggle();
const [draggedItem, setDraggedItem] = useState<number | null>(null);
const [dragOverItem, setDragOverItem] = useState<number | null>(null);
- if (!fields.length) return <div />;
+ if (!watchFields || !Array.isArray(watchFields) || watchFields.length === 0) return <div />;
const handleDragStart = (_: React.DragEvent, index: number) => {
setDraggedItem(index);
@@ -114,7 +158,7 @@ export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchem
<div
key={el.id}
className={twMerge(
- "relative bg-mineshaft-800 p-5 first:rounded-t-md last:rounded-b-md",
+ "relative bg-mineshaft-800 p-5 pr-10 first:rounded-t-md last:rounded-b-md",
dragOverItem === rootIndex ? "border-2 border-blue-400" : "",
draggedItem === rootIndex ? "opacity-50" : ""
)}
@@ -179,7 +223,7 @@ export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchem
</div>
)}
</div>
- <div className="flex text-gray-300">
+ <div className="flex gap-4 text-gray-300">
<div className="w-1/4">Actions</div>
<div className="flex flex-grow flex-wrap justify-start gap-8">
{actions.map(({ label, value }, index) => {
@@ -194,25 +238,14 @@ export const GeneralPermissionPolicies = <T extends keyof NonNullable<TFormSchem
}
return (
- <Controller
+ <ActionCheckbox
key={`${el.id}-${index + 1}`}
- name={`permissions.${subject}.${rootIndex}.${value}` as any}
+ value={value}
+ label={label}
+ rootIndex={rootIndex}
control={control}
- defaultValue={false}
- render={({ field }) => {
- return (
- <div className="flex items-center justify-center">
- <Checkbox
- isDisabled={isDisabled}
- isChecked={Boolean(field.value)}
- onCheckedChange={field.onChange}
- id={`permissions.${subject}.${rootIndex}.${String(value)}`}
- >
- {label}
- </Checkbox>
- </div>
- );
- }}
+ subject={subject}
+ isDisabled={isDisabled}
/>
);
})}
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/NewPermissionRule.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/NewPermissionRule.tsx
deleted file mode 100644
index ac7978ab68..0000000000
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/NewPermissionRule.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import { Controller, useForm, useFormContext } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import {
- Button,
- Checkbox,
- FormControl,
- FormLabel,
- ModalClose,
- Select,
- SelectItem
-} from "@app/components/v2";
-import { ProjectPermissionSub } from "@app/context";
-
-import {
- isConditionalSubjects,
- PROJECT_PERMISSION_OBJECT,
- projectRoleFormSchema,
- TFormSchema
-} from "./ProjectRoleModifySection.utils";
-
-type Props = {
- onClose: () => void;
-};
-
-export const NewPermissionRule = ({ onClose }: Props) => {
- const rootForm = useFormContext<TFormSchema>();
-
- const form = useForm<{
- type: ProjectPermissionSub;
- permissions: NonNullable<TFormSchema["permissions"]>;
- }>({
- resolver: zodResolver(
- projectRoleFormSchema
- .pick({ permissions: true })
- .extend({ type: z.nativeEnum(ProjectPermissionSub) })
- ),
- defaultValues: {
- type: ProjectPermissionSub.Secrets
- }
- });
-
- const selectedSubject = form.watch("type");
-
- return (
- <div>
- <Controller
- control={form.control}
- name="type"
- defaultValue={ProjectPermissionSub.Secrets}
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl label="Subject" errorText={error?.message} isError={Boolean(error)}>
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- {Object.keys(PROJECT_PERMISSION_OBJECT).map((subject) => (
- <SelectItem value={subject} key={`permission-create-${subject}`}>
- {PROJECT_PERMISSION_OBJECT[subject as ProjectPermissionSub].title}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- <FormLabel label="Actions" className="my-2" />
- <div className="flex flex-grow flex-wrap justify-start gap-8">
- {PROJECT_PERMISSION_OBJECT?.[selectedSubject]?.actions?.map(({ label, value }) => (
- <Controller
- key={`create-permission-${selectedSubject}-${label}`}
- name={`permissions.${selectedSubject}.0.${value as any}` as any}
- control={form.control}
- defaultValue={false}
- render={({ field }) => (
- <div className="flex items-center justify-center">
- <Checkbox
- isChecked={field.value}
- onCheckedChange={field.onChange}
- id={`new-permissions.${selectedSubject}.0.${String(value)}`}
- >
- {label}
- </Checkbox>
- </div>
- )}
- />
- ))}
- </div>
- <div className="mt-8 flex space-x-4">
- <Button
- onClick={form.handleSubmit((el) => {
- const rootPolicyValue = rootForm.getValues("permissions")?.[el.type];
- if (rootPolicyValue && isConditionalSubjects(selectedSubject)) {
- rootForm.setValue(
- `permissions.${el.type}`,
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore-error akhilmhdh: this is because of ts collision with both
- [...rootPolicyValue, ...(el?.permissions[el.type] || [])],
- { shouldDirty: true, shouldTouch: true }
- );
- } else {
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore-error akhilmhdh: this is because of ts collision with both
- rootForm.setValue(`permissions.${el.type}`, el?.permissions?.[el.type], {
- shouldDirty: true,
- shouldTouch: true
- });
- }
- onClose();
- })}
- >
- Create
- </Button>
- <ModalClose asChild>
- <Button colorSchema="secondary" variant="plain">
- Cancel
- </Button>
- </ModalClose>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PkiSubscriberPermissionConditions.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PkiSubscriberPermissionConditions.tsx
new file mode 100644
index 0000000000..58840fe2f9
--- /dev/null
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PkiSubscriberPermissionConditions.tsx
@@ -0,0 +1,173 @@
+import { Controller, useFieldArray, useFormContext } from "react-hook-form";
+import { faInfoCircle, faPlus, faTrash, faWarning } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import {
+ Button,
+ FormControl,
+ IconButton,
+ Input,
+ Select,
+ SelectItem,
+ Tooltip
+} from "@app/components/v2";
+import {
+ PermissionConditionOperators,
+ ProjectPermissionSub
+} from "@app/context/ProjectPermissionContext/types";
+
+import { getConditionOperatorHelperInfo } from "./PermissionConditionHelpers";
+import { TFormSchema } from "./ProjectRoleModifySection.utils";
+
+type Props = {
+ position?: number;
+ isDisabled?: boolean;
+};
+
+export const PkiSubscriberPermissionConditions = ({ position = 0, isDisabled }: Props) => {
+ const {
+ control,
+ watch,
+ formState: { errors }
+ } = useFormContext<TFormSchema>();
+
+ const permissionSubject = ProjectPermissionSub.PkiSubscribers;
+ const items = useFieldArray({
+ control,
+ name: `permissions.${permissionSubject}.${position}.conditions`
+ });
+
+ return (
+ <div className="mt-6 border-t border-t-mineshaft-600 bg-mineshaft-800 pt-2">
+ <p className="mt-2 text-gray-300">Conditions</p>
+ <p className="text-sm text-mineshaft-400">
+ Conditions determine when a policy will be applied (always if no conditions are present).
+ </p>
+ <p className="mb-3 text-sm leading-4 text-mineshaft-400">
+ All conditions must evaluate to true for the policy to take effect.
+ </p>
+ <div className="mt-2 flex flex-col space-y-2">
+ {items.fields.map((el, index) => {
+ const condition =
+ (watch(`permissions.${permissionSubject}.${position}.conditions.${index}`) as {
+ lhs: string;
+ rhs: string;
+ operator: string;
+ }) || {};
+
+ return (
+ <div
+ key={el.id}
+ className="flex gap-2 bg-mineshaft-800 first:rounded-t-md last:rounded-b-md"
+ >
+ <div className="w-1/4">
+ <Controller
+ control={control}
+ name={`permissions.${permissionSubject}.${position}.conditions.${index}.lhs`}
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ className="mb-0"
+ >
+ <Select
+ defaultValue={field.value}
+ {...field}
+ onValueChange={(e) => field.onChange(e)}
+ className="w-full"
+ >
+ <SelectItem value="name">Name</SelectItem>
+ </Select>
+ </FormControl>
+ )}
+ />
+ </div>
+ <div className="flex w-36 items-center space-x-2">
+ <Controller
+ control={control}
+ name={`permissions.${permissionSubject}.${position}.conditions.${index}.operator`}
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ className="mb-0 flex-grow"
+ >
+ <Select
+ defaultValue={field.value}
+ {...field}
+ onValueChange={(e) => field.onChange(e)}
+ className="w-full"
+ >
+ <SelectItem value={PermissionConditionOperators.$EQ}>Equals</SelectItem>
+ <SelectItem value={PermissionConditionOperators.$GLOB}>Glob</SelectItem>
+ <SelectItem value={PermissionConditionOperators.$IN}>In</SelectItem>
+ </Select>
+ </FormControl>
+ )}
+ />
+ <Tooltip
+ asChild
+ content={getConditionOperatorHelperInfo(
+ condition?.operator as PermissionConditionOperators
+ )}
+ className="max-w-xs"
+ >
+ <FontAwesomeIcon icon={faInfoCircle} size="xs" className="text-gray-400" />
+ </Tooltip>
+ </div>
+ <div className="flex-grow">
+ <Controller
+ control={control}
+ name={`permissions.${permissionSubject}.${position}.conditions.${index}.rhs`}
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ className="mb-0 flex-grow"
+ >
+ <Input {...field} />
+ </FormControl>
+ )}
+ />
+ </div>
+ <div>
+ <IconButton
+ ariaLabel="plus"
+ variant="outline_bg"
+ className="p-2.5"
+ onClick={() => items.remove(index)}
+ >
+ <FontAwesomeIcon icon={faTrash} />
+ </IconButton>
+ </div>
+ </div>
+ );
+ })}
+ </div>
+ {errors?.permissions?.[permissionSubject]?.[position]?.conditions?.message && (
+ <div className="flex items-center space-x-2 py-2 text-sm text-gray-400">
+ <FontAwesomeIcon icon={faWarning} className="text-red" />
+ <span>{errors?.permissions?.[permissionSubject]?.[position]?.conditions?.message}</span>
+ </div>
+ )}
+ <div>
+ <Button
+ leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ variant="star"
+ size="xs"
+ className="mt-3"
+ isDisabled={isDisabled}
+ onClick={() =>
+ items.append({
+ lhs: "name",
+ operator: PermissionConditionOperators.$EQ,
+ rhs: ""
+ })
+ }
+ >
+ Add Condition
+ </Button>
+ </div>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
new file mode 100644
index 0000000000..e636bdfe46
--- /dev/null
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
@@ -0,0 +1,214 @@
+import { useState } from "react";
+import { Controller, useForm, useFormContext } from "react-hook-form";
+import { faCheck, faSearch, faXmark, faXmarkCircle } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import {
+ Button,
+ EmptyState,
+ IconButton,
+ Input,
+ Modal,
+ ModalClose,
+ ModalContent,
+ Table,
+ TableContainer,
+ TBody,
+ Td,
+ Tooltip,
+ Tr
+} from "@app/components/v2";
+import { ProjectPermissionSub } from "@app/context";
+import { useGetProjectTypeFromRoute } from "@app/hooks";
+import { ProjectType } from "@app/hooks/api/workspace/types";
+
+import {
+ isConditionalSubjects,
+ PROJECT_PERMISSION_OBJECT,
+ ProjectTypePermissionSubjects,
+ TFormSchema
+} from "./ProjectRoleModifySection.utils";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+};
+
+type ContentProps = {
+ onClose: () => void;
+};
+
+type TForm = { permissions: Record<ProjectPermissionSub, boolean> };
+
+const Content = ({ onClose }: ContentProps) => {
+ const rootForm = useFormContext<TFormSchema>();
+ const [search, setSearch] = useState("");
+ const {
+ control,
+ handleSubmit,
+ formState: { isDirty },
+ setValue,
+ reset
+ } = useForm<TForm>({
+ defaultValues: {
+ permissions: Object.fromEntries(
+ Object.values(ProjectPermissionSub).map((subject) => [subject, false])
+ )
+ }
+ });
+
+ const projectType = useGetProjectTypeFromRoute();
+
+ const filteredPolicies = Object.entries(PROJECT_PERMISSION_OBJECT)
+ .filter(
+ ([subject, { title }]) =>
+ ProjectTypePermissionSubjects[projectType ?? ProjectType.SecretManager][
+ subject as ProjectPermissionSub
+ ] && (search ? title.toLowerCase().includes(search.toLowerCase()) : true)
+ )
+ .sort((a, b) => a[1].title.localeCompare(b[1].title))
+ .map(([subject]) => subject);
+
+ const onSubmit = () =>
+ handleSubmit((form) => {
+ Object.entries(form.permissions).forEach(([subject, add]) => {
+ if (!add) return;
+
+ const type = subject as ProjectPermissionSub;
+
+ const rootPolicyValue = rootForm.getValues("permissions")?.[type];
+
+ if (rootPolicyValue && isConditionalSubjects(subject as ProjectPermissionSub)) {
+ rootForm.setValue(
+ `permissions.${type}`,
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore-error akhilmhdh: this is because of ts collision with both
+ [...rootPolicyValue, {}],
+ { shouldDirty: true, shouldTouch: true }
+ );
+ } else if (!rootPolicyValue?.length) {
+ rootForm.setValue(
+ `permissions.${type}`,
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore-error akhilmhdh: this is because of ts collision with both
+ [{}],
+ {
+ shouldDirty: true,
+ shouldTouch: true
+ }
+ );
+ }
+ });
+ onClose();
+ })();
+
+ return (
+ <>
+ <Input
+ placeholder="Search policies..."
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ leftIcon={<FontAwesomeIcon icon={faSearch} />}
+ rightIcon={
+ search ? (
+ <IconButton ariaLabel="Clear search" variant="plain" onClick={() => setSearch("")}>
+ <FontAwesomeIcon icon={faXmark} />
+ </IconButton>
+ ) : null
+ }
+ />
+ <TableContainer className="thin-scrollbar mt-4 max-h-[28rem]">
+ <div className="sticky top-0 z-30 flex justify-between border-b border-b-mineshaft-600 bg-mineshaft-800 py-3 pl-5 pr-4 font-inter text-sm font-medium text-bunker-300">
+ <span>Resource</span>
+ <div className="flex gap-2">
+ <Button
+ variant="plain"
+ className="p-0 text-mineshaft-400"
+ size="xs"
+ colorSchema="secondary"
+ onClick={() => {
+ setValue(
+ "permissions",
+ Object.fromEntries(
+ filteredPolicies.map((subject) => [subject, true])
+ ) as TForm["permissions"],
+ { shouldDirty: true }
+ );
+ }}
+ >
+ Select All
+ </Button>
+ <Tooltip content="Clear selection">
+ <IconButton
+ ariaLabel="Clear selection"
+ onClick={() => reset()}
+ variant="plain"
+ size="xs"
+ className={`text-mineshaft-400 ${!isDirty ? "pointer-events-none opacity-50" : ""} hover:text-red`}
+ isDisabled={!isDirty}
+ >
+ <FontAwesomeIcon icon={faXmarkCircle} />
+ </IconButton>
+ </Tooltip>
+ </div>
+ </div>
+ <Table>
+ <TBody>
+ {filteredPolicies.map((subject) => (
+ <Controller
+ control={control}
+ key={`permission-add-${subject}`}
+ render={({ field: { value, onChange } }) => (
+ <Tr
+ className={`${value ? "bg-mineshaft-600/30" : ""} cursor-pointer hover:bg-mineshaft-700`}
+ onClick={() => onChange(!value)}
+ >
+ <Td className={`${value ? "text-mineshaft-100" : "text-mineshaft-300"} w-full`}>
+ {PROJECT_PERMISSION_OBJECT[subject as ProjectPermissionSub].title}
+ </Td>
+ <Td>
+ {value ? <FontAwesomeIcon className="text-green" icon={faCheck} /> : null}
+ </Td>
+ </Tr>
+ )}
+ name={`permissions.${subject as ProjectPermissionSub}`}
+ />
+ ))}
+ </TBody>
+ </Table>
+ {!filteredPolicies.length && (
+ <EmptyState
+ iconSize="2x"
+ icon={faSearch}
+ className="!pb-4 !pt-8"
+ title="No policies match search"
+ />
+ )}
+ </TableContainer>
+ <div className="mt-8 flex space-x-4">
+ <Button isDisabled={!isDirty} onClick={onSubmit}>
+ Add Policies
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </>
+ );
+};
+
+export const PolicySelectionModal = ({ isOpen, onOpenChange }: Props) => {
+ return (
+ <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
+ <ModalContent
+ title="Add Policies"
+ subTitle="Select one or more policies to add to this role."
+ className="max-w-3xl"
+ >
+ <Content onClose={() => onOpenChange(false)} />
+ </ModalContent>
+ </Modal>
+ );
+};
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicyTemplateModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicyTemplateModal.tsx
new file mode 100644
index 0000000000..5f729983c1
--- /dev/null
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicyTemplateModal.tsx
@@ -0,0 +1,202 @@
+import { useState } from "react";
+import { useFormContext } from "react-hook-form";
+
+import { createNotification } from "@app/components/notifications";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+ Button,
+ Modal,
+ ModalClose,
+ ModalContent
+} from "@app/components/v2";
+import { ProjectPermissionSub } from "@app/context";
+import { useGetProjectTypeFromRoute } from "@app/hooks";
+import { ProjectType } from "@app/hooks/api/workspace/types";
+
+import {
+ PROJECT_PERMISSION_OBJECT,
+ RoleTemplate,
+ RoleTemplates,
+ TFormSchema
+} from "./ProjectRoleModifySection.utils";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+};
+
+type ContentProps = {
+ onClose: () => void;
+};
+
+const Content = ({ onClose }: ContentProps) => {
+ const rootForm = useFormContext<TFormSchema>();
+ const projectType = useGetProjectTypeFromRoute();
+
+ const [selectedTemplate, setSelectedTemplate] = useState<RoleTemplate>();
+ const [conflictingSubjects, setConflictingSubjects] = useState<ProjectPermissionSub[]>([]);
+ const [showConflictingSubjects, setShowConflictingSubjects] = useState(false);
+
+ const templates = RoleTemplates[projectType ?? ProjectType.SecretManager];
+
+ const onSubmit = (skipConflicting = false) => {
+ if (!selectedTemplate) {
+ createNotification({ type: "error", text: "Please select a template" });
+ return;
+ }
+
+ selectedTemplate.permissions.forEach(({ subject, actions }) => {
+ if (skipConflicting && conflictingSubjects.includes(subject)) return;
+
+ rootForm.setValue(
+ `permissions.${subject}`,
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore-error akhilmhdh: this is because of ts collision with both
+ [Object.fromEntries(actions.map((action) => [action, true]))],
+ {
+ shouldDirty: true,
+ shouldTouch: true,
+ shouldValidate: true
+ }
+ );
+ });
+
+ onClose();
+ };
+
+ const onApply = () => {
+ if (!selectedTemplate) {
+ createNotification({ type: "error", text: "Please select a template" });
+ return;
+ }
+
+ const conflictingPolicies: ProjectPermissionSub[] = [];
+
+ selectedTemplate.permissions.forEach(({ subject }) => {
+ const rootPolicyValue = rootForm.getValues("permissions")?.[subject];
+
+ if (rootPolicyValue?.length) {
+ conflictingPolicies.push(subject);
+ }
+ });
+
+ if (conflictingPolicies.length) {
+ setConflictingSubjects(conflictingPolicies);
+ setShowConflictingSubjects(true);
+ return;
+ }
+
+ onSubmit();
+ };
+
+ return (
+ <>
+ <Modal isOpen={showConflictingSubjects} onOpenChange={setShowConflictingSubjects}>
+ <ModalContent
+ title="Conflicting Policies"
+ subTitle="The following resources already have policies assigned to them."
+ >
+ <div className="grid grid-cols-2 gap-2 text-sm">
+ {conflictingSubjects.map((subject) => (
+ <div key={subject}>
+ <span className="text-mineshaft-200">
+ {PROJECT_PERMISSION_OBJECT[subject].title}
+ </span>
+ </div>
+ ))}
+ </div>
+ <div className="mt-8 flex space-x-4">
+ <ModalClose asChild>
+ <Button colorSchema="danger" onClick={() => onSubmit()}>
+ Overwrite Existing
+ </Button>
+ </ModalClose>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" onClick={() => onSubmit(true)}>
+ Skip Conflicting
+ </Button>
+ </ModalClose>
+ </div>
+ </ModalContent>
+ </Modal>
+ <Accordion
+ type="single"
+ value={selectedTemplate?.id}
+ onValueChange={(value) =>
+ setSelectedTemplate(templates.find((template) => template.id === value))
+ }
+ collapsible
+ className="w-full border-collapse"
+ >
+ {templates.map(({ name, description, permissions, id }) => (
+ <AccordionItem
+ key={id}
+ value={id}
+ className="m-0 border border-mineshaft-600 first:rounded-t last:rounded-b data-[state=open]:border-primary/40 data-[state=open]:bg-mineshaft-600/30"
+ >
+ <AccordionTrigger className="w-full justify-start p-4 py-8 text-mineshaft-100 hover:bg-mineshaft-700 hover:text-mineshaft-100 data-[state=open]:bg-primary/[3%] data-[state=open]:text-mineshaft-100">
+ <div className="mr-auto flex flex-col py-2 text-left">
+ <span>{name}</span>
+ <span className="text-sm leading-3 text-mineshaft-400">{description}</span>
+ </div>
+ </AccordionTrigger>
+ <AccordionContent className="border-t border-mineshaft-600">
+ <div className="thin-scrollbar max-h-[20rem] overflow-y-auto">
+ <span className="text-mineshaft-300">Grants the following permissions:</span>
+ <div className="grid grid-cols-2 gap-4 py-2">
+ {permissions
+ .map((permission) => ({
+ ...permission,
+ object: PROJECT_PERMISSION_OBJECT[permission.subject]
+ }))
+ .sort((a, b) => a.object.title.localeCompare(b.object.title))
+ .map(({ subject, actions, object }) => {
+ return (
+ <div key={subject}>
+ <span className="text-mineshaft-200">{object.title}</span>
+ <ul className="mt-1 flex list-disc flex-col gap-1 pl-4">
+ {actions.map((action) => (
+ <li key={action}>
+ {object.actions.find((a) => a.value === action)?.label}
+ </li>
+ ))}
+ </ul>
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ </AccordionContent>
+ </AccordionItem>
+ ))}
+ </Accordion>
+ <div className="mt-8 flex space-x-4">
+ <Button isDisabled={!selectedTemplate} onClick={onApply}>
+ Apply Template
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </>
+ );
+};
+
+export const PolicyTemplateModal = ({ isOpen, onOpenChange }: Props) => {
+ return (
+ <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
+ <ModalContent
+ title="Policy Templates"
+ subTitle="Select a template with prepopulated policies to get started. You can always add more policies later."
+ className="max-w-3xl"
+ >
+ <Content onClose={() => onOpenChange(false)} />
+ </ModalContent>
+ </Modal>
+ );
+};
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
index bbc304401e..ec25177a57 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
@@ -6,6 +6,7 @@ import { z } from "zod";
import { Tooltip } from "@app/components/v2";
import {
ProjectPermissionActions,
+ ProjectPermissionCertificateActions,
ProjectPermissionCmekActions,
ProjectPermissionSub
} from "@app/context";
@@ -17,6 +18,7 @@ import {
ProjectPermissionIdentityActions,
ProjectPermissionKmipActions,
ProjectPermissionMemberActions,
+ ProjectPermissionPkiSubscriberActions,
ProjectPermissionSecretActions,
ProjectPermissionSecretRotationActions,
ProjectPermissionSecretSyncActions,
@@ -25,6 +27,7 @@ import {
TPermissionConditionOperators
} from "@app/context/ProjectPermissionContext/types";
import { TProjectPermission } from "@app/hooks/api/roles/types";
+import { ProjectType } from "@app/hooks/api/workspace/types";
const GeneralPolicyActionSchema = z.object({
read: z.boolean().optional(),
@@ -33,6 +36,14 @@ const GeneralPolicyActionSchema = z.object({
create: z.boolean().optional()
});
+const CertificatePolicyActionSchema = z.object({
+ [ProjectPermissionCertificateActions.Create]: z.boolean().optional(),
+ [ProjectPermissionCertificateActions.Delete]: z.boolean().optional(),
+ [ProjectPermissionCertificateActions.Edit]: z.boolean().optional(),
+ [ProjectPermissionCertificateActions.Read]: z.boolean().optional(),
+ [ProjectPermissionCertificateActions.ReadPrivateKey]: z.boolean().optional()
+});
+
const SecretPolicyActionSchema = z.object({
[ProjectPermissionSecretActions.DescribeAndReadValue]: z.boolean().optional(), // existing read, gives both describe and read value
[ProjectPermissionSecretActions.DescribeSecret]: z.boolean().optional(),
@@ -127,6 +138,15 @@ const SshHostPolicyActionSchema = z.object({
[ProjectPermissionSshHostActions.IssueHostCert]: z.boolean().optional()
});
+const PkiSubscriberPolicyActionSchema = z.object({
+ [ProjectPermissionPkiSubscriberActions.Read]: z.boolean().optional(),
+ [ProjectPermissionPkiSubscriberActions.Create]: z.boolean().optional(),
+ [ProjectPermissionPkiSubscriberActions.Edit]: z.boolean().optional(),
+ [ProjectPermissionPkiSubscriberActions.Delete]: z.boolean().optional(),
+ [ProjectPermissionPkiSubscriberActions.IssueCert]: z.boolean().optional(),
+ [ProjectPermissionPkiSubscriberActions.ListCerts]: z.boolean().optional()
+});
+
const SecretRollbackPolicyActionSchema = z.object({
read: z.boolean().optional(),
create: z.boolean().optional()
@@ -176,7 +196,7 @@ const ConditionSchema = z
export const projectRoleFormSchema = z.object({
name: z.string().trim(),
- description: z.string().trim().optional(),
+ description: z.string().trim().nullish(),
slug: z
.string()
.trim()
@@ -225,7 +245,13 @@ export const projectRoleFormSchema = z.object({
[ProjectPermissionSub.AuditLogs]: GeneralPolicyActionSchema.array().default([]),
[ProjectPermissionSub.IpAllowList]: GeneralPolicyActionSchema.array().default([]),
[ProjectPermissionSub.CertificateAuthorities]: GeneralPolicyActionSchema.array().default([]),
- [ProjectPermissionSub.Certificates]: GeneralPolicyActionSchema.array().default([]),
+ [ProjectPermissionSub.Certificates]: CertificatePolicyActionSchema.array().default([]),
+ [ProjectPermissionSub.PkiSubscribers]: PkiSubscriberPolicyActionSchema.extend({
+ inverted: z.boolean().optional(),
+ conditions: ConditionSchema
+ })
+ .array()
+ .default([]),
[ProjectPermissionSub.PkiAlerts]: GeneralPolicyActionSchema.array().default([]),
[ProjectPermissionSub.PkiCollections]: GeneralPolicyActionSchema.array().default([]),
[ProjectPermissionSub.CertificateTemplates]: GeneralPolicyActionSchema.array().default([]),
@@ -268,6 +294,7 @@ type TConditionalFields =
| ProjectPermissionSub.SecretFolders
| ProjectPermissionSub.SecretImports
| ProjectPermissionSub.DynamicSecrets
+ | ProjectPermissionSub.PkiSubscribers
| ProjectPermissionSub.SshHosts
| ProjectPermissionSub.SecretRotation
| ProjectPermissionSub.Identity;
@@ -281,7 +308,8 @@ export const isConditionalSubjects = (
subject === ProjectPermissionSub.SecretFolders ||
subject === ProjectPermissionSub.Identity ||
subject === ProjectPermissionSub.SshHosts ||
- subject === ProjectPermissionSub.SecretRotation;
+ subject === ProjectPermissionSub.SecretRotation ||
+ subject === ProjectPermissionSub.PkiSubscribers;
const convertCaslConditionToFormOperator = (caslConditions: TPermissionCondition) => {
const formConditions: z.infer<typeof ConditionSchema> = [];
@@ -378,7 +406,6 @@ export const rolePermission2Form = (permissions: TProjectPermission[] = []) => {
ProjectPermissionSub.AuditLogs,
ProjectPermissionSub.IpAllowList,
ProjectPermissionSub.CertificateAuthorities,
- ProjectPermissionSub.Certificates,
ProjectPermissionSub.PkiAlerts,
ProjectPermissionSub.PkiCollections,
ProjectPermissionSub.CertificateTemplates,
@@ -515,6 +542,25 @@ export const rolePermission2Form = (permissions: TProjectPermission[] = []) => {
return;
}
+ if (subject === ProjectPermissionSub.Certificates) {
+ const canRead = action.includes(ProjectPermissionCertificateActions.Read);
+ const canEdit = action.includes(ProjectPermissionCertificateActions.Edit);
+ const canDelete = action.includes(ProjectPermissionCertificateActions.Delete);
+ const canCreate = action.includes(ProjectPermissionCertificateActions.Create);
+ const canReadPrivateKey = action.includes(ProjectPermissionCertificateActions.ReadPrivateKey);
+
+ if (!formVal[subject]) formVal[subject] = [{}];
+
+ // from above statement we are sure it won't be undefined
+ if (canRead) formVal[subject]![0].read = true;
+ if (canEdit) formVal[subject]![0].edit = true;
+ if (canCreate) formVal[subject]![0].create = true;
+ if (canDelete) formVal[subject]![0].delete = true;
+ if (canReadPrivateKey)
+ formVal[subject]![0][ProjectPermissionCertificateActions.ReadPrivateKey] = true;
+ return;
+ }
+
if (subject === ProjectPermissionSub.Project) {
const canEdit = action.includes(ProjectPermissionActions.Edit);
const canDelete = action.includes(ProjectPermissionActions.Delete);
@@ -695,6 +741,33 @@ export const rolePermission2Form = (permissions: TProjectPermission[] = []) => {
inverted
});
}
+
+ if (subject === ProjectPermissionSub.PkiSubscribers) {
+ if (!formVal[subject]) formVal[subject] = [];
+
+ formVal[subject]!.push({
+ [ProjectPermissionPkiSubscriberActions.Edit]: action.includes(
+ ProjectPermissionPkiSubscriberActions.Edit
+ ),
+ [ProjectPermissionPkiSubscriberActions.Delete]: action.includes(
+ ProjectPermissionPkiSubscriberActions.Delete
+ ),
+ [ProjectPermissionPkiSubscriberActions.Create]: action.includes(
+ ProjectPermissionPkiSubscriberActions.Create
+ ),
+ [ProjectPermissionPkiSubscriberActions.Read]: action.includes(
+ ProjectPermissionPkiSubscriberActions.Read
+ ),
+ [ProjectPermissionPkiSubscriberActions.IssueCert]: action.includes(
+ ProjectPermissionPkiSubscriberActions.IssueCert
+ ),
+ [ProjectPermissionPkiSubscriberActions.ListCerts]: action.includes(
+ ProjectPermissionPkiSubscriberActions.ListCerts
+ ),
+ conditions: conditions ? convertCaslConditionToFormOperator(conditions) : [],
+ inverted
+ });
+ }
});
return formVal;
@@ -857,19 +930,19 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
title: "Dynamic Secrets",
actions: [
{
- label: "Read root credentials",
+ label: "Read Root Credentials",
value: ProjectPermissionDynamicSecretActions.ReadRootCredential
},
{
- label: "Create root credentials",
+ label: "Create Root Credentials",
value: ProjectPermissionDynamicSecretActions.CreateRootCredential
},
{
- label: "Modify root credentials",
+ label: "Modify Root Credentials",
value: ProjectPermissionDynamicSecretActions.EditRootCredential
},
{
- label: "Remove root credentials",
+ label: "Remove Root Credentials",
value: ProjectPermissionDynamicSecretActions.DeleteRootCredential
},
{ label: "Manage Leases", value: ProjectPermissionDynamicSecretActions.Lease }
@@ -893,7 +966,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
actions: [{ label: "Modify", value: "edit" }]
},
[ProjectPermissionSub.Integrations]: {
- title: "Integrations",
+ title: "Native Integrations",
actions: [
{ label: "Read", value: "read" },
{ label: "Create", value: "create" },
@@ -1029,10 +1102,11 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
[ProjectPermissionSub.Certificates]: {
title: "Certificates",
actions: [
- { label: "Read", value: "read" },
- { label: "Create", value: "create" },
- { label: "Modify", value: "edit" },
- { label: "Remove", value: "delete" }
+ { label: "Read", value: ProjectPermissionCertificateActions.Read },
+ { label: "Read Private Key", value: ProjectPermissionCertificateActions.ReadPrivateKey },
+ { label: "Create", value: ProjectPermissionCertificateActions.Create },
+ { label: "Modify", value: ProjectPermissionCertificateActions.Edit },
+ { label: "Remove", value: ProjectPermissionCertificateActions.Delete }
]
},
[ProjectPermissionSub.CertificateTemplates]: {
@@ -1090,6 +1164,17 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
{ label: "Remove", value: "delete" }
]
},
+ [ProjectPermissionSub.PkiSubscribers]: {
+ title: "PKI Subscribers",
+ actions: [
+ { label: "Read", value: ProjectPermissionPkiSubscriberActions.Read },
+ { label: "Create", value: ProjectPermissionPkiSubscriberActions.Create },
+ { label: "Modify", value: ProjectPermissionPkiSubscriberActions.Edit },
+ { label: "Remove", value: ProjectPermissionPkiSubscriberActions.Delete },
+ { label: "Issue Certificate", value: ProjectPermissionPkiSubscriberActions.IssueCert },
+ { label: "List Certificates", value: ProjectPermissionPkiSubscriberActions.ListCerts }
+ ]
+ },
[ProjectPermissionSub.PkiCollections]: {
title: "PKI Collections",
actions: [
@@ -1109,7 +1194,7 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
]
},
[ProjectPermissionSub.SecretApproval]: {
- title: "Secret Protect policy",
+ title: "Secret Approval Policies",
actions: [
{ label: "Read", value: "read" },
{ label: "Create", value: "create" },
@@ -1160,25 +1245,447 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
title: "KMIP",
actions: [
{
- label: "Read clients",
+ label: "Read Clients",
value: ProjectPermissionKmipActions.ReadClients
},
{
- label: "Create clients",
+ label: "Create Clients",
value: ProjectPermissionKmipActions.CreateClients
},
{
- label: "Modify clients",
+ label: "Modify Clients",
value: ProjectPermissionKmipActions.UpdateClients
},
{
- label: "Delete clients",
+ label: "Delete Clients",
value: ProjectPermissionKmipActions.DeleteClients
},
{
- label: "Generate client certificates",
+ label: "Generate Client Certificates",
value: ProjectPermissionKmipActions.GenerateClientCertificates
}
]
}
};
+
+const SharedPermissionSubjects = {
+ [ProjectPermissionSub.AuditLogs]: true,
+ [ProjectPermissionSub.Groups]: true,
+ [ProjectPermissionSub.Member]: true,
+ [ProjectPermissionSub.Identity]: true,
+ [ProjectPermissionSub.Project]: true,
+ [ProjectPermissionSub.Role]: true,
+ [ProjectPermissionSub.Settings]: true
+};
+
+const SecretsManagerPermissionSubjects = (enabled = false) => ({
+ [ProjectPermissionSub.SecretFolders]: enabled,
+ [ProjectPermissionSub.SecretImports]: enabled,
+ [ProjectPermissionSub.DynamicSecrets]: enabled,
+ [ProjectPermissionSub.Secrets]: enabled,
+ [ProjectPermissionSub.SecretApproval]: enabled,
+ [ProjectPermissionSub.Integrations]: enabled,
+ [ProjectPermissionSub.SecretSyncs]: enabled,
+ [ProjectPermissionSub.Kms]: enabled,
+ [ProjectPermissionSub.Environments]: enabled,
+ [ProjectPermissionSub.Tags]: enabled,
+ [ProjectPermissionSub.Webhooks]: enabled,
+ [ProjectPermissionSub.IpAllowList]: enabled,
+ [ProjectPermissionSub.SecretRollback]: enabled,
+ [ProjectPermissionSub.SecretRotation]: enabled,
+ [ProjectPermissionSub.ServiceTokens]: enabled
+});
+
+const KmsPermissionSubjects = (enabled = false) => ({
+ [ProjectPermissionSub.Cmek]: enabled,
+ [ProjectPermissionSub.Kmip]: enabled
+});
+
+const CertificateManagerPermissionSubjects = (enabled = false) => ({
+ [ProjectPermissionSub.PkiCollections]: enabled,
+ [ProjectPermissionSub.PkiAlerts]: enabled,
+ [ProjectPermissionSub.PkiSubscribers]: enabled,
+ [ProjectPermissionSub.CertificateAuthorities]: enabled,
+ [ProjectPermissionSub.CertificateTemplates]: enabled,
+ [ProjectPermissionSub.Certificates]: enabled
+});
+
+const SshPermissionSubjects = (enabled = false) => ({
+ [ProjectPermissionSub.SshCertificateAuthorities]: enabled,
+ [ProjectPermissionSub.SshCertificates]: enabled,
+ [ProjectPermissionSub.SshCertificateTemplates]: enabled,
+ [ProjectPermissionSub.SshHosts]: enabled,
+ [ProjectPermissionSub.SshHostGroups]: enabled
+});
+
+// scott: this structure ensures we don't forget to add project permissions to their relevant project type
+export const ProjectTypePermissionSubjects: Record<
+ ProjectType,
+ Record<ProjectPermissionSub, boolean>
+> = {
+ [ProjectType.SecretManager]: {
+ ...SharedPermissionSubjects,
+ ...SecretsManagerPermissionSubjects(true),
+ ...KmsPermissionSubjects(),
+ ...CertificateManagerPermissionSubjects(),
+ ...SshPermissionSubjects()
+ },
+ [ProjectType.KMS]: {
+ ...SharedPermissionSubjects,
+ ...KmsPermissionSubjects(true),
+ ...SecretsManagerPermissionSubjects(),
+ ...CertificateManagerPermissionSubjects(),
+ ...SshPermissionSubjects()
+ },
+ [ProjectType.CertificateManager]: {
+ ...SharedPermissionSubjects,
+ ...CertificateManagerPermissionSubjects(true),
+ ...KmsPermissionSubjects(),
+ ...SecretsManagerPermissionSubjects(),
+ ...SshPermissionSubjects()
+ },
+ [ProjectType.SSH]: {
+ ...SharedPermissionSubjects,
+ ...SshPermissionSubjects(true),
+ ...CertificateManagerPermissionSubjects(),
+ ...KmsPermissionSubjects(),
+ ...SecretsManagerPermissionSubjects()
+ }
+};
+
+export type RoleTemplate = {
+ id: string;
+ name: string;
+ description: string;
+ permissions: { subject: ProjectPermissionSub; actions: string[] }[];
+};
+
+const projectManagerTemplate = (
+ additionalPermissions: RoleTemplate["permissions"] = []
+): RoleTemplate => ({
+ id: "project-manager",
+ name: "Project Management Policies",
+ description: "Grants access to manage project members and settings",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.AuditLogs,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.Groups,
+ actions: Object.values(ProjectPermissionGroupActions)
+ },
+ {
+ subject: ProjectPermissionSub.Member,
+ actions: Object.values(ProjectPermissionMemberActions)
+ },
+ {
+ subject: ProjectPermissionSub.Identity,
+ actions: Object.values(ProjectPermissionIdentityActions)
+ },
+ {
+ subject: ProjectPermissionSub.Project,
+ actions: [ProjectPermissionActions.Edit, ProjectPermissionActions.Delete]
+ },
+ { subject: ProjectPermissionSub.Role, actions: Object.values(ProjectPermissionActions) },
+ {
+ subject: ProjectPermissionSub.Settings,
+ actions: [ProjectPermissionActions.Read, ProjectPermissionActions.Edit]
+ },
+ ...additionalPermissions
+ ]
+});
+
+export const RoleTemplates: Record<ProjectType, RoleTemplate[]> = {
+ [ProjectType.SSH]: [
+ {
+ id: "ssh-viewer",
+ name: "SSH Viewing Policies",
+ description: "Grants read access to SSH certificates and hosts",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.SshCertificateAuthorities,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.SshCertificates,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.SshCertificateTemplates,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.SshHosts,
+ actions: [ProjectPermissionSshHostActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.SshHostGroups,
+ actions: [ProjectPermissionActions.Read]
+ }
+ ]
+ },
+ {
+ id: "ssh-cert-editor",
+ name: "SSH Certificate Editing Policies",
+ description: "Grants read and edit access to SSH certificates",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.SshCertificateAuthorities,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.SshCertificates,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.SshCertificateTemplates,
+ actions: Object.values(ProjectPermissionActions)
+ }
+ ]
+ },
+ {
+ id: "ssh-host-editor",
+ name: "SSH Host Editing Policies",
+ description: "Grants read and edit access to SSH hosts",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.SshHosts,
+ actions: Object.values(ProjectPermissionSshHostActions)
+ },
+ {
+ subject: ProjectPermissionSub.SshHostGroups,
+ actions: Object.values(ProjectPermissionActions)
+ }
+ ]
+ },
+ projectManagerTemplate()
+ ],
+ [ProjectType.KMS]: [
+ {
+ id: "kms-viewer",
+ name: "KMS Viewing Policies",
+ description: "Grants read access to KMS keys and KMIP clients",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.Cmek,
+ actions: [ProjectPermissionCmekActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.Kmip,
+ actions: [ProjectPermissionKmipActions.ReadClients]
+ }
+ ]
+ },
+ {
+ id: "key-editor",
+ name: "KMS Key Editing Policies",
+ description: "Grants read and edit access to KMS keys",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.Cmek,
+ actions: Object.values(ProjectPermissionCmekActions)
+ }
+ ]
+ },
+ {
+ id: "kmip-editor",
+ name: "KMIP Client Editing Policies",
+ description: "Grants read and edit access to KMIP clients",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.Kmip,
+ actions: Object.values(ProjectPermissionKmipActions)
+ }
+ ]
+ },
+ projectManagerTemplate()
+ ],
+ [ProjectType.CertificateManager]: [
+ {
+ id: "cert-viewer",
+ name: "Certificate Viewing Policies",
+ description: "Grants read access to certificates and related resources",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.PkiCollections,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.PkiAlerts,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.CertificateAuthorities,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.CertificateTemplates,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.Certificates,
+ actions: [
+ ProjectPermissionCertificateActions.Read,
+ ProjectPermissionCertificateActions.ReadPrivateKey
+ ]
+ }
+ ]
+ },
+ {
+ id: "cert-editor",
+ name: "Certificate Editing Policies",
+ description: "Grants read and edit access to certificates and related resources",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.PkiCollections,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.PkiAlerts,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.CertificateAuthorities,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.CertificateTemplates,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.Certificates,
+ actions: Object.values(ProjectPermissionCertificateActions)
+ }
+ ]
+ },
+ projectManagerTemplate()
+ ],
+ [ProjectType.SecretManager]: [
+ {
+ id: "secret-viewer",
+ name: "Secret Viewing Policies",
+ description: "Grants read access to secrets and related resources",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.SecretRollback,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.SecretImports,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.Secrets,
+ actions: [
+ ProjectPermissionSecretActions.DescribeSecret,
+ ProjectPermissionSecretActions.ReadValue
+ ]
+ },
+ {
+ subject: ProjectPermissionSub.DynamicSecrets,
+ actions: [ProjectPermissionDynamicSecretActions.ReadRootCredential]
+ },
+ {
+ subject: ProjectPermissionSub.Environments,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.Tags,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.SecretRotation,
+ actions: [ProjectPermissionSecretRotationActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.Integrations,
+ actions: [ProjectPermissionActions.Read]
+ },
+ {
+ subject: ProjectPermissionSub.SecretSyncs,
+ actions: [ProjectPermissionSecretSyncActions.Read]
+ }
+ ]
+ },
+ {
+ id: "secret-editor",
+ name: "Secret Editing Policies",
+ description: "Grants read and edit access to secrets and related resources",
+ permissions: [
+ {
+ subject: ProjectPermissionSub.Environments,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.DynamicSecrets,
+ actions: Object.values(ProjectPermissionDynamicSecretActions)
+ },
+ {
+ subject: ProjectPermissionSub.Secrets,
+ actions: [
+ ProjectPermissionSecretActions.DescribeSecret,
+ ProjectPermissionSecretActions.ReadValue,
+ ProjectPermissionSecretActions.Edit,
+ ProjectPermissionSecretActions.Create,
+ ProjectPermissionSecretActions.Delete
+ ]
+ },
+ {
+ subject: ProjectPermissionSub.SecretRollback,
+ actions: [ProjectPermissionActions.Read, ProjectPermissionActions.Create]
+ },
+ {
+ subject: ProjectPermissionSub.Tags,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.SecretImports,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.SecretRotation,
+ actions: Object.values(ProjectPermissionSecretRotationActions)
+ },
+ {
+ subject: ProjectPermissionSub.SecretFolders,
+ actions: [
+ ProjectPermissionActions.Create,
+ ProjectPermissionActions.Edit,
+ ProjectPermissionActions.Delete
+ ]
+ },
+ {
+ subject: ProjectPermissionSub.Integrations,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.SecretSyncs,
+ actions: Object.values(ProjectPermissionSecretSyncActions)
+ }
+ ]
+ },
+ projectManagerTemplate([
+ {
+ subject: ProjectPermissionSub.IpAllowList,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.Kms,
+ actions: [ProjectPermissionActions.Edit]
+ },
+ {
+ subject: ProjectPermissionSub.SecretApproval,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.ServiceTokens,
+ actions: Object.values(ProjectPermissionActions)
+ },
+ {
+ subject: ProjectPermissionSub.Webhooks,
+ actions: Object.values(ProjectPermissionActions)
+ }
+ ])
+ ]
+};
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleDetailsSection.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleDetailsSection.tsx
index 47a33dd4f6..48816709dd 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleDetailsSection.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleDetailsSection.tsx
@@ -6,6 +6,7 @@ import { IconButton, Tooltip } from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
import { useTimedReset } from "@app/hooks";
import { useGetProjectRoleBySlug } from "@app/hooks/api";
+import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
type Props = {
@@ -21,7 +22,9 @@ export const RoleDetailsSection = ({ roleSlug, handlePopUpOpen }: Props) => {
const { currentWorkspace } = useWorkspace();
const { data } = useGetProjectRoleBySlug(currentWorkspace?.id ?? "", roleSlug as string);
- const isCustomRole = !["admin", "member", "viewer", "no-access"].includes(data?.slug ?? "");
+ const isCustomRole = !Object.values(ProjectMembershipRole).includes(
+ (data?.slug ?? "") as ProjectMembershipRole
+ );
return data ? (
<div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx
index 25e33aed4b..2e51de9b75 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx
@@ -17,7 +17,7 @@ import { slugSchema } from "@app/lib/schemas";
const schema = z
.object({
- name: z.string(),
+ name: z.string().min(1, "Name required"),
description: z.string(),
slug: slugSchema({ min: 1 })
})
@@ -62,7 +62,7 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
if (role) {
reset({
name: role.name,
- description: role.description,
+ description: role.description || "",
slug: role.slug
});
} else {
@@ -115,12 +115,8 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
});
reset();
- } catch (err) {
- console.error(err);
- const error = err as any;
- const text =
- error?.response?.data?.message ??
- `Failed to ${popUp?.role?.data ? "update" : "create"} role`;
+ } catch {
+ const text = `Failed to ${popUp?.role?.data ? "update" : "create"} role`;
createNotification({
text,
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
index 2f46bd0650..593b40e937 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
@@ -1,36 +1,34 @@
import { useMemo } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { MongoAbility, MongoQuery, RawRuleOf } from "@casl/ability";
-import { faPlus, faSave } from "@fortawesome/free-solid-svg-icons";
+import { faSave } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { AccessTree } from "@app/components/permissions";
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger
-} from "@app/components/v2";
+import { Button } from "@app/components/v2";
import { ProjectPermissionSub, useWorkspace } from "@app/context";
import { ProjectPermissionSet } from "@app/context/ProjectPermissionContext";
import { evaluatePermissionsAbility } from "@app/helpers/permissions";
import { useGetProjectRoleBySlug, useUpdateProjectRole } from "@app/hooks/api";
+import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { ProjectType } from "@app/hooks/api/workspace/types";
+import { AddPoliciesButton } from "./AddPoliciesButton";
import { DynamicSecretPermissionConditions } from "./DynamicSecretPermissionConditions";
import { GeneralPermissionConditions } from "./GeneralPermissionConditions";
import { GeneralPermissionPolicies } from "./GeneralPermissionPolicies";
import { IdentityManagementPermissionConditions } from "./IdentityManagementPermissionConditions";
import { PermissionEmptyState } from "./PermissionEmptyState";
+import { PkiSubscriberPermissionConditions } from "./PkiSubscriberPermissionConditions";
import {
formRolePermission2API,
isConditionalSubjects,
PROJECT_PERMISSION_OBJECT,
projectRoleFormSchema,
+ ProjectTypePermissionSubjects,
rolePermission2Form,
TFormSchema
} from "./ProjectRoleModifySection.utils";
@@ -61,6 +59,10 @@ export const renderConditionalComponents = (
return <SshHostPermissionConditions isDisabled={isDisabled} />;
}
+ if (subject === ProjectPermissionSub.PkiSubscribers) {
+ return <PkiSubscriberPermissionConditions isDisabled={isDisabled} />;
+ }
+
return <GeneralPermissionConditions isDisabled={isDisabled} type={subject} />;
}
@@ -104,31 +106,9 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
}
};
- const isCustomRole = !["admin", "member", "viewer", "no-access"].includes(role?.slug ?? "");
-
- const onNewPolicy = (selectedSubject: ProjectPermissionSub) => {
- const rootPolicyValue = form.getValues(`permissions.${selectedSubject}`);
- if (rootPolicyValue && isConditionalSubjects(selectedSubject)) {
- form.setValue(
- `permissions.${selectedSubject}`,
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore-error akhilmhdh: this is because of ts collision with both
- [...rootPolicyValue, {}],
- { shouldDirty: true, shouldTouch: true }
- );
- } else {
- form.setValue(
- `permissions.${selectedSubject}`,
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore-error akhilmhdh: this is because of ts collision with both
- [{}],
- {
- shouldDirty: true,
- shouldTouch: true
- }
- );
- }
- };
+ const isCustomRole = !Object.values(ProjectMembershipRole).includes(
+ (role?.slug ?? "") as ProjectMembershipRole
+ );
const permissions = form.watch("permissions");
@@ -172,48 +152,17 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
<Button
variant="outline_bg"
type="submit"
- className={twMerge("h-10 rounded-r-none", isDirty && "bg-primary text-black")}
+ className={twMerge(
+ "mr-4 h-10 border border-primary",
+ isDirty && "bg-primary text-black"
+ )}
isDisabled={isSubmitting || !isDirty}
isLoading={isSubmitting}
leftIcon={<FontAwesomeIcon icon={faSave} />}
>
Save
</Button>
- <DropdownMenu>
- <DropdownMenuTrigger>
- <Button
- isDisabled={isDisabled}
- className="h-10 rounded-l-none"
- variant="outline_bg"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- >
- New policy
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent className="thin-scrollbar max-h-96" align="end">
- {Object.keys(PROJECT_PERMISSION_OBJECT)
- .sort((a, b) =>
- PROJECT_PERMISSION_OBJECT[
- a as keyof typeof PROJECT_PERMISSION_OBJECT
- ].title
- .toLowerCase()
- .localeCompare(
- PROJECT_PERMISSION_OBJECT[
- b as keyof typeof PROJECT_PERMISSION_OBJECT
- ].title.toLowerCase()
- )
- )
- .map((subject) => (
- <DropdownMenuItem
- key={`permission-create-${subject}`}
- className="py-3"
- onClick={() => onNewPolicy(subject as ProjectPermissionSub)}
- >
- {PROJECT_PERMISSION_OBJECT[subject as ProjectPermissionSub].title}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
+ <AddPoliciesButton isDisabled={isDisabled} />
</div>
</>
)}
@@ -221,17 +170,19 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
</div>
<div className="py-4">
{!isPending && <PermissionEmptyState />}
- {(Object.keys(PROJECT_PERMISSION_OBJECT) as ProjectPermissionSub[]).map((subject) => (
- <GeneralPermissionPolicies
- subject={subject}
- actions={PROJECT_PERMISSION_OBJECT[subject].actions}
- title={PROJECT_PERMISSION_OBJECT[subject].title}
- key={`project-permission-${subject}`}
- isDisabled={isDisabled}
- >
- {renderConditionalComponents(subject, isDisabled)}
- </GeneralPermissionPolicies>
- ))}
+ {(Object.keys(PROJECT_PERMISSION_OBJECT) as ProjectPermissionSub[])
+ .filter((subject) => ProjectTypePermissionSubjects[currentWorkspace.type][subject])
+ .map((subject) => (
+ <GeneralPermissionPolicies
+ subject={subject}
+ actions={PROJECT_PERMISSION_OBJECT[subject].actions}
+ title={PROJECT_PERMISSION_OBJECT[subject].title}
+ key={`project-permission-${subject}`}
+ isDisabled={isDisabled}
+ >
+ {renderConditionalComponents(subject, isDisabled)}
+ </GeneralPermissionPolicies>
+ ))}
</div>
</FormProvider>
</form>
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/SshHostPermissionConditions.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/SshHostPermissionConditions.tsx
index b82d86d819..85cba0d940 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/SshHostPermissionConditions.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/SshHostPermissionConditions.tsx
@@ -125,7 +125,7 @@ export const SshHostPermissionConditions = ({ position = 0, isDisabled }: Props)
errorText={error?.message}
className="mb-0 flex-grow"
>
- <Input {...field} />
+ <Input {...field} onChange={(e) => field.onChange(e.target.value.trim())} />
</FormControl>
)}
/>
diff --git a/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx b/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx
index 1869497220..53cd09f65d 100644
--- a/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx
@@ -91,7 +91,7 @@ export const ShareSecretPage = () => {
Infisical
</a>
<br />
- 156 2nd st, 3rd Floor, San Francisco, California, 94105, United States. 🇺🇸
+ 235 2nd st, San Francisco, California, 94105, United States. 🇺🇸
</p>
</div>
</div>
diff --git a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
index a2228e46b7..e347f1482f 100644
--- a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
@@ -6,7 +6,19 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, IconButton, Input, Select, SelectItem } from "@app/components/v2";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+ Button,
+ FormControl,
+ IconButton,
+ Input,
+ Select,
+ SelectItem,
+ Switch
+} from "@app/components/v2";
import { useTimedReset } from "@app/hooks";
import { useCreatePublicSharedSecret, useCreateSharedSecret } from "@app/hooks/api";
import { SecretSharingAccessType } from "@app/hooks/api/secretSharing";
@@ -33,7 +45,24 @@ const schema = z.object({
secret: z.string().min(1),
expiresIn: z.string(),
viewLimit: z.string(),
- accessType: z.nativeEnum(SecretSharingAccessType).optional()
+ accessType: z.nativeEnum(SecretSharingAccessType).optional(),
+ emails: z
+ .string()
+ .optional()
+ .refine(
+ (val) => {
+ if (!val) return true;
+ const emails = val
+ .split(",")
+ .map((email) => email.trim())
+ .filter((email) => email !== "");
+ if (emails.length > 100) return false;
+ return emails.every((email) => z.string().email().safeParse(email).success);
+ },
+ {
+ message: "Must be a comma-separated list of valid emails (max 100) or empty."
+ }
+ )
});
export type FormData = z.infer<typeof schema>;
@@ -42,14 +71,18 @@ type Props = {
isPublic: boolean; // whether or not this is a public (non-authenticated) secret sharing form
value?: string;
allowSecretSharingOutsideOrganization?: boolean;
+ maxSharedSecretLifetime?: number;
+ maxSharedSecretViewLimit?: number | null;
};
export const ShareSecretForm = ({
isPublic,
value,
- allowSecretSharingOutsideOrganization = true
+ allowSecretSharingOutsideOrganization = true,
+ maxSharedSecretLifetime,
+ maxSharedSecretViewLimit
}: Props) => {
- const [secretLink, setSecretLink] = useState("");
+ const [secretLink, setSecretLink] = useState<string | null>(null);
const [, isCopyingSecret, setCopyTextSecret] = useTimedReset<string>({
initialState: "Copy to clipboard"
});
@@ -58,6 +91,15 @@ export const ShareSecretForm = ({
const privateSharedSecretCreator = useCreateSharedSecret();
const createSharedSecret = isPublic ? publicSharedSecretCreator : privateSharedSecretCreator;
+ // Note: maxSharedSecretLifetime is in seconds
+ const filteredExpiresInOptions = maxSharedSecretLifetime
+ ? expiresInOptions.filter((v) => v.value / 1000 <= maxSharedSecretLifetime)
+ : expiresInOptions;
+
+ const filteredViewLimitOptions = maxSharedSecretViewLimit
+ ? viewLimitOptions.filter((v) => v.value > 0 && v.value <= maxSharedSecretViewLimit)
+ : viewLimitOptions;
+
const {
control,
reset,
@@ -66,7 +108,10 @@ export const ShareSecretForm = ({
} = useForm<FormData>({
resolver: zodResolver(schema),
defaultValues: {
- secret: value || ""
+ secret: value || "",
+ viewLimit: filteredViewLimitOptions[filteredViewLimitOptions.length - 1].value.toString(),
+ expiresIn:
+ filteredExpiresInOptions[Math.min(filteredExpiresInOptions.length - 1, 2)].value.toString()
}
});
@@ -76,32 +121,45 @@ export const ShareSecretForm = ({
secret,
expiresIn,
viewLimit,
- accessType
+ accessType,
+ emails
}: FormData) => {
try {
const expiresAt = new Date(new Date().getTime() + Number(expiresIn));
+ const processedEmails = emails ? emails.split(",").map((e) => e.trim()) : undefined;
+
const { id } = await createSharedSecret.mutateAsync({
name,
password,
secretValue: secret,
expiresAt,
expiresAfterViews: viewLimit === "-1" ? undefined : Number(viewLimit),
- accessType
+ accessType,
+ emails: processedEmails
});
- const link = `${window.location.origin}/shared/secret/${id}`;
+ if (processedEmails && processedEmails.length > 0) {
+ setSecretLink("");
+ createNotification({
+ text: `Shared secret link emailed to ${processedEmails.length} user(s).`,
+ type: "success"
+ });
+ } else {
+ const link = `${window.location.origin}/shared/secret/${id}`;
- setSecretLink(link);
- reset();
+ setSecretLink(link);
- navigator.clipboard.writeText(link);
- setCopyTextSecret("secret");
+ navigator.clipboard.writeText(link);
+ setCopyTextSecret("secret");
- createNotification({
- text: "Shared secret link copied to clipboard.",
- type: "success"
- });
+ createNotification({
+ text: "Shared secret link copied to clipboard.",
+ type: "success"
+ });
+ }
+
+ reset();
} catch (error) {
console.error(error);
createNotification({
@@ -111,152 +169,256 @@ export const ShareSecretForm = ({
}
};
- const hasSecretLink = Boolean(secretLink);
-
- return !hasSecretLink ? (
- <form onSubmit={handleSubmit(onFormSubmit)}>
- {!isPublic && (
+ if (secretLink === null)
+ return (
+ <form onSubmit={handleSubmit(onFormSubmit)}>
+ {!isPublic && (
+ <Controller
+ control={control}
+ name="name"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Name"
+ isOptional
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input
+ {...field}
+ placeholder="API Key"
+ type="text"
+ autoComplete="off"
+ autoCorrect="off"
+ spellCheck="false"
+ />
+ </FormControl>
+ )}
+ />
+ )}
<Controller
control={control}
- name="name"
+ name="secret"
render={({ field, fieldState: { error } }) => (
<FormControl
- label="Name (Optional)"
+ label="Your Secret"
isError={Boolean(error)}
errorText={error?.message}
+ className="mb-2"
+ isRequired
>
- <Input
+ <textarea
+ placeholder="Enter sensitive data to share via an encrypted link..."
{...field}
- placeholder="API Key"
- type="text"
- autoComplete="off"
- autoCorrect="off"
- spellCheck="false"
+ className="h-40 min-h-[70px] w-full rounded-md border border-mineshaft-600 bg-mineshaft-900 px-2 py-1.5 text-bunker-300 outline-none transition-all placeholder:text-mineshaft-400 hover:border-primary-400/30 focus:border-primary-400/50 group-hover:mr-2"
+ disabled={value !== undefined}
/>
</FormControl>
)}
/>
- )}
- <Controller
- control={control}
- name="secret"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Your Secret"
- isError={Boolean(error)}
- errorText={error?.message}
- className="mb-2"
- isRequired
- >
- <textarea
- placeholder="Enter sensitive data to share via an encrypted link..."
- {...field}
- className="h-40 min-h-[70px] w-full rounded-md border border-mineshaft-600 bg-mineshaft-900 px-2 py-1.5 text-bunker-300 outline-none transition-all placeholder:text-mineshaft-400 hover:border-primary-400/30 focus:border-primary-400/50 group-hover:mr-2"
- disabled={value !== undefined}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="password"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password"
- isError={Boolean(error)}
- errorText={error?.message}
- isOptional
- >
- <Input
- {...field}
- placeholder="Password"
- type="password"
- autoComplete="new-password"
- autoCorrect="off"
- spellCheck="false"
- aria-autocomplete="none"
- data-form-type="other"
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="expiresIn"
- defaultValue="3600000"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl label="Expires In" errorText={error?.message} isError={Boolean(error)}>
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- {expiresInOptions.map(({ label, value: expiresInValue }) => (
- <SelectItem value={String(expiresInValue || "")} key={label}>
- {label}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="viewLimit"
- defaultValue="-1"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl label="Max Views" errorText={error?.message} isError={Boolean(error)}>
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- {viewLimitOptions.map(({ label, value: viewLimitValue }) => (
- <SelectItem value={String(viewLimitValue || "")} key={label}>
- {label}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- {!isPublic && (
<Controller
control={control}
- name="accessType"
- defaultValue={SecretSharingAccessType.Organization}
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl label="General Access" errorText={error?.message} isError={Boolean(error)}>
- <Select
- defaultValue={field.value}
+ name="password"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Password"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ isOptional
+ >
+ <Input
{...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- {allowSecretSharingOutsideOrganization && (
- <SelectItem value={SecretSharingAccessType.Anyone}>Anyone</SelectItem>
- )}
- <SelectItem value={SecretSharingAccessType.Organization}>
- People within your organization
- </SelectItem>
- </Select>
+ placeholder="Password"
+ type="password"
+ autoComplete="new-password"
+ autoCorrect="off"
+ spellCheck="false"
+ aria-autocomplete="none"
+ data-form-type="other"
+ />
</FormControl>
)}
/>
- )}
- <Button
- className="mt-4"
- size="sm"
- type="submit"
- isLoading={isSubmitting}
- isDisabled={isSubmitting}
- >
- Create Secret Link
- </Button>
- </form>
- ) : (
+
+ {!isPublic && (
+ <Controller
+ control={control}
+ name="accessType"
+ defaultValue={SecretSharingAccessType.Organization}
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ <FormControl
+ helperText={
+ allowSecretSharingOutsideOrganization ? undefined : (
+ <span className="text-red-500">Feature enforced by organization</span>
+ )
+ }
+ errorText={error?.message}
+ isError={Boolean(error)}
+ >
+ <Switch
+ className={`ml-0 mr-2 bg-mineshaft-400/50 shadow-inner data-[state=checked]:bg-primary ${!allowSecretSharingOutsideOrganization ? "opacity-50" : ""}`}
+ thumbClassName="bg-mineshaft-800"
+ containerClassName="flex-row-reverse w-fit"
+ isChecked={
+ field.value === SecretSharingAccessType.Organization ||
+ !allowSecretSharingOutsideOrganization
+ }
+ isDisabled={!allowSecretSharingOutsideOrganization}
+ onCheckedChange={(v) =>
+ onChange(
+ v ? SecretSharingAccessType.Organization : SecretSharingAccessType.Anyone
+ )
+ }
+ id="org-access-only"
+ >
+ Limit access to people within organization
+ </Switch>
+ </FormControl>
+ )}
+ />
+ )}
+
+ <Accordion type="single" collapsible className="w-full">
+ <AccordionItem value="advance-settings" className="data-[state=open]:border-none">
+ <AccordionTrigger className="h-fit flex-none pl-1 text-sm">
+ <div className="order-1 ml-3">Advanced Settings</div>
+ </AccordionTrigger>
+ <AccordionContent childrenClassName="p-0">
+ <Controller
+ control={control}
+ name="expiresIn"
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ <FormControl
+ label="Expires In"
+ errorText={error?.message}
+ isError={Boolean(error)}
+ helperText={
+ expiresInOptions.length !== filteredExpiresInOptions.length ? (
+ <span className="text-yellow-500">
+ Limited to{" "}
+ {filteredExpiresInOptions[filteredExpiresInOptions.length - 1].label} by
+ organization
+ </span>
+ ) : undefined
+ }
+ >
+ <Select
+ defaultValue={field.value}
+ {...field}
+ onValueChange={(e) => onChange(e)}
+ className="w-full"
+ >
+ {expiresInOptions.map(({ label, value: expiresInValue }) => (
+ <SelectItem
+ value={String(expiresInValue || "")}
+ key={label}
+ isDisabled={!filteredExpiresInOptions.some((v) => v.label === label)}
+ >
+ {label}
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="viewLimit"
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ <FormControl
+ label="Max Views"
+ errorText={error?.message}
+ isError={Boolean(error)}
+ helperText={
+ viewLimitOptions.length !== filteredViewLimitOptions.length ? (
+ <span className="text-yellow-500">
+ Limited to{" "}
+ {filteredViewLimitOptions[filteredViewLimitOptions.length - 1].label} by
+ organization
+ </span>
+ ) : undefined
+ }
+ >
+ <Select
+ defaultValue={field.value}
+ {...field}
+ onValueChange={(e) => onChange(e)}
+ className="w-full"
+ >
+ {viewLimitOptions.map(({ label, value: viewLimitValue }) => (
+ <SelectItem
+ value={String(viewLimitValue || "")}
+ key={label}
+ isDisabled={!filteredViewLimitOptions.some((v) => v.label === label)}
+ >
+ {label}
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
+
+ {!isPublic && (
+ <Controller
+ control={control}
+ name="emails"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Authorized Emails"
+ isOptional
+ tooltipText="Unique secret links will be emailed to each individual. The secret will only be accessible to those links."
+ tooltipClassName="max-w-sm"
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input
+ {...field}
+ autoComplete="off"
+ />
+ </FormControl>
+ )}
+ />
+ )}
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
+
+ <div className="flex w-full justify-end">
+ <Button
+ className="mt-4"
+ size="sm"
+ type="submit"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting}
+ >
+ Create Secret Link
+ </Button>
+ </div>
+ </form>
+ );
+
+ if (secretLink === "")
+ return (
+ <>
+ <div className="mt-1 flex w-full items-center justify-center gap-2">
+ <FontAwesomeIcon icon={faCheck} className="text-green-500" />
+ <span>Shared secret link has been emailed to select users.</span>
+ </div>
+ <Button
+ className="mt-6 w-full bg-mineshaft-700 py-3 text-bunker-200"
+ colorSchema="primary"
+ variant="outline_bg"
+ size="sm"
+ onClick={() => setSecretLink(null)}
+ rightIcon={<FontAwesomeIcon icon={faRedo} className="pl-2" />}
+ >
+ Share Another Secret
+ </Button>
+ </>
+ );
+
+ return (
<>
<div className="mr-2 flex items-center justify-end rounded-md bg-white/[0.05] p-2 text-base text-gray-400">
<p className="mr-4 break-all">{secretLink}</p>
@@ -265,7 +427,7 @@ export const ShareSecretForm = ({
colorSchema="secondary"
className="group relative ml-2"
onClick={() => {
- navigator.clipboard.writeText(secretLink);
+ navigator.clipboard.writeText(secretLink || "");
setCopyTextSecret("Copied");
}}
>
@@ -277,7 +439,7 @@ export const ShareSecretForm = ({
colorSchema="primary"
variant="outline_bg"
size="sm"
- onClick={() => setSecretLink("")}
+ onClick={() => setSecretLink(null)}
rightIcon={<FontAwesomeIcon icon={faRedo} className="pl-2" />}
>
Share Another Secret
diff --git a/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx b/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx
index bce742358a..2bb5c7b0ff 100644
--- a/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx
+++ b/frontend/src/pages/public/ViewSecretRequestByIDPage/ViewSecretRequestByIDPage.tsx
@@ -175,7 +175,7 @@ export const ViewSecretRequestByIDPage = () => {
Infisical
</a>
<br />
- 156 2nd st, 3rd Floor, San Francisco, California, 94105, United States. 🇺🇸
+ 235 2nd st, San Francisco, California, 94105, United States. 🇺🇸
</p>
</div>
</div>
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
index 5112bd47ed..389aee68f3 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
@@ -38,6 +38,14 @@ export const ViewSharedSecretByIDPage = () => {
from: ROUTE_PATHS.Public.ViewSharedSecretByIDPage.id,
select: (el) => el.key
});
+ const email = useSearch({
+ from: ROUTE_PATHS.Public.ViewSharedSecretByIDPage.id,
+ select: (el) => el.email
+ });
+ const hash = useSearch({
+ from: ROUTE_PATHS.Public.ViewSharedSecretByIDPage.id,
+ select: (el) => el.hash
+ });
const [password, setPassword] = useState<string>();
const { hashedHex, key } = extractDetailsFromUrl(urlEncodedKey);
@@ -49,7 +57,9 @@ export const ViewSharedSecretByIDPage = () => {
} = useGetActiveSharedSecretById({
sharedSecretId: id,
hashedHex,
- password
+ password,
+ email,
+ hash
});
const navigate = useNavigate();
@@ -57,15 +67,16 @@ export const ViewSharedSecretByIDPage = () => {
const isUnauthorized =
((error as AxiosError)?.response?.data as { statusCode: number })?.statusCode === 401;
- const isForbidden =
- ((error as AxiosError)?.response?.data as { statusCode: number })?.statusCode === 403;
-
const isInvalidCredential =
((error as AxiosError)?.response?.data as { message: string })?.message ===
"Invalid credentials";
+ const isEmailUnauthorized =
+ ((error as AxiosError)?.response?.data as { message: string })?.message ===
+ "Email not authorized to view secret";
+
useEffect(() => {
- if (isUnauthorized && !isInvalidCredential) {
+ if (isUnauthorized && !isInvalidCredential && !isEmailUnauthorized) {
// persist current URL in session storage so that we can come back to this after successful login
sessionStorage.setItem(
SessionStorageKeys.ORG_LOGIN_SUCCESS_REDIRECT_URL,
@@ -85,10 +96,10 @@ export const ViewSharedSecretByIDPage = () => {
});
}
- if (isForbidden) {
+ if (error) {
createNotification({
type: "error",
- text: "You do not have access to this shared secret."
+ text: ((error as AxiosError)?.response?.data as { message: string })?.message
});
}
}, [error]);
@@ -195,7 +206,7 @@ export const ViewSharedSecretByIDPage = () => {
Infisical
</a>
<br />
- 156 2nd st, 3rd Floor, San Francisco, California, 94105, United States. 🇺🇸
+ 235 2nd st, San Francisco, California, 94105, United States. 🇺🇸
</p>
</div>
</div>
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/route.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/route.tsx
index 7b98dded34..7cbcb59a2e 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/route.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/route.tsx
@@ -7,7 +7,9 @@ import { authKeys, fetchAuthToken } from "@app/hooks/api/auth/queries";
import { ViewSharedSecretByIDPage } from "./ViewSharedSecretByIDPage";
const SharedSecretByIDPageQuerySchema = z.object({
- key: z.string().catch("")
+ key: z.string().catch(""),
+ email: z.string().optional(),
+ hash: z.string().optional()
});
export const Route = createFileRoute("/shared/secret/$secretId")({
diff --git a/frontend/src/pages/secret-manager/CommitDetailsPage/components/CommitDetailsTab/CommitDetailsTab.tsx b/frontend/src/pages/secret-manager/CommitDetailsPage/components/CommitDetailsTab/CommitDetailsTab.tsx
index 5e275ed156..f1810bdf76 100644
--- a/frontend/src/pages/secret-manager/CommitDetailsPage/components/CommitDetailsTab/CommitDetailsTab.tsx
+++ b/frontend/src/pages/secret-manager/CommitDetailsPage/components/CommitDetailsTab/CommitDetailsTab.tsx
@@ -5,6 +5,7 @@ import { DropdownMenuItem } from "@radix-ui/react-dropdown-menu";
import { useSearch } from "@tanstack/react-router";
import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
import {
DeleteActionModal,
DropdownMenu,
@@ -14,6 +15,10 @@ import {
Spinner
} from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
+import {
+ ProjectPermissionCommitsActions,
+ ProjectPermissionSub
+} from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
import { CommitWithChanges } from "@app/hooks/api/folderCommits";
import { useCommitRevert, useGetCommitDetails } from "@app/hooks/api/folderCommits/queries";
@@ -259,42 +264,53 @@ export const CommitDetailsTab = ({
</div>
</div>
<div className="flex items-center justify-start">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- ariaLabel="commit-options"
- variant="outline_bg"
- className="h-10 rounded border border-mineshaft-600 bg-mineshaft-800 px-4 py-2 text-sm font-medium"
- >
- <p className="mr-2">Restore Options</p>
- <FontAwesomeIcon icon={faAngleDown} />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- align="end"
- sideOffset={2}
- className="animate-in fade-in-50 zoom-in-95 min-w-[200px] p-1"
- style={{ marginTop: "0" }}
- >
- <DropdownMenuItem
- className="h-10 w-full cursor-pointer px-3 py-2 text-sm transition-colors hover:bg-mineshaft-700"
- onClick={() => goToRollbackPreview()}
- >
- <div className="flex w-full items-center justify-start">
- <span>Restore entire folder</span>
- </div>
- </DropdownMenuItem>
-
- <DropdownMenuItem
- className="h-10 w-full cursor-pointer px-3 py-2 text-sm transition-colors hover:bg-mineshaft-700"
- onClick={() => handlePopUpOpen("revertChanges")}
- >
- <div className="flex w-full items-center justify-start">
- <span>Revert commit changes</span>
- </div>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ <ProjectPermissionCan
+ I={ProjectPermissionCommitsActions.Read}
+ a={ProjectPermissionSub.Commits}
+ >
+ {(isAllowed) => (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ asChild
+ disabled={!isAllowed}
+ className={`${!isAllowed ? "cursor-not-allowed" : ""}`}
+ >
+ <IconButton
+ ariaLabel="commit-options"
+ variant="outline_bg"
+ className="h-10 rounded border border-mineshaft-600 bg-mineshaft-800 px-4 py-2 text-sm font-medium"
+ >
+ <p className="mr-2">Restore Options</p>
+ <FontAwesomeIcon icon={faAngleDown} />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ align="end"
+ sideOffset={2}
+ className="animate-in fade-in-50 zoom-in-95 min-w-[200px] p-1"
+ style={{ marginTop: "0" }}
+ >
+ <DropdownMenuItem
+ className="h-10 w-full cursor-pointer px-3 py-2 text-sm transition-colors hover:bg-mineshaft-700"
+ onClick={() => goToRollbackPreview()}
+ >
+ <div className="flex w-full items-center justify-start">
+ <span>Restore entire folder</span>
+ </div>
+ </DropdownMenuItem>
+
+ <DropdownMenuItem
+ className="h-10 w-full cursor-pointer px-3 py-2 text-sm transition-colors hover:bg-mineshaft-700"
+ onClick={() => handlePopUpOpen("revertChanges")}
+ >
+ <div className="flex w-full items-center justify-start">
+ <span>Revert commit changes</span>
+ </div>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ </ProjectPermissionCan>
</div>
</div>
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/IntegrationsListPage.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/IntegrationsListPage.tsx
index 6a1482d98e..172dda3029 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/IntegrationsListPage.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/IntegrationsListPage.tsx
@@ -1,11 +1,9 @@
import { Helmet } from "react-helmet";
import { useTranslation } from "react-i18next";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Badge, PageHeader, Tab, TabList, TabPanel, Tabs, Tooltip } from "@app/components/v2";
+import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
@@ -54,16 +52,7 @@ export const IntegrationsListPage = () => {
<Tabs value={selectedTab} onValueChange={updateSelectedTab}>
<TabList>
<Tab value={IntegrationsListPageTabs.SecretSyncs}>Secret Syncs</Tab>
- <Tab value={IntegrationsListPageTabs.NativeIntegrations}>
- Native Integrations
- <Tooltip content="Native Integrations will be deprecated in 2026. Please migrate to Secret Syncs as they become available.">
- <div>
- <Badge variant="primary" className="ml-1 cursor-pointer text-xs">
- Legacy
- </Badge>
- </div>
- </Tooltip>
- </Tab>
+ <Tab value={IntegrationsListPageTabs.NativeIntegrations}>Native Integrations</Tab>
<Tab value={IntegrationsListPageTabs.FrameworkIntegrations}>
Framework Integrations
</Tab>
@@ -81,26 +70,6 @@ export const IntegrationsListPage = () => {
</ProjectPermissionCan>
</TabPanel>
<TabPanel value={IntegrationsListPageTabs.NativeIntegrations}>
- <div className="mb-5 flex flex-col rounded-r border-l-2 border-l-primary bg-mineshaft-300/5 px-4 py-2.5">
- <div className="mb-1 flex items-center text-sm">
- <FontAwesomeIcon icon={faInfoCircle} size="sm" className="mr-1.5 text-primary" />
- Native Integrations Transitioning to Legacy Status
- </div>
- <p className="mb-2 mt-1 text-sm text-bunker-300">
- Native integrations are now a legacy feature and we will begin a phased
- deprecation in 2026. We recommend migrating to our new{" "}
- <a
- className="text-bunker-200 underline decoration-primary-700 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
- href="https://infisical.com/docs/integrations/secret-syncs/overview"
- target="_blank"
- rel="noopener noreferrer"
- >
- Secret Syncs
- </a>{" "}
- feature which offers the same functionality as Native Integrations with improved
- stability, insights, re-configurability, and customization.
- </p>
- </div>
<ProjectPermissionCan
renderGuardBanner
I={ProjectPermissionActions.Read}
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/OCIVaultSyncDestinationCol.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/OCIVaultSyncDestinationCol.tsx
new file mode 100644
index 0000000000..e6d5982699
--- /dev/null
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/OCIVaultSyncDestinationCol.tsx
@@ -0,0 +1,14 @@
+import { TOCIVaultSync } from "@app/hooks/api/secretSyncs/types/oci-vault-sync";
+
+import { getSecretSyncDestinationColValues } from "../helpers";
+import { SecretSyncTableCell } from "../SecretSyncTableCell";
+
+type Props = {
+ secretSync: TOCIVaultSync;
+};
+
+export const OCIVaultSyncDestinationCol = ({ secretSync }: Props) => {
+ const { primaryText, secondaryText } = getSecretSyncDestinationColValues(secretSync);
+
+ return <SecretSyncTableCell primaryText={primaryText} secondaryText={secondaryText} />;
+};
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/SecretSyncDestinationCol.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/SecretSyncDestinationCol.tsx
index abfbf100c4..8989808813 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/SecretSyncDestinationCol.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/SecretSyncDestinationCol.tsx
@@ -10,6 +10,7 @@ import { GcpSyncDestinationCol } from "./GcpSyncDestinationCol";
import { GitHubSyncDestinationCol } from "./GitHubSyncDestinationCol";
import { HCVaultSyncDestinationCol } from "./HCVaultSyncDestinationCol";
import { HumanitecSyncDestinationCol } from "./HumanitecSyncDestinationCol";
+import { OCIVaultSyncDestinationCol } from "./OCIVaultSyncDestinationCol";
import { TeamCitySyncDestinationCol } from "./TeamCitySyncDestinationCol";
import { TerraformCloudSyncDestinationCol } from "./TerraformCloudSyncDestinationCol";
import { VercelSyncDestinationCol } from "./VercelSyncDestinationCol";
@@ -49,6 +50,8 @@ export const SecretSyncDestinationCol = ({ secretSync }: Props) => {
return <HCVaultSyncDestinationCol secretSync={secretSync} />;
case SecretSync.TeamCity:
return <TeamCitySyncDestinationCol secretSync={secretSync} />;
+ case SecretSync.OCIVault:
+ return <OCIVaultSyncDestinationCol secretSync={secretSync} />;
default:
throw new Error(
`Unhandled Secret Sync Destination Col: ${(secretSync as TSecretSync).destination}`
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
index b1fe387e52..4bf0eeed20 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
@@ -102,6 +102,10 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
primaryText = destinationConfig.project;
secondaryText = destinationConfig.buildConfig;
break;
+ case SecretSync.OCIVault:
+ primaryText = destinationConfig.compartmentOcid;
+ secondaryText = destinationConfig.vaultOcid;
+ break;
default:
throw new Error(`Unhandled Destination Col Values ${destination}`);
}
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx
index 269d77543e..a9304e7edc 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx
@@ -251,7 +251,7 @@ export const AccessPolicyForm = ({
label="Policy Type"
isRequired
isError={Boolean(error)}
- tooltipText="Change polices govern secret changes within a given environment and secret path. Access polices allow underprivileged user to request access to environment/secret path."
+ tooltipText="Change policies govern secret changes within a given environment and secret path. Access policies allow underprivileged user to request access to environment/secret path."
errorText={error?.message}
>
<Select
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
index 1d917f816e..c6fdc4a9dd 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
@@ -56,7 +56,10 @@ import {
useSubscription,
useWorkspace
} from "@app/context";
-import { ProjectPermissionSecretRotationActions } from "@app/context/ProjectPermissionContext/types";
+import {
+ ProjectPermissionCommitsActions,
+ ProjectPermissionSecretRotationActions
+} from "@app/context/ProjectPermissionContext/types";
import { usePopUp } from "@app/hooks";
import {
useCreateFolder,
@@ -779,8 +782,8 @@ export const ActionBar = ({
</div>
<div>
<ProjectPermissionCan
- I={ProjectPermissionActions.Read}
- a={ProjectPermissionSub.SecretRollback}
+ I={isPITEnabled ? ProjectPermissionCommitsActions.Read : ProjectPermissionActions.Read}
+ a={isPITEnabled ? ProjectPermissionSub.Commits : ProjectPermissionSub.SecretRollback}
>
{(isAllowed) => (
<Button
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SqlDatabaseInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SqlDatabaseInputForm.tsx
index 136ca27738..a295fbac8f 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SqlDatabaseInputForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/SqlDatabaseInputForm.tsx
@@ -6,6 +6,7 @@ import { z } from "zod";
import { TtlFormLabel } from "@app/components/features";
import { createNotification } from "@app/components/notifications";
+import { OrgPermissionCan } from "@app/components/permissions";
import {
Accordion,
AccordionContent,
@@ -18,9 +19,13 @@ import {
SecretInput,
Select,
SelectItem,
- TextArea
+ TextArea,
+ Tooltip
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import {
+ OrgGatewayPermissionActions,
+ OrgPermissionSubjects
+} from "@app/context/OrgPermissionContext/types";
import { gatewaysQueryKeys, useCreateDynamicSecret } from "@app/hooks/api";
import { DynamicSecretProviders, SqlProviders } from "@app/hooks/api/dynamicSecret/types";
import { WorkspaceEnv } from "@app/hooks/api/types";
@@ -61,7 +66,7 @@ const formSchema = z.object({
revocationStatement: z.string().min(1),
renewStatement: z.string().optional(),
ca: z.string().optional(),
- projectGatewayId: z.string().optional()
+ gatewayId: z.string().optional()
}),
defaultTTL: z.string().superRefine((val, ctx) => {
const valMs = ms(val);
@@ -164,8 +169,6 @@ export const SqlDatabaseInputForm = ({
projectSlug,
isSingleEnvironmentMode
}: Props) => {
- const { currentWorkspace } = useWorkspace();
-
const {
control,
setValue,
@@ -193,9 +196,7 @@ export const SqlDatabaseInputForm = ({
});
const createDynamicSecret = useCreateDynamicSecret();
- const { data: projectGateways, isPending: isProjectGatewaysLoading } = useQuery(
- gatewaysQueryKeys.listProjectGateways({ projectId: currentWorkspace.id })
- );
+ const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
const handleCreateDynamicSecret = async ({
name,
@@ -301,40 +302,55 @@ export const SqlDatabaseInputForm = ({
Configuration
</div>
<div>
- <Controller
- control={control}
- name="provider.projectGatewayId"
- defaultValue=""
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Gateway"
- >
- <Select
- value={value}
- onValueChange={onChange}
- className="w-full border border-mineshaft-500"
- dropdownContainerClassName="max-w-none"
- isLoading={isProjectGatewaysLoading}
- placeholder="Internet gateway"
- position="popper"
- >
- <SelectItem
- value={null as unknown as string}
- onClick={() => onChange(undefined)}
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.AttachGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <Controller
+ control={control}
+ name="provider.gatewayId"
+ defaultValue=""
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Gateway"
>
- Internet Gateway
- </SelectItem>
- {projectGateways?.map((el) => (
- <SelectItem value={el.projectGatewayId} key={el.projectGatewayId}>
- {el.name}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
+ <Tooltip
+ isDisabled={isAllowed}
+ content="Restricted access. You don't have permission to attach gateways to resources."
+ >
+ <div>
+ <Select
+ isDisabled={!isAllowed}
+ value={value}
+ onValueChange={onChange}
+ className="w-full border border-mineshaft-500"
+ dropdownContainerClassName="max-w-none"
+ isLoading={isGatewaysLoading}
+ placeholder="Default: Internet Gateway"
+ position="popper"
+ >
+ <SelectItem
+ value={null as unknown as string}
+ onClick={() => onChange(undefined)}
+ >
+ Internet Gateway
+ </SelectItem>
+ {gateways?.map((el) => (
+ <SelectItem value={el.id} key={el.id}>
+ {el.name}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ </Tooltip>
+ </FormControl>
+ )}
+ />
)}
- />
+ </OrgPermissionCan>
</div>
<div className="flex flex-col">
<div className="pb-0.5 pl-1 text-sm text-mineshaft-400">Service</div>
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx
index 69d3b6d405..9bdace648e 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateSecretImportForm.tsx
@@ -163,8 +163,8 @@ export const CreateSecretImportForm = ({
onValueChange={(val) => onChange(val === "true")}
className="w-full border border-mineshaft-500"
>
- <SelectItem value="false">Ignore secret approval polices</SelectItem>
- <SelectItem value="true">Respect secret approval polices</SelectItem>
+ <SelectItem value="false">Ignore secret approval policies</SelectItem>
+ <SelectItem value="true">Respect secret approval policies</SelectItem>
</Select>
</FormControl>
)}
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretSqlProviderForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretSqlProviderForm.tsx
index 7c15db140a..5c53caa650 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretSqlProviderForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretSqlProviderForm.tsx
@@ -6,6 +6,7 @@ import { z } from "zod";
import { TtlFormLabel } from "@app/components/features";
import { createNotification } from "@app/components/notifications";
+import { OrgPermissionCan } from "@app/components/permissions";
import {
Accordion,
AccordionContent,
@@ -17,9 +18,11 @@ import {
SecretInput,
Select,
SelectItem,
- TextArea
+ TextArea,
+ Tooltip
} from "@app/components/v2";
-import { useWorkspace } from "@app/context";
+import { OrgPermissionSubjects } from "@app/context";
+import { OrgGatewayPermissionActions } from "@app/context/OrgPermissionContext/types";
import { gatewaysQueryKeys, useUpdateDynamicSecret } from "@app/hooks/api";
import { SqlProviders, TDynamicSecret } from "@app/hooks/api/dynamicSecret/types";
@@ -60,7 +63,7 @@ const formSchema = z.object({
revocationStatement: z.string().min(1),
renewStatement: z.string().optional(),
ca: z.string().optional(),
- projectGatewayId: z.string().optional().nullable()
+ gatewayId: z.string().optional().nullable()
})
.partial(),
defaultTTL: z.string().superRefine((val, ctx) => {
@@ -147,15 +150,11 @@ export const EditDynamicSecretSqlProviderForm = ({
}
});
- const { currentWorkspace } = useWorkspace();
- const { data: projectGateways, isPending: isProjectGatewaysLoading } = useQuery(
- gatewaysQueryKeys.listProjectGateways({ projectId: currentWorkspace.id })
- );
+ const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
const updateDynamicSecret = useUpdateDynamicSecret();
- const selectedProjectGatewayId = watch("inputs.projectGatewayId");
- const isGatewayInActive =
- projectGateways?.findIndex((el) => el.projectGatewayId === selectedProjectGatewayId) === -1;
+ const selectedGatewayId = watch("inputs.gatewayId");
+ const isGatewayInActive = gateways?.findIndex((el) => el.id === selectedGatewayId) === -1;
const handleUpdateDynamicSecret = async ({
inputs,
@@ -177,7 +176,7 @@ export const EditDynamicSecretSqlProviderForm = ({
defaultTTL,
inputs: {
...inputs,
- projectGatewayId: isGatewayInActive ? null : inputs.projectGatewayId
+ gatewayId: isGatewayInActive ? null : inputs.gatewayId
},
newName: newName === dynamicSecret.name ? undefined : newName,
metadata
@@ -250,45 +249,60 @@ export const EditDynamicSecretSqlProviderForm = ({
<div>
<div className="mb-4 border-b border-b-mineshaft-600 pb-2">Configuration</div>
<div>
- <Controller
- control={control}
- name="inputs.projectGatewayId"
- defaultValue=""
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message) || isGatewayInActive}
- errorText={
- isGatewayInActive && selectedProjectGatewayId
- ? `Project Gateway ${selectedProjectGatewayId} is removed`
- : error?.message
- }
- label="Gateway"
- helperText=""
- >
- <Select
- value={value || undefined}
- onValueChange={onChange}
- className="w-full border border-mineshaft-500"
- dropdownContainerClassName="max-w-none"
- isLoading={isProjectGatewaysLoading}
- placeholder="Internet Gateway"
- position="popper"
- >
- <SelectItem
- value={null as unknown as string}
- onClick={() => onChange(undefined)}
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.AttachGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <Controller
+ control={control}
+ name="inputs.gatewayId"
+ defaultValue=""
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message) || isGatewayInActive}
+ errorText={
+ isGatewayInActive && selectedGatewayId
+ ? `Project Gateway ${selectedGatewayId} is removed`
+ : error?.message
+ }
+ label="Gateway"
+ helperText=""
>
- Internet Gateway
- </SelectItem>
- {projectGateways?.map((el) => (
- <SelectItem value={el.projectGatewayId} key={el.id}>
- {el.name}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
+ <Tooltip
+ isDisabled={isAllowed}
+ content="Restricted access. You don't have permission to attach gateways to resources."
+ >
+ <div>
+ <Select
+ isDisabled={!isAllowed}
+ value={value || undefined}
+ onValueChange={onChange}
+ className="w-full border border-mineshaft-500"
+ dropdownContainerClassName="max-w-none"
+ isLoading={isGatewaysLoading}
+ placeholder="Default: Internet Gateway"
+ position="popper"
+ >
+ <SelectItem
+ value={null as unknown as string}
+ onClick={() => onChange(undefined)}
+ >
+ Internet Gateway
+ </SelectItem>
+ {gateways?.map((el) => (
+ <SelectItem value={el.id} key={el.id}>
+ {el.name}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ </Tooltip>
+ </FormControl>
+ )}
+ />
)}
- />
+ </OrgPermissionCan>
</div>
<div className="flex flex-col">
<Controller
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
index da4e897411..d417821e46 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
@@ -95,7 +95,6 @@ export const SecretDetailSidebar = ({
handleSecretShare
}: Props) => {
const {
- register,
control,
watch,
handleSubmit,
@@ -104,7 +103,8 @@ export const SecretDetailSidebar = ({
formState: { isDirty, isSubmitting }
} = useForm<TFormSchema>({
resolver: zodResolver(formSchema),
- values: secret
+ values: secret,
+ disabled: !secret
});
const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp([
@@ -398,11 +398,19 @@ export const SecretDetailSidebar = ({
autoFocus={false}
/>
<Tooltip
- content="You don't have permission to view the secret value."
- isDisabled={!secret?.secretValueHidden}
+ content={
+ !currentWorkspace.secretSharing
+ ? "This project does not allow secret sharing."
+ : "You don't have permission to view the secret value."
+ }
+ isDisabled={
+ !secret?.secretValueHidden && currentWorkspace.secretSharing
+ }
>
<Button
- isDisabled={secret?.secretValueHidden}
+ isDisabled={
+ secret?.secretValueHidden || !currentWorkspace.secretSharing
+ }
className="px-2 py-[0.43rem] font-normal"
variant="outline_bg"
leftIcon={<FontAwesomeIcon icon={faShare} />}
@@ -705,14 +713,25 @@ export const SecretDetailSidebar = ({
</FormControl>
</div>
</div>
- <FormControl label="Comments & Notes">
- <TextArea
- className="border border-mineshaft-600 bg-bunker-800 text-sm"
- {...register("comment")}
- readOnly={isReadOnly}
- rows={5}
- />
- </FormControl>
+ <Controller
+ control={control}
+ name="comment"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Comments & Notes"
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ className="mb-0"
+ >
+ <TextArea
+ className="border border-mineshaft-600 bg-bunker-800 text-sm"
+ readOnly={isReadOnly}
+ rows={5}
+ {...field}
+ />
+ </FormControl>
+ )}
+ />
<FormControl>
{secretReminderRepeatDays && secretReminderRepeatDays > 0 ? (
<div className="flex items-center justify-between px-2">
@@ -913,7 +932,9 @@ export const SecretDetailSidebar = ({
variant="outline_bg"
size="sm"
className="h-8 w-8 rounded-md"
- onClick={() => setValue("value", secretValue)}
+ onClick={() =>
+ setValue("value", secretValue, { shouldDirty: true })
+ }
>
<FontAwesomeIcon icon={faArrowRotateRight} />
</IconButton>
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
index cb2cf33613..32586e9909 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
@@ -589,7 +589,7 @@ export const SecretItem = memo(
)}
</ProjectPermissionCan>
<IconButton
- isDisabled={secret.secretValueHidden}
+ isDisabled={secret.secretValueHidden || !currentWorkspace.secretSharing}
className="w-0 overflow-hidden p-0 group-hover:w-5"
variant="plain"
size="md"
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OCIVaultSyncDestinationSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OCIVaultSyncDestinationSection.tsx
new file mode 100644
index 0000000000..8a987ae26b
--- /dev/null
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OCIVaultSyncDestinationSection.tsx
@@ -0,0 +1,42 @@
+import { GenericFieldLabel } from "@app/components/secret-syncs";
+import { Tooltip } from "@app/components/v2";
+import { TOCIVaultSync } from "@app/hooks/api/secretSyncs/types/oci-vault-sync";
+
+type Props = {
+ secretSync: TOCIVaultSync;
+};
+
+export const OCIVaultSyncDestinationSection = ({ secretSync }: Props) => {
+ const {
+ destinationConfig: { compartmentOcid, keyOcid, vaultOcid }
+ } = secretSync;
+
+ return (
+ <>
+ <Tooltip side="bottom" className="max-w-sm select-text break-words" content={compartmentOcid}>
+ <div>
+ <GenericFieldLabel label="Compartment OCID">
+ {compartmentOcid.substring(0, 21)}...
+ {compartmentOcid.substring(compartmentOcid.length - 6)}
+ </GenericFieldLabel>
+ </div>
+ </Tooltip>
+ <Tooltip side="bottom" className="max-w-sm select-text break-words" content={compartmentOcid}>
+ <div>
+ <GenericFieldLabel label="Vault OCID">
+ {vaultOcid.substring(0, 15)}...
+ {vaultOcid.substring(vaultOcid.length - 6)}
+ </GenericFieldLabel>
+ </div>
+ </Tooltip>
+ <Tooltip side="bottom" className="max-w-sm select-text break-words" content={compartmentOcid}>
+ <div>
+ <GenericFieldLabel label="Key OCID">
+ {keyOcid.substring(0, 13)}...
+ {keyOcid.substring(keyOcid.length - 6)}
+ </GenericFieldLabel>
+ </div>
+ </Tooltip>
+ </>
+ );
+};
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx
index 4ea5798d94..b0c989ee20 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx
@@ -20,6 +20,7 @@ import { GcpSyncDestinationSection } from "./GcpSyncDestinationSection";
import { GitHubSyncDestinationSection } from "./GitHubSyncDestinationSection";
import { HCVaultSyncDestinationSection } from "./HCVaultSyncDestinationSection";
import { HumanitecSyncDestinationSection } from "./HumanitecSyncDestinationSection";
+import { OCIVaultSyncDestinationSection } from "./OCIVaultSyncDestinationSection";
import { TeamCitySyncDestinationSection } from "./TeamCitySyncDestinationSection";
import { TerraformCloudSyncDestinationSection } from "./TerraformCloudSyncDestinationSection";
import { VercelSyncDestinationSection } from "./VercelSyncDestinationSection";
@@ -81,6 +82,9 @@ export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }:
case SecretSync.TeamCity:
DestinationComponents = <TeamCitySyncDestinationSection secretSync={secretSync} />;
break;
+ case SecretSync.OCIVault:
+ DestinationComponents = <OCIVaultSyncDestinationSection secretSync={secretSync} />;
+ break;
default:
throw new Error(`Unhandled Destination Section components: ${destination}`);
}
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
index 5995e7cd12..a53016d536 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
@@ -21,12 +21,7 @@ type Props = {
export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) => {
const {
destination,
- syncOptions: {
- // appendSuffix,
- // prependPrefix,
- initialSyncBehavior,
- disableSecretDeletion
- }
+ syncOptions: { initialSyncBehavior, disableSecretDeletion, keySchema }
} = secretSync;
let AdditionalSyncOptionsComponent: ReactNode;
@@ -54,6 +49,7 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
case SecretSync.Windmill:
case SecretSync.HCVault:
case SecretSync.TeamCity:
+ case SecretSync.OCIVault:
AdditionalSyncOptionsComponent = null;
break;
default:
@@ -87,8 +83,7 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
<GenericFieldLabel label="Initial Sync Behavior">
{SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP[initialSyncBehavior](destination).name}
</GenericFieldLabel>
- {/* <SecretSyncLabel label="Prefix">{prependPrefix}</SecretSyncLabel>
- <SecretSyncLabel label="Suffix">{appendSuffix}</SecretSyncLabel> */}
+ <GenericFieldLabel label="Key Schema">{keySchema}</GenericFieldLabel>
{AdditionalSyncOptionsComponent}
{disableSecretDeletion && (
<GenericFieldLabel label="Secret Deletion">
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
index 37bcc315eb..8ada43347f 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
@@ -10,6 +10,7 @@ import { DeleteProjectSection } from "../DeleteProjectSection";
import { EnvironmentSection } from "../EnvironmentSection";
import { PointInTimeVersionLimitSection } from "../PointInTimeVersionLimitSection";
import { RebuildSecretIndicesSection } from "../RebuildSecretIndicesSection/RebuildSecretIndicesSection";
+import { SecretSharingSection } from "../SecretSharingSection";
import { SecretTagsSection } from "../SecretTagsSection";
export const ProjectGeneralTab = () => {
@@ -22,6 +23,7 @@ export const ProjectGeneralTab = () => {
{isSecretManager && <EnvironmentSection />}
{isSecretManager && <SecretTagsSection />}
{isSecretManager && <AutoCapitalizationSection />}
+ {isSecretManager && <SecretSharingSection />}
{isSecretManager && <PointInTimeVersionLimitSection />}
<AuditLogsRetentionSection />
{isSecretManager && <BackfillSecretReferenceSecretion />}
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
new file mode 100644
index 0000000000..837f32d3e5
--- /dev/null
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
@@ -0,0 +1,64 @@
+import { useState } from "react";
+
+import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
+import { Checkbox } from "@app/components/v2";
+import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { useUpdateProject } from "@app/hooks/api/workspace/queries";
+
+export const SecretSharingSection = () => {
+ const { currentWorkspace } = useWorkspace();
+ const { mutateAsync: updateProject } = useUpdateProject();
+
+ const [isLoading, setIsLoading] = useState(false);
+
+ const handleToggle = async (state: boolean) => {
+ setIsLoading(true);
+
+ try {
+ if (!currentWorkspace?.id) {
+ setIsLoading(false);
+ return;
+ }
+
+ await updateProject({
+ projectID: currentWorkspace.id,
+ secretSharing: state
+ });
+
+ createNotification({
+ text: `Successfully ${state ? "enabled" : "disabled"} secret sharing for this project`,
+ type: "success"
+ });
+ } catch (err) {
+ console.error(err);
+ createNotification({
+ text: "Failed to update secret sharing for this project",
+ type: "error"
+ });
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ return (
+ <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <p className="mb-3 text-xl font-semibold">Allow Secret Sharing</p>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
+ <div className="w-max">
+ <Checkbox
+ className="data-[state=checked]:bg-primary"
+ id="secretSharing"
+ isDisabled={!isAllowed || isLoading}
+ isChecked={currentWorkspace?.secretSharing ?? true}
+ onCheckedChange={(state) => handleToggle(state as boolean)}
+ >
+ This feature enables your project members to securely share secrets.
+ </Checkbox>
+ </div>
+ )}
+ </ProjectPermissionCan>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/index.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/index.tsx
new file mode 100644
index 0000000000..716cc511ed
--- /dev/null
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/index.tsx
@@ -0,0 +1 @@
+export { SecretSharingSection } from "./SecretSharingSection";
diff --git a/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateTemplateModal.tsx b/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateTemplateModal.tsx
index 9790df2920..55d4104ace 100644
--- a/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateTemplateModal.tsx
+++ b/frontend/src/pages/ssh/SshCaByIDPage/components/SshCertificateTemplateModal.tsx
@@ -61,7 +61,7 @@ const schema = z
allowCustomKeyIds: z.boolean().optional().default(false)
})
.refine((data) => ms(data.maxTTL) >= ms(data.ttl), {
- message: "Max TLL must be greater than or equal to TTL",
+ message: "Max TTL must be greater than or equal to TTL",
path: ["maxTTL"]
});
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupModal.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupModal.tsx
index de5d82311a..84be5a96d7 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupModal.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupModal.tsx
@@ -22,6 +22,7 @@ import {
useCreateSshHostGroup,
useGetSshHostGroupById,
useGetWorkspaceUsers,
+ useListWorkspaceGroups,
useListWorkspaceSshHostGroups,
useUpdateSshHostGroup
} from "@app/hooks/api";
@@ -38,7 +39,14 @@ const schema = z
loginMappings: z
.object({
loginUser: z.string().trim().min(1),
- allowedPrincipals: z.array(z.string().trim()).default([])
+ allowedPrincipals: z
+ .array(
+ z.object({
+ type: z.enum(["user", "group"]),
+ value: z.string().trim().min(1)
+ })
+ )
+ .default([])
})
.array()
.default([])
@@ -49,9 +57,10 @@ export type FormData = z.infer<typeof schema>;
export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
const { currentWorkspace } = useWorkspace();
- const projectId = currentWorkspace?.id || "";
- const { data: sshHostGroups } = useListWorkspaceSshHostGroups(currentWorkspace.id);
+ const projectId = currentWorkspace.id;
+ const { data: sshHostGroups } = useListWorkspaceSshHostGroups(projectId);
const { data: members = [] } = useGetWorkspaceUsers(projectId);
+ const { data: groups = [] } = useListWorkspaceGroups(projectId);
const [expandedMappings, setExpandedMappings] = useState<Record<number, boolean>>({});
const { data: sshHostGroup } = useGetSshHostGroupById(
@@ -87,7 +96,16 @@ export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
name: sshHostGroup.name,
loginMappings: sshHostGroup.loginMappings.map(({ loginUser, allowedPrincipals }) => ({
loginUser,
- allowedPrincipals: allowedPrincipals.usernames
+ allowedPrincipals: [
+ ...(allowedPrincipals.usernames || []).map((username) => ({
+ type: "user" as const,
+ value: username
+ })),
+ ...(allowedPrincipals.groups || []).map((group) => ({
+ type: "group" as const,
+ value: group
+ }))
+ ]
}))
});
@@ -118,27 +136,35 @@ export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
return;
}
+ const transformedLoginMappings = loginMappings.map(({ loginUser, allowedPrincipals }) => {
+ const usernames = allowedPrincipals
+ .filter((p) => p.type === "user" && p.value)
+ .map((p) => p.value);
+
+ const groupNames = allowedPrincipals
+ .filter((p) => p.type === "group" && p.value)
+ .map((p) => p.value);
+
+ return {
+ loginUser,
+ allowedPrincipals: {
+ usernames,
+ groups: groupNames
+ }
+ };
+ });
+
if (sshHostGroup) {
await updateMutateAsync({
sshHostGroupId: sshHostGroup.id,
name,
- loginMappings: loginMappings.map(({ loginUser, allowedPrincipals }) => ({
- loginUser,
- allowedPrincipals: {
- usernames: allowedPrincipals
- }
- }))
+ loginMappings: transformedLoginMappings
});
} else {
await createMutateAsync({
projectId,
name,
- loginMappings: loginMappings.map(({ loginUser, allowedPrincipals }) => ({
- loginUser,
- allowedPrincipals: {
- usernames: allowedPrincipals
- }
- }))
+ loginMappings: transformedLoginMappings
});
}
@@ -165,6 +191,15 @@ export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
}));
};
+ const isPrincipalDuplicate = (
+ mappingIndex: number,
+ principalType: string,
+ principalValue: string
+ ) => {
+ const principals = getValues(`loginMappings.${mappingIndex}.allowedPrincipals`) || [];
+ return principals.some((p) => p.type === principalType && p.value === principalValue);
+ };
+
return (
<Modal
isOpen={popUp?.sshHostGroup?.isOpen}
@@ -203,7 +238,10 @@ export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
variant="outline_bg"
onClick={() => {
const newIndex = loginMappingsFormFields.fields.length;
- loginMappingsFormFields.append({ loginUser: "", allowedPrincipals: [""] });
+ loginMappingsFormFields.append({
+ loginUser: "",
+ allowedPrincipals: [{ type: "user", value: "" }]
+ });
setExpandedMappings((prev) => ({
...prev,
[newIndex]: true
@@ -299,7 +337,10 @@ export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
variant="outline_bg"
onClick={() => {
const current = getValues(`loginMappings.${i}.allowedPrincipals`) ?? [];
- setValue(`loginMappings.${i}.allowedPrincipals`, [...current, ""]);
+ setValue(`loginMappings.${i}.allowedPrincipals`, [
+ ...current,
+ { type: "user", value: "" }
+ ]);
}}
>
Add Principal
@@ -310,40 +351,69 @@ export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
name={`loginMappings.${i}.allowedPrincipals`}
render={({ field: { value = [], onChange }, fieldState: { error } }) => (
<div className="flex flex-col space-y-2">
- {(value.length === 0 ? [""] : value).map(
- (principal: string, principalIndex: number) => (
- <div
- key={`${metadataFieldId}-principal-${principal}`}
- className="flex items-center space-x-2"
- >
- <div className="flex-1">
- <Select
- value={principal}
- onValueChange={(newValue) => {
- if (value.includes(newValue)) {
- createNotification({
- text: "This principal is already added",
- type: "error"
- });
- return;
- }
- const newPrincipals = [...value];
- newPrincipals[principalIndex] = newValue;
- onChange(newPrincipals);
- }}
- placeholder="Select a member"
- className="w-full"
- >
- {members.map((member) => (
- <SelectItem
- key={member.user.id}
- value={member.user.username}
- >
- {member.user.username}
- </SelectItem>
- ))}
- </Select>
- </div>
+ {value.map((principal, principalIndex) => (
+ <div
+ key={`principal-${i + 1}-${principalIndex + 1}-${principal.type}`}
+ className="flex items-center space-x-2"
+ >
+ <div className="mr-2">
+ <Select
+ className="w-24"
+ value={principal.type}
+ onValueChange={(newType) => {
+ const newPrincipals = [...value];
+ newPrincipals[principalIndex] = {
+ type: newType as "user" | "group",
+ value: ""
+ };
+ onChange(newPrincipals);
+ }}
+ >
+ <SelectItem value="user">User</SelectItem>
+ <SelectItem value="group">Group</SelectItem>
+ </Select>
+ </div>
+ <div className="flex-1">
+ <Select
+ value={principal.value}
+ onValueChange={(newValue) => {
+ if (isPrincipalDuplicate(i, principal.type, newValue)) {
+ createNotification({
+ text: `This ${principal.type} is already added`,
+ type: "error"
+ });
+ return;
+ }
+ const newPrincipals = [...value];
+ newPrincipals[principalIndex] = {
+ type: principal.type as "user" | "group",
+ value: newValue
+ };
+ onChange(newPrincipals);
+ }}
+ placeholder={`Select a ${principal.type}`}
+ className="w-full"
+ >
+ {principal.type === "user"
+ ? members.map((member) => (
+ <SelectItem
+ key={member.user.id}
+ value={member.user.username}
+ >
+ {member.user.username}
+ </SelectItem>
+ ))
+ : groups.map((group) => (
+ <SelectItem
+ key={group.group.slug}
+ value={group.group.slug}
+ >
+ {group.group.slug}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ <div className="flex w-10 justify-center">
<IconButton
size="sm"
ariaLabel="delete principal"
@@ -353,14 +423,14 @@ export const SshHostGroupModal = ({ popUp, handlePopUpToggle }: Props) => {
const newPrincipals = value.filter(
(_, idx) => idx !== principalIndex
);
- onChange(newPrincipals);
+ onChange(newPrincipals.length ? newPrincipals : []);
}}
>
<FontAwesomeIcon icon={faTrash} />
</IconButton>
</div>
- )
- )}
+ </div>
+ ))}
{error && <span className="text-sm text-red-500">{error.message}</span>}
</div>
)}
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsSection.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsSection.tsx
index 70036d88a7..e2c731f977 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsSection.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsSection.tsx
@@ -1,4 +1,4 @@
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
+import { faArrowUpRightFromSquare, faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
@@ -56,22 +56,38 @@ export const SshHostGroupsSection = () => {
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
<div className="mb-4 flex justify-between">
<p className="text-xl font-semibold text-mineshaft-100">Host Groups</p>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Create}
- a={ProjectPermissionSub.SshHostGroups}
- >
- {(isAllowed) => (
- <Button
- colorSchema="primary"
- type="button"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- onClick={() => handleAddSshHostGroupModal()}
- isDisabled={!isAllowed}
- >
- Add Group
- </Button>
- )}
- </ProjectPermissionCan>
+ <div className="flex justify-end">
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href="https://infisical.com/docs/documentation/platform/ssh/host-groups"
+ >
+ <span className="flex w-max cursor-pointer items-center rounded-md border border-mineshaft-500 bg-mineshaft-600 px-4 py-2 text-mineshaft-200 duration-200 hover:border-primary/40 hover:bg-primary/10 hover:text-white">
+ Documentation{" "}
+ <FontAwesomeIcon
+ icon={faArrowUpRightFromSquare}
+ className="mb-[0.06rem] ml-1 text-xs"
+ />
+ </span>
+ </a>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Create}
+ a={ProjectPermissionSub.SshHostGroups}
+ >
+ {(isAllowed) => (
+ <Button
+ colorSchema="primary"
+ type="button"
+ leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ onClick={() => handleAddSshHostGroupModal()}
+ isDisabled={!isAllowed}
+ className="ml-4"
+ >
+ Add Group
+ </Button>
+ )}
+ </ProjectPermissionCan>
+ </div>
</div>
<SshHostGroupsTable handlePopUpOpen={handlePopUpOpen} />
<SshHostGroupModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsTable.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsTable.tsx
index 194d9e90e0..59fcdfdb54 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsTable.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostGroupsTable.tsx
@@ -1,10 +1,18 @@
-import { faEllipsis, faPencil, faServer, faTrash } from "@fortawesome/free-solid-svg-icons";
+import {
+ faEllipsis,
+ faPencil,
+ faServer,
+ faTrash,
+ faUser,
+ faUsers
+} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { twMerge } from "tailwind-merge";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
+ Badge,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
@@ -77,9 +85,40 @@ export const SshHostGroupsTable = ({ handlePopUpOpen }: Props) => {
group.loginMappings.map(({ loginUser, allowedPrincipals }) => (
<div key={`${group.id}-${loginUser}`} className="mb-2">
<div className="text-mineshaft-200">{loginUser}</div>
- {allowedPrincipals.usernames.map((username) => (
- <div key={`${group.id}-${loginUser}-${username}`} className="ml-4">
- └─ {username}
+ {allowedPrincipals.usernames?.map((username) => (
+ <div
+ key={`${loginUser}-${username}`}
+ className="flex items-center gap-2"
+ >
+ <div className="flex items-center">
+ <span className="text-gray-400">└─</span>
+ </div>
+ <div className="flex items-center gap-1.5">
+ <FontAwesomeIcon
+ icon={faUser}
+ className="text-xs text-yellow/80"
+ />
+ <span>{username}</span>
+ <Badge variant="primary">user</Badge>
+ </div>
+ </div>
+ ))}
+ {allowedPrincipals.groups?.map((allowedGroup) => (
+ <div
+ key={`${loginUser}-${allowedGroup}`}
+ className="flex items-center gap-2"
+ >
+ <div className="flex items-center">
+ <span className="text-gray-400">└─</span>
+ </div>
+ <div className="flex items-center gap-1.5">
+ <FontAwesomeIcon
+ icon={faUsers}
+ className="text-xs text-green/80"
+ />
+ <span>{allowedGroup}</span>
+ <Badge variant="success">group</Badge>
+ </div>
</div>
))}
</div>
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx
index 5ac53a16ea..5619a75c4c 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx
@@ -23,6 +23,7 @@ import {
useCreateSshHost,
useGetSshHostById,
useGetWorkspaceUsers,
+ useListWorkspaceGroups,
useListWorkspaceSshHosts,
useUpdateSshHost
} from "@app/hooks/api";
@@ -49,7 +50,14 @@ const schema = z
loginMappings: z
.object({
loginUser: z.string().trim().min(1),
- allowedPrincipals: z.array(z.string().trim()).default([]),
+ allowedPrincipals: z
+ .array(
+ z.object({
+ type: z.enum(["user", "group"]),
+ value: z.string().trim().min(1)
+ })
+ )
+ .default([]),
source: z.nativeEnum(LoginMappingSource)
})
.array()
@@ -64,6 +72,7 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
const projectId = currentWorkspace?.id || "";
const { data: sshHosts } = useListWorkspaceSshHosts(currentWorkspace.id);
const { data: members = [] } = useGetWorkspaceUsers(projectId);
+ const { data: groups = [] } = useListWorkspaceGroups(projectId);
const [expandedMappings, setExpandedMappings] = useState<Record<number, boolean>>({});
const { data: sshHost } = useGetSshHostById(
@@ -103,7 +112,16 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
userCertTtl: sshHost.userCertTtl,
loginMappings: sshHost.loginMappings.map(({ loginUser, allowedPrincipals, source }) => ({
loginUser,
- allowedPrincipals: allowedPrincipals.usernames,
+ allowedPrincipals: [
+ ...(allowedPrincipals.usernames || []).map((username) => ({
+ type: "user" as const,
+ value: username
+ })),
+ ...(allowedPrincipals.groups || []).map((group) => ({
+ type: "group" as const,
+ value: group
+ }))
+ ],
source
}))
});
@@ -159,18 +177,31 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
}
}
+ const transformedLoginMappings = hostLoginMappings.map(({ loginUser, allowedPrincipals }) => {
+ const usernames = allowedPrincipals
+ .filter((p) => p.type === "user" && p.value)
+ .map((p) => p.value);
+
+ const groupNames = allowedPrincipals
+ .filter((p) => p.type === "group" && p.value)
+ .map((p) => p.value);
+
+ return {
+ loginUser,
+ allowedPrincipals: {
+ usernames,
+ groups: groupNames
+ }
+ };
+ });
+
if (sshHost) {
await updateMutateAsync({
sshHostId: sshHost.id,
hostname,
alias: trimmedAlias,
userCertTtl,
- loginMappings: hostLoginMappings.map(({ loginUser, allowedPrincipals }) => ({
- loginUser,
- allowedPrincipals: {
- usernames: allowedPrincipals
- }
- }))
+ loginMappings: transformedLoginMappings
});
} else {
await createMutateAsync({
@@ -178,12 +209,7 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
hostname,
alias: trimmedAlias,
userCertTtl,
- loginMappings: hostLoginMappings.map(({ loginUser, allowedPrincipals }) => ({
- loginUser,
- allowedPrincipals: {
- usernames: allowedPrincipals
- }
- }))
+ loginMappings: transformedLoginMappings
});
}
@@ -210,6 +236,15 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
}));
};
+ const isPrincipalDuplicate = (
+ mappingIndex: number,
+ principalType: string,
+ principalValue: string
+ ) => {
+ const principals = getValues(`loginMappings.${mappingIndex}.allowedPrincipals`) || [];
+ return principals.some((p) => p.type === principalType && p.value === principalValue);
+ };
+
return (
<Modal
isOpen={popUp?.sshHost?.isOpen}
@@ -275,7 +310,7 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
const newIndex = loginMappingsFormFields.fields.length;
loginMappingsFormFields.append({
loginUser: "",
- allowedPrincipals: [""],
+ allowedPrincipals: [],
source: LoginMappingSource.HOST
});
setExpandedMappings((prev) => ({
@@ -397,7 +432,10 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
onClick={() => {
const current =
getValues(`loginMappings.${i}.allowedPrincipals`) ?? [];
- setValue(`loginMappings.${i}.allowedPrincipals`, [...current, ""]);
+ setValue(`loginMappings.${i}.allowedPrincipals`, [
+ ...current,
+ { type: "user", value: "" }
+ ]);
}}
>
Add Principal
@@ -409,50 +447,82 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
name={`loginMappings.${i}.allowedPrincipals`}
render={({ field: { value = [], onChange }, fieldState: { error } }) => (
<div className="flex flex-col space-y-2">
- {(value.length === 0 ? [""] : value).map(
- (principal: string, principalIndex: number) => (
- <div
- key={`${metadataFieldId}-principal-${principal}`}
- className="flex items-center space-x-2"
- >
- <div className="flex-1">
- <Select
- value={principal}
- onValueChange={(newValue) => {
- if (
- loginMappingsFormFields.fields[i].source ===
- LoginMappingSource.HOST_GROUP
- )
- return;
-
- if (value.includes(newValue)) {
- createNotification({
- text: "This principal is already added",
- type: "error"
- });
- return;
- }
- const newPrincipals = [...value];
- newPrincipals[principalIndex] = newValue;
- onChange(newPrincipals);
- }}
- placeholder="Select a member"
- className="w-full"
- isDisabled={
+ {value.map((principal, principalIndex) => (
+ <div
+ key={`principal-${i + 1}-${principalIndex + 1}-${principal.type}`}
+ className="flex items-center space-x-2"
+ >
+ <div className="mr-2">
+ <Select
+ className="w-24"
+ value={principal.type}
+ onValueChange={(newType) => {
+ const newPrincipals = [...value];
+ newPrincipals[principalIndex] = {
+ type: newType as "user" | "group",
+ value: ""
+ };
+ onChange(newPrincipals);
+ }}
+ isDisabled={
+ loginMappingsFormFields.fields[i].source ===
+ LoginMappingSource.HOST_GROUP
+ }
+ >
+ <SelectItem value="user">User</SelectItem>
+ <SelectItem value="group">Group</SelectItem>
+ </Select>
+ </div>
+ <div className="flex-1">
+ <Select
+ value={principal.value}
+ onValueChange={(newValue) => {
+ if (
loginMappingsFormFields.fields[i].source ===
LoginMappingSource.HOST_GROUP
+ )
+ return;
+ if (isPrincipalDuplicate(i, principal.type, newValue)) {
+ createNotification({
+ text: `This ${principal.type} is already added`,
+ type: "error"
+ });
+ return;
}
- >
- {members.map((member) => (
- <SelectItem
- key={member.user.id}
- value={member.user.username}
- >
- {member.user.username}
- </SelectItem>
- ))}
- </Select>
- </div>
+ const newPrincipals = [...value];
+ newPrincipals[principalIndex] = {
+ type: principal.type,
+ value: newValue
+ };
+ onChange(newPrincipals);
+ }}
+ placeholder={`Select a ${principal.type}`}
+ className="w-full"
+ isDisabled={
+ loginMappingsFormFields.fields[i].source ===
+ LoginMappingSource.HOST_GROUP
+ }
+ >
+ {principal.type === "user"
+ ? members.map((member) => (
+ <SelectItem
+ key={member.user.id}
+ value={member.user.username}
+ >
+ {member.user.username}
+ </SelectItem>
+ ))
+ : groups.map((group) => (
+ <SelectItem
+ key={group.group.slug}
+ value={group.group.slug}
+ >
+ {group.group.slug}
+ </SelectItem>
+ ))}
+ </Select>
+ </div>
+ <div className="flex w-10 justify-center">
<IconButton
size="sm"
ariaLabel="delete principal"
@@ -468,7 +538,7 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
const newPrincipals = value.filter(
(_, idx) => idx !== principalIndex
);
- onChange(newPrincipals);
+ onChange([...newPrincipals]);
}}
isDisabled={
loginMappingsFormFields.fields[i].source ===
@@ -478,8 +548,8 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {
<FontAwesomeIcon icon={faTrash} />
</IconButton>
</div>
- )
- )}
+ </div>
+ ))}
{error && <span className="text-sm text-red-500">{error.message}</span>}
</div>
)}
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostsSection.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostsSection.tsx
index a3f9917ba2..ed190db219 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostsSection.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostsSection.tsx
@@ -42,7 +42,7 @@ export const SshHostsSection = () => {
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
<div className="mb-4 flex justify-between">
<p className="text-xl font-semibold text-mineshaft-100">Hosts</p>
- <div className="flex w-full justify-end">
+ <div className="flex justify-end">
<a
target="_blank"
rel="noopener noreferrer"
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostsTable.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostsTable.tsx
index 491307d216..62f563ccec 100644
--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostsTable.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostsTable.tsx
@@ -3,7 +3,9 @@ import {
faEllipsis,
faPencil,
faServer,
- faTrash
+ faTrash,
+ faUser,
+ faUsers
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import FileSaver from "file-saver";
@@ -12,6 +14,7 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
+ Badge,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
@@ -27,7 +30,7 @@ import {
Tooltip,
Tr
} from "@app/components/v2";
-import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { ProjectPermissionSshHostActions, ProjectPermissionSub, useWorkspace } from "@app/context";
import { fetchSshHostUserCaPublicKey, useListWorkspaceSshHosts } from "@app/hooks/api";
import { LoginMappingSource } from "@app/hooks/api/sshHost/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -101,43 +104,53 @@ export const SshHostsTable = ({ handlePopUpOpen }: Props) => {
const hostLoginUserToPrincipals = hostMappings.reduce(
(acc, { loginUser, allowedPrincipals }) => {
- acc[loginUser] = new Set(allowedPrincipals.usernames);
+ acc[loginUser] = {
+ users: new Set(allowedPrincipals.usernames),
+ groups: new Set(allowedPrincipals.groups)
+ };
return acc;
},
- {} as Record<string, Set<string>>
+ {} as Record<string, { users: Set<string>; groups: Set<string> }>
);
const entriesFromHost = hostMappings.map(
({ loginUser, allowedPrincipals }) => ({
loginUser,
source: LoginMappingSource.HOST,
- usernames: allowedPrincipals.usernames
+ users: allowedPrincipals.usernames,
+ groups: allowedPrincipals.groups
})
);
const entriesFromGroup = groupMappings
.map(({ loginUser, allowedPrincipals }) => {
- const existing = hostLoginUserToPrincipals[loginUser] || new Set();
- const filteredUsernames = allowedPrincipals.usernames.filter(
- (u) => !existing.has(u)
+ const existing = hostLoginUserToPrincipals[loginUser] || {};
+ const filteredUsernames = allowedPrincipals.usernames?.filter(
+ (u) => !existing.users?.has(u)
);
- return filteredUsernames.length > 0
+ const filteredGroups = allowedPrincipals.groups?.filter(
+ (g) => !existing.groups?.has(g)
+ );
+ return ((filteredGroups?.length || filteredUsernames?.length) ?? 0) >
+ 0
? {
loginUser,
source: LoginMappingSource.HOST_GROUP,
- usernames: filteredUsernames
+ users: filteredUsernames,
+ groups: filteredGroups
}
: null;
})
.filter(Boolean) as {
loginUser: string;
source: LoginMappingSource;
- usernames: string[];
+ users: string[];
+ groups: string[];
}[];
return [...entriesFromHost, ...entriesFromGroup]
.sort((a, b) => a.loginUser.localeCompare(b.loginUser))
- .map(({ loginUser, usernames, source }) => (
+ .map(({ loginUser, users, groups, source }) => (
<div key={`${host.id}-${loginUser}-${source}`} className="mb-2">
<div className="text-mineshaft-200">
{loginUser}
@@ -147,12 +160,40 @@ export const SshHostsTable = ({ handlePopUpOpen }: Props) => {
</span>
)}
</div>
- {usernames.map((username) => (
+ {users?.map((username) => (
<div
key={`${host.id}-${loginUser}-${source}-${username}`}
- className="ml-4"
+ className="flex items-center gap-2"
+ >
+ <div className="flex items-center">
+ <span className="text-gray-400">└─</span>
+ </div>
+ <div className="flex items-center gap-1.5">
+ <FontAwesomeIcon
+ icon={faUser}
+ className="text-xs text-yellow/80"
+ />
+ <span>{username}</span>
+ <Badge variant="primary">user</Badge>
+ </div>
+ </div>
+ ))}
+ {groups?.map((group) => (
+ <div
+ key={`${host.id}-${loginUser}-${source}-${group}`}
+ className="flex items-center gap-2"
>
- └─ {username}
+ <div className="flex items-center">
+ <span className="text-gray-400">└─</span>
+ </div>
+ <div className="flex items-center gap-1.5">
+ <FontAwesomeIcon
+ icon={faUsers}
+ className="text-xs text-green/80"
+ />
+ <span>{group}</span>
+ <Badge variant="success">group</Badge>
+ </div>
</div>
))}
</div>
@@ -180,7 +221,7 @@ export const SshHostsTable = ({ handlePopUpOpen }: Props) => {
Download User CA Public Key
</DropdownMenuItem>
<ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
+ I={ProjectPermissionSshHostActions.Edit}
a={ProjectPermissionSub.SshHosts}
>
{(isAllowed) => (
@@ -202,7 +243,7 @@ export const SshHostsTable = ({ handlePopUpOpen }: Props) => {
)}
</ProjectPermissionCan>
<ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
+ I={ProjectPermissionSshHostActions.Delete}
a={ProjectPermissionSub.SshHosts}
>
{(isAllowed) => (
diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts
index 1104b6f27d..3891198cd6 100644
--- a/frontend/src/routeTree.gen.ts
+++ b/frontend/src/routeTree.gen.ts
@@ -42,6 +42,7 @@ import { Route as adminLayoutImport } from './pages/admin/layout'
import { Route as authProviderSuccessPageRouteImport } from './pages/auth/ProviderSuccessPage/route'
import { Route as authProviderErrorPageRouteImport } from './pages/auth/ProviderErrorPage/route'
import { Route as userPersonalSettingsPageRouteImport } from './pages/user/PersonalSettingsPage/route'
+import { Route as organizationSsoPageRouteImport } from './pages/organization/SsoPage/route'
import { Route as organizationSecretScanningPageRouteImport } from './pages/organization/SecretScanningPage/route'
import { Route as organizationBillingPageRouteImport } from './pages/organization/BillingPage/route'
import { Route as organizationAuditLogsPageRouteImport } from './pages/organization/AuditLogsPage/route'
@@ -52,14 +53,18 @@ import { Route as sshLayoutImport } from './pages/ssh/layout'
import { Route as secretManagerLayoutImport } from './pages/secret-manager/layout'
import { Route as kmsLayoutImport } from './pages/kms/layout'
import { Route as certManagerLayoutImport } from './pages/cert-manager/layout'
+import { Route as organizationSshSettingsPageRouteImport } from './pages/organization/SshSettingsPage/route'
import { Route as organizationSshOverviewPageRouteImport } from './pages/organization/SshOverviewPage/route'
import { Route as organizationSecretSharingSettingsPageRouteImport } from './pages/organization/SecretSharingSettingsPage/route'
+import { Route as organizationSecretManagerSettingsPageRouteImport } from './pages/organization/SecretManagerSettingsPage/route'
import { Route as organizationSecretManagerOverviewPageRouteImport } from './pages/organization/SecretManagerOverviewPage/route'
import { Route as organizationRoleByIDPageRouteImport } from './pages/organization/RoleByIDPage/route'
import { Route as organizationUserDetailsByIDPageRouteImport } from './pages/organization/UserDetailsByIDPage/route'
+import { Route as organizationKmsSettingsPageRouteImport } from './pages/organization/KmsSettingsPage/route'
import { Route as organizationKmsOverviewPageRouteImport } from './pages/organization/KmsOverviewPage/route'
import { Route as organizationIdentityDetailsByIDPageRouteImport } from './pages/organization/IdentityDetailsByIDPage/route'
import { Route as organizationGroupDetailsByIDPageRouteImport } from './pages/organization/GroupDetailsByIDPage/route'
+import { Route as organizationCertManagerSettingsPageRouteImport } from './pages/organization/CertManagerSettingsPage/route'
import { Route as organizationCertManagerOverviewPageRouteImport } from './pages/organization/CertManagerOverviewPage/route'
import { Route as organizationSettingsPageRouteImport } from './pages/organization/SettingsPage/route'
import { Route as organizationSecretSharingPageRouteImport } from './pages/organization/SecretSharingPage/route'
@@ -114,8 +119,10 @@ import { Route as secretManagerSecretDashboardPageRouteImport } from './pages/se
import { Route as secretManagerIntegrationsSelectIntegrationAuthPageRouteImport } from './pages/secret-manager/integrations/SelectIntegrationAuthPage/route'
import { Route as secretManagerIntegrationsDetailsByIDPageRouteImport } from './pages/secret-manager/IntegrationsDetailsByIDPage/route'
import { Route as organizationAppConnectionsOauthCallbackPageRouteImport } from './pages/organization/AppConnections/OauthCallbackPage/route'
+import { Route as certManagerPkiSubscriberDetailsByIDPageRouteImport } from './pages/cert-manager/PkiSubscriberDetailsByIDPage/route'
import { Route as certManagerCertAuthDetailsByIDPageRouteImport } from './pages/cert-manager/CertAuthDetailsByIDPage/route'
import { Route as secretManagerIntegrationsListPageRouteImport } from './pages/secret-manager/IntegrationsListPage/route'
+import { Route as certManagerPkiSubscribersPageRouteImport } from './pages/cert-manager/PkiSubscribersPage/route'
import { Route as secretManagerIntegrationsWindmillConfigurePageRouteImport } from './pages/secret-manager/integrations/WindmillConfigurePage/route'
import { Route as secretManagerIntegrationsWindmillAuthorizePageRouteImport } from './pages/secret-manager/integrations/WindmillAuthorizePage/route'
import { Route as secretManagerIntegrationsVercelConfigurePageRouteImport } from './pages/secret-manager/integrations/VercelConfigurePage/route'
@@ -249,6 +256,10 @@ const AuthenticateInjectOrgDetailsOrgLayoutSecretManagerProjectIdSecretManagerLa
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations',
)()
+const AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersImport =
+ createFileRoute(
+ '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers',
+ )()
const AuthenticateInjectOrgDetailsOrgLayoutSecretManagerProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdImport =
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/commits/$environment/$folderId',
@@ -546,6 +557,12 @@ const AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdRoute =
getParentRoute: () => organizationLayoutRoute,
} as any)
+const organizationSsoPageRouteRoute = organizationSsoPageRouteImport.update({
+ id: '/sso',
+ path: '/sso',
+ getParentRoute: () => AuthenticateInjectOrgDetailsOrgLayoutOrganizationRoute,
+} as any)
+
const organizationSecretScanningPageRouteRoute =
organizationSecretScanningPageRouteImport.update({
id: '/secret-scanning',
@@ -615,6 +632,14 @@ const certManagerLayoutRoute = certManagerLayoutImport.update({
AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdRoute,
} as any)
+const organizationSshSettingsPageRouteRoute =
+ organizationSshSettingsPageRouteImport.update({
+ id: '/ssh/settings',
+ path: '/ssh/settings',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationRoute,
+ } as any)
+
const organizationSshOverviewPageRouteRoute =
organizationSshOverviewPageRouteImport.update({
id: '/ssh/overview',
@@ -631,6 +656,14 @@ const organizationSecretSharingSettingsPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationSecretSharingRoute,
} as any)
+const organizationSecretManagerSettingsPageRouteRoute =
+ organizationSecretManagerSettingsPageRouteImport.update({
+ id: '/secret-manager/settings',
+ path: '/secret-manager/settings',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationRoute,
+ } as any)
+
const organizationSecretManagerOverviewPageRouteRoute =
organizationSecretManagerOverviewPageRouteImport.update({
id: '/secret-manager/overview',
@@ -655,6 +688,14 @@ const organizationUserDetailsByIDPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationRoute,
} as any)
+const organizationKmsSettingsPageRouteRoute =
+ organizationKmsSettingsPageRouteImport.update({
+ id: '/kms/settings',
+ path: '/kms/settings',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationRoute,
+ } as any)
+
const organizationKmsOverviewPageRouteRoute =
organizationKmsOverviewPageRouteImport.update({
id: '/kms/overview',
@@ -679,6 +720,14 @@ const organizationGroupDetailsByIDPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationRoute,
} as any)
+const organizationCertManagerSettingsPageRouteRoute =
+ organizationCertManagerSettingsPageRouteImport.update({
+ id: '/cert-manager/settings',
+ path: '/cert-manager/settings',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationRoute,
+ } as any)
+
const organizationCertManagerOverviewPageRouteRoute =
organizationCertManagerOverviewPageRouteImport.update({
id: '/cert-manager/overview',
@@ -823,6 +872,15 @@ const secretManagerIntegrationsRouteAzureAppConfigurationsOauthRedirectRoute =
} as any,
)
+const AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRoute =
+ AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersImport.update(
+ {
+ id: '/subscribers',
+ path: '/subscribers',
+ getParentRoute: () => certManagerLayoutRoute,
+ } as any,
+ )
+
const projectAccessControlPageRouteCertManagerRoute =
projectAccessControlPageRouteCertManagerImport.update({
id: '/access-management',
@@ -924,8 +982,8 @@ const certManagerSettingsPageRouteRoute =
const certManagerCertificatesPageRouteRoute =
certManagerCertificatesPageRouteImport.update({
- id: '/overview',
- path: '/overview',
+ id: '/certificates',
+ path: '/certificates',
getParentRoute: () => certManagerLayoutRoute,
} as any)
@@ -1078,6 +1136,14 @@ const organizationAppConnectionsOauthCallbackPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationAppConnectionsRoute,
} as any)
+const certManagerPkiSubscriberDetailsByIDPageRouteRoute =
+ certManagerPkiSubscriberDetailsByIDPageRouteImport.update({
+ id: '/$subscriberName',
+ path: '/$subscriberName',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRoute,
+ } as any)
+
const certManagerCertAuthDetailsByIDPageRouteRoute =
certManagerCertAuthDetailsByIDPageRouteImport.update({
id: '/ca/$caId',
@@ -1093,6 +1159,14 @@ const secretManagerIntegrationsListPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutSecretManagerProjectIdSecretManagerLayoutIntegrationsRoute,
} as any)
+const certManagerPkiSubscribersPageRouteRoute =
+ certManagerPkiSubscribersPageRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRoute,
+ } as any)
+
const AuthenticateInjectOrgDetailsOrgLayoutSecretManagerProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdRoute =
AuthenticateInjectOrgDetailsOrgLayoutSecretManagerProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdImport.update(
{
@@ -2035,6 +2109,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof organizationSecretScanningPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organization/sso': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organization/sso'
+ path: '/sso'
+ fullPath: '/organization/sso'
+ preLoaderRoute: typeof organizationSsoPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
+ }
'/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId': {
id: '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId'
path: '/cert-manager/$projectId'
@@ -2126,6 +2207,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof organizationCertManagerOverviewPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/settings': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/settings'
+ path: '/cert-manager/settings'
+ fullPath: '/organization/cert-manager/settings'
+ preLoaderRoute: typeof organizationCertManagerSettingsPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organization/groups/$groupId': {
id: '/_authenticate/_inject-org-details/_org-layout/organization/groups/$groupId'
path: '/groups/$groupId'
@@ -2147,6 +2235,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof organizationKmsOverviewPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organization/kms/settings': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organization/kms/settings'
+ path: '/kms/settings'
+ fullPath: '/organization/kms/settings'
+ preLoaderRoute: typeof organizationKmsSettingsPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organization/members/$membershipId': {
id: '/_authenticate/_inject-org-details/_org-layout/organization/members/$membershipId'
path: '/members/$membershipId'
@@ -2168,6 +2263,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof organizationSecretManagerOverviewPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/settings': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/settings'
+ path: '/secret-manager/settings'
+ fullPath: '/organization/secret-manager/settings'
+ preLoaderRoute: typeof organizationSecretManagerSettingsPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organization/secret-sharing/settings': {
id: '/_authenticate/_inject-org-details/_org-layout/organization/secret-sharing/settings'
path: '/settings'
@@ -2182,6 +2284,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof organizationSshOverviewPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organization/ssh/settings': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organization/ssh/settings'
+ path: '/ssh/settings'
+ fullPath: '/organization/ssh/settings'
+ preLoaderRoute: typeof organizationSshSettingsPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationImport
+ }
'/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout': {
id: '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout'
path: ''
@@ -2224,10 +2333,10 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof certManagerCertificateAuthoritiesPageRouteImport
parentRoute: typeof certManagerLayoutImport
}
- '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/overview': {
- id: '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/overview'
- path: '/overview'
- fullPath: '/cert-manager/$projectId/overview'
+ '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificates': {
+ id: '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificates'
+ path: '/certificates'
+ fullPath: '/cert-manager/$projectId/certificates'
preLoaderRoute: typeof certManagerCertificatesPageRouteImport
parentRoute: typeof certManagerLayoutImport
}
@@ -2336,6 +2445,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof projectAccessControlPageRouteCertManagerImport
parentRoute: typeof certManagerLayoutImport
}
+ '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers': {
+ id: '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers'
+ path: '/subscribers'
+ fullPath: '/cert-manager/$projectId/subscribers'
+ preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersImport
+ parentRoute: typeof certManagerLayoutImport
+ }
'/_authenticate/_inject-org-details/_org-layout/integrations/azure-app-configuration/oauth2/callback': {
id: '/_authenticate/_inject-org-details/_org-layout/integrations/azure-app-configuration/oauth2/callback'
path: '/azure-app-configuration/oauth2/callback'
@@ -2427,6 +2543,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof projectAccessControlPageRouteSshImport
parentRoute: typeof sshLayoutImport
}
+ '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/': {
+ id: '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/'
+ path: '/'
+ fullPath: '/cert-manager/$projectId/subscribers/'
+ preLoaderRoute: typeof certManagerPkiSubscribersPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersImport
+ }
'/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/': {
id: '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/'
path: '/'
@@ -2441,6 +2564,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof certManagerCertAuthDetailsByIDPageRouteImport
parentRoute: typeof certManagerLayoutImport
}
+ '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName': {
+ id: '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName'
+ path: '/$subscriberName'
+ fullPath: '/cert-manager/$projectId/subscribers/$subscriberName'
+ preLoaderRoute: typeof certManagerPkiSubscriberDetailsByIDPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organization/app-connections/$appConnection/oauth/callback': {
id: '/_authenticate/_inject-org-details/_org-layout/organization/app-connections/$appConnection/oauth/callback'
path: '/$appConnection/oauth/callback'
@@ -3252,18 +3382,23 @@ interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationRouteChildren {
organizationAuditLogsPageRouteRoute: typeof organizationAuditLogsPageRouteRoute
organizationBillingPageRouteRoute: typeof organizationBillingPageRouteRoute
organizationSecretScanningPageRouteRoute: typeof organizationSecretScanningPageRouteRoute
+ organizationSsoPageRouteRoute: typeof organizationSsoPageRouteRoute
AuthenticateInjectOrgDetailsOrgLayoutOrganizationAppConnectionsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationAppConnectionsRouteWithChildren
AuthenticateInjectOrgDetailsOrgLayoutOrganizationGatewaysRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationGatewaysRouteWithChildren
AuthenticateInjectOrgDetailsOrgLayoutOrganizationSecretSharingRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationSecretSharingRouteWithChildren
AuthenticateInjectOrgDetailsOrgLayoutOrganizationSettingsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationSettingsRouteWithChildren
organizationCertManagerOverviewPageRouteRoute: typeof organizationCertManagerOverviewPageRouteRoute
+ organizationCertManagerSettingsPageRouteRoute: typeof organizationCertManagerSettingsPageRouteRoute
organizationGroupDetailsByIDPageRouteRoute: typeof organizationGroupDetailsByIDPageRouteRoute
organizationIdentityDetailsByIDPageRouteRoute: typeof organizationIdentityDetailsByIDPageRouteRoute
organizationKmsOverviewPageRouteRoute: typeof organizationKmsOverviewPageRouteRoute
+ organizationKmsSettingsPageRouteRoute: typeof organizationKmsSettingsPageRouteRoute
organizationUserDetailsByIDPageRouteRoute: typeof organizationUserDetailsByIDPageRouteRoute
organizationRoleByIDPageRouteRoute: typeof organizationRoleByIDPageRouteRoute
organizationSecretManagerOverviewPageRouteRoute: typeof organizationSecretManagerOverviewPageRouteRoute
+ organizationSecretManagerSettingsPageRouteRoute: typeof organizationSecretManagerSettingsPageRouteRoute
organizationSshOverviewPageRouteRoute: typeof organizationSshOverviewPageRouteRoute
+ organizationSshSettingsPageRouteRoute: typeof organizationSshSettingsPageRouteRoute
}
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationRouteChildren =
@@ -3275,6 +3410,7 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationRouteChildren: Authentica
organizationBillingPageRouteRoute: organizationBillingPageRouteRoute,
organizationSecretScanningPageRouteRoute:
organizationSecretScanningPageRouteRoute,
+ organizationSsoPageRouteRoute: organizationSsoPageRouteRoute,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationAppConnectionsRoute:
AuthenticateInjectOrgDetailsOrgLayoutOrganizationAppConnectionsRouteWithChildren,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationGatewaysRoute:
@@ -3285,19 +3421,27 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationRouteChildren: Authentica
AuthenticateInjectOrgDetailsOrgLayoutOrganizationSettingsRouteWithChildren,
organizationCertManagerOverviewPageRouteRoute:
organizationCertManagerOverviewPageRouteRoute,
+ organizationCertManagerSettingsPageRouteRoute:
+ organizationCertManagerSettingsPageRouteRoute,
organizationGroupDetailsByIDPageRouteRoute:
organizationGroupDetailsByIDPageRouteRoute,
organizationIdentityDetailsByIDPageRouteRoute:
organizationIdentityDetailsByIDPageRouteRoute,
organizationKmsOverviewPageRouteRoute:
organizationKmsOverviewPageRouteRoute,
+ organizationKmsSettingsPageRouteRoute:
+ organizationKmsSettingsPageRouteRoute,
organizationUserDetailsByIDPageRouteRoute:
organizationUserDetailsByIDPageRouteRoute,
organizationRoleByIDPageRouteRoute: organizationRoleByIDPageRouteRoute,
organizationSecretManagerOverviewPageRouteRoute:
organizationSecretManagerOverviewPageRouteRoute,
+ organizationSecretManagerSettingsPageRouteRoute:
+ organizationSecretManagerSettingsPageRouteRoute,
organizationSshOverviewPageRouteRoute:
organizationSshOverviewPageRouteRoute,
+ organizationSshSettingsPageRouteRoute:
+ organizationSshSettingsPageRouteRoute,
}
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationRouteWithChildren =
@@ -3305,12 +3449,31 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationRouteWithChildren =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationRouteChildren,
)
+interface AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRouteChildren {
+ certManagerPkiSubscribersPageRouteRoute: typeof certManagerPkiSubscribersPageRouteRoute
+ certManagerPkiSubscriberDetailsByIDPageRouteRoute: typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
+}
+
+const AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRouteChildren =
+ {
+ certManagerPkiSubscribersPageRouteRoute:
+ certManagerPkiSubscribersPageRouteRoute,
+ certManagerPkiSubscriberDetailsByIDPageRouteRoute:
+ certManagerPkiSubscriberDetailsByIDPageRouteRoute,
+ }
+
+const AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRouteWithChildren =
+ AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRoute._addFileChildren(
+ AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRouteChildren,
+ )
+
interface certManagerLayoutRouteChildren {
certManagerAlertingPageRouteRoute: typeof certManagerAlertingPageRouteRoute
certManagerCertificateAuthoritiesPageRouteRoute: typeof certManagerCertificateAuthoritiesPageRouteRoute
certManagerCertificatesPageRouteRoute: typeof certManagerCertificatesPageRouteRoute
certManagerSettingsPageRouteRoute: typeof certManagerSettingsPageRouteRoute
projectAccessControlPageRouteCertManagerRoute: typeof projectAccessControlPageRouteCertManagerRoute
+ AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRouteWithChildren
certManagerCertAuthDetailsByIDPageRouteRoute: typeof certManagerCertAuthDetailsByIDPageRouteRoute
projectIdentityDetailsByIDPageRouteCertManagerRoute: typeof projectIdentityDetailsByIDPageRouteCertManagerRoute
projectMemberDetailsByIDPageRouteCertManagerRoute: typeof projectMemberDetailsByIDPageRouteCertManagerRoute
@@ -3326,6 +3489,8 @@ const certManagerLayoutRouteChildren: certManagerLayoutRouteChildren = {
certManagerSettingsPageRouteRoute: certManagerSettingsPageRouteRoute,
projectAccessControlPageRouteCertManagerRoute:
projectAccessControlPageRouteCertManagerRoute,
+ AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRoute:
+ AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRouteWithChildren,
certManagerCertAuthDetailsByIDPageRouteRoute:
certManagerCertAuthDetailsByIDPageRouteRoute,
projectIdentityDetailsByIDPageRouteCertManagerRoute:
@@ -4007,6 +4172,7 @@ export interface FileRoutesByFullPath {
'/organization/audit-logs': typeof organizationAuditLogsPageRouteRoute
'/organization/billing': typeof organizationBillingPageRouteRoute
'/organization/secret-scanning': typeof organizationSecretScanningPageRouteRoute
+ '/organization/sso': typeof organizationSsoPageRouteRoute
'/cert-manager/$projectId': typeof certManagerLayoutRouteWithChildren
'/kms/$projectId': typeof kmsLayoutRouteWithChildren
'/organization/app-connections': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationAppConnectionsRouteWithChildren
@@ -4020,17 +4186,21 @@ export interface FileRoutesByFullPath {
'/organization/secret-sharing/': typeof organizationSecretSharingPageRouteRoute
'/organization/settings/': typeof organizationSettingsPageRouteRoute
'/organization/cert-manager/overview': typeof organizationCertManagerOverviewPageRouteRoute
+ '/organization/cert-manager/settings': typeof organizationCertManagerSettingsPageRouteRoute
'/organization/groups/$groupId': typeof organizationGroupDetailsByIDPageRouteRoute
'/organization/identities/$identityId': typeof organizationIdentityDetailsByIDPageRouteRoute
'/organization/kms/overview': typeof organizationKmsOverviewPageRouteRoute
+ '/organization/kms/settings': typeof organizationKmsSettingsPageRouteRoute
'/organization/members/$membershipId': typeof organizationUserDetailsByIDPageRouteRoute
'/organization/roles/$roleId': typeof organizationRoleByIDPageRouteRoute
'/organization/secret-manager/overview': typeof organizationSecretManagerOverviewPageRouteRoute
+ '/organization/secret-manager/settings': typeof organizationSecretManagerSettingsPageRouteRoute
'/organization/secret-sharing/settings': typeof organizationSecretSharingSettingsPageRouteRoute
'/organization/ssh/overview': typeof organizationSshOverviewPageRouteRoute
+ '/organization/ssh/settings': typeof organizationSshSettingsPageRouteRoute
'/cert-manager/$projectId/alerting': typeof certManagerAlertingPageRouteRoute
'/cert-manager/$projectId/certificate-authorities': typeof certManagerCertificateAuthoritiesPageRouteRoute
- '/cert-manager/$projectId/overview': typeof certManagerCertificatesPageRouteRoute
+ '/cert-manager/$projectId/certificates': typeof certManagerCertificatesPageRouteRoute
'/cert-manager/$projectId/settings': typeof certManagerSettingsPageRouteRoute
'/kms/$projectId/kmip': typeof kmsKmipPageRouteRoute
'/kms/$projectId/overview': typeof kmsOverviewPageRouteRoute
@@ -4046,6 +4216,7 @@ export interface FileRoutesByFullPath {
'/ssh/$projectId/overview': typeof sshSshHostsPageRouteRoute
'/ssh/$projectId/settings': typeof sshSettingsPageRouteRoute
'/cert-manager/$projectId/access-management': typeof projectAccessControlPageRouteCertManagerRoute
+ '/cert-manager/$projectId/subscribers': typeof AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRouteWithChildren
'/integrations/azure-app-configuration/oauth2/callback': typeof secretManagerIntegrationsRouteAzureAppConfigurationsOauthRedirectRoute
'/integrations/azure-key-vault/oauth2/callback': typeof secretManagerIntegrationsRouteAzureKeyVaultOauthRedirectRoute
'/integrations/bitbucket/oauth2/callback': typeof secretManagerIntegrationsRouteBitbucketOauthRedirectRoute
@@ -4059,8 +4230,10 @@ export interface FileRoutesByFullPath {
'/secret-manager/$projectId/access-management': typeof projectAccessControlPageRouteSecretManagerRoute
'/secret-manager/$projectId/integrations': typeof AuthenticateInjectOrgDetailsOrgLayoutSecretManagerProjectIdSecretManagerLayoutIntegrationsRouteWithChildren
'/ssh/$projectId/access-management': typeof projectAccessControlPageRouteSshRoute
+ '/cert-manager/$projectId/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute
'/secret-manager/$projectId/integrations/': typeof secretManagerIntegrationsListPageRouteRoute
'/cert-manager/$projectId/ca/$caId': typeof certManagerCertAuthDetailsByIDPageRouteRoute
+ '/cert-manager/$projectId/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
'/organization/app-connections/$appConnection/oauth/callback': typeof organizationAppConnectionsOauthCallbackPageRouteRoute
'/secret-manager/$projectId/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute
'/secret-manager/$projectId/integrations/select-integration-auth': typeof secretManagerIntegrationsSelectIntegrationAuthPageRouteRoute
@@ -4195,6 +4368,7 @@ export interface FileRoutesByTo {
'/organization/audit-logs': typeof organizationAuditLogsPageRouteRoute
'/organization/billing': typeof organizationBillingPageRouteRoute
'/organization/secret-scanning': typeof organizationSecretScanningPageRouteRoute
+ '/organization/sso': typeof organizationSsoPageRouteRoute
'/cert-manager/$projectId': typeof certManagerLayoutRouteWithChildren
'/kms/$projectId': typeof kmsLayoutRouteWithChildren
'/secret-manager/$projectId': typeof secretManagerLayoutRouteWithChildren
@@ -4204,17 +4378,21 @@ export interface FileRoutesByTo {
'/organization/secret-sharing': typeof organizationSecretSharingPageRouteRoute
'/organization/settings': typeof organizationSettingsPageRouteRoute
'/organization/cert-manager/overview': typeof organizationCertManagerOverviewPageRouteRoute
+ '/organization/cert-manager/settings': typeof organizationCertManagerSettingsPageRouteRoute
'/organization/groups/$groupId': typeof organizationGroupDetailsByIDPageRouteRoute
'/organization/identities/$identityId': typeof organizationIdentityDetailsByIDPageRouteRoute
'/organization/kms/overview': typeof organizationKmsOverviewPageRouteRoute
+ '/organization/kms/settings': typeof organizationKmsSettingsPageRouteRoute
'/organization/members/$membershipId': typeof organizationUserDetailsByIDPageRouteRoute
'/organization/roles/$roleId': typeof organizationRoleByIDPageRouteRoute
'/organization/secret-manager/overview': typeof organizationSecretManagerOverviewPageRouteRoute
+ '/organization/secret-manager/settings': typeof organizationSecretManagerSettingsPageRouteRoute
'/organization/secret-sharing/settings': typeof organizationSecretSharingSettingsPageRouteRoute
'/organization/ssh/overview': typeof organizationSshOverviewPageRouteRoute
+ '/organization/ssh/settings': typeof organizationSshSettingsPageRouteRoute
'/cert-manager/$projectId/alerting': typeof certManagerAlertingPageRouteRoute
'/cert-manager/$projectId/certificate-authorities': typeof certManagerCertificateAuthoritiesPageRouteRoute
- '/cert-manager/$projectId/overview': typeof certManagerCertificatesPageRouteRoute
+ '/cert-manager/$projectId/certificates': typeof certManagerCertificatesPageRouteRoute
'/cert-manager/$projectId/settings': typeof certManagerSettingsPageRouteRoute
'/kms/$projectId/kmip': typeof kmsKmipPageRouteRoute
'/kms/$projectId/overview': typeof kmsOverviewPageRouteRoute
@@ -4242,8 +4420,10 @@ export interface FileRoutesByTo {
'/kms/$projectId/access-management': typeof projectAccessControlPageRouteKmsRoute
'/secret-manager/$projectId/access-management': typeof projectAccessControlPageRouteSecretManagerRoute
'/ssh/$projectId/access-management': typeof projectAccessControlPageRouteSshRoute
+ '/cert-manager/$projectId/subscribers': typeof certManagerPkiSubscribersPageRouteRoute
'/secret-manager/$projectId/integrations': typeof secretManagerIntegrationsListPageRouteRoute
'/cert-manager/$projectId/ca/$caId': typeof certManagerCertAuthDetailsByIDPageRouteRoute
+ '/cert-manager/$projectId/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
'/organization/app-connections/$appConnection/oauth/callback': typeof organizationAppConnectionsOauthCallbackPageRouteRoute
'/secret-manager/$projectId/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute
'/secret-manager/$projectId/integrations/select-integration-auth': typeof secretManagerIntegrationsSelectIntegrationAuthPageRouteRoute
@@ -4386,6 +4566,7 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organization/audit-logs': typeof organizationAuditLogsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/billing': typeof organizationBillingPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/secret-scanning': typeof organizationSecretScanningPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/organization/sso': typeof organizationSsoPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/kms/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutKmsProjectIdRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organization/app-connections': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationAppConnectionsRouteWithChildren
@@ -4399,21 +4580,25 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organization/secret-sharing/': typeof organizationSecretSharingPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/settings/': typeof organizationSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/overview': typeof organizationCertManagerOverviewPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/settings': typeof organizationCertManagerSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/groups/$groupId': typeof organizationGroupDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/identities/$identityId': typeof organizationIdentityDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/kms/overview': typeof organizationKmsOverviewPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/organization/kms/settings': typeof organizationKmsSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/members/$membershipId': typeof organizationUserDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/roles/$roleId': typeof organizationRoleByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/overview': typeof organizationSecretManagerOverviewPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/settings': typeof organizationSecretManagerSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/secret-sharing/settings': typeof organizationSecretSharingSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/ssh/overview': typeof organizationSshOverviewPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/organization/ssh/settings': typeof organizationSshSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout': typeof certManagerLayoutRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/kms/$projectId/_kms-layout': typeof kmsLayoutRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout': typeof secretManagerLayoutRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout': typeof sshLayoutRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/alerting': typeof certManagerAlertingPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificate-authorities': typeof certManagerCertificateAuthoritiesPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/overview': typeof certManagerCertificatesPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificates': typeof certManagerCertificatesPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/settings': typeof certManagerSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/kms/$projectId/_kms-layout/kmip': typeof kmsKmipPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/kms/$projectId/_kms-layout/overview': typeof kmsOverviewPageRouteRoute
@@ -4429,6 +4614,7 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout/overview': typeof sshSshHostsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout/settings': typeof sshSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/access-management': typeof projectAccessControlPageRouteCertManagerRoute
+ '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers': typeof AuthenticateInjectOrgDetailsOrgLayoutCertManagerProjectIdCertManagerLayoutSubscribersRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/integrations/azure-app-configuration/oauth2/callback': typeof secretManagerIntegrationsRouteAzureAppConfigurationsOauthRedirectRoute
'/_authenticate/_inject-org-details/_org-layout/integrations/azure-key-vault/oauth2/callback': typeof secretManagerIntegrationsRouteAzureKeyVaultOauthRedirectRoute
'/_authenticate/_inject-org-details/_org-layout/integrations/bitbucket/oauth2/callback': typeof secretManagerIntegrationsRouteBitbucketOauthRedirectRoute
@@ -4442,8 +4628,10 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/access-management': typeof projectAccessControlPageRouteSecretManagerRoute
'/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations': typeof AuthenticateInjectOrgDetailsOrgLayoutSecretManagerProjectIdSecretManagerLayoutIntegrationsRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout/access-management': typeof projectAccessControlPageRouteSshRoute
+ '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/': typeof secretManagerIntegrationsListPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId': typeof certManagerCertAuthDetailsByIDPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organization/app-connections/$appConnection/oauth/callback': typeof organizationAppConnectionsOauthCallbackPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/select-integration-auth': typeof secretManagerIntegrationsSelectIntegrationAuthPageRouteRoute
@@ -4584,6 +4772,7 @@ export interface FileRouteTypes {
| '/organization/audit-logs'
| '/organization/billing'
| '/organization/secret-scanning'
+ | '/organization/sso'
| '/cert-manager/$projectId'
| '/kms/$projectId'
| '/organization/app-connections'
@@ -4597,17 +4786,21 @@ export interface FileRouteTypes {
| '/organization/secret-sharing/'
| '/organization/settings/'
| '/organization/cert-manager/overview'
+ | '/organization/cert-manager/settings'
| '/organization/groups/$groupId'
| '/organization/identities/$identityId'
| '/organization/kms/overview'
+ | '/organization/kms/settings'
| '/organization/members/$membershipId'
| '/organization/roles/$roleId'
| '/organization/secret-manager/overview'
+ | '/organization/secret-manager/settings'
| '/organization/secret-sharing/settings'
| '/organization/ssh/overview'
+ | '/organization/ssh/settings'
| '/cert-manager/$projectId/alerting'
| '/cert-manager/$projectId/certificate-authorities'
- | '/cert-manager/$projectId/overview'
+ | '/cert-manager/$projectId/certificates'
| '/cert-manager/$projectId/settings'
| '/kms/$projectId/kmip'
| '/kms/$projectId/overview'
@@ -4623,6 +4816,7 @@ export interface FileRouteTypes {
| '/ssh/$projectId/overview'
| '/ssh/$projectId/settings'
| '/cert-manager/$projectId/access-management'
+ | '/cert-manager/$projectId/subscribers'
| '/integrations/azure-app-configuration/oauth2/callback'
| '/integrations/azure-key-vault/oauth2/callback'
| '/integrations/bitbucket/oauth2/callback'
@@ -4636,8 +4830,10 @@ export interface FileRouteTypes {
| '/secret-manager/$projectId/access-management'
| '/secret-manager/$projectId/integrations'
| '/ssh/$projectId/access-management'
+ | '/cert-manager/$projectId/subscribers/'
| '/secret-manager/$projectId/integrations/'
| '/cert-manager/$projectId/ca/$caId'
+ | '/cert-manager/$projectId/subscribers/$subscriberName'
| '/organization/app-connections/$appConnection/oauth/callback'
| '/secret-manager/$projectId/integrations/$integrationId'
| '/secret-manager/$projectId/integrations/select-integration-auth'
@@ -4771,6 +4967,7 @@ export interface FileRouteTypes {
| '/organization/audit-logs'
| '/organization/billing'
| '/organization/secret-scanning'
+ | '/organization/sso'
| '/cert-manager/$projectId'
| '/kms/$projectId'
| '/secret-manager/$projectId'
@@ -4780,17 +4977,21 @@ export interface FileRouteTypes {
| '/organization/secret-sharing'
| '/organization/settings'
| '/organization/cert-manager/overview'
+ | '/organization/cert-manager/settings'
| '/organization/groups/$groupId'
| '/organization/identities/$identityId'
| '/organization/kms/overview'
+ | '/organization/kms/settings'
| '/organization/members/$membershipId'
| '/organization/roles/$roleId'
| '/organization/secret-manager/overview'
+ | '/organization/secret-manager/settings'
| '/organization/secret-sharing/settings'
| '/organization/ssh/overview'
+ | '/organization/ssh/settings'
| '/cert-manager/$projectId/alerting'
| '/cert-manager/$projectId/certificate-authorities'
- | '/cert-manager/$projectId/overview'
+ | '/cert-manager/$projectId/certificates'
| '/cert-manager/$projectId/settings'
| '/kms/$projectId/kmip'
| '/kms/$projectId/overview'
@@ -4818,8 +5019,10 @@ export interface FileRouteTypes {
| '/kms/$projectId/access-management'
| '/secret-manager/$projectId/access-management'
| '/ssh/$projectId/access-management'
+ | '/cert-manager/$projectId/subscribers'
| '/secret-manager/$projectId/integrations'
| '/cert-manager/$projectId/ca/$caId'
+ | '/cert-manager/$projectId/subscribers/$subscriberName'
| '/organization/app-connections/$appConnection/oauth/callback'
| '/secret-manager/$projectId/integrations/$integrationId'
| '/secret-manager/$projectId/integrations/select-integration-auth'
@@ -4960,6 +5163,7 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organization/audit-logs'
| '/_authenticate/_inject-org-details/_org-layout/organization/billing'
| '/_authenticate/_inject-org-details/_org-layout/organization/secret-scanning'
+ | '/_authenticate/_inject-org-details/_org-layout/organization/sso'
| '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId'
| '/_authenticate/_inject-org-details/_org-layout/kms/$projectId'
| '/_authenticate/_inject-org-details/_org-layout/organization/app-connections'
@@ -4973,21 +5177,25 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organization/secret-sharing/'
| '/_authenticate/_inject-org-details/_org-layout/organization/settings/'
| '/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/overview'
+ | '/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/settings'
| '/_authenticate/_inject-org-details/_org-layout/organization/groups/$groupId'
| '/_authenticate/_inject-org-details/_org-layout/organization/identities/$identityId'
| '/_authenticate/_inject-org-details/_org-layout/organization/kms/overview'
+ | '/_authenticate/_inject-org-details/_org-layout/organization/kms/settings'
| '/_authenticate/_inject-org-details/_org-layout/organization/members/$membershipId'
| '/_authenticate/_inject-org-details/_org-layout/organization/roles/$roleId'
| '/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/overview'
+ | '/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/settings'
| '/_authenticate/_inject-org-details/_org-layout/organization/secret-sharing/settings'
| '/_authenticate/_inject-org-details/_org-layout/organization/ssh/overview'
+ | '/_authenticate/_inject-org-details/_org-layout/organization/ssh/settings'
| '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout'
| '/_authenticate/_inject-org-details/_org-layout/kms/$projectId/_kms-layout'
| '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout'
| '/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout'
| '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/alerting'
| '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificate-authorities'
- | '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/overview'
+ | '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificates'
| '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/settings'
| '/_authenticate/_inject-org-details/_org-layout/kms/$projectId/_kms-layout/kmip'
| '/_authenticate/_inject-org-details/_org-layout/kms/$projectId/_kms-layout/overview'
@@ -5003,6 +5211,7 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout/overview'
| '/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout/settings'
| '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/access-management'
+ | '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers'
| '/_authenticate/_inject-org-details/_org-layout/integrations/azure-app-configuration/oauth2/callback'
| '/_authenticate/_inject-org-details/_org-layout/integrations/azure-key-vault/oauth2/callback'
| '/_authenticate/_inject-org-details/_org-layout/integrations/bitbucket/oauth2/callback'
@@ -5016,8 +5225,10 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/access-management'
| '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations'
| '/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout/access-management'
+ | '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/'
| '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/'
| '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId'
+ | '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName'
| '/_authenticate/_inject-org-details/_org-layout/organization/app-connections/$appConnection/oauth/callback'
| '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/$integrationId'
| '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/select-integration-auth'
@@ -5357,18 +5568,23 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organization/audit-logs",
"/_authenticate/_inject-org-details/_org-layout/organization/billing",
"/_authenticate/_inject-org-details/_org-layout/organization/secret-scanning",
+ "/_authenticate/_inject-org-details/_org-layout/organization/sso",
"/_authenticate/_inject-org-details/_org-layout/organization/app-connections",
"/_authenticate/_inject-org-details/_org-layout/organization/gateways",
"/_authenticate/_inject-org-details/_org-layout/organization/secret-sharing",
"/_authenticate/_inject-org-details/_org-layout/organization/settings",
"/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/overview",
+ "/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/settings",
"/_authenticate/_inject-org-details/_org-layout/organization/groups/$groupId",
"/_authenticate/_inject-org-details/_org-layout/organization/identities/$identityId",
"/_authenticate/_inject-org-details/_org-layout/organization/kms/overview",
+ "/_authenticate/_inject-org-details/_org-layout/organization/kms/settings",
"/_authenticate/_inject-org-details/_org-layout/organization/members/$membershipId",
"/_authenticate/_inject-org-details/_org-layout/organization/roles/$roleId",
"/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/overview",
- "/_authenticate/_inject-org-details/_org-layout/organization/ssh/overview"
+ "/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/settings",
+ "/_authenticate/_inject-org-details/_org-layout/organization/ssh/overview",
+ "/_authenticate/_inject-org-details/_org-layout/organization/ssh/settings"
]
},
"/_authenticate/_inject-org-details/admin/_admin-layout": {
@@ -5402,6 +5618,10 @@ export const routeTree = rootRoute
"filePath": "organization/SecretScanningPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organization"
},
+ "/_authenticate/_inject-org-details/_org-layout/organization/sso": {
+ "filePath": "organization/SsoPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organization"
+ },
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId": {
"filePath": "",
"parent": "/_authenticate/_inject-org-details/_org-layout",
@@ -5481,6 +5701,10 @@ export const routeTree = rootRoute
"filePath": "organization/CertManagerOverviewPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organization"
},
+ "/_authenticate/_inject-org-details/_org-layout/organization/cert-manager/settings": {
+ "filePath": "organization/CertManagerSettingsPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organization"
+ },
"/_authenticate/_inject-org-details/_org-layout/organization/groups/$groupId": {
"filePath": "organization/GroupDetailsByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organization"
@@ -5493,6 +5717,10 @@ export const routeTree = rootRoute
"filePath": "organization/KmsOverviewPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organization"
},
+ "/_authenticate/_inject-org-details/_org-layout/organization/kms/settings": {
+ "filePath": "organization/KmsSettingsPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organization"
+ },
"/_authenticate/_inject-org-details/_org-layout/organization/members/$membershipId": {
"filePath": "organization/UserDetailsByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organization"
@@ -5505,6 +5733,10 @@ export const routeTree = rootRoute
"filePath": "organization/SecretManagerOverviewPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organization"
},
+ "/_authenticate/_inject-org-details/_org-layout/organization/secret-manager/settings": {
+ "filePath": "organization/SecretManagerSettingsPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organization"
+ },
"/_authenticate/_inject-org-details/_org-layout/organization/secret-sharing/settings": {
"filePath": "organization/SecretSharingSettingsPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organization/secret-sharing"
@@ -5513,15 +5745,20 @@ export const routeTree = rootRoute
"filePath": "organization/SshOverviewPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organization"
},
+ "/_authenticate/_inject-org-details/_org-layout/organization/ssh/settings": {
+ "filePath": "organization/SshSettingsPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organization"
+ },
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout": {
"filePath": "cert-manager/layout.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId",
"children": [
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/alerting",
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificate-authorities",
- "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/overview",
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificates",
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/settings",
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/access-management",
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers",
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId",
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/identities/$identityId",
"/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/members/$membershipId",
@@ -5584,7 +5821,7 @@ export const routeTree = rootRoute
"filePath": "cert-manager/CertificateAuthoritiesPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout"
},
- "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/overview": {
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/certificates": {
"filePath": "cert-manager/CertificatesPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout"
},
@@ -5648,6 +5885,14 @@ export const routeTree = rootRoute
"filePath": "project/AccessControlPage/route-cert-manager.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout"
},
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers": {
+ "filePath": "",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout",
+ "children": [
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/",
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName"
+ ]
+ },
"/_authenticate/_inject-org-details/_org-layout/integrations/azure-app-configuration/oauth2/callback": {
"filePath": "secret-manager/integrations/route-azure-app-configurations-oauth-redirect.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/integrations"
@@ -5780,6 +6025,10 @@ export const routeTree = rootRoute
"filePath": "project/AccessControlPage/route-ssh.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout"
},
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/": {
+ "filePath": "cert-manager/PkiSubscribersPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers"
+ },
"/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/": {
"filePath": "secret-manager/IntegrationsListPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations"
@@ -5788,6 +6037,10 @@ export const routeTree = rootRoute
"filePath": "cert-manager/CertAuthDetailsByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout"
},
+ "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName": {
+ "filePath": "cert-manager/PkiSubscriberDetailsByIDPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers"
+ },
"/_authenticate/_inject-org-details/_org-layout/organization/app-connections/$appConnection/oauth/callback": {
"filePath": "organization/AppConnections/OauthCallbackPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organization/app-connections"
diff --git a/frontend/src/routes.ts b/frontend/src/routes.ts
index 9954fb6508..f4bc59ee5c 100644
--- a/frontend/src/routes.ts
+++ b/frontend/src/routes.ts
@@ -9,9 +9,13 @@ const adminRoute = route("/admin", [
const organizationRoutes = route("/organization", [
route("/secret-manager/overview", "organization/SecretManagerOverviewPage/route.tsx"),
+ route("/secret-manager/settings", "organization/SecretManagerSettingsPage/route.tsx"),
route("/cert-manager/overview", "organization/CertManagerOverviewPage/route.tsx"),
+ route("/cert-manager/settings", "organization/CertManagerSettingsPage/route.tsx"),
route("/ssh/overview", "organization/SshOverviewPage/route.tsx"),
+ route("/ssh/settings", "organization/SshSettingsPage/route.tsx"),
route("/kms/overview", "organization/KmsOverviewPage/route.tsx"),
+ route("/kms/settings", "organization/KmsSettingsPage/route.tsx"),
route("/access-management", "organization/AccessManagementPage/route.tsx"),
route("/admin", "organization/AdminPage/route.tsx"),
route("/audit-logs", "organization/AuditLogsPage/route.tsx"),
@@ -24,6 +28,7 @@ const organizationRoutes = route("/organization", [
index("organization/SettingsPage/route.tsx"),
route("/oauth/callback", "organization/SettingsPage/OauthCallbackPage/route.tsx")
]),
+ route("/sso", "organization/SsoPage/route.tsx"),
route("/secret-scanning", "organization/SecretScanningPage/route.tsx"),
route("/groups/$groupId", "organization/GroupDetailsByIDPage/route.tsx"),
route("/members/$membershipId", "organization/UserDetailsByIDPage/route.tsx"),
@@ -294,7 +299,11 @@ const secretManagerIntegrationsRedirect = route("/integrations", [
const certManagerRoutes = route("/cert-manager/$projectId", [
layout("cert-manager-layout", "cert-manager/layout.tsx", [
- route("/overview", "cert-manager/CertificatesPage/route.tsx"),
+ route("/subscribers", [
+ index("cert-manager/PkiSubscribersPage/route.tsx"),
+ route("/$subscriberName", "cert-manager/PkiSubscriberDetailsByIDPage/route.tsx")
+ ]),
+ route("/certificates", "cert-manager/CertificatesPage/route.tsx"),
route("/certificate-authorities", "cert-manager/CertificateAuthoritiesPage/route.tsx"),
route("/alerting", "cert-manager/AlertingPage/route.tsx"),
route("/ca/$caId", "cert-manager/CertAuthDetailsByIDPage/route.tsx"),
diff --git a/helm-charts/secrets-operator/Chart.yaml b/helm-charts/secrets-operator/Chart.yaml
index c8bfc3539c..e22529f9ca 100644
--- a/helm-charts/secrets-operator/Chart.yaml
+++ b/helm-charts/secrets-operator/Chart.yaml
@@ -13,9 +13,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: v0.9.1
+version: v0.9.2
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
-appVersion: "v0.9.1"
+appVersion: "v0.9.2"
diff --git a/helm-charts/secrets-operator/templates/clustergenerator-crd.yaml b/helm-charts/secrets-operator/templates/clustergenerator-crd.yaml
new file mode 100644
index 0000000000..8da166a5e2
--- /dev/null
+++ b/helm-charts/secrets-operator/templates/clustergenerator-crd.yaml
@@ -0,0 +1,97 @@
+{{- if .Values.installCRDs }}
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: clustergenerators.secrets.infisical.com
+ annotations:
+ controller-gen.kubebuilder.io/version: v0.10.0
+ labels:
+ {{- include "secrets-operator.labels" . | nindent 4 }}
+spec:
+ group: secrets.infisical.com
+ names:
+ kind: ClusterGenerator
+ listKind: ClusterGeneratorList
+ plural: clustergenerators
+ singular: clustergenerator
+ scope: Cluster
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ description: ClusterGenerator represents a cluster-wide generator
+ properties:
+ apiVersion:
+ description: 'APIVersion defines the versioned schema of this representation
+ of an object. Servers should convert recognized schemas to the latest
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
+ type: string
+ kind:
+ description: 'Kind is a string value representing the REST resource this
+ object represents. Servers may infer this from the endpoint the client
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
+ type: string
+ metadata:
+ type: object
+ spec:
+ properties:
+ generator:
+ description: Generator the spec for this generator, must match the kind.
+ properties:
+ passwordSpec:
+ description: PasswordSpec controls the behavior of the password
+ generator.
+ properties:
+ allowRepeat:
+ default: false
+ description: set allowRepeat to true to allow repeating characters.
+ type: boolean
+ digits:
+ description: digits specifies the number of digits in the generated
+ password. If omitted it defaults to 25% of the length of the
+ password
+ type: integer
+ length:
+ default: 24
+ description: Length of the password to be generated. Defaults
+ to 24
+ type: integer
+ noUpper:
+ default: false
+ description: Set noUpper to disable uppercase characters
+ type: boolean
+ symbolCharacters:
+ description: symbolCharacters specifies the special characters
+ that should be used in the generated password.
+ type: string
+ symbols:
+ description: symbols specifies the number of symbol characters
+ in the generated password. If omitted it defaults to 25% of
+ the length of the password
+ type: integer
+ type: object
+ uuidSpec:
+ description: UUIDSpec controls the behavior of the uuid generator.
+ type: object
+ type: object
+ kind:
+ description: Kind the kind of this generator.
+ enum:
+ - Password
+ - UUID
+ type: string
+ required:
+ - kind
+ type: object
+ type: object
+ served: true
+ storage: true
+ subresources:
+ status: {}
+status:
+ acceptedNames:
+ kind: ""
+ plural: ""
+ conditions: []
+ storedVersions: []
+{{- end }}
diff --git a/helm-charts/secrets-operator/templates/infisicalpushsecret-crd.yaml b/helm-charts/secrets-operator/templates/infisicalpushsecret-crd.yaml
index 5afb4f5196..64ddc3e5ec 100644
--- a/helm-charts/secrets-operator/templates/infisicalpushsecret-crd.yaml
+++ b/helm-charts/secrets-operator/templates/infisicalpushsecret-crd.yaml
@@ -143,6 +143,34 @@ spec:
type: string
push:
properties:
+ generators:
+ items:
+ properties:
+ destinationSecretName:
+ type: string
+ generatorRef:
+ properties:
+ kind:
+ allOf:
+ - enum:
+ - Password
+ - UUID
+ - enum:
+ - Password
+ - UUID
+ description: Specify the Kind of the generator resource
+ type: string
+ name:
+ type: string
+ required:
+ - kind
+ - name
+ type: object
+ required:
+ - destinationSecretName
+ - generatorRef
+ type: object
+ type: array
secret:
properties:
secretName:
@@ -168,8 +196,6 @@ spec:
- secretName
- secretNamespace
type: object
- required:
- - secret
type: object
resyncInterval:
type: string
@@ -199,7 +225,6 @@ spec:
required:
- destination
- push
- - resyncInterval
type: object
status:
description: InfisicalPushSecretStatus defines the observed state of InfisicalPushSecret
diff --git a/helm-charts/secrets-operator/templates/manager-rbac.yaml b/helm-charts/secrets-operator/templates/manager-rbac.yaml
index 3ab1a74097..93289ca67d 100644
--- a/helm-charts/secrets-operator/templates/manager-rbac.yaml
+++ b/helm-charts/secrets-operator/templates/manager-rbac.yaml
@@ -81,6 +81,18 @@ rules:
- tokenreviews
verbs:
- create
+- apiGroups:
+ - secrets.infisical.com
+ resources:
+ - clustergenerators
+ verbs:
+ - create
+ - delete
+ - get
+ - list
+ - patch
+ - update
+ - watch
- apiGroups:
- secrets.infisical.com
resources:
diff --git a/helm-charts/secrets-operator/values.yaml b/helm-charts/secrets-operator/values.yaml
index cb96f39598..78cfe4ad76 100644
--- a/helm-charts/secrets-operator/values.yaml
+++ b/helm-charts/secrets-operator/values.yaml
@@ -32,7 +32,7 @@ controllerManager:
- ALL
image:
repository: infisical/kubernetes-operator
- tag: v0.9.1
+ tag: v0.9.2
resources:
limits:
cpu: 500m
diff --git a/k8-operator/api/v1alpha1/generators.go b/k8-operator/api/v1alpha1/generators.go
new file mode 100644
index 0000000000..0f6d86c2dd
--- /dev/null
+++ b/k8-operator/api/v1alpha1/generators.go
@@ -0,0 +1,152 @@
+/*
+Copyright 2022.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package v1alpha1
+
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+// GeneratorKind represents a kind of generator.
+// +kubebuilder:validation:Enum=Password;UUID
+type GeneratorKind string
+
+const (
+ GeneratorKindPassword GeneratorKind = "Password"
+ GeneratorKindUUID GeneratorKind = "UUID"
+)
+
+type ClusterGeneratorSpec struct {
+ // Kind the kind of this generator.
+ Kind GeneratorKind `json:"kind"`
+
+ // Generator the spec for this generator, must match the kind.
+ Generator GeneratorSpec `json:"generator,omitempty"`
+}
+
+type GeneratorSpec struct {
+ // +kubebuilder:validation:Optional
+ PasswordSpec *PasswordSpec `json:"passwordSpec,omitempty"`
+ // +kubebuilder:validation:Optional
+ UUIDSpec *UUIDSpec `json:"uuidSpec,omitempty"`
+}
+
+// ClusterGenerator represents a cluster-wide generator
+// +kubebuilder:object:root=true
+// +kubebuilder:storageversion
+// +kubebuilder:subresource:status
+// +kubebuilder:resource:scope=Cluster
+type ClusterGenerator struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ Spec ClusterGeneratorSpec `json:"spec,omitempty"`
+}
+
+// +kubebuilder:object:root=true
+
+// ClusterGeneratorList contains a list of ClusterGenerator resources.
+type ClusterGeneratorList struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ListMeta `json:"metadata,omitempty"`
+ Items []ClusterGenerator `json:"items"`
+}
+
+// ! UUID Generator
+
+// UUIDSpec controls the behavior of the uuid generator.
+type UUIDSpec struct{}
+
+// UUID generates a version 4 UUID (e56657e3-764f-11ef-a397-65231a88c216).
+// +kubebuilder:object:root=true
+// +kubebuilder:subresource:status
+type UUID struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ Spec UUIDSpec `json:"spec,omitempty"`
+}
+
+// +kubebuilder:object:root=true
+
+// UUIDList contains a list of UUID resources.
+type UUIDList struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ListMeta `json:"metadata,omitempty"`
+ Items []UUID `json:"items"`
+}
+
+// ! Password Generator
+
+// PasswordSpec controls the behavior of the password generator.
+type PasswordSpec struct {
+ // Length of the password to be generated.
+ // Defaults to 24
+ // +kubebuilder:validation:Optional
+ // +kubebuilder:default=24
+ Length int `json:"length"`
+
+ // digits specifies the number of digits in the generated
+ // password. If omitted it defaults to 25% of the length of the password
+ Digits *int `json:"digits,omitempty"`
+
+ // symbols specifies the number of symbol characters in the generated
+ // password. If omitted it defaults to 25% of the length of the password
+ Symbols *int `json:"symbols,omitempty"`
+
+ // symbolCharacters specifies the special characters that should be used
+ // in the generated password.
+ SymbolCharacters *string `json:"symbolCharacters,omitempty"`
+
+ // Set noUpper to disable uppercase characters
+ // +kubebuilder:validation:Optional
+ // +kubebuilder:default=false
+ NoUpper bool `json:"noUpper"`
+
+ // set allowRepeat to true to allow repeating characters.
+ // +kubebuilder:validation:Optional
+ // +kubebuilder:default=false
+ AllowRepeat bool `json:"allowRepeat"`
+}
+
+// Password generates a random password based on the
+// configuration parameters in spec.
+// You can specify the length, characterset and other attributes.
+// +kubebuilder:object:root=true
+// +kubebuilder:storageversion
+// +kubebuilder:subresource:status
+// +kubebuilder:resource:scope=Namespaced
+type Password struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ Spec PasswordSpec `json:"spec,omitempty"`
+}
+
+// +kubebuilder:object:root=true
+
+// PasswordList contains a list of Password resources.
+type PasswordList struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ListMeta `json:"metadata,omitempty"`
+ Items []Password `json:"items"`
+}
+
+func init() {
+ SchemeBuilder.Register(&Password{}, &PasswordList{})
+ SchemeBuilder.Register(&UUID{}, &UUIDList{})
+ SchemeBuilder.Register(&ClusterGenerator{}, &ClusterGeneratorList{})
+}
diff --git a/k8-operator/api/v1alpha1/infisicalpushsecret_types.go b/k8-operator/api/v1alpha1/infisicalpushsecret_types.go
index 5a74388816..8958c714d1 100644
--- a/k8-operator/api/v1alpha1/infisicalpushsecret_types.go
+++ b/k8-operator/api/v1alpha1/infisicalpushsecret_types.go
@@ -29,9 +29,28 @@ type InfisicalPushSecretSecretSource struct {
Template *SecretTemplate `json:"template,omitempty"`
}
-type SecretPush struct {
+type GeneratorRef struct {
+ // Specify the Kind of the generator resource
+ // +kubebuilder:validation:Enum=Password;UUID
+ // +kubebuilder:validation:Required
+ Kind GeneratorKind `json:"kind"`
+
+ // +kubebuilder:validation:Required
+ Name string `json:"name"`
+}
+
+type SecretPushGenerator struct {
+ // +kubebuilder:validation:Required
+ DestinationSecretName string `json:"destinationSecretName"`
// +kubebuilder:validation:Required
- Secret InfisicalPushSecretSecretSource `json:"secret"`
+ GeneratorRef GeneratorRef `json:"generatorRef"`
+}
+
+type SecretPush struct {
+ // +kubebuilder:validation:Optional
+ Secret *InfisicalPushSecretSecretSource `json:"secret,omitempty"`
+ // +kubebuilder:validation:Optional
+ Generators []SecretPushGenerator `json:"generators,omitempty"`
}
// InfisicalPushSecretSpec defines the desired state of InfisicalPushSecret
@@ -52,7 +71,8 @@ type InfisicalPushSecretSpec struct {
// +kubebuilder:validation:Required
Push SecretPush `json:"push"`
- ResyncInterval string `json:"resyncInterval"`
+ // +kubebuilder:validation:Optional
+ ResyncInterval *string `json:"resyncInterval,omitempty"`
// Infisical host to pull secrets from
// +kubebuilder:validation:Optional
diff --git a/k8-operator/api/v1alpha1/zz_generated.deepcopy.go b/k8-operator/api/v1alpha1/zz_generated.deepcopy.go
index 4958e9c762..382b0e8cd5 100644
--- a/k8-operator/api/v1alpha1/zz_generated.deepcopy.go
+++ b/k8-operator/api/v1alpha1/zz_generated.deepcopy.go
@@ -96,6 +96,80 @@ func (in *CaReference) DeepCopy() *CaReference {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ClusterGenerator) DeepCopyInto(out *ClusterGenerator) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ in.Spec.DeepCopyInto(&out.Spec)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterGenerator.
+func (in *ClusterGenerator) DeepCopy() *ClusterGenerator {
+ if in == nil {
+ return nil
+ }
+ out := new(ClusterGenerator)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ClusterGenerator) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ClusterGeneratorList) DeepCopyInto(out *ClusterGeneratorList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ListMeta.DeepCopyInto(&out.ListMeta)
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]ClusterGenerator, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterGeneratorList.
+func (in *ClusterGeneratorList) DeepCopy() *ClusterGeneratorList {
+ if in == nil {
+ return nil
+ }
+ out := new(ClusterGeneratorList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ClusterGeneratorList) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ClusterGeneratorSpec) DeepCopyInto(out *ClusterGeneratorSpec) {
+ *out = *in
+ in.Generator.DeepCopyInto(&out.Generator)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterGeneratorSpec.
+func (in *ClusterGeneratorSpec) DeepCopy() *ClusterGeneratorSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(ClusterGeneratorSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DynamicSecretDetails) DeepCopyInto(out *DynamicSecretDetails) {
*out = *in
@@ -143,6 +217,46 @@ func (in *GcpIamAuthDetails) DeepCopy() *GcpIamAuthDetails {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *GeneratorRef) DeepCopyInto(out *GeneratorRef) {
+ *out = *in
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeneratorRef.
+func (in *GeneratorRef) DeepCopy() *GeneratorRef {
+ if in == nil {
+ return nil
+ }
+ out := new(GeneratorRef)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *GeneratorSpec) DeepCopyInto(out *GeneratorSpec) {
+ *out = *in
+ if in.PasswordSpec != nil {
+ in, out := &in.PasswordSpec, &out.PasswordSpec
+ *out = new(PasswordSpec)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.UUIDSpec != nil {
+ in, out := &in.UUIDSpec, &out.UUIDSpec
+ *out = new(UUIDSpec)
+ **out = **in
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GeneratorSpec.
+func (in *GeneratorSpec) DeepCopy() *GeneratorSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(GeneratorSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GenericAwsIamAuth) DeepCopyInto(out *GenericAwsIamAuth) {
*out = *in
@@ -483,6 +597,11 @@ func (in *InfisicalPushSecretSpec) DeepCopyInto(out *InfisicalPushSecretSpec) {
out.Destination = in.Destination
in.Authentication.DeepCopyInto(&out.Authentication)
in.Push.DeepCopyInto(&out.Push)
+ if in.ResyncInterval != nil {
+ in, out := &in.ResyncInterval, &out.ResyncInterval
+ *out = new(string)
+ **out = **in
+ }
out.TLS = in.TLS
}
@@ -746,10 +865,107 @@ func (in *ManagedKubeSecretConfig) DeepCopy() *ManagedKubeSecretConfig {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Password) DeepCopyInto(out *Password) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ in.Spec.DeepCopyInto(&out.Spec)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Password.
+func (in *Password) DeepCopy() *Password {
+ if in == nil {
+ return nil
+ }
+ out := new(Password)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *Password) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *PasswordList) DeepCopyInto(out *PasswordList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ListMeta.DeepCopyInto(&out.ListMeta)
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]Password, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PasswordList.
+func (in *PasswordList) DeepCopy() *PasswordList {
+ if in == nil {
+ return nil
+ }
+ out := new(PasswordList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *PasswordList) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *PasswordSpec) DeepCopyInto(out *PasswordSpec) {
+ *out = *in
+ if in.Digits != nil {
+ in, out := &in.Digits, &out.Digits
+ *out = new(int)
+ **out = **in
+ }
+ if in.Symbols != nil {
+ in, out := &in.Symbols, &out.Symbols
+ *out = new(int)
+ **out = **in
+ }
+ if in.SymbolCharacters != nil {
+ in, out := &in.SymbolCharacters, &out.SymbolCharacters
+ *out = new(string)
+ **out = **in
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PasswordSpec.
+func (in *PasswordSpec) DeepCopy() *PasswordSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(PasswordSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SecretPush) DeepCopyInto(out *SecretPush) {
*out = *in
- in.Secret.DeepCopyInto(&out.Secret)
+ if in.Secret != nil {
+ in, out := &in.Secret, &out.Secret
+ *out = new(InfisicalPushSecretSecretSource)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.Generators != nil {
+ in, out := &in.Generators, &out.Generators
+ *out = make([]SecretPushGenerator, len(*in))
+ copy(*out, *in)
+ }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretPush.
@@ -762,6 +978,22 @@ func (in *SecretPush) DeepCopy() *SecretPush {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *SecretPushGenerator) DeepCopyInto(out *SecretPushGenerator) {
+ *out = *in
+ out.GeneratorRef = in.GeneratorRef
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretPushGenerator.
+func (in *SecretPushGenerator) DeepCopy() *SecretPushGenerator {
+ if in == nil {
+ return nil
+ }
+ out := new(SecretPushGenerator)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SecretScopeInWorkspace) DeepCopyInto(out *SecretScopeInWorkspace) {
*out = *in
@@ -848,6 +1080,79 @@ func (in *TLSConfig) DeepCopy() *TLSConfig {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *UUID) DeepCopyInto(out *UUID) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ out.Spec = in.Spec
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UUID.
+func (in *UUID) DeepCopy() *UUID {
+ if in == nil {
+ return nil
+ }
+ out := new(UUID)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *UUID) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *UUIDList) DeepCopyInto(out *UUIDList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ListMeta.DeepCopyInto(&out.ListMeta)
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]UUID, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UUIDList.
+func (in *UUIDList) DeepCopy() *UUIDList {
+ if in == nil {
+ return nil
+ }
+ out := new(UUIDList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *UUIDList) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *UUIDSpec) DeepCopyInto(out *UUIDSpec) {
+ *out = *in
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UUIDSpec.
+func (in *UUIDSpec) DeepCopy() *UUIDSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(UUIDSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UniversalAuthDetails) DeepCopyInto(out *UniversalAuthDetails) {
*out = *in
diff --git a/k8-operator/config/crd/bases/secrets.infisical.com_clustergenerators.yaml b/k8-operator/config/crd/bases/secrets.infisical.com_clustergenerators.yaml
new file mode 100644
index 0000000000..c4a9eb1680
--- /dev/null
+++ b/k8-operator/config/crd/bases/secrets.infisical.com_clustergenerators.yaml
@@ -0,0 +1,90 @@
+---
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ annotations:
+ controller-gen.kubebuilder.io/version: v0.10.0
+ creationTimestamp: null
+ name: clustergenerators.secrets.infisical.com
+spec:
+ group: secrets.infisical.com
+ names:
+ kind: ClusterGenerator
+ listKind: ClusterGeneratorList
+ plural: clustergenerators
+ singular: clustergenerator
+ scope: Cluster
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ description: ClusterGenerator represents a cluster-wide generator
+ properties:
+ apiVersion:
+ description: 'APIVersion defines the versioned schema of this representation
+ of an object. Servers should convert recognized schemas to the latest
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
+ type: string
+ kind:
+ description: 'Kind is a string value representing the REST resource this
+ object represents. Servers may infer this from the endpoint the client
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
+ type: string
+ metadata:
+ type: object
+ spec:
+ properties:
+ generator:
+ description: Generator the spec for this generator, must match the
+ kind.
+ properties:
+ passwordSpec:
+ description: PasswordSpec controls the behavior of the password
+ generator.
+ properties:
+ allowRepeat:
+ default: false
+ description: set allowRepeat to true to allow repeating characters.
+ type: boolean
+ digits:
+ description: digits specifies the number of digits in the
+ generated password. If omitted it defaults to 25% of the
+ length of the password
+ type: integer
+ length:
+ default: 24
+ description: Length of the password to be generated. Defaults
+ to 24
+ type: integer
+ noUpper:
+ default: false
+ description: Set noUpper to disable uppercase characters
+ type: boolean
+ symbolCharacters:
+ description: symbolCharacters specifies the special characters
+ that should be used in the generated password.
+ type: string
+ symbols:
+ description: symbols specifies the number of symbol characters
+ in the generated password. If omitted it defaults to 25%
+ of the length of the password
+ type: integer
+ type: object
+ uuidSpec:
+ description: UUIDSpec controls the behavior of the uuid generator.
+ type: object
+ type: object
+ kind:
+ description: Kind the kind of this generator.
+ enum:
+ - Password
+ - UUID
+ type: string
+ required:
+ - kind
+ type: object
+ type: object
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/k8-operator/config/crd/bases/secrets.infisical.com_infisicalpushsecrets.yaml b/k8-operator/config/crd/bases/secrets.infisical.com_infisicalpushsecrets.yaml
index 37df72854c..9d7e2adbda 100644
--- a/k8-operator/config/crd/bases/secrets.infisical.com_infisicalpushsecrets.yaml
+++ b/k8-operator/config/crd/bases/secrets.infisical.com_infisicalpushsecrets.yaml
@@ -142,6 +142,34 @@ spec:
type: string
push:
properties:
+ generators:
+ items:
+ properties:
+ destinationSecretName:
+ type: string
+ generatorRef:
+ properties:
+ kind:
+ allOf:
+ - enum:
+ - Password
+ - UUID
+ - enum:
+ - Password
+ - UUID
+ description: Specify the Kind of the generator resource
+ type: string
+ name:
+ type: string
+ required:
+ - kind
+ - name
+ type: object
+ required:
+ - destinationSecretName
+ - generatorRef
+ type: object
+ type: array
secret:
properties:
secretName:
@@ -168,8 +196,6 @@ spec:
- secretName
- secretNamespace
type: object
- required:
- - secret
type: object
resyncInterval:
type: string
@@ -200,7 +226,6 @@ spec:
required:
- destination
- push
- - resyncInterval
type: object
status:
description: InfisicalPushSecretStatus defines the observed state of InfisicalPushSecret
diff --git a/k8-operator/config/crd/bases/secrets.infisical.com_passwords.yaml b/k8-operator/config/crd/bases/secrets.infisical.com_passwords.yaml
new file mode 100644
index 0000000000..dc14f2bf0e
--- /dev/null
+++ b/k8-operator/config/crd/bases/secrets.infisical.com_passwords.yaml
@@ -0,0 +1,69 @@
+---
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ annotations:
+ controller-gen.kubebuilder.io/version: v0.10.0
+ creationTimestamp: null
+ name: passwords.secrets.infisical.com
+spec:
+ group: secrets.infisical.com
+ names:
+ kind: Password
+ listKind: PasswordList
+ plural: passwords
+ singular: password
+ scope: Namespaced
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ description: Password generates a random password based on the configuration
+ parameters in spec. You can specify the length, characterset and other attributes.
+ properties:
+ apiVersion:
+ description: 'APIVersion defines the versioned schema of this representation
+ of an object. Servers should convert recognized schemas to the latest
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
+ type: string
+ kind:
+ description: 'Kind is a string value representing the REST resource this
+ object represents. Servers may infer this from the endpoint the client
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
+ type: string
+ metadata:
+ type: object
+ spec:
+ description: PasswordSpec controls the behavior of the password generator.
+ properties:
+ allowRepeat:
+ default: false
+ description: set allowRepeat to true to allow repeating characters.
+ type: boolean
+ digits:
+ description: digits specifies the number of digits in the generated
+ password. If omitted it defaults to 25% of the length of the password
+ type: integer
+ length:
+ default: 24
+ description: Length of the password to be generated. Defaults to 24
+ type: integer
+ noUpper:
+ default: false
+ description: Set noUpper to disable uppercase characters
+ type: boolean
+ symbolCharacters:
+ description: symbolCharacters specifies the special characters that
+ should be used in the generated password.
+ type: string
+ symbols:
+ description: symbols specifies the number of symbol characters in
+ the generated password. If omitted it defaults to 25% of the length
+ of the password
+ type: integer
+ type: object
+ type: object
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/k8-operator/config/crd/bases/secrets.infisical.com_uuids.yaml b/k8-operator/config/crd/bases/secrets.infisical.com_uuids.yaml
new file mode 100644
index 0000000000..495b5b2766
--- /dev/null
+++ b/k8-operator/config/crd/bases/secrets.infisical.com_uuids.yaml
@@ -0,0 +1,42 @@
+---
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ annotations:
+ controller-gen.kubebuilder.io/version: v0.10.0
+ creationTimestamp: null
+ name: uuids.secrets.infisical.com
+spec:
+ group: secrets.infisical.com
+ names:
+ kind: UUID
+ listKind: UUIDList
+ plural: uuids
+ singular: uuid
+ scope: Namespaced
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ description: UUID generates a version 4 UUID (e56657e3-764f-11ef-a397-65231a88c216).
+ properties:
+ apiVersion:
+ description: 'APIVersion defines the versioned schema of this representation
+ of an object. Servers should convert recognized schemas to the latest
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
+ type: string
+ kind:
+ description: 'Kind is a string value representing the REST resource this
+ object represents. Servers may infer this from the endpoint the client
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
+ type: string
+ metadata:
+ type: object
+ spec:
+ description: UUIDSpec controls the behavior of the uuid generator.
+ type: object
+ type: object
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/k8-operator/config/crd/kustomization.yaml b/k8-operator/config/crd/kustomization.yaml
index ea6db574af..02e3fad980 100644
--- a/k8-operator/config/crd/kustomization.yaml
+++ b/k8-operator/config/crd/kustomization.yaml
@@ -5,6 +5,7 @@ resources:
- bases/secrets.infisical.com_infisicalsecrets.yaml
- bases/secrets.infisical.com_infisicalpushsecrets.yaml
- bases/secrets.infisical.com_infisicaldynamicsecrets.yaml
+ - bases/secrets.infisical.com_clustergenerators.yaml
#+kubebuilder:scaffold:crdkustomizeresource
patchesStrategicMerge:
diff --git a/k8-operator/config/rbac/role.yaml b/k8-operator/config/rbac/role.yaml
index 542face87a..ea2fbada31 100644
--- a/k8-operator/config/rbac/role.yaml
+++ b/k8-operator/config/rbac/role.yaml
@@ -74,6 +74,18 @@ rules:
- tokenreviews
verbs:
- create
+- apiGroups:
+ - secrets.infisical.com
+ resources:
+ - clustergenerators
+ verbs:
+ - create
+ - delete
+ - get
+ - list
+ - patch
+ - update
+ - watch
- apiGroups:
- secrets.infisical.com
resources:
diff --git a/k8-operator/config/samples/crd/pushsecret/cluster-password-generator.yml b/k8-operator/config/samples/crd/pushsecret/cluster-password-generator.yml
new file mode 100644
index 0000000000..ce3c8c0877
--- /dev/null
+++ b/k8-operator/config/samples/crd/pushsecret/cluster-password-generator.yml
@@ -0,0 +1,14 @@
+apiVersion: secrets.infisical.com/v1alpha1
+kind: ClusterGenerator
+metadata:
+ name: password-generator
+spec:
+ kind: Password
+ generator:
+ passwordSpec:
+ length: 10
+ digits: 5
+ symbols: 5
+ symbolCharacters: "-_$@"
+ noUpper: false
+ allowRepeat: true
diff --git a/k8-operator/controllers/infisicaldynamicsecret/infisicaldynamicsecret_helper.go b/k8-operator/controllers/infisicaldynamicsecret/infisicaldynamicsecret_helper.go
index 861880d950..6e3b135e4c 100644
--- a/k8-operator/controllers/infisicaldynamicsecret/infisicaldynamicsecret_helper.go
+++ b/k8-operator/controllers/infisicaldynamicsecret/infisicaldynamicsecret_helper.go
@@ -393,7 +393,7 @@ func (r *InfisicalDynamicSecretReconciler) ReconcileInfisicalDynamicSecret(ctx c
// Max TTL
if infisicalDynamicSecret.Status.MaxTTL != "" {
- maxTTLDuration, err := util.ConvertIntervalToDuration(infisicalDynamicSecret.Status.MaxTTL)
+ maxTTLDuration, err := util.ConvertIntervalToDuration(&infisicalDynamicSecret.Status.MaxTTL)
if err != nil {
return defaultNextReconcile, fmt.Errorf("unable to parse MaxTTL duration: %w", err)
}
diff --git a/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_controller.go b/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_controller.go
index ebf537a63c..47c55d6985 100644
--- a/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_controller.go
+++ b/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_controller.go
@@ -51,7 +51,7 @@ func (r *InfisicalPushSecretReconciler) GetLogger(req ctrl.Request) logr.Logger
//+kubebuilder:rbac:groups="",resources=pods,verbs=get;list
//+kubebuilder:rbac:groups="authentication.k8s.io",resources=tokenreviews,verbs=create
//+kubebuilder:rbac:groups="",resources=serviceaccounts/token,verbs=create
-
+// +kubebuilder:rbac:groups=secrets.infisical.com,resources=clustergenerators,verbs=get;list;watch;create;update;patch;delete
// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
// For more details, check Reconcile and its Result here:
@@ -108,23 +108,30 @@ func (r *InfisicalPushSecretReconciler) Reconcile(ctx context.Context, req ctrl.
return ctrl.Result{}, nil
}
- if infisicalPushSecretCRD.Spec.ResyncInterval != "" {
+ if infisicalPushSecretCRD.Spec.Push.Secret == nil && infisicalPushSecretCRD.Spec.Push.Generators == nil {
+ logger.Info("No secret or generators found, skipping reconciliation. Please define ")
+ return ctrl.Result{}, nil
+ }
- duration, err := util.ConvertIntervalToDuration(infisicalPushSecretCRD.Spec.ResyncInterval)
+ duration, err := util.ConvertIntervalToDuration(infisicalPushSecretCRD.Spec.ResyncInterval)
- if err != nil {
+ if err != nil {
+ // if resyncInterval is nil, we don't want to reconcile automatically
+ if infisicalPushSecretCRD.Spec.ResyncInterval != nil {
logger.Error(err, fmt.Sprintf("unable to convert resync interval to duration. Will requeue after [requeueTime=%v]", requeueTime))
return ctrl.Result{
RequeueAfter: requeueTime,
}, nil
+ } else {
+ logger.Error(err, "unable to convert resync interval to duration")
+ return ctrl.Result{}, err
}
+ }
- requeueTime = duration
+ requeueTime = duration
+ if requeueTime != 0 {
logger.Info(fmt.Sprintf("Manual re-sync interval set. Interval: %v", requeueTime))
-
- } else {
- logger.Info(fmt.Sprintf("Re-sync interval set. Interval: %v", requeueTime))
}
// Check if the resource is already marked for deletion
@@ -137,10 +144,15 @@ func (r *InfisicalPushSecretReconciler) Reconcile(ctx context.Context, req ctrl.
// Get modified/default config
infisicalConfig, err := controllerhelpers.GetInfisicalConfigMap(ctx, r.Client)
if err != nil {
- logger.Error(err, fmt.Sprintf("unable to fetch infisical-config. Will requeue after [requeueTime=%v]", requeueTime))
- return ctrl.Result{
- RequeueAfter: requeueTime,
- }, nil
+ if requeueTime != 0 {
+ logger.Error(err, fmt.Sprintf("unable to fetch infisical-config. Will requeue after [requeueTime=%v]", requeueTime))
+ return ctrl.Result{
+ RequeueAfter: requeueTime,
+ }, nil
+ } else {
+ logger.Error(err, "unable to fetch infisical-config")
+ return ctrl.Result{}, err
+ }
}
if infisicalPushSecretCRD.Spec.HostAPI == "" {
@@ -152,10 +164,15 @@ func (r *InfisicalPushSecretReconciler) Reconcile(ctx context.Context, req ctrl.
if infisicalPushSecretCRD.Spec.TLS.CaRef.SecretName != "" {
api.API_CA_CERTIFICATE, err = r.getInfisicalCaCertificateFromKubeSecret(ctx, infisicalPushSecretCRD)
if err != nil {
- logger.Error(err, fmt.Sprintf("unable to fetch CA certificate. Will requeue after [requeueTime=%v]", requeueTime))
- return ctrl.Result{
- RequeueAfter: requeueTime,
- }, nil
+ if requeueTime != 0 {
+ logger.Error(err, fmt.Sprintf("unable to fetch CA certificate. Will requeue after [requeueTime=%v]", requeueTime))
+ return ctrl.Result{
+ RequeueAfter: requeueTime,
+ }, nil
+ } else {
+ logger.Error(err, "unable to fetch CA certificate")
+ return ctrl.Result{}, err
+ }
}
logger.Info("Using custom CA certificate...")
@@ -167,17 +184,27 @@ func (r *InfisicalPushSecretReconciler) Reconcile(ctx context.Context, req ctrl.
r.SetReconcileStatusCondition(ctx, &infisicalPushSecretCRD, err)
if err != nil {
- logger.Error(err, fmt.Sprintf("unable to reconcile Infisical Push Secret. Will requeue after [requeueTime=%v]", requeueTime))
+ if requeueTime != 0 {
+ logger.Error(err, fmt.Sprintf("unable to reconcile Infisical Push Secret. Will requeue after [requeueTime=%v]", requeueTime))
+ return ctrl.Result{
+ RequeueAfter: requeueTime,
+ }, nil
+ } else {
+ logger.Error(err, "unable to reconcile Infisical Push Secret")
+ return ctrl.Result{}, err
+ }
+ }
+
+ // Sync again after the specified time
+ if requeueTime != 0 {
+ logger.Info(fmt.Sprintf("Operator will requeue after [%v]", requeueTime))
return ctrl.Result{
RequeueAfter: requeueTime,
}, nil
+ } else {
+ logger.Info("Operator will reconcile on next spec change")
+ return ctrl.Result{}, nil
}
-
- // Sync again after the specified time
- logger.Info(fmt.Sprintf("Operator will requeue after [%v]", requeueTime))
- return ctrl.Result{
- RequeueAfter: requeueTime,
- }, nil
}
func (r *InfisicalPushSecretReconciler) SetupWithManager(mgr ctrl.Manager) error {
@@ -228,27 +255,67 @@ func (r *InfisicalPushSecretReconciler) SetupWithManager(mgr ctrl.Manager) error
)).
Watches(
&source.Kind{Type: &corev1.Secret{}},
- handler.EnqueueRequestsFromMapFunc(func(o client.Object) []reconcile.Request {
- ctx := context.Background()
- pushSecrets := &secretsv1alpha1.InfisicalPushSecretList{}
- if err := r.List(ctx, pushSecrets); err != nil {
- return []reconcile.Request{}
- }
-
- requests := []reconcile.Request{}
- for _, pushSecret := range pushSecrets.Items {
- if pushSecret.Spec.Push.Secret.SecretName == o.GetName() &&
- pushSecret.Spec.Push.Secret.SecretNamespace == o.GetNamespace() {
- requests = append(requests, reconcile.Request{
- NamespacedName: types.NamespacedName{
- Name: pushSecret.GetName(),
- Namespace: pushSecret.GetNamespace(),
- },
- })
- }
- }
- return requests
- }),
+ handler.EnqueueRequestsFromMapFunc(r.findPushSecretsForSecret),
+ ).
+ Watches(
+ &source.Kind{Type: &secretsv1alpha1.ClusterGenerator{}},
+ handler.EnqueueRequestsFromMapFunc(r.findPushSecretsForClusterGenerator),
).
Complete(r)
}
+
+func (r *InfisicalPushSecretReconciler) findPushSecretsForClusterGenerator(o client.Object) []reconcile.Request {
+ ctx := context.Background()
+ pushSecrets := &secretsv1alpha1.InfisicalPushSecretList{}
+ if err := r.List(ctx, pushSecrets); err != nil {
+ return []reconcile.Request{}
+ }
+
+ clusterGenerator, ok := o.(*secretsv1alpha1.ClusterGenerator)
+ if !ok {
+ return []reconcile.Request{}
+ }
+
+ requests := []reconcile.Request{}
+ for _, pushSecret := range pushSecrets.Items {
+ if pushSecret.Spec.Push.Generators != nil {
+ for _, generator := range pushSecret.Spec.Push.Generators {
+ if generator.GeneratorRef.Name == clusterGenerator.GetName() {
+ requests = append(requests, reconcile.Request{
+ NamespacedName: types.NamespacedName{
+ Name: pushSecret.GetName(),
+ Namespace: pushSecret.GetNamespace(),
+ },
+ })
+ break
+ }
+ }
+ }
+ }
+ return requests
+}
+
+func (r *InfisicalPushSecretReconciler) findPushSecretsForSecret(o client.Object) []reconcile.Request {
+ ctx := context.Background()
+ pushSecrets := &secretsv1alpha1.InfisicalPushSecretList{}
+ if err := r.List(ctx, pushSecrets); err != nil {
+ return []reconcile.Request{}
+ }
+
+ requests := []reconcile.Request{}
+ for _, pushSecret := range pushSecrets.Items {
+ if pushSecret.Spec.Push.Secret != nil &&
+ pushSecret.Spec.Push.Secret.SecretName == o.GetName() &&
+ pushSecret.Spec.Push.Secret.SecretNamespace == o.GetNamespace() {
+ requests = append(requests, reconcile.Request{
+ NamespacedName: types.NamespacedName{
+ Name: pushSecret.GetName(),
+ Namespace: pushSecret.GetNamespace(),
+ },
+ })
+ }
+
+ }
+
+ return requests
+}
diff --git a/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_helper.go b/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_helper.go
index 848df3c829..1400b163bd 100644
--- a/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_helper.go
+++ b/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_helper.go
@@ -19,6 +19,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
+ generatorUtil "github.com/Infisical/infisical/k8-operator/packages/generator"
infisicalSdk "github.com/infisical/go-sdk"
k8Errors "k8s.io/apimachinery/pkg/api/errors"
)
@@ -106,6 +107,52 @@ func (r *InfisicalPushSecretReconciler) updateResourceVariables(infisicalPushSec
infisicalPushSecretResourceVariablesMap[string(infisicalPushSecret.UID)] = resourceVariables
}
+func (r *InfisicalPushSecretReconciler) processGenerators(ctx context.Context, infisicalPushSecret v1alpha1.InfisicalPushSecret) (map[string]string, error) {
+
+ processedSecrets := make(map[string]string)
+
+ if len(infisicalPushSecret.Spec.Push.Generators) == 0 {
+ return processedSecrets, nil
+ }
+
+ for _, generator := range infisicalPushSecret.Spec.Push.Generators {
+ generatorRef := generator.GeneratorRef
+
+ clusterGenerator := &v1alpha1.ClusterGenerator{}
+ err := r.Client.Get(ctx, types.NamespacedName{Name: generatorRef.Name}, clusterGenerator)
+ if err != nil {
+ return nil, fmt.Errorf("unable to get ClusterGenerator resource [err=%s]", err)
+ }
+ if generatorRef.Kind == v1alpha1.GeneratorKindPassword {
+ // get the custom ClusterGenerator resource from the cluster
+
+ if clusterGenerator.Spec.Generator.PasswordSpec == nil {
+ return nil, fmt.Errorf("password spec is not defined in the ClusterGenerator resource")
+ }
+
+ password, err := generatorUtil.GeneratorPassword(*clusterGenerator.Spec.Generator.PasswordSpec)
+ if err != nil {
+ return nil, fmt.Errorf("unable to generate password [err=%s]", err)
+ }
+
+ processedSecrets[generator.DestinationSecretName] = password
+ }
+
+ if generatorRef.Kind == v1alpha1.GeneratorKindUUID {
+
+ uuid, err := generatorUtil.GeneratorUUID()
+ if err != nil {
+ return nil, fmt.Errorf("unable to generate UUID [err=%s]", err)
+ }
+
+ processedSecrets[generator.DestinationSecretName] = uuid
+ }
+ }
+
+ return processedSecrets, nil
+
+}
+
func (r *InfisicalPushSecretReconciler) processTemplatedSecrets(infisicalPushSecret v1alpha1.InfisicalPushSecret, kubePushSecret *corev1.Secret, destination v1alpha1.InfisicalPushSecretDestination) (map[string]string, error) {
processedSecrets := make(map[string]string)
@@ -172,18 +219,31 @@ func (r *InfisicalPushSecretReconciler) ReconcileInfisicalPushSecret(ctx context
})
}
- kubePushSecret, err := util.GetKubeSecretByNamespacedName(ctx, r.Client, types.NamespacedName{
- Namespace: infisicalPushSecret.Spec.Push.Secret.SecretNamespace,
- Name: infisicalPushSecret.Spec.Push.Secret.SecretName,
- })
+ processedSecrets := make(map[string]string)
- if err != nil {
- return fmt.Errorf("unable to fetch kube secret [err=%s]", err)
+ if infisicalPushSecret.Spec.Push.Secret != nil {
+ kubePushSecret, err := util.GetKubeSecretByNamespacedName(ctx, r.Client, types.NamespacedName{
+ Namespace: infisicalPushSecret.Spec.Push.Secret.SecretNamespace,
+ Name: infisicalPushSecret.Spec.Push.Secret.SecretName,
+ })
+
+ if err != nil {
+ return fmt.Errorf("unable to fetch kube secret [err=%s]", err)
+ }
+
+ processedSecrets, err = r.processTemplatedSecrets(infisicalPushSecret, kubePushSecret, infisicalPushSecret.Spec.Destination)
+ if err != nil {
+ return fmt.Errorf("unable to process templated secrets [err=%s]", err)
+ }
}
- processedSecrets, err := r.processTemplatedSecrets(infisicalPushSecret, kubePushSecret, infisicalPushSecret.Spec.Destination)
+ generatorSecrets, err := r.processGenerators(ctx, infisicalPushSecret)
if err != nil {
- return fmt.Errorf("unable to process templated secrets [err=%s]", err)
+ return fmt.Errorf("unable to process generators [err=%s]", err)
+ }
+
+ for key, value := range generatorSecrets {
+ processedSecrets[key] = value
}
destination := infisicalPushSecret.Spec.Destination
diff --git a/k8-operator/go.mod b/k8-operator/go.mod
index 6ce68ed7fc..c9b868b006 100644
--- a/k8-operator/go.mod
+++ b/k8-operator/go.mod
@@ -4,10 +4,12 @@ go 1.21
require (
github.com/Masterminds/sprig/v3 v3.3.0
+ github.com/aws/smithy-go v1.20.3
github.com/infisical/go-sdk v0.4.4
github.com/lestrrat-go/jwx/v2 v2.1.4
github.com/onsi/ginkgo/v2 v2.6.0
github.com/onsi/gomega v1.24.1
+ github.com/sethvargo/go-password v0.3.1
k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
sigs.k8s.io/controller-runtime v0.14.4
@@ -34,7 +36,6 @@ require (
github.com/aws/aws-sdk-go-v2/service/sso v1.22.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.1 // indirect
- github.com/aws/smithy-go v1.20.3 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
@@ -85,7 +86,7 @@ require (
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
- github.com/google/uuid v1.6.0 // indirect
+ github.com/google/uuid v1.6.0
github.com/imdario/mergo v0.3.12 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
diff --git a/k8-operator/go.sum b/k8-operator/go.sum
index bcecfadc01..2e151b0a4c 100644
--- a/k8-operator/go.sum
+++ b/k8-operator/go.sum
@@ -338,6 +338,8 @@ github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZV
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
+github.com/sethvargo/go-password v0.3.1 h1:WqrLTjo7X6AcVYfC6R7GtSyuUQR9hGyAj/f1PYQZCJU=
+github.com/sethvargo/go-password v0.3.1/go.mod h1:rXofC1zT54N7R8K/h1WDUdkf9BOx5OptoxrMBcrXzvs=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
diff --git a/k8-operator/packages/generator/generator.go b/k8-operator/packages/generator/generator.go
new file mode 100644
index 0000000000..cc1b290c7f
--- /dev/null
+++ b/k8-operator/packages/generator/generator.go
@@ -0,0 +1 @@
+package generator
diff --git a/k8-operator/packages/generator/password.go b/k8-operator/packages/generator/password.go
new file mode 100644
index 0000000000..d322f10144
--- /dev/null
+++ b/k8-operator/packages/generator/password.go
@@ -0,0 +1,76 @@
+package generator
+
+import (
+ "github.com/Infisical/infisical/k8-operator/api/v1alpha1"
+ "github.com/sethvargo/go-password/password"
+)
+
+const (
+ defaultLength = 24
+ defaultSymbolChars = "~!@#$%^&*()_+`-={}|[]\\:\"<>?,./"
+ digitFactor = 0.25
+ symbolFactor = 0.25
+)
+
+func generateSafePassword(
+ passLen int,
+ symbols int,
+ symbolCharacters string,
+ digits int,
+ noUpper bool,
+ allowRepeat bool,
+) (string, error) {
+ gen, err := password.NewGenerator(&password.GeneratorInput{
+ Symbols: symbolCharacters,
+ })
+ if err != nil {
+ return "", err
+ }
+ return gen.Generate(
+ passLen,
+ digits,
+ symbols,
+ noUpper,
+ allowRepeat,
+ )
+}
+
+func GeneratorPassword(spec v1alpha1.PasswordSpec) (string, error) {
+
+ symbolCharacters := defaultSymbolChars
+
+ if spec.SymbolCharacters != nil && *spec.SymbolCharacters != "" {
+ symbolCharacters = *spec.SymbolCharacters
+ }
+
+ passwordLength := defaultLength
+
+ if spec.Length != 0 {
+ passwordLength = spec.Length
+ }
+
+ digits := int(float32(passwordLength) * digitFactor)
+ if spec.Digits != nil {
+ digits = *spec.Digits
+ }
+
+ symbols := int(float32(passwordLength) * symbolFactor)
+ if spec.Symbols != nil {
+ symbols = *spec.Symbols
+ }
+
+ pass, err := generateSafePassword(
+ passwordLength,
+ symbols,
+ symbolCharacters,
+ digits,
+ spec.NoUpper,
+ spec.AllowRepeat,
+ )
+
+ if err != nil {
+ return "", err
+ }
+
+ return pass, nil
+}
diff --git a/k8-operator/packages/generator/uuid.go b/k8-operator/packages/generator/uuid.go
new file mode 100644
index 0000000000..b9249f783f
--- /dev/null
+++ b/k8-operator/packages/generator/uuid.go
@@ -0,0 +1,10 @@
+package generator
+
+import (
+ "github.com/google/uuid"
+)
+
+func GeneratorUUID() (string, error) {
+ uuid := uuid.New().String()
+ return uuid, nil
+}
diff --git a/k8-operator/packages/util/helpers.go b/k8-operator/packages/util/helpers.go
index 02621dcfdf..ef37127159 100644
--- a/k8-operator/packages/util/helpers.go
+++ b/k8-operator/packages/util/helpers.go
@@ -7,14 +7,19 @@ import (
"time"
)
-func ConvertIntervalToDuration(resyncInterval string) (time.Duration, error) {
- length := len(resyncInterval)
+func ConvertIntervalToDuration(resyncInterval *string) (time.Duration, error) {
+
+ if resyncInterval == nil || *resyncInterval == "" {
+ return 0, nil
+ }
+
+ length := len(*resyncInterval)
if length < 2 {
return 0, fmt.Errorf("invalid format")
}
- unit := resyncInterval[length-1:]
- numberPart := resyncInterval[:length-1]
+ unit := (*resyncInterval)[length-1:]
+ numberPart := (*resyncInterval)[:length-1]
number, err := strconv.Atoi(numberPart)
if err != nil {
@@ -40,16 +45,6 @@ func ConvertIntervalToDuration(resyncInterval string) (time.Duration, error) {
}
}
-func ConvertIntervalToTime(resyncInterval string) (time.Time, error) {
- duration, err := ConvertIntervalToDuration(resyncInterval)
- if err != nil {
- return time.Time{}, err
- }
-
- // Add duration to current time
- return time.Now().Add(duration), nil
-}
-
func AppendAPIEndpoint(address string) string {
if strings.HasSuffix(address, "/api") {
return address
diff --git a/migration/.eslintrc.js b/migration/.eslintrc.js
deleted file mode 100644
index cfc6baf3ac..0000000000
--- a/migration/.eslintrc.js
+++ /dev/null
@@ -1,8 +0,0 @@
-module.exports = {
- "parserOptions": {
- "ecmaVersion": 2017
- },
- "env": {
- "es6": true
- }
- }
\ No newline at end of file
diff --git a/migration/README.md b/migration/README.md
deleted file mode 100644
index 5d3984b23b..0000000000
--- a/migration/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-As Infisical's codebase matures, there are structural things that we need to change.
-
-This folder houses various migration scripts that can be used to upgrade self-hosted installations of Infisical to be compatible with newer versions.
\ No newline at end of file
diff --git a/migration/models/bot.js b/migration/models/bot.js
deleted file mode 100644
index 85c93014c4..0000000000
--- a/migration/models/bot.js
+++ /dev/null
@@ -1,61 +0,0 @@
-var mongoose = require('mongoose');
-
-var botSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- required: true
- },
- workspace: {
- type: mongoose.Schema.Types.ObjectId,
- ref: 'Workspace',
- required: true
- },
- isActive: {
- type: Boolean,
- required: true,
- default: false
- },
- publicKey: {
- type: String,
- required: true
- },
- encryptedPrivateKey: {
- type: String,
- required: true,
- select: false
- },
- iv: {
- type: String,
- required: true,
- select: false
- },
- tag: {
- type: String,
- required: true,
- select: false
- },
- algorithm: { // the encryption algorithm used
- type: String,
- enum: ['aes-256-gcm'],
- required: true,
- select: false
- },
- keyEncoding: {
- type: String,
- enum: [
- 'utf8',
- 'base64'
- ],
- required: true,
- select: false
- }
- },
- {
- timestamps: true
- }
-);
-
-var Bot = mongoose.model('Bot', botSchema);
-
-module.exports = Bot;
diff --git a/migration/models/secretBlindIndexData.js b/migration/models/secretBlindIndexData.js
deleted file mode 100644
index bcfa923949..0000000000
--- a/migration/models/secretBlindIndexData.js
+++ /dev/null
@@ -1,43 +0,0 @@
-var mongoose = require('mongoose');
-
-var secretBlindIndexDataSchema = new mongoose.Schema(
- {
- workspace: {
- type: mongoose.Schema.Types.ObjectId,
- ref: 'Workspace',
- required: true
- },
- encryptedSaltCiphertext:{
- type: String,
- required: true
- },
- saltIV: {
- type: String,
- required: true
- },
- saltTag: {
- type: String,
- required: true
- },
- algorithm: {
- type: String,
- enum: ['aes-256-gcm'],
- required: true,
- select: false
- },
- keyEncoding: {
- type: String,
- enum: [
- 'utf8',
- 'base64'
- ],
- required: true,
- select: false
- }
-
- }
-);
-
-var SecretBlindIndexData = mongoose.model('SecretBlindIndexData', secretBlindIndexDataSchema);
-
-module.exports = SecretBlindIndexData;
\ No newline at end of file
diff --git a/migration/models/user.js b/migration/models/user.js
deleted file mode 100644
index 24e2c6554d..0000000000
--- a/migration/models/user.js
+++ /dev/null
@@ -1,83 +0,0 @@
-var mongoose = require('mongoose');
-
-var userSchema = new mongoose.Schema(
- {
- email: {
- type: String,
- required: true
- },
- firstName: {
- type: String
- },
- lastName: {
- type: String
- },
- encryptionVersion: {
- type: Number,
- select: false,
- default: 1 // to resolve backward-compatibility issues
- },
- protectedKey: { // introduced as part of encryption version 2
- type: String,
- select: false
- },
- protectedKeyIV: { // introduced as part of encryption version 2
- type: String,
- select: false
- },
- protectedKeyTag: { // introduced as part of encryption version 2
- type: String,
- select: false
- },
- publicKey: {
- type: String,
- select: false
- },
- encryptedPrivateKey: {
- type: String,
- select: false
- },
- iv: { // iv of [encryptedPrivateKey]
- type: String,
- select: false
- },
- tag: { // tag of [encryptedPrivateKey]
- type: String,
- select: false
- },
- salt: {
- type: String,
- select: false
- },
- verifier: {
- type: String,
- select: false
- },
- refreshVersion: {
- type: Number,
- default: 0,
- select: false
- },
- isMfaEnabled: {
- type: Boolean,
- default: false
- },
- mfaMethods: [{
- type: String
- }],
- devices: {
- type: [{
- ip: String,
- userAgent: String
- }],
- default: []
- }
- },
- {
- timestamps: true
- }
-);
-
-var User = mongoose.model('User', userSchema);
-
-module.exports = User;
diff --git a/migration/package-lock.json b/migration/package-lock.json
deleted file mode 100644
index cf1084060e..0000000000
--- a/migration/package-lock.json
+++ /dev/null
@@ -1,444 +0,0 @@
-{
- "name": "migration",
- "version": "1.0.0",
- "lockfileVersion": 2,
- "requires": true,
- "packages": {
- "": {
- "name": "migration",
- "version": "1.0.0",
- "license": "ISC",
- "dependencies": {
- "dotenv": "^16.0.3",
- "ip": "^2.0.1",
- "mongoose": "^7.2.1"
- }
- },
- "node_modules/@types/node": {
- "version": "20.2.5",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz",
- "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ=="
- },
- "node_modules/@types/webidl-conversions": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
- "integrity": "sha512-xTE1E+YF4aWPJJeUzaZI5DRntlkY3+BCVJi0axFptnjGmAoWxkyREIh/XMrfxVLejwQxMCfDXdICo0VLxThrog=="
- },
- "node_modules/@types/whatwg-url": {
- "version": "8.2.2",
- "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
- "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
- "dependencies": {
- "@types/node": "*",
- "@types/webidl-conversions": "*"
- }
- },
- "node_modules/bson": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/bson/-/bson-5.3.0.tgz",
- "integrity": "sha512-ukmCZMneMlaC5ebPHXIkP8YJzNl5DC41N5MAIvKDqLggdao342t4McltoJBQfQya/nHBWAcSsYRqlXPoQkTJag==",
- "engines": {
- "node": ">=14.20.1"
- }
- },
- "node_modules/debug": {
- "version": "4.3.4",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
- "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
- "dependencies": {
- "ms": "2.1.2"
- },
- "engines": {
- "node": ">=6.0"
- },
- "peerDependenciesMeta": {
- "supports-color": {
- "optional": true
- }
- }
- },
- "node_modules/debug/node_modules/ms": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
- },
- "node_modules/dotenv": {
- "version": "16.0.3",
- "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
- "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/ip": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz",
- "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ=="
- },
- "node_modules/kareem": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz",
- "integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==",
- "engines": {
- "node": ">=12.0.0"
- }
- },
- "node_modules/memory-pager": {
- "version": "1.5.0",
- "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
- "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
- "optional": true
- },
- "node_modules/mongodb": {
- "version": "5.5.0",
- "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.5.0.tgz",
- "integrity": "sha512-XgrkUgAAdfnZKQfk5AsYL8j7O99WHd4YXPxYxnh8dZxD+ekYWFRA3JktUsBnfg+455Smf75/+asoU/YLwNGoQQ==",
- "dependencies": {
- "bson": "^5.3.0",
- "mongodb-connection-string-url": "^2.6.0",
- "socks": "^2.7.1"
- },
- "engines": {
- "node": ">=14.20.1"
- },
- "optionalDependencies": {
- "saslprep": "^1.0.3"
- },
- "peerDependencies": {
- "@aws-sdk/credential-providers": "^3.201.0",
- "mongodb-client-encryption": ">=2.3.0 <3",
- "snappy": "^7.2.2"
- },
- "peerDependenciesMeta": {
- "@aws-sdk/credential-providers": {
- "optional": true
- },
- "mongodb-client-encryption": {
- "optional": true
- },
- "snappy": {
- "optional": true
- }
- }
- },
- "node_modules/mongodb-connection-string-url": {
- "version": "2.6.0",
- "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz",
- "integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==",
- "dependencies": {
- "@types/whatwg-url": "^8.2.1",
- "whatwg-url": "^11.0.0"
- }
- },
- "node_modules/mongoose": {
- "version": "7.2.1",
- "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.2.1.tgz",
- "integrity": "sha512-c2OOl+ch9NlmPeJw7UjSb2jHNjoOw1XXHyzwygIf4z1GmaBx1OYb8OYqHkYPivvEmfY/vUWZFCgePsDqZgFn2w==",
- "dependencies": {
- "bson": "^5.3.0",
- "kareem": "2.5.1",
- "mongodb": "5.5.0",
- "mpath": "0.9.0",
- "mquery": "5.0.0",
- "ms": "2.1.3",
- "sift": "16.0.1"
- },
- "engines": {
- "node": ">=14.20.1"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/mongoose"
- }
- },
- "node_modules/mpath": {
- "version": "0.9.0",
- "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
- "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==",
- "engines": {
- "node": ">=4.0.0"
- }
- },
- "node_modules/mquery": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz",
- "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==",
- "dependencies": {
- "debug": "4.x"
- },
- "engines": {
- "node": ">=14.0.0"
- }
- },
- "node_modules/ms": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
- },
- "node_modules/punycode": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
- "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/saslprep": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
- "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
- "optional": true,
- "dependencies": {
- "sparse-bitfield": "^3.0.3"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/sift": {
- "version": "16.0.1",
- "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz",
- "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ=="
- },
- "node_modules/smart-buffer": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
- "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
- "engines": {
- "node": ">= 6.0.0",
- "npm": ">= 3.0.0"
- }
- },
- "node_modules/socks": {
- "version": "2.7.1",
- "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
- "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
- "dependencies": {
- "ip": "^2.0.0",
- "smart-buffer": "^4.2.0"
- },
- "engines": {
- "node": ">= 10.13.0",
- "npm": ">= 3.0.0"
- }
- },
- "node_modules/sparse-bitfield": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
- "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
- "optional": true,
- "dependencies": {
- "memory-pager": "^1.0.2"
- }
- },
- "node_modules/tr46": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
- "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
- "dependencies": {
- "punycode": "^2.1.1"
- },
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/webidl-conversions": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
- "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/whatwg-url": {
- "version": "11.0.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
- "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
- "dependencies": {
- "tr46": "^3.0.0",
- "webidl-conversions": "^7.0.0"
- },
- "engines": {
- "node": ">=12"
- }
- }
- },
- "dependencies": {
- "@types/node": {
- "version": "20.2.5",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz",
- "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ=="
- },
- "@types/webidl-conversions": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
- "integrity": "sha512-xTE1E+YF4aWPJJeUzaZI5DRntlkY3+BCVJi0axFptnjGmAoWxkyREIh/XMrfxVLejwQxMCfDXdICo0VLxThrog=="
- },
- "@types/whatwg-url": {
- "version": "8.2.2",
- "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
- "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
- "requires": {
- "@types/node": "*",
- "@types/webidl-conversions": "*"
- }
- },
- "bson": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/bson/-/bson-5.3.0.tgz",
- "integrity": "sha512-ukmCZMneMlaC5ebPHXIkP8YJzNl5DC41N5MAIvKDqLggdao342t4McltoJBQfQya/nHBWAcSsYRqlXPoQkTJag=="
- },
- "debug": {
- "version": "4.3.4",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
- "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
- "requires": {
- "ms": "2.1.2"
- },
- "dependencies": {
- "ms": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
- }
- }
- },
- "dotenv": {
- "version": "16.0.3",
- "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
- "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ=="
- },
- "ip": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz",
- "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ=="
- },
- "kareem": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz",
- "integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA=="
- },
- "memory-pager": {
- "version": "1.5.0",
- "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
- "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
- "optional": true
- },
- "mongodb": {
- "version": "5.5.0",
- "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.5.0.tgz",
- "integrity": "sha512-XgrkUgAAdfnZKQfk5AsYL8j7O99WHd4YXPxYxnh8dZxD+ekYWFRA3JktUsBnfg+455Smf75/+asoU/YLwNGoQQ==",
- "requires": {
- "bson": "^5.3.0",
- "mongodb-connection-string-url": "^2.6.0",
- "saslprep": "^1.0.3",
- "socks": "^2.7.1"
- }
- },
- "mongodb-connection-string-url": {
- "version": "2.6.0",
- "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz",
- "integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==",
- "requires": {
- "@types/whatwg-url": "^8.2.1",
- "whatwg-url": "^11.0.0"
- }
- },
- "mongoose": {
- "version": "7.2.1",
- "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.2.1.tgz",
- "integrity": "sha512-c2OOl+ch9NlmPeJw7UjSb2jHNjoOw1XXHyzwygIf4z1GmaBx1OYb8OYqHkYPivvEmfY/vUWZFCgePsDqZgFn2w==",
- "requires": {
- "bson": "^5.3.0",
- "kareem": "2.5.1",
- "mongodb": "5.5.0",
- "mpath": "0.9.0",
- "mquery": "5.0.0",
- "ms": "2.1.3",
- "sift": "16.0.1"
- }
- },
- "mpath": {
- "version": "0.9.0",
- "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
- "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew=="
- },
- "mquery": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz",
- "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==",
- "requires": {
- "debug": "4.x"
- }
- },
- "ms": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
- },
- "punycode": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
- "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA=="
- },
- "saslprep": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
- "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
- "optional": true,
- "requires": {
- "sparse-bitfield": "^3.0.3"
- }
- },
- "sift": {
- "version": "16.0.1",
- "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz",
- "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ=="
- },
- "smart-buffer": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
- "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="
- },
- "socks": {
- "version": "2.7.1",
- "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
- "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
- "requires": {
- "ip": "^2.0.0",
- "smart-buffer": "^4.2.0"
- }
- },
- "sparse-bitfield": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
- "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
- "optional": true,
- "requires": {
- "memory-pager": "^1.0.2"
- }
- },
- "tr46": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
- "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
- "requires": {
- "punycode": "^2.1.1"
- }
- },
- "webidl-conversions": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
- "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="
- },
- "whatwg-url": {
- "version": "11.0.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
- "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
- "requires": {
- "tr46": "^3.0.0",
- "webidl-conversions": "^7.0.0"
- }
- }
- }
-}
diff --git a/migration/package.json b/migration/package.json
deleted file mode 100644
index 9f431ca3a6..0000000000
--- a/migration/package.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name": "migration",
- "version": "1.0.0",
- "description": "As Infisical's codebase matures, there are structural things that we need to change.",
- "main": "index.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "author": "",
- "license": "ISC",
- "dependencies": {
- "dotenv": "^16.0.3",
- "ip": "^2.0.1",
- "mongoose": "^7.2.1"
- }
-}
diff --git a/migration/scripts/reencrypt_under_256_key.js b/migration/scripts/reencrypt_under_256_key.js
deleted file mode 100644
index 5f36bd2c70..0000000000
--- a/migration/scripts/reencrypt_under_256_key.js
+++ /dev/null
@@ -1,177 +0,0 @@
-require('dotenv').config();
-const crypto = require('crypto');
-const mongoose = require('mongoose');
-const Bot = require('../models/bot');
-const SecretBlindIndexData = require('../models/secretBlindIndexData');
-
-const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // 16-byte hex encryption key to migrate from
-const ROOT_ENCRYPTION_KEY = process.env.ROOT_ENCRYPTION_KEY; // 32-byte base64 encryption key to migrate to
-
-const ALGORITHM_AES_256_GCM = 'aes-256-gcm';
-const ENCODING_SCHEME_UTF8 = 'utf8';
-const ENCODING_SCHEME_BASE64 = 'base64';
-
-const decryptSymmetric = ({
- ciphertext,
- iv,
- tag,
- key
-}) => {
- const decipher = crypto.createDecipheriv(
- 'aes-256-gcm',
- key,
- Buffer.from(iv, ENCODING_SCHEME_BASE64)
- );
-
- decipher.setAuthTag(Buffer.from(tag, ENCODING_SCHEME_BASE64));
-
- let cleartext = decipher.update(ciphertext, ENCODING_SCHEME_BASE64, ENCODING_SCHEME_UTF8);
- cleartext += decipher.final('utf8');
-
- return cleartext;
-}
-
-const encryptSymmetric = (
- plaintext,
- key
-) => {
- const iv = crypto.randomBytes(12);
-
- const secretKey = crypto.createSecretKey(key, ENCODING_SCHEME_BASE64);
- const cipher = crypto.createCipheriv(ALGORITHM_AES_256_GCM, secretKey, iv);
-
- let ciphertext = cipher.update(plaintext, ENCODING_SCHEME_UTF8, ENCODING_SCHEME_BASE64);
- ciphertext += cipher.final(ENCODING_SCHEME_BASE64);
-
- return {
- ciphertext,
- iv: iv.toString(ENCODING_SCHEME_BASE64),
- tag: cipher.getAuthTag().toString(ENCODING_SCHEME_BASE64)
- };
-};
-
-/**
- * Validate that encryption key [key] is encoded in [encoding] and [bytes] bytes
- * @param {String} key - encryption key to validate
- * @param {String} encoding - encoding like hex or base64
- * @param {Number} bytes - number of bytes
- */
-const validateEncryptionKey = (encryptionKey, encoding, bytes) => {
- const keyBuffer = Buffer.from(encryptionKey, encoding);
- const decoded = keyBuffer.toString(encoding);
-
- if (decoded !== encryptionKey) throw Error({
- message: `Failed to validate that encryption key is encoded in ${encoding}`
- });
-
- if (keyBuffer.length !== bytes) throw Error({
- message: `Failed to validate that encryption key is ${bytes} bytes`
- });
-}
-
-const main = async () => {
-
- // validate that ENCRYPTION_KEY is a 16-byte hex string
- validateEncryptionKey(ENCRYPTION_KEY, 'hex', 16);
-
- // validate that ROOT_ENCRYPTION_KEY is a 32-byte base64 string
- validateEncryptionKey(ROOT_ENCRYPTION_KEY, 'base64', 32);
-
- mongoose.connect(process.env.MONGO_URI)
- .then(async () => {
- console.log('Connected!');
-
- if (ENCRYPTION_KEY && ROOT_ENCRYPTION_KEY) {
-
- // re-encrypt bot private keys
- const bots = await Bot.find({
- algorithm: ALGORITHM_AES_256_GCM,
- keyEncoding: ENCODING_SCHEME_UTF8
- }).select('+encryptedPrivateKey iv tag algorithm keyEncoding workspace');
-
- if (bots.length > 0) {
- const operationsBot = await Promise.all(
- bots.map(async (bot) => {
-
- const privateKey = decryptSymmetric({
- ciphertext: bot.encryptedPrivateKey,
- iv: bot.iv,
- tag: bot.tag,
- key: ENCRYPTION_KEY
- });
-
- const {
- ciphertext: encryptedPrivateKey,
- iv,
- tag
- } = encryptSymmetric(privateKey, ROOT_ENCRYPTION_KEY);
-
- return ({
- updateOne: {
- filter: {
- _id: bot._id
- },
- update: {
- encryptedPrivateKey,
- iv,
- tag,
- algorithm: ALGORITHM_AES_256_GCM,
- keyEncoding: ENCODING_SCHEME_BASE64
- }
- }
- })
- })
- );
-
- const botBulkWriteResult = await Bot.bulkWrite(operationsBot);
- console.log('botBulkWriteResult: ', botBulkWriteResult);
- }
-
- // re-encrypt secret blind index data salts
- const secretBlindIndexData = await SecretBlindIndexData.find({
- algorithm: ALGORITHM_AES_256_GCM,
- keyEncoding: ENCODING_SCHEME_UTF8
- }).select('+encryptedSaltCiphertext +saltIV +saltTag +algorithm +keyEncoding');
-
- if (secretBlindIndexData.length > 0) {
- const operationsSecretBlindIndexData = await Promise.all(
- secretBlindIndexData.map(async (secretBlindIndexDatum) => {
-
- const salt = decryptSymmetric({
- ciphertext: secretBlindIndexDatum.encryptedSaltCiphertext,
- iv: secretBlindIndexDatum.saltIV,
- tag: secretBlindIndexDatum.saltTag,
- key: ENCRYPTION_KEY
- });
-
- const {
- ciphertext: encryptedSaltCiphertext,
- iv: saltIV,
- tag: saltTag
- } = encryptSymmetric(salt, ROOT_ENCRYPTION_KEY);
-
- return ({
- updateOne: {
- filter: {
- _id: secretBlindIndexDatum._id
- },
- update: {
- encryptedSaltCiphertext,
- saltIV,
- saltTag,
- algorithm: ALGORITHM_AES_256_GCM,
- keyEncoding: ENCODING_SCHEME_BASE64
- }
- }
- })
- })
- );
-
- const secretBlindIndexDataBulkWriteResult = await SecretBlindIndexData.bulkWrite(operationsSecretBlindIndexData);
- console.log('secretBlindIndexDataBulkWriteResult: ', secretBlindIndexDataBulkWriteResult);
- }
- }
- });
-}
-
-main();
\ No newline at end of file