-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(pki): add AWS ACM Public CA support #6069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
saifsmailbox98
merged 19 commits into
main
from
saif/pki-75-infisical-pki-add-support-for-aws-trust-services-public-ca
Apr 21, 2026
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0f98c49
feat(pki): add AWS ACM Public CA support
saifsmailbox98 aa42642
chore(backend): add @aws-sdk/client-acm dependency
saifsmailbox98 2f98833
chore(pki): remove ACM development mock client
saifsmailbox98 742a47d
fix(pki): surface AWS errors and fix ACM renewal polling
saifsmailbox98 f3f1f1f
fix(pki): retry ACM export when renewal relation not yet ready
saifsmailbox98 ab2698a
chore(pki): clean up ACM extras and add docs
saifsmailbox98 090f310
fix(pki): make external CA revocation atomic and surface AWS errors
saifsmailbox98 3d68e5b
fix(pki): preserve original region on ACM renewal and hoist AWS calls…
saifsmailbox98 6f61d9d
fix(pki): derive ACM signature algorithm from issued cert
saifsmailbox98 8df9a92
chore(pki): remove unused AwsAcmKeyAlgorithm enum
saifsmailbox98 32a58bf
Merge remote-tracking branch 'origin/main' into saif/pki-75-infisical…
saifsmailbox98 d0452dd
refactor(pki): generate ACM export passphrase with nanoid customAlphabet
saifsmailbox98 e3562d0
fix(ui): mark AWS Connection field as required in ACM external CA form
saifsmailbox98 0b3a511
docs(pki): clarify ACM auto-renewal and refresh screenshots
saifsmailbox98 8075347
docs(pki): add ACM public CA API reference pages
saifsmailbox98 c3848e7
refactor(pki): share Route 53 helper and tidy ACM internals
saifsmailbox98 3c6a2d8
feat(ui): pre-fill and lock TTL for ACM Public CA profiles
saifsmailbox98 91bccd5
docs(pki): expand ACM Public CA guide and document permissions on AWS…
saifsmailbox98 ea891ec
fix(pki): skip AWS ACM revoke for superseded certificates
saifsmailbox98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
backend/src/db/migrations/20260416231234_add-external-metadata-to-certificates.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { Knex } from "knex"; | ||
|
|
||
| import { TableName } from "../schemas"; | ||
|
|
||
| export async function up(knex: Knex): Promise<void> { | ||
| if (await knex.schema.hasTable(TableName.Certificate)) { | ||
| const hasColumn = await knex.schema.hasColumn(TableName.Certificate, "externalMetadata"); | ||
| if (!hasColumn) { | ||
| await knex.schema.alterTable(TableName.Certificate, (t) => { | ||
| t.jsonb("externalMetadata").nullable(); | ||
| }); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export async function down(knex: Knex): Promise<void> { | ||
| if (await knex.schema.hasTable(TableName.Certificate)) { | ||
| if (await knex.schema.hasColumn(TableName.Certificate, "externalMetadata")) { | ||
| await knex.schema.alterTable(TableName.Certificate, (t) => { | ||
| t.dropColumn("externalMetadata"); | ||
| }); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...routes/v1/certificate-authority-routers/aws-acm-public-ca-certificate-authority-router.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { | ||
| AwsAcmPublicCaCertificateAuthoritySchema, | ||
| CreateAwsAcmPublicCaCertificateAuthoritySchema, | ||
| UpdateAwsAcmPublicCaCertificateAuthoritySchema | ||
| } from "@app/services/certificate-authority/aws-acm-public-ca/aws-acm-public-ca-certificate-authority-schemas"; | ||
| import { CaType } from "@app/services/certificate-authority/certificate-authority-enums"; | ||
|
|
||
| import { registerCertificateAuthorityEndpoints } from "./certificate-authority-endpoints"; | ||
|
|
||
| export const registerAwsAcmPublicCaCertificateAuthorityRouter = async (server: FastifyZodProvider) => { | ||
| registerCertificateAuthorityEndpoints({ | ||
| caType: CaType.AWS_ACM_PUBLIC_CA, | ||
| server, | ||
| responseSchema: AwsAcmPublicCaCertificateAuthoritySchema, | ||
| createSchema: CreateAwsAcmPublicCaCertificateAuthoritySchema, | ||
| updateSchema: UpdateAwsAcmPublicCaCertificateAuthoritySchema | ||
| }); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...certificate-authority/aws-acm-public-ca/aws-acm-public-ca-certificate-authority-client.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { ACMClient } from "@aws-sdk/client-acm"; | ||
|
|
||
| import { CustomAWSHasher } from "@app/lib/aws/hashing"; | ||
| import { crypto } from "@app/lib/crypto/cryptography"; | ||
| import { NotFoundError } from "@app/lib/errors"; | ||
| import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal"; | ||
| import { AWSRegion } from "@app/services/app-connection/app-connection-enums"; | ||
| import { decryptAppConnection } from "@app/services/app-connection/app-connection-fns"; | ||
| import { getAwsConnectionConfig } from "@app/services/app-connection/aws/aws-connection-fns"; | ||
| import { TAwsConnection } from "@app/services/app-connection/aws/aws-connection-types"; | ||
| import { TKmsServiceFactory } from "@app/services/kms/kms-service"; | ||
|
|
||
| export const createAcmClient = async ({ | ||
| appConnectionId, | ||
| region, | ||
| appConnectionDAL, | ||
| kmsService | ||
| }: { | ||
| appConnectionId: string; | ||
| region: AWSRegion; | ||
| appConnectionDAL: Pick<TAppConnectionDALFactory, "findById">; | ||
| kmsService: Pick< | ||
| TKmsServiceFactory, | ||
| "encryptWithKmsKey" | "generateKmsKey" | "createCipherPairWithDataKey" | "decryptWithKmsKey" | ||
| >; | ||
| }) => { | ||
| const appConnection = await appConnectionDAL.findById(appConnectionId); | ||
| if (!appConnection) { | ||
| throw new NotFoundError({ message: `App connection with ID '${appConnectionId}' not found` }); | ||
| } | ||
|
|
||
| const decryptedConnection = (await decryptAppConnection(appConnection, kmsService)) as TAwsConnection; | ||
| const awsConfig = await getAwsConnectionConfig(decryptedConnection, region); | ||
|
|
||
| return new ACMClient({ | ||
| sha256: CustomAWSHasher, | ||
| useFipsEndpoint: crypto.isFipsModeEnabled(), | ||
| credentials: awsConfig.credentials, | ||
| region: awsConfig.region | ||
| }); | ||
| }; | ||
|
|
||
| export const resolveDnsAwsConnection = async ({ | ||
| dnsAppConnectionId, | ||
| appConnectionDAL, | ||
| kmsService | ||
| }: { | ||
| dnsAppConnectionId: string; | ||
| appConnectionDAL: Pick<TAppConnectionDALFactory, "findById">; | ||
| kmsService: Pick< | ||
| TKmsServiceFactory, | ||
| "encryptWithKmsKey" | "generateKmsKey" | "createCipherPairWithDataKey" | "decryptWithKmsKey" | ||
| >; | ||
| }) => { | ||
| const dnsAppConnection = await appConnectionDAL.findById(dnsAppConnectionId); | ||
| if (!dnsAppConnection) { | ||
| throw new NotFoundError({ message: `DNS app connection with ID '${dnsAppConnectionId}' not found` }); | ||
| } | ||
| return (await decryptAppConnection(dnsAppConnection, kmsService)) as TAwsConnection; | ||
| }; |
9 changes: 9 additions & 0 deletions
9
.../certificate-authority/aws-acm-public-ca/aws-acm-public-ca-certificate-authority-enums.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export enum AwsAcmValidationMethod { | ||
| DNS = "DNS" | ||
| } | ||
|
|
||
| /** | ||
| * ACM public certificates have a fixed validity period (as of 2025). | ||
| * See: https://docs.aws.amazon.com/acm/latest/userguide/managed-renewal.html | ||
| */ | ||
| export const AWS_ACM_CERTIFICATE_VALIDITY_DAYS = 198; | ||
|
saifsmailbox98 marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.