Skip to content

fix(sse): recognise the AWS KMS backend instead of rendering it unsupported - #327

Merged
overtrue merged 1 commit into
rustfs:mainfrom
AndrewGanzha:feature/kms-issue-320
Nov 30, 2026
Merged

overtrue merged 1 commit into
rustfs:mainfrom
AndrewGanzha:feature/kms-issue-320

Conversation

@AndrewGanzha

Copy link
Copy Markdown
Contributor

Description

A cluster configured with the AWS KMS backend cannot be read or managed in the Console: the Encryption & Keys page claims the backend is unsupported and forces the configuration form into a read-only fallback.

Root cause: the server reports the AWS backend under two different spellings — GET /kms/service-status returns "AWS", GET /kms/status returns "aws", and the configure request also accepts the "AwsKms" alias. normalizeBackendType knew neither, so every AWS cluster fell through to "unsupported" (lib/sse/config.ts, types/kms.ts).

This PR adds the backend type and a dedicated AWS KMS section to the form:

  • types/kms.ts: "AWS" added to KmsBackendType; region and endpoint_url added to KmsBackendSummary (the only non-secret settings the server persists and echoes back — it never reports credential material); new KmsAwsConfigPayload in KmsConfigPayload.
  • lib/sse/config.ts: new "aws" form backend; "AWS", "aws" and "AwsKms" all normalize to it; region/endpoint_url hydrate from config_summary.backend_summary.
  • app/(dashboard)/sse/page.tsx: "AWS KMS" option in the backend selector, an "AWS KMS configuration" section with a required Region and an optional Endpoint, and the same cache/timeout fields every backend shares. A plaintext (http://) endpoint shows a development-only warning and unlocks the server's allow_insecure_dev_defaults flag for that request only; https:// endpoints do not set it. Non-URL endpoints are rejected in the field.
  • Credentials are deliberately absent from the form: the server resolves them from its own AWS provider chain, and the section says so.

Capabilities on /kms/status stay optional and additive: a server that omits them renders absence as "unknown" rather than "false", which the page test pins, along with the AWS status hydration.

Scope: this is Part A of #320 only. The missing admin endpoints listed under Part B are not touched here.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvements
  • Security fix

Testing

  • Unit tests added/updated
  • Manual testing completed

tests/lib/sse-config.test.ts covers normalizeBackendType for all three AWS spellings and status hydration (including a summary that omits the fields). tests/lib/management-permission-controls.test.ts mounts the page against an AWS status and asserts the AWS section renders instead of the unsupported fallback, plus that a missing capability matrix does not mark the backend unsupported.

Manual verification against a real server: RustFS 1.0.x in Docker, AWS backend configured through POST /kms/configure (region: us-east-1), then the Console dev server logged in against it. Before/after screenshots below.

pnpm install --frozen-lockfile
pnpm type-check      # clean
pnpm lint            # clean
pnpm format:check    # clean
pnpm test:run        # 1320 tests, 0 failures

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • TypeScript types are properly defined
  • All commit messages are in English (Conventional Commits)
  • All existing tests pass
  • No new dependencies added, or they are justified

Related Issues

Part of #320 (Part A — AWS KMS backend). Closes the defect half of the issue; Part B endpoints remain.

Screenshots (if applicable)

Encryption & Keys page with an AWS KMS backend configured, desktop 1264×1269.

Before After
"Unsupported KMS backend" alert, disabled backend selector, read-only form "AWS KMS configuration" section, region hydrated from the server (us-east-1), Create/Save enabled

Screenshots attached below.

Additional Notes

  • The verification server had no real AWS credentials (only a placeholder provider chain), so its KMS service reports Configured + Health: Unknown. That is the server's own state and is unrelated to this change; it also happens to exercise the "capabilities absent ⇒ unknown, not false" path.
  • No credential field, secret or token is introduced into the Console for this backend.
  • Validation only runs on submit through the existing buildConfigPayload path, so no new form state machine was added.

…ported

A cluster configured with the AWS KMS backend could not be read or managed:
`KmsBackendType` omitted "AWS" and `normalizeBackendType` fell through to
"unsupported", so the Encryption & Keys page claimed the backend was not
supported by this Console version and forced the configuration form into a
read-only fallback.

The server reports the backend as "AWS" on /kms/service-status and as "aws"
on /kms/status, so both spellings (plus the configure-time "AwsKms" alias)
now normalize to the new "aws" form backend. The form gains an AWS KMS
section with the two non-secret settings the server persists and echoes back
(region and endpoint URL); credentials stay with the server's AWS provider
chain and are never entered or stored in the console. A plaintext endpoint
shows a development-only warning and unlocks the server's insecure-defaults
flag for that request.

Capabilities remain optional and additive: a server that omits them renders
absence as unknown rather than false, which a test now pins together with the
AWS status hydration.

Closes rustfs#320 (Part A).
@AndrewGanzha

Copy link
Copy Markdown
Contributor Author
before-full after-full

@overtrue overtrue left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Clean fix for AWS KMS support and capability-matrix fallback handling.

Review Notes

  • types/kms.ts & lib/sse/config.ts: Adding "AWS" to KmsBackendType, region/endpoint_url to KmsBackendSummary, KmsAwsConfigPayload to KmsConfigPayload, and normalizing "AWS", "aws", and "AwsKms" in normalizeBackendType resolves the read-only unsupported fallback cleanly without introducing or echoing any AWS credentials.
  • app/(dashboard)/sse/page.tsx: buildConfigPayload validates non-empty awsRegion and optional awsEndpointUrl (/^https?:\/\/\S+$/i), and displays a destructive development-only Alert when a plaintext http:// endpoint is entered. Note that allow_insecure_dev_defaults: true is inferred automatically whenever endpointUrl starts with http://; if you ever want an explicit opt-in toggle in the future, that would be an easy follow-up, though the warning banner makes the behavior clear here.
  • i18n/locales/*.json: All 15 locale files are updated consistently with the new AWS KMS strings.
  • tests/lib/sse-config.test.ts & tests/lib/management-permission-controls.test.ts: Good unit and mounted-page test coverage for alias normalization, status hydration, missing summary fields, and missing capability matrices.

Merge Gate Note

  • No GitHub Actions check runs are reported on this fork PR yet (docs/test/quality/build workflows need maintainer approval to run), so please trigger and verify CI passes before merging.

@AndrewGanzha

Copy link
Copy Markdown
Contributor Author

LGTM! Clean fix for AWS KMS support and capability-matrix fallback handling.

Review Notes

* `types/kms.ts` & `lib/sse/config.ts`: Adding `"AWS"` to `KmsBackendType`, `region`/`endpoint_url` to `KmsBackendSummary`, `KmsAwsConfigPayload` to `KmsConfigPayload`, and normalizing `"AWS"`, `"aws"`, and `"AwsKms"` in `normalizeBackendType` resolves the read-only unsupported fallback cleanly without introducing or echoing any AWS credentials.

* `app/(dashboard)/sse/page.tsx`: `buildConfigPayload` validates non-empty `awsRegion` and optional `awsEndpointUrl` (`/^https?:\/\/\S+$/i`), and displays a destructive development-only `Alert` when a plaintext `http://` endpoint is entered. Note that `allow_insecure_dev_defaults: true` is inferred automatically whenever `endpointUrl` starts with `http://`; if you ever want an explicit opt-in toggle in the future, that would be an easy follow-up, though the warning banner makes the behavior clear here.

* `i18n/locales/*.json`: All 15 locale files are updated consistently with the new AWS KMS strings.

* `tests/lib/sse-config.test.ts` & `tests/lib/management-permission-controls.test.ts`: Good unit and mounted-page test coverage for alias normalization, status hydration, missing summary fields, and missing capability matrices.

Merge Gate Note

* No GitHub Actions check runs are reported on this fork PR yet (`docs`/`test`/`quality`/`build` workflows need maintainer approval to run), so please trigger and verify CI passes before merging.

Thank you! Can we depoly and I gonna take next task?

@overtrue
overtrue merged commit 9013449 into rustfs:main Nov 30, 2026
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.

2 participants