From a4c8682b77ef413dfa31129d268626549e1a9fc5 Mon Sep 17 00:00:00 2001 From: Shivani <01chocolatygirl05@gmail.com> Date: Tue, 24 Nov 2026 19:23:21 +0530 Subject: [PATCH] Handle TSP error code 212 --- .../kms/v1/TenantSecurityErrorCodes.java | 4 +++- .../tenantsecurity/kms/v1/ErrorResponseTest.java | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ironcorelabs/tenantsecurity/kms/v1/TenantSecurityErrorCodes.java b/src/main/java/com/ironcorelabs/tenantsecurity/kms/v1/TenantSecurityErrorCodes.java index 4ca194f..7740341 100644 --- a/src/main/java/com/ironcorelabs/tenantsecurity/kms/v1/TenantSecurityErrorCodes.java +++ b/src/main/java/com/ironcorelabs/tenantsecurity/kms/v1/TenantSecurityErrorCodes.java @@ -31,7 +31,9 @@ public enum TenantSecurityErrorCodes { KMS_UNREACHABLE(208, "Request to KMS failed because KMS was unreachable."), KMS_THROTTLED(209, "Request to KMS failed because KMS throttled the Tenant Security Proxy."), KMS_ACCOUNT_ISSUE(210, "Request to KMS failed because of an issue with the KMS account."), - // map to SecurityEventException + KMS_ROLE_ASSUMPTION_MISCONFIGURED(212, + "Request to KMS failed because the tenant IAM role configuration was misconfigured."), + // map to SecurityEventException SECURITY_EVENT_REJECTED(301, "Tenant Security Proxy could not accept the security event"), // map to TscException diff --git a/src/test/java/com/ironcorelabs/tenantsecurity/kms/v1/ErrorResponseTest.java b/src/test/java/com/ironcorelabs/tenantsecurity/kms/v1/ErrorResponseTest.java index 003e08d..0f84df6 100644 --- a/src/test/java/com/ironcorelabs/tenantsecurity/kms/v1/ErrorResponseTest.java +++ b/src/test/java/com/ironcorelabs/tenantsecurity/kms/v1/ErrorResponseTest.java @@ -105,6 +105,18 @@ public void exceptionFromErrorResponseTspServiceException() throws Exception { TenantSecurityException fooException = foo.toTenantSecurityException(staticHttpCode); assertKmsException(staticMsg, staticHttpCode, fooException, TenantSecurityErrorCodes.KMS_ACCOUNT_ISSUE); + ErrorResponse kmsRoleMisconfiguredError = + new ErrorResponse( + TenantSecurityErrorCodes.KMS_ROLE_ASSUMPTION_MISCONFIGURED.getCode(), staticMsg); + + TenantSecurityException kmsRoleMisconfiguredException = + kmsRoleMisconfiguredError.toTenantSecurityException(staticHttpCode); + + assertKmsException( + staticMsg, + staticHttpCode, + kmsRoleMisconfiguredException, + TenantSecurityErrorCodes.KMS_ROLE_ASSUMPTION_MISCONFIGURED); ErrorResponse kmsUnreachableError = new ErrorResponse(TenantSecurityErrorCodes.KMS_UNREACHABLE.getCode(), staticMsg);