Skip to content

feat(kms): bulk import keys#6089

Open
victorvhs017 wants to merge 7 commits intomainfrom
feature/kms-bulk-import
Open

feat(kms): bulk import keys#6089
victorvhs017 wants to merge 7 commits intomainfrom
feature/kms-bulk-import

Conversation

@victorvhs017
Copy link
Copy Markdown
Contributor

Context

Adds bulk KMS key import: POST /api/v1/kms/keys/bulk-import accepts up to 100 keys per request (name, usage, algorithm, base64 key material) and returns created { id, name }[] plus per-key errors for partial success. Audit: CMEK_BULK_IMPORT_KEYS (when at least one key imports). Extends kmsService.importKeyMaterial so sign/verify keys can be imported (with PKCS8 validation) alongside encrypt/decrypt. UI: Import Keys modal (JSON upload, validation preview, import). Docs: platform KMS overview updated for the import flow (export behavior lives on the base branch).

Screenshots

image image image image image

Steps to verify

  1. Use a JSON file in the documented import shape (from export on base branch or hand-built).
  2. Open Import Keys → upload → confirm preview and validation errors when invalid.
  3. Run import; confirm new keys in the table and audit log for successful imports.
  4. Trigger a duplicate name or bad material → partial errors[] in the response / UI.

Type

  • Fix
  • Feature
  • Improvement
  • Breaking
  • Docs
  • Chore

Checklist

  • Title follows the conventional commit format: type(scope): short description (scope is optional, e.g., fix: prevent crash on sync or fix(api): handle null response).
  • Tested locally
  • Updated docs (if needed)
  • Updated CLAUDE.md files (if needed)
  • Read the contributing guide

Victor Hugo dos Santos added 2 commits April 17, 2026 23:21
- Added a new API endpoint for bulk importing KMS keys with validation for key types and algorithms.
- Introduced corresponding types and interfaces for handling bulk import requests and responses.
- Updated the audit log to track bulk import events.
- Enhanced the CmekTable component to include an import keys option in the dropdown menu.
- Created a new CmekBulkImportModal component for user interaction during key import.
- Added a new field for failed key names in the audit log metadata to track import failures.
- Updated the audit log creation logic to include failed key names during bulk import.
- Improved error handling in the CmekBulkImportModal to provide user feedback for file read failures and key count limits.
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Apr 18, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
infisical 🟢 Ready View Preview Apr 18, 2026, 2:41 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@maidul98
Copy link
Copy Markdown
Collaborator

maidul98 commented Apr 18, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@victorvhs017 victorvhs017 changed the title Feature/kms bulk import feat(kms): bulk import keys Apr 18, 2026
@linear
Copy link
Copy Markdown

linear Bot commented Apr 18, 2026

- Introduced new sections in the documentation for bulk export and import of key material.
- Updated the CmekBulkImportModal component to utilize stable UI components, enhancing the user experience for importing keys.
- Improved the layout and structure of the key import table for better readability and usability.
@victorvhs017 victorvhs017 marked this pull request as ready for review April 27, 2026 23:42
@infisical-review-police
Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-infisical-6089-feat-kms-bulk-import-keys

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e318e148c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread backend/src/server/routes/v1/cmek-router.ts
Comment thread frontend/src/pages/kms/OverviewPage/components/CmekTable.tsx Outdated
Comment thread backend/src/server/routes/v1/cmek-router.ts
Comment thread backend/src/services/kms/kms-service.ts
- Added validation to ensure keyMaterial is base64 encoded in the CmekBulkImportModal component.
- Updated the cmek-service to return a structured result for bulk import operations.
- Introduced new types for bulk import results to capture errors and project details.
- Enhanced KMS service to validate key length based on the algorithm used for symmetric keys.
- Updated documentation with new images and improved clarity on bulk import/export processes.
Copy link
Copy Markdown
Contributor

@scott-ray-wilson scott-ray-wilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great minor comments

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: your nord pass is showing 😏

Comment on lines +349 to +361
<Tooltip open={!isAllowed ? undefined : false}>
<TooltipTrigger asChild className="block w-full">
<DropdownMenuItem
onClick={() => handlePopUpOpen("importKeys")}
isDisabled={!isAllowed}
>
<FontAwesomeIcon icon={faFileImport} />
Import Keys
</DropdownMenuItem>
</TooltipTrigger>
<TooltipContent side="left">Access Restricted</TooltipContent>
</Tooltip>
)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: using font awesome icon instead of lucid
also I think we need to remove asChild as it messes with the dropdown styling and then doesn't show when disabled - it's removing the flex/gap styling on the menu

onClick={() => handlePopUpOpen("upsertKey", null)}
isDisabled={!isAllowed}
>
<FontAwesomeIcon icon={faPlus} className="mr-2" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we use lucide icon

);
}

return (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image
  1. maybe the back button should be outline? or cancel? one should be I feel
  2. let's maybe make the hover more inline with the error state, feels weird it turns gray (or just leave the same, remove hover)
  3. I'm not sure I see the value in numbering them? the alignment of the header col bothers me so if we keep it could we at least remove the # in the header?

<ul className="max-h-[50vh] thin-scrollbar space-y-1 overflow-y-auto pr-2">
{importResult.failed.map((err) => (
<li key={err.name} className="text-xs text-red/80">
<span className="font-medium">{err.name}</span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you merge main we actually now have a danger alert v3 variant, we should move this to that with a cute little alert icon :3

also the description says the same thing as the text beneath it minus the failed count - little redundant maybe just say the failed count in the alert and don't add the additional repetition?

Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should handle this empty json array

Image

{
"name": "my-rsa-key",
"keyType": "sign-verify",
"algorithm": "rsa-4096",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is incorrect format - should be RSA_4096

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants