mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-08 13:06:00 +00:00
fix(kms): report a missing KMS key as 400 KMS.NotFoundException
A PutObject whose resolved SSE-KMS key (request header or bucket default rule) does not exist in the KMS answered 500 InternalError with a generic message: KmsError::KeyNotFound fell through to the default arm of the StorageError-to-ApiError mapping. S3 reports this client mistake as 400 KMS.NotFoundException; the mapping now does the same and names the key. s3s has no status for a custom code, so the ApiError-to-S3Error conversion supplies it. The legacy create-key aliases behind /minio/admin/v3/kms/key/create ignored the key-id query parameter that mc sends, creating a key under a generated id instead of the requested name. The alias now honors key-id (and its keyId/key spellings) alongside the name tag, and refuses a request whose two sources disagree. Refs: rustfs/backlog#2330 (KMS-312, KMS-110)
This commit is contained in:
@@ -39,7 +39,7 @@ The wire prefix is `/rustfs/admin/v3`. `GET /kms/status` and `GET /kms/service-s
|
||||
| `POST /kms/restore/dry-run` | `kms:Restore` | sensitive | no | Preflight; writes nothing |
|
||||
| `POST /kms/restore` | `kms:Restore` | high | no | Requires `confirm_backup_id` and `confirm_conflict_policy` |
|
||||
| `POST /kms/restore/abort` | `kms:Restore` | high | no | Requires `confirm_target_key_dir` |
|
||||
| `POST /kms/create-key`, `POST /kms/key/create` | `kms:Configure` | high | no | Legacy `mc` aliases of `POST /kms/keys` |
|
||||
| `POST /kms/create-key`, `POST /kms/key/create` | `kms:Configure` | high | no | Legacy `mc` aliases of `POST /kms/keys`; the key name comes from the `key-id` query parameter (`mc`'s form) or the `name` tag, and a request carrying both with different values is refused with `400` |
|
||||
| `GET /kms/describe-key`, `GET /kms/key/status` | `kms:DescribeKey` | sensitive | yes | Legacy aliases of `GET /kms/keys/{key_id}` |
|
||||
| `GET /kms/list-keys` | `kms:ListKeys` | sensitive | no | Legacy alias of `GET /kms/keys`; same listing contract |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user